Przeglądaj źródła

客户统计修改

anderx 4 lat temu
rodzic
commit
396e0ee4c6

+ 41 - 16
src/main/java/com/goafanti/admin/bo/AdminCustomerBo.java

@@ -6,14 +6,49 @@ public class AdminCustomerBo {
 	private String aName;
 	private String depId;
 	private String depName;
+	/** 私有数 */
 	private Integer userCount;
-	private Integer inputCount;
-	private Integer receiveCount;
-	private Integer completeCount;
-	private Integer interviewCount;
+	/** 渠道数 */
+	private Integer channelCount;
+	/** 签单数 */
 	private Integer signCount;
+	/** 私有新增数 */
+	private Integer newCount;
+	/** 渠道新增数 */
+	private Integer channelNewCount;
+	/** 私有面谈数 */
+	private Integer completeCount;
+	/** 渠道面谈数 */
+	private Integer channelCompleteCount;
+	/** 私有领取数 */
+	private Integer receiveCount;
+	
 	
 	
+	public Integer getChannelCount() {
+		return channelCount;
+	}
+	public void setChannelCount(Integer channelCount) {
+		this.channelCount = channelCount;
+	}
+	public Integer getNewCount() {
+		return newCount;
+	}
+	public void setNewCount(Integer newCount) {
+		this.newCount = newCount;
+	}
+	public Integer getChannelNewCount() {
+		return channelNewCount;
+	}
+	public void setChannelNewCount(Integer channelNewCount) {
+		this.channelNewCount = channelNewCount;
+	}
+	public Integer getChannelCompleteCount() {
+		return channelCompleteCount;
+	}
+	public void setChannelCompleteCount(Integer channelCompleteCount) {
+		this.channelCompleteCount = channelCompleteCount;
+	}
 	public String getAid() {
 		return aid;
 	}
@@ -38,12 +73,7 @@ public class AdminCustomerBo {
 	public void setUserCount(Integer userCount) {
 		this.userCount = userCount;
 	}
-	public Integer getInputCount() {
-		return inputCount;
-	}
-	public void setInputCount(Integer inputCount) {
-		this.inputCount = inputCount;
-	}
+	
 	public Integer getReceiveCount() {
 		return receiveCount;
 	}
@@ -57,12 +87,7 @@ public class AdminCustomerBo {
 	public void setCompleteCount(Integer completeCount) {
 		this.completeCount = completeCount;
 	}
-	public Integer getInterviewCount() {
-		return interviewCount;
-	}
-	public void setInterviewCount(Integer interviewCount) {
-		this.interviewCount = interviewCount;
-	}
+	
 	public String getDepId() {
 		return depId;
 	}

+ 48 - 14
src/main/java/com/goafanti/admin/bo/depCountBo.java

@@ -7,13 +7,57 @@ public class depCountBo {
 	private String id;
 	private String name;
 	private Integer userCount;
-	private Integer inputCount;
 	private Integer receiveCount;
 	private Integer completeCount;
-	private Integer interviewCount;
+	private Integer signCount;
+	private Integer channelCount;
+	private Integer newCount;
+	private Integer channelNewCount;
+	private Integer channelCompleteCount;
 	private List<depCountBo> list;
 	private List<AdminCustomerBo> aList;
 	
+	public depCountBo() {
+		userCount = 0;
+		receiveCount = 0;
+		completeCount = 0;
+		signCount = 0;
+		channelCount = 0;
+		newCount = 0;
+		channelCompleteCount = 0;
+		channelNewCount = 0;
+	}
+	
+	public Integer getSignCount() {
+		return signCount;
+	}
+	public void setSignCount(Integer signCount) {
+		this.signCount = signCount;
+	}
+	public Integer getChannelCount() {
+		return channelCount;
+	}
+	public void setChannelCount(Integer channelCount) {
+		this.channelCount = channelCount;
+	}
+	public Integer getNewCount() {
+		return newCount;
+	}
+	public void setNewCount(Integer newCount) {
+		this.newCount = newCount;
+	}
+	public Integer getChannelNewCount() {
+		return channelNewCount;
+	}
+	public void setChannelNewCount(Integer channelNewCount) {
+		this.channelNewCount = channelNewCount;
+	}
+	public Integer getChannelCompleteCount() {
+		return channelCompleteCount;
+	}
+	public void setChannelCompleteCount(Integer channelCompleteCount) {
+		this.channelCompleteCount = channelCompleteCount;
+	}
 	public String getId() {
 		return id;
 	}
@@ -32,12 +76,7 @@ public class depCountBo {
 	public void setUserCount(Integer userCount) {
 		this.userCount = userCount;
 	}
-	public Integer getInputCount() {
-		return inputCount;
-	}
-	public void setInputCount(Integer inputCount) {
-		this.inputCount = inputCount;
-	}
+
 	public Integer getReceiveCount() {
 		return receiveCount;
 	}
@@ -50,12 +89,7 @@ public class depCountBo {
 	public void setCompleteCount(Integer completeCount) {
 		this.completeCount = completeCount;
 	}
-	public Integer getInterviewCount() {
-		return interviewCount;
-	}
-	public void setInterviewCount(Integer interviewCount) {
-		this.interviewCount = interviewCount;
-	}
+
 	public List<depCountBo> getList() {
 		return list;
 	}

+ 21 - 14
src/main/java/com/goafanti/admin/service/impl/AdminServiceImpl.java

@@ -378,11 +378,6 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 			acb.setName(oo.getName());
 			deps=organizationManagementMapper.selectBysuperName(acb.getName());
 		}
-		acb.setCompleteCount(0);
-		acb.setInputCount(0);
-		acb.setInterviewCount(0);
-		acb.setReceiveCount(0);
-		acb.setUserCount(0);
 		//迭代查出所有层级并计算
 		acb.setList(nestingList(deps,startTime,  endTime,aName));
 		//计算顶层
@@ -403,8 +398,9 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 			ab.setaList(aList);
 			//计算总数
 			sumCount(ab,1);
-			if (ab.getCompleteCount()!=0||ab.getInputCount()!=0||ab.getInterviewCount()!=0
-					||ab.getReceiveCount()!=0||ab.getUserCount()!=0) {
+			if (ab.getCompleteCount() != 0 || ab.getReceiveCount() != 0 || ab.getUserCount() != 0
+					|| ab.getSignCount() != 0 || ab.getChannelCount() != 0|| ab.getNewCount() != 0
+					|| ab.getChannelNewCount() != 0|| ab.getChannelCompleteCount() != 0) {
 				res.add(ab);
 			}
 		}
@@ -416,30 +412,41 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 	 * @param type 0 部门计算 1人员计算
 	 */
 	private void sumCount(depCountBo ab,int type ) {
-		int completeCount=0,inputCount=0,interviewCount=0,receiveCount=0,userCount=0;
+		int completeCount=0,receiveCount=0,userCount=0,signCount=0,channelCount=0,newCount=0,channelNewCount=0,channelCompleteCount=0;
 		if (ab.getList()!=null&&!ab.getList().isEmpty()) {
 			for (depCountBo a : ab.getList()) {
 				if ( a.getCompleteCount()!=0) completeCount+=a.getCompleteCount();
-				if ( a.getInputCount()!=0) inputCount+=a.getInputCount();
-				if ( a.getInterviewCount()!=0) interviewCount+=a.getInterviewCount();
 				if ( a.getReceiveCount()!=0) receiveCount+=a.getReceiveCount();
 				if ( a.getUserCount()!=0) userCount+=a.getUserCount();
+				if ( a.getSignCount()!=0) signCount+=a.getSignCount();
+				if ( a.getChannelCount()!=0) channelCount+=a.getChannelCount();
+				if ( a.getNewCount()!=0) newCount+=a.getNewCount();
+				if ( a.getChannelNewCount()!=0) channelNewCount+=a.getChannelNewCount();
+				if ( a.getChannelCompleteCount()!=0) channelCompleteCount+=a.getChannelCompleteCount();
+				
 			}
 		}
 		if (ab.getaList()!=null&&!ab.getaList().isEmpty()) {
 			for (AdminCustomerBo a : ab.getaList()) {
 				if ( a.getCompleteCount()!=0) completeCount+=a.getCompleteCount();
-				if ( a.getInputCount()!=0) inputCount+=a.getInputCount();
-				if ( a.getInterviewCount()!=0) interviewCount+=a.getInterviewCount();
 				if ( a.getReceiveCount()!=0) receiveCount+=a.getReceiveCount();
 				if ( a.getUserCount()!=0) userCount+=a.getUserCount();
+				if ( a.getSignCount()!=0) signCount+=a.getSignCount();
+				if ( a.getChannelCount()!=0) channelCount+=a.getChannelCount();
+				if ( a.getNewCount()!=0) newCount+=a.getNewCount();
+				if ( a.getChannelNewCount()!=0) channelNewCount+=a.getChannelNewCount();
+				if ( a.getChannelCompleteCount()!=0) channelCompleteCount+=a.getChannelCompleteCount();
 			}
 		}
 		ab.setCompleteCount(completeCount);
-		ab.setInputCount(inputCount);
-		ab.setInterviewCount(interviewCount);
 		ab.setReceiveCount(receiveCount);
 		ab.setUserCount(userCount);
+		ab.setSignCount(signCount);
+		ab.setChannelCount(channelCount);
+		ab.setNewCount(newCount);
+		ab.setChannelNewCount(channelNewCount);
+		ab.setChannelCompleteCount(channelCompleteCount);
+		
 	}
 
 	@SuppressWarnings("unchecked")

+ 5 - 0
src/main/java/com/goafanti/common/enums/OfficialPatentType.java

@@ -20,6 +20,11 @@ public enum OfficialPatentType {
 	QZXKQQF(6,"强制许可请求费"),
 	QZXKSYCJQQF(7,"强制许可使用裁决请求费"),
 	DLYSFYHS(8,"登录、印刷费、印花税"),
+	FJF11(9,"要求附加费从第 11 项起每项增收"),
+	FJF31(10,"说明书附加费从第 31 页起每页增收"),
+	FJF301(11,"从第 301 页起每页增收"),
+	ZZF(12,"中止费"),
+	JSBGF(13,"检索报告费"),
 	NOT(99,"未知");
 	
 	private OfficialPatentType(Integer code, String desc) {

+ 56 - 50
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -1110,44 +1110,47 @@ select a.id,a.nickname as name,a.source,c.name contacts,c.mobile as contactMobil
 	from user a 
 	left join (select uid,max(time_stamp) as time_stamp from user_follow group by uid) b  on a.id=b.uid
 	left join (select uid,name ,mobile from organization_contact_book where major=1) c on a.id=c.uid
-	<if test="type==3 or type==4">
+	<if test="type==5 or type==6">
 	left join (select aid,uid from user_business
-	<if test="type==3">
 	where follow_situation=5 
-	</if> 
-	<if test="type==4">
-	where follow_situation=1
-	</if> 
 	<if test="startTime != null and endTime != null">
-		and  update_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}  
+	and  create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}  
     </if>
 	group by aid,uid)d on a.id=d.uid
 	</if>
-	where  a.type=1
-    <if test=" type !=3 and type !=4 and aid != null"> 
+	where  a.type=1 
+	<if test="type != 5 and type !=6">
 	and a.aid=  #{aid,jdbcType=VARCHAR}
-    </if>
-    <if test=" (type ==3 or type ==4) and aid != null"> 
+	</if>
+	<if test="type == 5 or type ==6">
 	and d.aid=  #{aid,jdbcType=VARCHAR}
+	</if>
+	  <if test="type == 0 or type == 1">
+    and  a.share_type = 0
     </if>
-    <if test="type == 0">
-    and a.source in (1,2,3)
-    and  a.share_type = 0 
-    </if>
-     <if test="type==1 or type==2 ">
-    and  a.share_type in (0,2) and a.channel=0
-    </if>
-    <if test="type == 5">
-    and  a.share_type = 2
+    <if test="type !=1 and type!=4 and type!=6">
+	 and a.channel=0 
     </if>
-	<if test="type == 1">
-    and a.source =1
+	<if test="type == 1 or type==4 or type==6">
+	 and a.channel=1 
+    </if> 
+    <if test="type == 2">
+    and a.share_type=2
+    </if> 
+	<if test="type == 3 or type==4">
+	and a.source=1
+	and  a.share_type = 0
+	</if>
+	<if test="type==7 ">
+	and a.share_type = 0
+	and a.source=2
+	</if>
+	<if test="type!=2 and  type!=7">
     <if test="startTime != null and endTime != null">
 	and  a.create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR} 
     </if>
-    </if>
-    <if test="type == 2">
-    and a.source =2
+	</if>
+    <if test="type==2 or type==7">
 	<if test="startTime != null and endTime != null">
 	and  a.transfer_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR} 
     </if>
@@ -1162,44 +1165,47 @@ select a.id,a.nickname as name,a.source,c.name contacts,c.mobile as contactMobil
   	from user a 
 	left join (select uid,max(time_stamp) as time_stamp from user_follow group by uid) b  on a.id=b.uid
 	left join (select uid,name ,mobile from organization_contact_book where major=1) c on a.id=c.uid
-	<if test="type==3 or type==4">
+	<if test="type==5 or type==6">
 	left join (select aid,uid from user_business
-	<if test="type==3">
 	where follow_situation=5 
-	</if> 
-	<if test="type==4">
-	where follow_situation=1
-	</if> 
 	<if test="startTime != null and endTime != null">
-		and  update_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}  
+	and  create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}  
     </if>
 	group by aid,uid)d on a.id=d.uid
 	</if>
-	where  a.type=1
-   <if test=" type !=3 and type !=4 and aid != null"> 
+	where  a.type=1 
+	<if test="type != 5 and type !=6">
 	and a.aid=  #{aid,jdbcType=VARCHAR}
-    </if>
-    <if test=" (type ==3 or type ==4) and aid != null"> 
+	</if>
+	<if test="type == 5 or type ==6">
 	and d.aid=  #{aid,jdbcType=VARCHAR}
+	</if>
+	  <if test="type == 0 or type == 1">
+    and  a.share_type = 0
     </if>
-    <if test="type == 0">
-    and a.source in (1,2,3)
-    and  a.share_type = 0 
-    </if>
-     <if test="type==1 or type==2 ">
-    and  a.share_type in (0,2)
-    </if>
-    <if test="type == 5">
-    and  a.share_type = 2
+    <if test="type !=1 and type!=4 and type!=6">
+	 and a.channel=0 
     </if>
-	<if test="type == 1">
-    and a.source =1  
+	<if test="type == 1 or type==4 or type==6">
+	 and a.channel=1 
+    </if> 
+    <if test="type == 2">
+    and a.share_type=2
+    </if> 
+	<if test="type == 3 or type==4">
+	and a.source=1
+	and  a.share_type = 0
+	</if>
+	<if test="type==7 ">
+	and a.share_type = 0
+	and a.source=2
+	</if>
+	<if test="type!=2 and  type!=7">
     <if test="startTime != null and endTime != null">
 	and  a.create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR} 
     </if>
-    </if>
-    <if test="type == 2">
-    and a.source =2
+	</if>
+    <if test="type==2 or type==7">
 	<if test="startTime != null and endTime != null">
 	and  a.transfer_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR} 
     </if>

+ 42 - 19
src/main/java/com/goafanti/common/mapper/OrganizationManagementMapper.xml

@@ -641,37 +641,60 @@
 	</select>
 	
 	<select id="getDepAll" resultType="com.goafanti.admin.bo.AdminCustomerBo">
-	select a.id as aid,a.name as aName,d.id depId,d.name as depName,ifnull(b.userCount,0) as userCount,ifnull(c.timeCount,0) as inputCount,
-  	ifnull(d.timeCount,0) as receiveCount, ifnull(e.completeCount,0)completeCount,ifnull(f.interviewCount,0)interviewCount
+	select a.id as aid,a.name as aName,d.id depId,d.name as depName,ifnull(b.userCount,0) as userCount,ifnull(qd.userCount,0) as channelCount,
+	ifnull(c.userCount,0) as signCount,ifnull(d.timeCount,0) as newCount,ifnull(e.timeCount,0) as channelNewCount,
+	ifnull(f.completeCount,0)completeCount,ifnull(g.completeCount,0)channelCompleteCount,ifnull(h.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
+	and  share_type=0 and source !=0 and type=1 and channel=0
+		<if test="startTime != null and endTime != null"> 
+    and  create_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
+    </if>
 	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 =1 and type=1
-	<if test="startTime != null and endTime != null"> 
+	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 and channel=1
+		<if test="startTime != null and endTime != null"> 
     and  create_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
     </if>
+	group by aid) qd on a.id=qd.aid
+	left join (select aid,count(aid) as userCount from user where aid is not null  
+	and  share_type=2 and source !=0 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) 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}
+	and  share_type=0 and source =1 and type=1 and channel=0
+		<if test="startTime != null and endTime != null"> 
+    and  create_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
     </if>
 	group by aid) d on a.id=d.aid
-	left join (select x.aid,count(uid) completeCount from (select a.aid,a.uid from user_business a left join `user` b on a.uid=b.id where a.follow_situation=5
-	  <if test="startTime != null and endTime != null"> 
-    and  a.update_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
+	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 and channel=1
+		<if test="startTime != null and endTime != null"> 
+    and  create_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
+    </if>
+	group by aid) e on a.id=e.aid
+	left join (select x.aid,count(uid) completeCount from (select a.aid,a.uid from user_business a left join `user` b on a.uid=b.id where a.follow_situation=5 and b.channel=0
+	and b.`type`=1  
+	<if test="startTime != null and endTime != null"> 
+    and  create_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
+    </if>
+	group by aid,uid)x group by aid)f on a.id=f.aid 
+	left join (select x.aid,count(uid) completeCount from (select a.aid,a.uid from user_business a left join `user` b on a.uid=b.id where a.follow_situation=5 and b.channel=1
+	and b.`type`=1 
+		<if test="startTime != null and endTime != null"> 
+    and  create_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
     </if>
-	and b.`type`=1 group by aid,uid)x group by aid)e on a.id=e.aid 
-	left join (select x.aid,count(uid) interviewCount from (select a.aid,a.uid from user_business a left join `user` b on a.uid=b.id where a.follow_situation=1
-	  <if test="startTime != null and endTime != null"> 
-    and  a.update_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
+	group by aid,uid)x group by aid)g on a.id=g.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 and channel=0
+		<if test="startTime != null and endTime != null"> 
+    and  transfer_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
     </if>
-	and b.`type`=1 group by aid,uid)x group by aid)f on a.id=f.aid
+	group by aid) h on a.id=h.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
+	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='正常' 
 	<if test="depName !=null">

+ 1 - 2
src/main/java/com/goafanti/common/mapper/UserMapper.xml

@@ -1612,8 +1612,7 @@
    update user
 		set aid=#{transferId,jdbcType=VARCHAR},
 		information_maintainer=#{transferId,jdbcType=VARCHAR},
-			source=3,
-			transfer_time=now()
+			source=3
 		where aid=#{aid,jdbcType=VARCHAR}
   </update>
   <select id="getAidAndUser" resultType="java.lang.Integer">

+ 3 - 3
src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

@@ -795,7 +795,9 @@ public class AdminCustomerApiController extends BaseApiController{
 		return res;
 	}
 	
-	/** 转交客户到制定人 **/
+	/** 
+	 *  客户转交
+	 * 转交客户到制定人 **/
 	@RequestMapping(value = "/transferToOther", method = RequestMethod.GET)
 	public Result transferToOther(String uid,String aid,Integer operatorType,String oldAid){
 		Result res = new Result();
@@ -818,8 +820,6 @@ public class AdminCustomerApiController extends BaseApiController{
 	/**
 	   *   客户转交记录 
 	 * @param uid 客户编号
-	 * @param aid 管理员编号
-	 * @param oldAid 接收者编号
 	 * @return
 	 */
 	@RequestMapping(value = "/transferList", method = RequestMethod.GET)

+ 0 - 1
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -1155,7 +1155,6 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 			user.setShareType(AFTConstants.USER_SHARE_PRIVATE);
 			user.setInformationMaintainer(TokenManager.getAdminId());
 			user.setSource(2);// 客户来源设置为领取
-			user.setTransferTime(now);
 			flag = addUserLock(uid, TokenManager.getAdminId(), now, uList); // 指定用户锁定客户
 			addUserTransferLog(uid, TokenManager.getAdminId(), 1, null, now, uList);
 			if (flag <= 0)