1.兼容历史数据中无unionid和memberid的情况
Showing
4 changed files
with
39 additions
and
14 deletions
| ... | @@ -27,6 +27,7 @@ import java.sql.Timestamp; | ... | @@ -27,6 +27,7 @@ import java.sql.Timestamp; |
| 27 | import java.time.LocalDateTime; | 27 | import java.time.LocalDateTime; |
| 28 | import java.util.List; | 28 | import java.util.List; |
| 29 | import java.util.Map; | 29 | import java.util.Map; |
| 30 | import java.util.Objects; | ||
| 30 | 31 | ||
| 31 | /** | 32 | /** |
| 32 | * @author XiangHan | 33 | * @author XiangHan |
| ... | @@ -93,14 +94,22 @@ public class UserWeixinServiceImpl implements UserWeixinService { | ... | @@ -93,14 +94,22 @@ public class UserWeixinServiceImpl implements UserWeixinService { |
| 93 | String appid = resources.getAppid(); | 94 | String appid = resources.getAppid(); |
| 94 | String openid = resources.getOpenid(); | 95 | String openid = resources.getOpenid(); |
| 95 | UserWeixin userWeixin = UserWeixinRepository.findFirstByAppidAndOpenid(appid,openid).orElseGet(UserWeixin::new); | 96 | UserWeixin userWeixin = UserWeixinRepository.findFirstByAppidAndOpenid(appid,openid).orElseGet(UserWeixin::new); |
| 96 | ValidationUtil.isNull( userWeixin.getId(),"UserWeixin","id",resources.getId()); | 97 | if (Objects.isNull(userWeixin.getId())) { |
| 98 | this.create(resources); | ||
| 99 | } else { | ||
| 100 | if (Objects.isNull(userWeixin.getMemberId())) { | ||
| 101 | String memberCode = resources.getMemberCode(); | ||
| 102 | MemberDTO memberDTO = this.memberService.getByCode(memberCode); | ||
| 103 | resources.setMemberId(memberDTO.getId()); | ||
| 104 | } | ||
| 97 | resources.setId(userWeixin.getId()); | 105 | resources.setId(userWeixin.getId()); |
| 98 | resources.setMemberId(userWeixin.getMemberId()); | ||
| 99 | BeanUtils.copyProperties(resources,userWeixin); | 106 | BeanUtils.copyProperties(resources,userWeixin); |
| 100 | log.info("update ==>>userWeixin ==>> resources ==>> [{}]",resources); | 107 | log.info("update ==>>userWeixin ==>> resources ==>> [{}]",resources); |
| 101 | UserWeixinRepository.save(resources); | 108 | UserWeixinRepository.save(resources); |
| 102 | } | 109 | } |
| 103 | 110 | ||
| 111 | } | ||
| 112 | |||
| 104 | @Override | 113 | @Override |
| 105 | @Transactional(rollbackFor = Exception.class) | 114 | @Transactional(rollbackFor = Exception.class) |
| 106 | public void delete(Long id) { | 115 | public void delete(Long id) { | ... | ... |
| ... | @@ -28,11 +28,11 @@ public class UcGatewayEventConsumer { | ... | @@ -28,11 +28,11 @@ public class UcGatewayEventConsumer { |
| 28 | * @author Hongyan Wang | 28 | * @author Hongyan Wang |
| 29 | * @date 2021/9/7 11:26 上午 | 29 | * @date 2021/9/7 11:26 上午 |
| 30 | */ | 30 | */ |
| 31 | @RabbitHandler | 31 | /*@RabbitHandler |
| 32 | @RabbitListener(bindings = { | 32 | @RabbitListener(bindings = { |
| 33 | @QueueBinding(value = @Queue(value = RabbitMqConfig.UC_ROUTE_KEY_DIRECT_EVENT_AAA), | 33 | @QueueBinding(value = @Queue(value = RabbitMqConfig.UC_ROUTE_KEY_DIRECT_EVENT_AAA), |
| 34 | exchange = @Exchange(value = ExchangeTypes.DIRECT)) | 34 | exchange = @Exchange(value = ExchangeTypes.DIRECT)) |
| 35 | }, containerFactory = "managementRabbitListenerContainerFactory") | 35 | }, containerFactory = "managementRabbitListenerContainerFactory")*/ |
| 36 | public void ucEventConsumer(String content) { | 36 | public void ucEventConsumer(String content) { |
| 37 | log.info(" receive dataSync msg , content is : {} ", content); | 37 | log.info(" receive dataSync msg , content is : {} ", content); |
| 38 | DataSyncMsg dataSyncMsg = this.parseContent(content); | 38 | DataSyncMsg dataSyncMsg = this.parseContent(content); | ... | ... |
| ... | @@ -32,11 +32,11 @@ public class WeiXinEventConsumer { | ... | @@ -32,11 +32,11 @@ public class WeiXinEventConsumer { |
| 32 | * @description 删除用户收藏记录 | 32 | * @description 删除用户收藏记录 |
| 33 | * @param content 消息内容 | 33 | * @param content 消息内容 |
| 34 | */ | 34 | */ |
| 35 | @RabbitHandler | 35 | /*@RabbitHandler |
| 36 | @RabbitListener(bindings = { | 36 | @RabbitListener(bindings = { |
| 37 | @QueueBinding(value = @Queue(value = RabbitMqConfig.COLLECTION_DELETE_QUEUE), | 37 | @QueueBinding(value = @Queue(value = RabbitMqConfig.COLLECTION_DELETE_QUEUE), |
| 38 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}, | 38 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}, |
| 39 | containerFactory = "managementRabbitListenerContainerFactory") | 39 | containerFactory = "managementRabbitListenerContainerFactory")*/ |
| 40 | public void deleteCollection(String content) { | 40 | public void deleteCollection(String content) { |
| 41 | try { | 41 | try { |
| 42 | log.info("receive UserCollection delete message, content {}", content); | 42 | log.info("receive UserCollection delete message, content {}", content); |
| ... | @@ -50,11 +50,11 @@ public class WeiXinEventConsumer { | ... | @@ -50,11 +50,11 @@ public class WeiXinEventConsumer { |
| 50 | * @description 删除全部收藏记录 | 50 | * @description 删除全部收藏记录 |
| 51 | * @param content 消息内容 | 51 | * @param content 消息内容 |
| 52 | */ | 52 | */ |
| 53 | @RabbitHandler | 53 | /*@RabbitHandler |
| 54 | @RabbitListener(bindings = { | 54 | @RabbitListener(bindings = { |
| 55 | @QueueBinding(value = @Queue(value = RabbitMqConfig.COLLECTION_DELETE_ALL_QUEUE), | 55 | @QueueBinding(value = @Queue(value = RabbitMqConfig.COLLECTION_DELETE_ALL_QUEUE), |
| 56 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}, | 56 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}, |
| 57 | containerFactory = "managementRabbitListenerContainerFactory") | 57 | containerFactory = "managementRabbitListenerContainerFactory")*/ |
| 58 | @Transactional | 58 | @Transactional |
| 59 | public void deleteAllCollection(String content) { | 59 | public void deleteAllCollection(String content) { |
| 60 | try { | 60 | try { |
| ... | @@ -70,11 +70,11 @@ public class WeiXinEventConsumer { | ... | @@ -70,11 +70,11 @@ public class WeiXinEventConsumer { |
| 70 | * @param content 消息内容 | 70 | * @param content 消息内容 |
| 71 | * @description 获取公众号带参二维码 | 71 | * @description 获取公众号带参二维码 |
| 72 | */ | 72 | */ |
| 73 | @RabbitHandler | 73 | /*@RabbitHandler |
| 74 | @RabbitListener(bindings = { | 74 | @RabbitListener(bindings = { |
| 75 | @QueueBinding(value = @Queue(value = RabbitMqConfig.GET_QR_CODE_QUEUE), | 75 | @QueueBinding(value = @Queue(value = RabbitMqConfig.GET_QR_CODE_QUEUE), |
| 76 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}, | 76 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}, |
| 77 | containerFactory = "managementRabbitListenerContainerFactory") | 77 | containerFactory = "managementRabbitListenerContainerFactory")*/ |
| 78 | public void getQrCode(String content) { | 78 | public void getQrCode(String content) { |
| 79 | try { | 79 | try { |
| 80 | log.info("receive get qrCode message, content {}", content); | 80 | log.info("receive get qrCode message, content {}", content); |
| ... | @@ -130,11 +130,11 @@ public class WeiXinEventConsumer { | ... | @@ -130,11 +130,11 @@ public class WeiXinEventConsumer { |
| 130 | * } | 130 | * } |
| 131 | * @param content | 131 | * @param content |
| 132 | */ | 132 | */ |
| 133 | @RabbitHandler | 133 | /*@RabbitHandler |
| 134 | @RabbitListener(bindings = { | 134 | @RabbitListener(bindings = { |
| 135 | @QueueBinding(value = @Queue(value = RabbitMqConfig.WEIXIN_SUBORUNSUB_QUEUE), | 135 | @QueueBinding(value = @Queue(value = RabbitMqConfig.WEIXIN_SUBORUNSUB_QUEUE), |
| 136 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}, | 136 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}, |
| 137 | containerFactory = "managementRabbitListenerContainerFactory") | 137 | containerFactory = "managementRabbitListenerContainerFactory")*/ |
| 138 | @Transactional | 138 | @Transactional |
| 139 | public void subOrUnSubEvent(String content) { | 139 | public void subOrUnSubEvent(String content) { |
| 140 | try { | 140 | try { |
| ... | @@ -177,11 +177,11 @@ public class WeiXinEventConsumer { | ... | @@ -177,11 +177,11 @@ public class WeiXinEventConsumer { |
| 177 | * @description 添加收藏记录 | 177 | * @description 添加收藏记录 |
| 178 | * @param content 消息内容 | 178 | * @param content 消息内容 |
| 179 | */ | 179 | */ |
| 180 | @RabbitHandler | 180 | /* @RabbitHandler |
| 181 | @RabbitListener(bindings = { | 181 | @RabbitListener(bindings = { |
| 182 | @QueueBinding(value = @Queue(value = RabbitMqConfig.COLLECTION_ADD_QUEUE), | 182 | @QueueBinding(value = @Queue(value = RabbitMqConfig.COLLECTION_ADD_QUEUE), |
| 183 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}, | 183 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}, |
| 184 | containerFactory = "managementRabbitListenerContainerFactory") | 184 | containerFactory = "managementRabbitListenerContainerFactory")*/ |
| 185 | @Transactional | 185 | @Transactional |
| 186 | public void addCollection(String content) { | 186 | public void addCollection(String content) { |
| 187 | try { | 187 | try { | ... | ... |
src/main/resources/rebel.xml
0 → 100644
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | |||
| 3 | <!-- | ||
| 4 | This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project. | ||
| 5 | Refer to https://manuals.jrebel.com/jrebel/standalone/config.html for more information. | ||
| 6 | --> | ||
| 7 | <application generated-by="intellij" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_3.xsd"> | ||
| 8 | |||
| 9 | <id>member-engine</id> | ||
| 10 | |||
| 11 | <classpath> | ||
| 12 | <dir name="D:/HanXi/work space/taojinglihua/member-engine/target/classes"> | ||
| 13 | </dir> | ||
| 14 | </classpath> | ||
| 15 | |||
| 16 | </application> |
-
Please register or sign in to post a comment