Forráskód Böngészése

Merge branch 'test' of jishutao/kede-server into prod

gitadmin 4 hónapja%!(EXTRA string=óta)
szülő
commit
5df1cf60d8

+ 10 - 0
src/main/java/com/goafanti/admin/bo/AdminCustomerBo.java

@@ -12,6 +12,8 @@ public class AdminCustomerBo {
 	private String depName;
 	@Excel( name = "私有数",width = 12)
 	private Integer userCount;
+	@Excel( name = "有效数",width = 12)
+	private Integer privateCount;
 	@Excel( name = "有效面谈数",width = 12)
 	private Integer firstInterviewCount;
 	@Excel( name = "渠道数",width = 12)
@@ -37,6 +39,14 @@ public class AdminCustomerBo {
 	@Excel( name = "重点客户",width = 12)
 	private Integer keynoteCount;
 
+	public Integer getPrivateCount() {
+		return privateCount;
+	}
+
+	public void setPrivateCount(Integer privateCount) {
+		this.privateCount = privateCount;
+	}
+
 	public Integer getFirstInterviewCount() {
 		return firstInterviewCount;
 	}

+ 9 - 0
src/main/java/com/goafanti/admin/bo/DepCountBo.java

@@ -8,6 +8,7 @@ public class DepCountBo {
 	private String id;
 	private String name;
 	private Integer userCount;
+	private Integer privateCount;
 	private Integer firstInterviewCount;
 	private Integer receiveCount;
 	private Integer completeCount;
@@ -26,6 +27,14 @@ public class DepCountBo {
 	private List<DepCountBo> list;
 	private List<AdminCustomerBo> aList;
 
+	public Integer getPrivateCount() {
+		return privateCount;
+	}
+
+	public void setPrivateCount(Integer privateCount) {
+		this.privateCount = privateCount;
+	}
+
 	public Integer getFirstInterviewCount() {
 		return firstInterviewCount;
 	}

+ 7 - 2
src/main/java/com/goafanti/admin/service/impl/AdminServiceImpl.java

@@ -461,6 +461,7 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 						admin.setIntentionCount(user.getIntentionCount());
 						admin.setKeynoteCount(user.getKeynoteCount());
 						admin.setGeneralCount(user.getGeneralCount());
+						admin.setPrivateCount(user.getPrivateCount());
 						break;
 					}
 				}
@@ -497,6 +498,7 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 		if (admin.getKeynoteCount()==null)admin.setKeynoteCount(0);
 		if (admin.getGeneralCount()==null)admin.setGeneralCount(0);
 		if (admin.getFirstInterviewCount()==null)admin.setFirstInterviewCount(0);
+		if (admin.getPrivateCount()==null)admin.setPrivateCount(0);
 	}
 
 	//迭代获取所有部门与部门员工并计算出部门数量
@@ -520,7 +522,8 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 	 */
 	public void sumCount(DepCountBo ab) {
 		int completeCount=0,receiveCount=0,userCount=0,signCount=0,channelCount=0,newCount=0,channelNewCount=0,
-				channelCompleteCount=0,transferCount=0,intentionCount=0,keynoteCount=0,generalCount=0,firstInterviewCount=0;
+				channelCompleteCount=0,transferCount=0,intentionCount=0,keynoteCount=0,generalCount=0,
+				firstInterviewCount=0,privateCount=0;
 
 		if (ab.getList()!=null&&!ab.getList().isEmpty()) {
 			for (DepCountBo a : ab.getList()) {
@@ -537,6 +540,7 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 				if (a.getKeynoteCount()!=null&& a.getKeynoteCount()!=0) keynoteCount+=a.getKeynoteCount();
 				if (a.getGeneralCount()!=null&& a.getGeneralCount()!=0) generalCount=a.getGeneralCount();
 				if (a.getFirstInterviewCount()!=null&& a.getFirstInterviewCount()!=0) firstInterviewCount+=a.getFirstInterviewCount();
+				if (a.getPrivateCount()!=null&& a.getPrivateCount()!=0) privateCount+=a.getPrivateCount();
 			}
 		}
 		if (ab.getaList()!=null&&!ab.getaList().isEmpty()) {
@@ -554,6 +558,7 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 				if (a.getKeynoteCount()!=null&& a.getKeynoteCount()!=0) keynoteCount+=a.getKeynoteCount();
 				if (a.getGeneralCount()!=null&& a.getGeneralCount()!=0) generalCount=a.getGeneralCount();
 				if (a.getFirstInterviewCount()!=null&& a.getFirstInterviewCount()!=0) firstInterviewCount+=a.getFirstInterviewCount();
+				if (a.getPrivateCount()!=null&& a.getPrivateCount()!=0) privateCount+=a.getPrivateCount();
 			}
 		}
 		ab.setCompleteCount(completeCount);
@@ -569,7 +574,7 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 		ab.setKeynoteCount(keynoteCount);
 		ab.setGeneralCount(generalCount);
 		ab.setFirstInterviewCount(firstInterviewCount);
-
+		ab.setPrivateCount(privateCount);
 	}
 
 	@SuppressWarnings("unchecked")

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 59 - 31
src/main/java/com/goafanti/common/mapper/UserMapper.xml


+ 1 - 0
src/main/java/com/goafanti/common/mapper/UserMapperExt.xml

@@ -2356,6 +2356,7 @@ inner join(
 
 	<select id="selectNoChannelByaids" resultType="com.goafanti.admin.bo.AdminCustomerBo">
 		select aid,sum(if( share_type=0 and new_channel=0,1,0))userCount,
+		sum(if( share_type=0 and new_channel=0 and private_valid=1 ,1,0))privateCount,
 		sum(if(share_type=3 and new_channel=1,1,0))channelCount,
 		sum(if( share_type=2 ,1,0))signCount,
 		sum(if(share_type=0 and source =1 and new_channel=0,1,0))newCount,

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

@@ -167,7 +167,7 @@
   </update>
   <select id="selectByUidGetList" resultType="com.goafanti.customer.bo.transferListBo">
 	select a.id,a.type,b.nickname userName,c.name usedAName,d.name newAName,e.bname Pname,
-	       a.aid,a.uid,a.take_aid takeAid,
+	       a.aid,a.uid,a.take_aid takeAid,a.create_time as createTime,
   	date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as createDate,remarks
   	from user_transfer_log a left join user b on a.uid=b.id
 	left join admin c on a.aid=c.id left join admin d on a.take_aid=d.id

+ 26 - 2
src/main/java/com/goafanti/common/model/User.java

@@ -7,7 +7,7 @@ import java.util.Date;
  * (User)实体类
  *
  * @author makejava
- * @since 2025-03-21 16:37:40
+ * @since 2025-09-22 11:15:07
  */
 public class User implements  AftUser{
     private static final long serialVersionUID = 896145436195951740L;
@@ -202,7 +202,7 @@ public class User implements  AftUser{
      */
     private Date clueTransferTime;
     /**
-     * 客户性质0=其他,1=政府机构,2=科研院所,3=高等院校,4=国有企业,5=民营企业,6=社会团体
+     * 客户性质 0=其他,1=政府机构,2=科研院所,3=高等院校,4=社会团体,5=企业
      */
     private Integer nature;
     /**
@@ -217,6 +217,14 @@ public class User implements  AftUser{
      * 上市 0=否,1=是
      */
     private Integer listedNature;
+    /**
+     * 新客户 0=是,1=否
+     */
+    private Integer newUser;
+    /**
+     * 私有有效标识 0=否,1=是
+     */
+    private Integer privateValid;
 
 
     public String getId() {
@@ -635,5 +643,21 @@ public class User implements  AftUser{
         this.listedNature = listedNature;
     }
 
+    public Integer getNewUser() {
+        return newUser;
+    }
+
+    public void setNewUser(Integer newUser) {
+        this.newUser = newUser;
+    }
+
+    public Integer getPrivateValid() {
+        return privateValid;
+    }
+
+    public void setPrivateValid(Integer privateValid) {
+        this.privateValid = privateValid;
+    }
+
 }
 

+ 11 - 1
src/main/java/com/goafanti/customer/bo/transferListBo.java

@@ -1,5 +1,7 @@
 package com.goafanti.customer.bo;
 
+import java.util.Date;
+
 public class transferListBo {
 	private Integer id;
 	private Integer type;
@@ -9,11 +11,19 @@ public class transferListBo {
 	private String pName;
 	private String createDate;
 	private String remarks;
-
+	private Date createTime;
 	private String aid;
 	private String uid;
 	private String takeAid;
 
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
 	public String getAid() {
 		return aid;
 	}

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

@@ -394,7 +394,8 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		user.setUpdateTime(now);
 		user.setSignBills(0);
 		user.setNewChannel(0);
-
+		//新增有效标识
+		user.setPrivateValid(1);
 		if(StringUtils.isNotBlank(in.getIntroduction()))user.setIntroduction(in.getIntroduction());
 		user.setMobile(in.getContactMobile());
 		user.setPassword(AFTConstants.INITIALPASSWORD);
@@ -1340,6 +1341,8 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 			}
 			user.setInformationMaintainer(TokenManager.getAdminId());
 			user.setSource(2);// 客户来源设置为领取
+			//领取客户新增判定有效,领取自己的需要大于180天
+			user.setPrivateValid(addPrivateValid(uid));
 			addUserTransferLog(uid, aid, null,1, null, now, uList);
 			updateUserMid(aid,uid,0,null);
 			//转交
@@ -1426,7 +1429,43 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		return errors;
 	}
 
+	private int addPrivateValid(String uid) {
+		List<transferListBo> transferListBos = userTransferLogMapper.selectByUidGetList(uid);
+		//获取我的最后一个操作数据
+		boolean flag = false;
+		if(transferListBos.isEmpty()){
+			//没有操作数据则是有效新增
+			flag = true;
+		}else{
+			//有数据就看最后一条当前人的操作时间
+			List<transferListBo> collect = transferListBos.stream().filter(e -> e.getAid().equals(TokenManager.getAdminId())).collect(Collectors.toList());
+			if(collect.isEmpty()){
+				//没有操作数据则是有效新增
+				flag = true;
+			}else{
+				//获取最新数据
+				collect.sort(Comparator.comparing(transferListBo -> transferListBo.getCreateTime().getTime()));
+				transferListBo transferListBo = collect.get(collect.size()-1);
+				long userTime=transferListBo.getCreateTime().getTime();
+				long validTime=System.currentTimeMillis();
+				long dayTime= 180L *24*60*60*1000;
+				validTime=validTime-dayTime;
+				if( userTime<validTime ){
+					flag = true;
+				}else{
+					flag = false;
+				}
+			}
 
+		}
+		if (flag){
+//			System.out.println("========================是有效数据");
+			return 1;
+		}else{
+//			System.out.println("========================无效数据");
+			return 0;
+		}
+	}
 
 
 	@Override
@@ -3138,6 +3177,8 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		user.setNatureOther(in.getNatureOther());
 		user.setEnterpriseNature(in.getEnterpriseNature());
 		user.setListedNature(in.getListedNature());
+		//新增有效的概率
+		//查询上一次我释放的时间
 		userMapper.update(user);
 		OrganizationIdentity oi = new OrganizationIdentity();
 		oi.setUid(in.getId());