浏览代码

会员进度导出修改

anderx 1 年之前
父节点
当前提交
452bed4afe

+ 1 - 1
src/main/java/com/goafanti/common/dao/AdminUserCountMapper.java

@@ -21,7 +21,7 @@ public interface AdminUserCountMapper {
     int updateByAidAndDateSelective(AdminUserCount e);
 
     int updateByaidAndDate(@Param("aid") String aid,@Param("startTime") String startTime,
-                           @Param("endTime")String endTime,@Param("type")Integer type);
+                           @Param("endTime")String endTime);
 
     List<AdminUserCount> selectByaidAndDate(@Param("aid") String aid, @Param("startTime") String startTime);
 

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

@@ -173,30 +173,15 @@
 
 
   <update id="updateByaidAndDate" >
-    update admin_user_count a,(select aid,dates,count(*)counts
-        from (select aid,DATE_FORMAT(a.transfer_time , '%Y-%m-%d') dates
-        from user a where status =0 and source in(1,2,3)
-        <if test="type==0 or type==3">
-          and share_type=0 and new_channel=0
-        </if>
-        <if test="type==1 or type==4">
-          and share_type=0 and new_channel=1
-        </if>
-        <if test="type==5 or type==6">
-          and share_type=2
-        </if>
-        and aid=  #{aid}
-        and transfer_time BETWEEN #{startTime} and  #{endTime})x group by aid,dates)b
-    set
-    <if test="type==0 or type==3">
-        a.private_count =b.counts
-    </if>
-    <if test="type==1 or type==4">
-      a.channel_count =b.counts
-    </if>
-    <if test="type==5 or type==6">
-      a.sign_count =b.counts
-    </if>
+    update admin_user_count a,(select aid,dates,sum(sy)pr,sum(syqd)prc,sum(qd)sign
+    from (select  aid,if( share_type=0 and new_channel=0,1,0)sy,
+    if( share_type=0 and new_channel=1,1,0)syqd,if( share_type=2,1,0)qd,DATE_FORMAT(transfer_time , '%Y-%m-%d') dates
+    from user
+    where share_type in (0,2)
+    and  aid = #{aid}
+    and transfer_time BETWEEN #{startTime} and  #{endTime})x group by aid,dates
+    )b
+    set a.private_count =b.pr ,a.channel_count =b.prc,a.sign_count =b.sign
     where a.aid=b.aid and a.date_time=b.dates
   </update>
 

+ 48 - 40
src/main/java/com/goafanti/common/task/ReleaseUserTask.java

@@ -7,7 +7,6 @@ import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.*;
 import com.goafanti.common.enums.NoticeStatus;
 import com.goafanti.common.enums.NoticeTypes;
-import com.goafanti.common.model.AdminUserCount;
 import com.goafanti.common.model.Notice;
 import com.goafanti.common.model.User;
 import com.goafanti.common.model.UserTransferLog;
@@ -18,8 +17,8 @@ import com.goafanti.customer.bo.LockingReleaseBo;
 import com.goafanti.customer.service.CustomerService;
 import com.goafanti.user.service.UserService;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 import java.time.LocalDateTime;
@@ -30,8 +29,8 @@ import java.util.List;
 import java.util.UUID;
 
 
-@Component
-//@RestController
+//@Component
+@RestController
 public class ReleaseUserTask {
 	@Resource
 	private CustomerService customerService;
@@ -64,8 +63,8 @@ public class ReleaseUserTask {
 	 *
 	 */
 //	@Scheduled(cron = "0 22 16  * * ?")
-//	@RequestMapping("/open/test")
-	@Scheduled(cron = "0 0 1  * * ?")
+	@RequestMapping("/open/test")
+//	@Scheduled(cron = "0 0 1  * * ?")
 	public void startTask() {
 		try {
 			List<User> userList = userService.selectUserByRoleName("营销员", "营销经理");
@@ -307,32 +306,12 @@ public class ReleaseUserTask {
 				}
 			}
 			//签单客户要单独处理,没有锁,直接释放
-			List<LockingReleaseBo> newList = new ArrayList<LockingReleaseBo>();
-			if (!lockSignList.isEmpty()) {
-				for (int i = 0; i < lockSignList.size(); i++) {
-					newList.add(lockSignList.get(i));
-					if (pointsDataLimit == newList.size() || i == lockUserList.size() - 1) {
-						customerService.updateUserShareType(newList);
-						newList.clear();
-						Thread.sleep(2000);
-					}
-
-				}
-			}
+			pushSignUser(lockSignList);
 			//处理私有客户
-			if (!lockUserList.isEmpty()) {
-				for (int i = 0; i < lockUserList.size(); i++) {
-					newList.add(lockUserList.get(i));
-					if (pointsDataLimit == newList.size() || i == lockUserList.size() - 1) {
-                        customerService.updatePendingReleaseLock(newList);
-                        newList.clear();
-						Thread.sleep(2000);
-					}
-
-				}
-			}
+			pushPrivateUser(lockUserList);
 			//处理每个人重复的天数
-			pushSalesmanCount(lockUserList);
+			pushSalesmanPrivateCount(lockUserList);
+			pushSalesmanSignCount(lockSignList);
 			pushChannel(releaseTime, userList);
 			//客户释放
 			List<LockingReleaseBo> lockList = customerService.selectPendinglockUserList();
@@ -351,23 +330,52 @@ public class ReleaseUserTask {
 		LoggerUtils.debug(getClass(), "==============客户释放完成============");
 	}
 
+	private void pushSalesmanSignCount(List<LockingReleaseBo> lockUserList) {
+	}
 
+	private void pushSalesmanPrivateCount(List<LockingReleaseBo> list) {
+		for (LockingReleaseBo e : list) {
+			String sartTime= e.getLockTime();
+			String endTime=e.getLockTime()+" 23:59:59";
+			adminUserCountMapper.updateByaidAndDate(e.getAid(), sartTime, endTime);
+		}
+	}
 
+	private void pushPrivateUser(List<LockingReleaseBo> lockUserList) throws InterruptedException {
+		List<LockingReleaseBo> newList=new ArrayList<LockingReleaseBo>();
+		if (!lockUserList.isEmpty()) {
+			for (int i = 0; i < lockUserList.size(); i++) {
+				newList.add(lockUserList.get(i));
+				if (pointsDataLimit == newList.size() || i == lockUserList.size() - 1) {
+					customerService.updatePendingReleaseLock(newList);
+					newList.clear();
+					Thread.sleep(2000);
+				}
 
-	private void pushSalesmanCount(List<LockingReleaseBo> aidList) {
-		for (LockingReleaseBo e : aidList) {
-			String dates= e.getLockTime();
-			AdminUserCount adminUserCount = customerService.getAdminUserCount(e.getAid(), dates);
-			if (adminUserCount!=null&&adminUserCount.getPrivateCount()>0){
-				AdminUserCount newAdminUserCount = new AdminUserCount();
-				newAdminUserCount.setId(adminUserCount.getId());
-				newAdminUserCount.setPrivateCount(adminUserCount.getPrivateCount()-1);
-				adminUserCountMapper.updateByPrimaryKeySelective(newAdminUserCount);
 			}
+		}
+	}
+
+	private void pushSignUser(List<LockingReleaseBo> lockSignList) throws InterruptedException {
+		List<LockingReleaseBo> newList = new ArrayList<LockingReleaseBo>();
+		if (!lockSignList.isEmpty()) {
+			for (int i = 0; i < lockSignList.size(); i++) {
+				newList.add(lockSignList.get(i));
+				if (pointsDataLimit == newList.size() || i == lockSignList.size() - 1) {
+					customerService.updateUserShareType(newList);
+					newList.clear();
+					Thread.sleep(2000);
+				}
 
+			}
 		}
 	}
 
+
+	private void pushSalesmanCount(List<LockingReleaseBo> aidList) {
+
+	}
+
 	/**
 	 * 处理外联
 	 */

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

@@ -2243,10 +2243,14 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 	@Override
 	public List<LockingReleaseBo> selectWaitReleaseCustomer(String uid) {
 		List<LockingReleaseBo> list = new ArrayList<>();
+		//u.channel=0 and u.share_type=0   私有和私有渠道客户 30
+		//u.share_type in(0) and  u.channel=0 and u.new_channel=0  私有 非渠道270
 		List<LockingReleaseBo> lockingReleaseBos = userLockReleaseMapper.selectWaitReleaseCustomer(uid);
 		for (LockingReleaseBo bo : lockingReleaseBos) {
 			// 渠道为空或者不其他的需要处理
-			if (bo.getNewChannel()!=1||bo.getChannelType()==null||bo.getChannelType()!=1){
+			if(bo.getNewChannel()==0){
+				list.add(bo);
+			}else if (bo.getNewChannel()==1&&(bo.getChannelType()!=null||bo.getChannelType()!=1)){
 				list.add(bo);
 			}
 		}

+ 1 - 2
src/main/java/com/goafanti/test/controller/TestController.java

@@ -3,7 +3,6 @@ package com.goafanti.test.controller;
 import com.goafanti.common.bo.EmailBo;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.utils.AsyncUtils;
-import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -16,7 +15,7 @@ public class TestController {
     @Resource
     private AsyncUtils asyncUtils;
 
-    @GetMapping(value = "/test")
+//    @GetMapping(value = "/test")
     public String test(){
         asyncUtils.send(new EmailBo("催款处理失败",  AFTConstants.ADMIN_EMAIL,  "超管", "平台"));
         return "test";

+ 2 - 2
src/main/resources/props/config_local.properties

@@ -1,8 +1,8 @@
 dev.name=local
 jdbc.driverClassName=com.mysql.jdbc.Driver
 
-#static.host=//static.jishutao.com/1.3.37
-static.host=//172.16.1.187/1.3.37
+static.host=//static.jishutao.com/1.3.37
+#static.host=//172.16.1.187/1.3.37
 
 #jdbc.url=jdbc\:mysql://localhost:3306/aft20241122?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
 #jdbc.url=jdbc\:mysql://localhost:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false