大屏接口

dev_0531
yechenhao 6 years ago
parent 147c219935
commit 0100793bc4

@ -722,61 +722,66 @@ public class CustomerViewService {
//查询企业微信已配置联系我的用户 //查询企业微信已配置联系我的用户
int i = 0; int i = 0;
for (OpCustomer customer : customers) { List<OpCustomer> opCustomers = customers.subList(132800, customers.size());
for (OpCustomer customer : opCustomers) {
i++; i++;
String wechatUniId = customer.getWechatUniId(); try{
if (StringUtils.isBlank(wechatUniId)){ String wechatUniId = customer.getWechatUniId();
continue; if (StringUtils.isBlank(wechatUniId)){
} continue;
if (customer.getMemberId() != 0L){ }
continue; if (customer.getMemberId() != 0L){
} continue;
String url = ""; }
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String url = "";
Map<String, Object> params = new HashMap<>(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
params.put("unionId", wechatUniId); Map<String, Object> params = new HashMap<>();
String message = HttpClientUtil.httpPost(vipBsdUrl + MD5FileUtil.getMD5String("BOSIDENG" + sdf.format(new Date())), JSONObject.toJSONString(params)).getMessage(); params.put("unionId", wechatUniId);
if (StringUtils.isBlank(message)){ String message = HttpClientUtil.httpPost(vipBsdUrl + MD5FileUtil.getMD5String("BOSIDENG" + sdf.format(new Date())), JSONObject.toJSONString(params)).getMessage();
continue; if (StringUtils.isBlank(message)){
} continue;
System.out.println(i+"/"+customers.size()+"------"+message); }
JSONObject vipJson = JSONObject.parseObject(message); System.out.println(i+"/"+customers.size()+"------"+message);
BsdVipResponse bsdResponse = vipJson.toJavaObject(BsdVipResponse.class); JSONObject vipJson = JSONObject.parseObject(message);
if (bsdResponse.getSuccess() && bsdResponse.getData() != null){ BsdVipResponse bsdResponse = vipJson.toJavaObject(BsdVipResponse.class);
MemberDtlDTO data = bsdResponse.getData(); if (bsdResponse.getSuccess() && bsdResponse.getData() != null){
MemberDtlDTO data = bsdResponse.getData();
OpCustomer opCustomer = new OpCustomer(data.getMemberName(), data.getMobileNo());
opCustomer.setUpdateBy(Constants.SYS_OPERATION); OpCustomer opCustomer = new OpCustomer(data.getMemberName(), data.getMobileNo());
opCustomer.setUpdateBy(Constants.SYS_OPERATION);
// 根据手机号码去重
QueryWrapper<OpVip> wrapper = new QueryWrapper<>(); // 根据手机号码去重
wrapper.eq("phone", data.getMobileNo()).last("limit 1"); QueryWrapper<OpVip> wrapper = new QueryWrapper<>();
OpVip opVip = opVipDOMapper.selectOne(wrapper); wrapper.eq("phone", data.getMobileNo()).last("limit 1");
OpVip opVip1 = new OpVip(); OpVip opVip = opVipDOMapper.selectOne(wrapper);
opVip1.setStatus(1L); OpVip opVip1 = new OpVip();
opVip1.setLevel(data.getMemberLevel().toString()); opVip1.setStatus(1L);
opVip1.setPhone(data.getMobileNo()); opVip1.setLevel(data.getMemberLevel().toString());
opVip1.setName(data.getMemberName()); opVip1.setPhone(data.getMobileNo());
opVip1.setBirthday(data.getBirthday()); opVip1.setName(data.getMemberName());
opVip1.setRegisterTime(data.getCreateDate()); opVip1.setBirthday(data.getBirthday());
if (opVip == null) { opVip1.setRegisterTime(data.getCreateDate());
//数据库没有这个数据--新建数据 if (opVip == null) {
opVip1.setCreateBy(Constants.SYS_OPERATION); //数据库没有这个数据--新建数据
opVip1.setCreateTime(new Date()); opVip1.setCreateBy(Constants.SYS_OPERATION);
opVipDOMapper.insert(opVip1); opVip1.setCreateTime(new Date());
//有vip信息就绑定信息 opVipDOMapper.insert(opVip1);
opCustomer.setMemberId(opVip1.getId()); //有vip信息就绑定信息
} else { opCustomer.setMemberId(opVip1.getId());
opVip1.setId(opVip.getId()); } else {
opVip1.setUpdateTime(new Date()); opVip1.setId(opVip.getId());
opVip1.setUpdateBy(Constants.SYS_OPERATION); opVip1.setUpdateTime(new Date());
opVipDOMapper.updateById(opVip1); opVip1.setUpdateBy(Constants.SYS_OPERATION);
//有vip信息就绑定信息 opVipDOMapper.updateById(opVip1);
opCustomer.setMemberId(opVip.getId()); //有vip信息就绑定信息
opCustomer.setMemberId(opVip.getId());
}
QueryWrapper<OpCustomer> wrapper1 = new QueryWrapper<>();
wrapper1.eq("wechat_uni_id", wechatUniId);
opCustomerDOMapper.update(opCustomer, wrapper1);
} }
QueryWrapper<OpCustomer> wrapper1 = new QueryWrapper<>(); }catch (Exception e){
wrapper1.eq("wechat_uni_id", wechatUniId); log.error("同步vip出错",e);
opCustomerDOMapper.update(opCustomer, wrapper1);
} }
} }
} }

Loading…
Cancel
Save