소스 검색

营销首页统计暂停规则修改

anderx 2 년 전
부모
커밋
c07e7bb6c2

+ 19 - 14
src/main/java/com/goafanti/common/task/ReleaseUserTask.java

@@ -1,18 +1,5 @@
 package com.goafanti.common.task;
 
-import java.util.*;
-
-import javax.annotation.Resource;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.ResponseBody;
-
 import com.goafanti.common.bo.EmailBo;
 import com.goafanti.common.bo.userDaysBo;
 import com.goafanti.common.constant.AFTConstants;
@@ -27,7 +14,16 @@ import com.goafanti.common.utils.StringUtils;
 import com.goafanti.customer.bo.LockingReleaseBo;
 import com.goafanti.customer.service.CustomerService;
 import com.goafanti.user.service.UserService;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
 
 
 @Component
@@ -128,6 +124,7 @@ public class ReleaseUserTask {
 				}
 			}
 			List<LockingReleaseBo> newList = new ArrayList<LockingReleaseBo>();
+			List<String> aidList=new ArrayList<>();
 			if (lockUserList != null && lockUserList.size() > 0) {
 				for (int i = 0; i < lockUserList.size(); i++) {
 					newList.add(lockUserList.get(i));
@@ -138,8 +135,16 @@ public class ReleaseUserTask {
 						newList.clear();
 						Thread.sleep(2000);
 					}
+					//设置释放客户修改客户数
+					String aid=lockUserList.get(i).getAid();
+					if (!aidList.contains(aid)){
+						aidList.add(aid);
+					}
 				}
 			}
+			for (String aid : aidList) {
+				customerService.updateAdminUserCountByAid(aid);
+			}
 			pushChannel(releaseTime, userList);
 		} catch (Exception e) {
 			Notice n = new Notice(UUID.randomUUID().toString(), new Date(), 0, "1",

+ 2 - 0
src/main/java/com/goafanti/customer/service/CustomerService.java

@@ -579,4 +579,6 @@ public interface CustomerService {
 	 * @param transferTime
 	 */
 	void updateAdminUserCount(String aid,Date transferTime);
+
+	void updateAdminUserCountByAid(String aid);
 }

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

@@ -489,6 +489,28 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		}
 	}
 
+	@Override
+	public void updateAdminUserCountByAid(String aid) {
+		List<AdminUserCount> list = userMapper.selectListByaidAndDate(aid);
+			for (AdminUserCount e : list) {
+				String startTime=DateUtils.formatDate(e.getDateTime(),AFTConstants.YYYYMMDD);
+				AdminUserCount selectAUC = adminUserCountMapper.selectByaidAndDate(e.getAid(), startTime);
+				if (selectAUC==null){
+					adminUserCountMapper.insertSelective(e);
+				}else {
+					AdminUserCount newAUC=new AdminUserCount();
+					newAUC.setId(selectAUC.getId());
+					if (e.getPrivateCount()==null)selectAUC.setPrivateCount(0);
+					if (e.getChannelCount()==null)selectAUC.setChannelCount(0);
+					if (e.getSignCount()==null)selectAUC.setSignCount(0);
+					newAUC.setPrivateCount(e.getPrivateCount());
+					newAUC.setChannelCount(e.getChannelCount());
+					newAUC.setSignCount(e.getSignCount());
+					adminUserCountMapper.updateByPrimaryKeySelective(newAUC);
+				}
+			}
+	}
+
 	private void checkUserName(InputAddCustomer in) {
 		if (userMapper.checkUser("", in.getName(), "", in.getType(), null, null).size() > 0)
 			throw new BusinessException(new Error(ErrorConstants.CUSTOMER_ALREADY_EXIST, in.getName(), ""));