|
@@ -1,7 +1,10 @@
|
|
package com.management.platform.controller;
|
|
package com.management.platform.controller;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
-import com.management.platform.entity.*;
|
|
|
|
|
|
+import com.management.platform.entity.Custom;
|
|
|
|
+import com.management.platform.entity.User;
|
|
|
|
+import com.management.platform.entity.WechatQrcodeScan;
|
|
|
|
+import com.management.platform.entity.WechatUserFollow;
|
|
import com.management.platform.mapper.WechatQrcodeScanMapper;
|
|
import com.management.platform.mapper.WechatQrcodeScanMapper;
|
|
import com.management.platform.mapper.WechatUserFollowMapper;
|
|
import com.management.platform.mapper.WechatUserFollowMapper;
|
|
import com.management.platform.service.CustomService;
|
|
import com.management.platform.service.CustomService;
|
|
@@ -25,7 +28,6 @@ import java.time.LocalDateTime;
|
|
import java.time.ZoneId;
|
|
import java.time.ZoneId;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
-import java.util.List;
|
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@@ -169,30 +171,30 @@ public class WechatCallbackController {
|
|
followRecord.setSalesmanId(salesmanId);
|
|
followRecord.setSalesmanId(salesmanId);
|
|
followMapper.insert(followRecord);
|
|
followMapper.insert(followRecord);
|
|
|
|
|
|
- List<MiniBindUser> miniBindUserList = miniBindUserService.list(new QueryWrapper<MiniBindUser>()
|
|
|
|
|
|
+ /*List<MiniBindUser> miniBindUserList = miniBindUserService.list(new QueryWrapper<MiniBindUser>()
|
|
.eq("unionid", scanRecord.getUnionid())
|
|
.eq("unionid", scanRecord.getUnionid())
|
|
.orderByDesc("create_time")
|
|
.orderByDesc("create_time")
|
|
- .last("limit 1"));
|
|
|
|
|
|
+ .last("limit 1"));*/
|
|
|
|
|
|
- if (!miniBindUserList.isEmpty()){
|
|
|
|
- int count = customService.count(new QueryWrapper<Custom>().eq("custom_name", openId));
|
|
|
|
- if(count==0) {
|
|
|
|
- Custom custom = new Custom();
|
|
|
|
- custom.setCustomName(openId);//用户的openId
|
|
|
|
- custom.setIsDelete(0);
|
|
|
|
- custom.setInchargerId(miniBindUserList.get(0).getUserId());
|
|
|
|
- custom.setCreateTime(new Date());
|
|
|
|
- if (StringUtils.isNotEmpty(miniBindUserList.get(0).getUserId())) {
|
|
|
|
- User user = userService.getById(miniBindUserList.get(0).getUserId());
|
|
|
|
- custom.setCompanyId(user != null ? user.getCompanyId() : null);
|
|
|
|
- customService.save(custom);
|
|
|
|
- log.info("新增客户成功");
|
|
|
|
- }
|
|
|
|
- }else {
|
|
|
|
- log.info("已存在custom_name为"+openId+"的客户");
|
|
|
|
|
|
+// if (!miniBindUserList.isEmpty()){
|
|
|
|
+ int count = customService.count(new QueryWrapper<Custom>().eq("custom_name", openId));
|
|
|
|
+ if(count==0) {
|
|
|
|
+ Custom custom = new Custom();
|
|
|
|
+ custom.setCustomName(openId);//用户的openId
|
|
|
|
+ custom.setIsDelete(0);
|
|
|
|
+ custom.setCreateTime(new Date());
|
|
|
|
+ if (StringUtils.isNotEmpty(salesmanId)) {
|
|
|
|
+ custom.setInchargerId(salesmanId);
|
|
|
|
+ User user = userService.getById(salesmanId);
|
|
|
|
+ custom.setCompanyId(user != null ? user.getCompanyId() : null);
|
|
|
|
+ customService.save(custom);
|
|
|
|
+ log.info("新增客户成功");
|
|
}
|
|
}
|
|
|
|
+ }else {
|
|
|
|
+ log.info("已存在custom_name为"+openId+"的客户");
|
|
}
|
|
}
|
|
- log.info("用户新关注成功");
|
|
|
|
|
|
+// }
|
|
|
|
+ log.info("用户关注成功");
|
|
} else {
|
|
} else {
|
|
followRecord.setIsFollow(true);
|
|
followRecord.setIsFollow(true);
|
|
followRecord.setFollowTime(LocalDateTime.now());
|
|
followRecord.setFollowTime(LocalDateTime.now());
|