修改同步明细接口。

dev
kevin jiang 5 years ago
parent d87dabb7d7
commit fc04804860

@ -14,14 +14,13 @@ import com.lmax.disruptor.*;
import com.lmax.disruptor.dsl.Disruptor; import com.lmax.disruptor.dsl.Disruptor;
import com.lmax.disruptor.dsl.ProducerType; import com.lmax.disruptor.dsl.ProducerType;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.cp.bean.WxCpUser;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Arrays; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.*; import java.util.concurrent.*;
/** /**
@ -60,7 +59,7 @@ public class CustomerDataJob {
private RedisUtil redisUtil; private RedisUtil redisUtil;
public void handle(String cpUserIds) { public void handle(String cpUserIds) throws WxErrorException {
//创建线程池 //创建线程池
ExecutorService executors = Executors.newFixedThreadPool(THREAD_NUMBERS); ExecutorService executors = Executors.newFixedThreadPool(THREAD_NUMBERS);
@ -109,14 +108,25 @@ public class CustomerDataJob {
index++; index++;
} }
} else { } else {
String[] split = cpUserIds.split(","); // String[] split = cpUserIds.split(",");
List<String> cpUserIdList = Arrays.asList(split); // List<String> cpUserIdList = Arrays.asList(split);
List<String> cpUserIdList = new ArrayList<>();
List<WxCpUser> wxCpUsers = qwMailListManageService.syncUser();
for (int i = 0; i < wxCpUsers.size(); i++) {
WxCpUser item = wxCpUsers.get(i);
cpUserIdList.add(item.getUserId());
}
// 获取账号的总客户数 // 获取账号的总客户数
List<Map<String, Object>> customerList = opSellerCustomerRelationDOMapper.selectCustomersByCpUserIdByList(cpUserIdList); List<Map<String, Object>> customerList = opSellerCustomerRelationDOMapper.selectCustomersByCpUserIdByList(cpUserIdList);
Map<String, Object> customerMap = new HashMap<>(); Map<String, Object> customerMap = new HashMap<>();
for (int i = 0; i < customerList.size(); i++) { for (int i = 0; i < customerList.size(); i++) {
Map<String, Object> item = customerList.get(i); Map<String, Object> item = customerList.get(i);
customerMap.put(item.get("cpUserId").toString(), item.get("sumCustomer")); if(null != item.get("cpUserId")){
customerMap.put(item.get("cpUserId").toString(), item.get("sumCustomer"));
}
} }
for (String cpUserId : cpUserIdList) { for (String cpUserId : cpUserIdList) {

@ -24,6 +24,7 @@ import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.cp.api.*; import me.chanjar.weixin.cp.api.*;
import me.chanjar.weixin.cp.bean.*; import me.chanjar.weixin.cp.bean.*;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -430,6 +431,8 @@ public class QWMailListManageService {
return customers; return customers;
} }
private File file = new File("file/601.txt");
public void getCustomerNew(String cpUserId, Integer sumCustomer, CustomerService customerService, List<Map<String, Object>> tagList) throws WxErrorException { public void getCustomerNew(String cpUserId, Integer sumCustomer, CustomerService customerService, List<Map<String, Object>> tagList) throws WxErrorException {
//查询店铺id——店铺ID存在说明该账号的客户都绑在店上不存在则说明绑在账号上 //查询店铺id——店铺ID存在说明该账号的客户都绑在店上不存在则说明绑在账号上
// Long storeId = privilageCpUserStoreDOMapper.selectOneByCpUserId(cpUserId); // Long storeId = privilageCpUserStoreDOMapper.selectOneByCpUserId(cpUserId);
@ -514,12 +517,16 @@ public class QWMailListManageService {
wxDataDTO.setUnionId(externalContact.getUnionId()); wxDataDTO.setUnionId(externalContact.getUnionId());
turnBackDTO.setWxData(wxDataDTO); turnBackDTO.setWxData(wxDataDTO);
// SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// Date jtime = sdf.parse(turnBackDTO.getJoinTime()); // Date jtime = sdf.parse(turnBackDTO.getJoinTime());
// Date etime = sdf.parse("2020-05-28 00:00:00"); // Date stime = sdf.parse("2020-05-25 00:00:00");
// if (jtime.before(etime)) { // Date etime = sdf.parse("2020-05-26 00:00:00");
//
//
// if (jtime.after(stime) && jtime.before(etime)) {
//// System.out.println("aa" + turnBackDTO.toString()); //// System.out.println("aa" + turnBackDTO.toString());
// continue; // FileUtils.write(file, turnBackDTO.toString() + "\n","utf-8", true);
// } // continue;
// }
// System.out.println(turnBackDTO.toString()); // System.out.println(turnBackDTO.toString());
customerService.turnBack(turnBackDTO); customerService.turnBack(turnBackDTO);

@ -57,7 +57,10 @@ public class JobTest {
// 13278869965 // 13278869965
// 19906239800 // 19906239800
String cpUserIds = "17386133351"; String cpUserIds = "17386133351";
customerDataJob.handle(null);
customerDataJob.handle(cpUserIds);
// List<String> cpUserIds = dataAccountDOMapper.selectByAccount(); // List<String> cpUserIds = dataAccountDOMapper.selectByAccount();
// customerDataJob.handleList(cpUserIds); // customerDataJob.handleList(cpUserIds);
log.info("<--获取联系客户统计数据定时任务结束-->"); log.info("<--获取联系客户统计数据定时任务结束-->");

Loading…
Cancel
Save