Browse Source

筛选修改

anderx 6 years ago
parent
commit
66f95339e8

+ 12 - 5
src/main/java/com/goafanti/admin/bo/AdminCustomerBo.java

@@ -5,7 +5,8 @@ public class AdminCustomerBo {
 	private String aName;
 	private String depName;
 	private String userCount;
-	private String timeCount;
+	private String inputCount;
+	private String receiveCount;
 	public String getAid() {
 		return aid;
 	}
@@ -30,11 +31,17 @@ public class AdminCustomerBo {
 	public void setUserCount(String userCount) {
 		this.userCount = userCount;
 	}
-	public String getTimeCount() {
-		return timeCount;
+	public String getInputCount() {
+		return inputCount;
 	}
-	public void setTimeCount(String timeCount) {
-		this.timeCount = timeCount;
+	public void setInputCount(String inputCount) {
+		this.inputCount = inputCount;
+	}
+	public String getReceiveCount() {
+		return receiveCount;
+	}
+	public void setReceiveCount(String receiveCount) {
+		this.receiveCount = receiveCount;
 	}
 	
 }

+ 1 - 1
src/main/java/com/goafanti/common/controller/BaseApiController.java

@@ -63,7 +63,7 @@ public class BaseApiController extends BaseController {
 		if (!files.isEmpty()) {
 			try {
 				MultipartFile mf = files.get(0);
-				fileName = FileUtils.mosaicFileName(mf, isPrivate, sign, path, TokenManager.getUserId());
+				fileName = FileUtils.splicingFileName(mf, isPrivate, sign, path, TokenManager.getUserId());
 				mf.transferTo(isPrivate ? toPrivateFile(fileName) : toFile(fileName));
 				LoggerUtils.debug(getClass(), fileName + " 文件上传成功");
 			} catch (Exception e) {

+ 24 - 9
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -1052,16 +1052,23 @@
   
   
    <select id="selectAdminCustomerList" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminCustomerBo">
-  	select a.id as aid,a.name as aName,d.name as depName,ifnull(b.userCount,0) as userCount,ifnull(c.timeCount,0) as timeCount from admin a 
+  	select a.id as aid,a.name as aName,d.name as depName,ifnull(b.userCount,0) as userCount,ifnull(c.timeCount,0) as inputCount,
+  	ifnull(c.timeCount,0) as receiveCount from admin a 
 	left join (select aid,count(aid) as userCount from user where aid is not null  
 	and  share_type=0 and source !=0 and type=1
 	group by aid) b on a.id=b.aid
-	left join (select aid,count(aid) as timeCount from user where aid is not null  
-	and  share_type=0 and source !=0 and type=1
-	 <if test="startTime != null and endTime != null"> 
+	left join (select aid,count(aid) as timeCount from `user` where aid is not null  
+	and  share_type=0 and source =1 and type=1
+     <if test="startTime != null and endTime != null"> 
     and  create_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
     </if>
 	group by aid) c on a.id=c.aid
+	left join (select aid,count(aid) as timeCount from `user` where aid is not null  
+	and  share_type=0 and source =2 and type=1
+	 <if test="startTime != null and endTime != null"> 
+    and  transfer_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
+    </if>
+	group by aid) d on a.id=c.aid
 	left join department d on a.department_id=d.id
 	left join user_role e on a.id=e.uid
 	left join `role` f on e.rid=f.id
@@ -1076,20 +1083,28 @@
   </select>
   
   <select id="selectAdminCustomerCount" parameterType="java.lang.String" resultType="java.lang.Integer">
-  select count(*) from admin a 
+ select a.id as aid,a.name as aName,d.name as depName,ifnull(b.userCount,0) as userCount,ifnull(c.timeCount,0) as inputCount,
+  	ifnull(c.timeCount,0) as receiveCount from admin a 
 	left join (select aid,count(aid) as userCount from user where aid is not null  
 	and  share_type=0 and source !=0 and type=1
 	group by aid) b on a.id=b.aid
-	left join (select aid,count(aid) as timeCount from user where aid is not null  
-	and  share_type=0 and source !=0 and type=1
-	 <if test="startTime != null and endTime != null"> 
+	left join (select aid,count(aid) as timeCount from `user` where aid is not null  
+	and  share_type=0 and source =1 and type=1
+     <if test="startTime != null and endTime != null"> 
     and  create_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
     </if>
 	group by aid) c on a.id=c.aid
+	left join (select aid,count(aid) as timeCount from `user` where aid is not null  
+	and  share_type=0 and source =2 and type=1
+	 <if test="startTime != null and endTime != null"> 
+    and  transfer_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
+    </if>
+	group by aid) d on a.id=c.aid
+	left join department d on a.department_id=d.id
 	left join user_role e on a.id=e.uid
 	left join `role` f on e.rid=f.id
 	where f.role_name in ('营销员','营销经理')	
-	and  a.status='正常'
+	and	 a.status='正常'
 	<if test="depId != null"> 
     and a.department_id =  #{depId,jdbcType=VARCHAR}
     </if>

+ 4 - 4
src/main/java/com/goafanti/common/mapper/TOrderOutsourceMapper.xml

@@ -386,8 +386,8 @@
 	<if test="name != null">
 	and c.nickname like concat('%',#{name},'%')
 	</if>
-	<if test="startTime != null and endTime != null">
-	and b.create_time between #{startTime} and  #{endTime}
+	<if test="starTime != null and endTime != null">
+	and b.create_time between #{starTime} and  #{endTime}
 	</if>
 	order by b.create_time desc
   	<if test="page_sql!=null">
@@ -432,8 +432,8 @@
 	<if test="name != null">
 	and c.nickname like concat('%',#{name},'%')
 	</if>
-	<if test="startTime != null and endTime != null">
-	and b.create_time between #{startTime} and  #{endTime}
+	<if test="starTime != null and endTime != null">
+	and b.create_time between #{starTime} and  #{endTime}
 	</if>
 	order by b.create_time desc
   	<if test="page_sql!=null">

+ 28 - 0
src/main/java/com/goafanti/common/utils/FileUtils.java

@@ -125,6 +125,34 @@ public class FileUtils {
 		}
 		return fileName;
 	}
+	
+	/**
+	 * 根据上传文件 拼接fileName
+	 * 
+	 * @param mf
+	 * @param isPrivate
+	 * @param sign
+	 * @param path
+	 * @return
+	 */
+	public static String splicingFileName(MultipartFile mf, boolean isPrivate, String sign, String path, String uid) {
+		String suffix = mf.getOriginalFilename().substring(mf.getOriginalFilename().lastIndexOf("."));
+		boolean uniq = false;
+		if (sign!= null ){
+			uniq = true;
+		}
+		String fileName = "";
+		if (isPrivate || StringUtils.isNotBlank(sign)) {
+			if (uniq) {
+				fileName = path + uid + "/" + System.nanoTime() + "_" + sign + suffix;
+			} else {
+				fileName = path + uid + "/" +  sign + suffix;
+			}
+		} else {
+			fileName = path + uid + "/" + System.nanoTime() + suffix;
+		}
+		return fileName;
+	}
 
 	/**
 	 * 获取下载文件名称

+ 3 - 3
src/main/java/com/goafanti/order/controller/OutsourceOrgApiController.java

@@ -133,9 +133,9 @@ public class OutsourceOrgApiController extends CertifyApiController {
 	 * 外包审核列表(营销管理员列表)
 	 */
 	@RequestMapping(value="/salesmanOrderOutsourceList", method = RequestMethod.GET)
-	public Result salesmanOrderOutsourceList(String name,String orderNo,String starTime,String endTime,Integer refundStatus,Integer pageNo,Integer pageSize){
+	public Result salesmanOrderOutsourceList(String name,String contractNo,String starTime,String endTime,Integer refundStatus,Integer pageNo,Integer pageSize){
 		Result res=new Result();
-		res.data(outsourceOrgService.salesmanOrderOutsourceList(name, orderNo, starTime, endTime,refundStatus, pageNo, pageSize));
+		res.data(outsourceOrgService.salesmanOrderOutsourceList(name, contractNo, starTime, endTime,refundStatus, pageNo, pageSize));
 		return res;
 	}
 	/**
@@ -173,7 +173,7 @@ public class OutsourceOrgApiController extends CertifyApiController {
                 res.getError().add(buildError(ErrorConstants.FILE_NON_EXISTENT, "", "找不到文件!"));
             } else {
                String suffix = path.substring(path.lastIndexOf("."));
-               String name=path.substring(path.lastIndexOf("/")+1, path.lastIndexOf("."));
+               String name=path.substring(path.lastIndexOf("_")+1, path.lastIndexOf("."));
                 String fileName = name + suffix;
                 downloadFile(response, fileName, path);
         } 

+ 1 - 1
src/main/java/com/goafanti/order/service/OutsourceOrgService.java

@@ -27,7 +27,7 @@ public interface OutsourceOrgService {
 	
 	int updateAuditOutsource(OrderOutsourceDtails o);
 
-	Pagination<OrderOutsourceBo> salesmanOrderOutsourceList(String name, String orderNo, String starTime, String endTime,
+	Pagination<OrderOutsourceBo> salesmanOrderOutsourceList(String name, String contractNo, String starTime, String endTime,
 			Integer refundStatus, Integer pageNo, Integer pageSize);
 
 	

+ 14 - 2
src/main/java/com/goafanti/order/service/impl/OutsourceOrgServiceImpl.java

@@ -6,12 +6,15 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.commons.lang3.StringUtils;
+import org.hibernate.validator.constraints.Mod11Check.ProcessingDirection;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.goafanti.common.dao.OutsourceOrganizationMapper;
+import com.goafanti.common.dao.TOrderNewMapper;
 import com.goafanti.common.dao.TOrderOutsourceMapper;
 import com.goafanti.common.model.OutsourceOrganization;
+import com.goafanti.common.model.TOrderNew;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.order.bo.OrderOutsourceBo;
@@ -26,6 +29,8 @@ public class OutsourceOrgServiceImpl  extends BaseMybatisDao<TOrderOutsourceMapp
 	@Autowired
 	private TOrderOutsourceMapper	tOrderOutsourceMapper;
 	@Autowired
+	private TOrderNewMapper	tOrderNewMapper;
+	@Autowired
 	private OrderService	orderService;
 	@Override
 	public int addOutsourceOrg(OutsourceOrganization o) {
@@ -78,11 +83,18 @@ public class OutsourceOrgServiceImpl  extends BaseMybatisDao<TOrderOutsourceMapp
 	@Override
 	public int updateAuditOutsource(OrderOutsourceDtails o) {
 		o.setAuditTime(new Date());
+		if (o.getRefundStatus()==1) {
+			TOrderNew t=new TOrderNew();
+			t.setOrderNo(o.getOrderNo());
+			t.setOrderStatus(2);//订单审核标记通过
+			t.setProcessStatus(2);//订单流程标记到财务
+			tOrderNewMapper.updateByPrimaryKeySelective(t);
+		}
 		return tOrderOutsourceMapper.updateByPrimaryKeySelective(o);
 	}
 	@SuppressWarnings("unchecked")
 	@Override
-	public Pagination<OrderOutsourceBo> salesmanOrderOutsourceList(String name, String orderNo, String starTime,
+	public Pagination<OrderOutsourceBo> salesmanOrderOutsourceList(String name, String contractNo, String starTime,
 			String endTime, Integer refundStatus, Integer pageNo, Integer pageSize) {
 		Map<String, Object> params = new HashMap<String, Object>();
 		if(pageSize==null||pageSize<0)pageSize=10;
@@ -90,7 +102,7 @@ public class OutsourceOrgServiceImpl  extends BaseMybatisDao<TOrderOutsourceMapp
 		if (StringUtils.isNotBlank(name)) params.put("name", name);
 		params.put("deps", orderService.selectMyDeps());
 		if(refundStatus != null) params.put("refundStatus", refundStatus);
-		if (StringUtils.isNotBlank(orderNo)) params.put("orderNo", orderNo);
+		if (StringUtils.isNotBlank(contractNo)) params.put("contractNo", contractNo);
 		if (StringUtils.isNotBlank(starTime)) params.put("starTime", starTime);
 		if (StringUtils.isNotBlank(endTime)) params.put("endTime", endTime+" 23:59:59");
 		Pagination<OrderOutsourceBo> p = (Pagination<OrderOutsourceBo>)findPage("salesmanOrderOutsourceList", "salesmanOrderOutsourceCount", params, pageNo, pageSize);