Parcourir la source

fix 发送更换车票模板消息空指针

zoujiajian il y a 3 ans
Parent
commit
ec5e4f1e81

+ 2 - 0
netflix-dao/src/main/java/com/cyksj/mapper/GroupsRelationMapper.java

@@ -28,4 +28,6 @@ public interface GroupsRelationMapper extends BaseMapper<GroupsRelation> {
 	Long selectSimilarExpiredRelation(@Param("skuId") Long skuId, @Param("minExpiryTime") DateTime minExpiryTime);
 
 	List<GroupsRelationView> selectRelationByGoodsId(@Param("goodsId") Long goodsId, @Param("userId") Long userId);
+
+	GroupsRelationView getGroupRelationViewByUserIdAndRelationId(@Param("userId") Long userId, @Param("relationId") Long relationId);
 }

+ 12 - 0
netflix-dao/src/main/resources/mapper/GroupRelationMapper.xml

@@ -64,4 +64,16 @@
           and gt.status = 'validity'
           and gr.status = 'validity'
     </select>
+
+    <select id="getGroupRelationViewByUserIdAndRelationId"
+            resultType="com.cyksj.model.manage.views.GroupsRelationView">
+        select gr.*,
+               a.account as tripsAccount,
+               g.title
+        from groups_relation gr
+                 left join groups_trips gt on gt.id = gr.groups_id
+                 left join account a on a.id = gt.account_id
+                 left join goods_don g on g.id = a.goods_id
+        where gr.id = #{relationId} and gr.user_id = #{userId}
+    </select>
 </mapper>

+ 4 - 4
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -1864,15 +1864,15 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			//保存更换车票记录
 			saveChangeTicketRecord(preStartTime, preExpiryTime, preRelationId, userId, preSkuId, orderId, num, afterSku, afterRelation.getId());
 
-			GroupsRelationView groupsRelationView = beanSearcher.searchFirst(GroupsRelationView.class, MapUtils.builder().field(GroupsRelationView::getUserId, userId)
-					.field(GroupsRelationView::getId, afterRelation.getId()).build());
+			GroupsRelationView groupsRelationView = groupsRelationMapper.getGroupRelationViewByUserIdAndRelationId(userId, afterRelation.getId());
+
 			try {
 				//发放更换车票模板消息通知用户
-				log.info("发送更换用户:{}车票:{}通知消息start=====>", userId, afterRelation.getId());
+				log.info("发送更换用户:{}车票:{}通知消息start=====>", userId, groupsRelationView.getId());
 				templateCommonService.sendUpdateAccountMsgNotify(groupsRelationView);
 				log.info("发送更换用户车票通知消息end=====>");
 			} catch (Exception e) {
-				log.error("发送更换用户:{}车票:{}通知消息错误e:{}", userId, afterRelation.getId(), StringUtil.getErrorText(e));
+				log.error("发送更换用户:{}车票:{}通知消息错误e:{}", userId, groupsRelationView.getId(), StringUtil.getErrorText(e));
 			}
 		} else {
 			//之前的车票已被清除  加续费时间加到新的车票上