From 9d35ba657fa5e3add766405d76e3ff8c4dcd4ad4 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 04 七月 2020 15:38:00 +0800 Subject: [PATCH] 多系统兼容优化 --- fanli/src/main/java/com/yeshi/fanli/service/impl/order/msg/UserOrderMsgNotificationServiceImpl.java | 260 +++++++++++++++++++++++++++------------------------- 1 files changed, 135 insertions(+), 125 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/msg/UserOrderMsgNotificationServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/msg/UserOrderMsgNotificationServiceImpl.java index f0380c1..9f35f67 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/msg/UserOrderMsgNotificationServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/msg/UserOrderMsgNotificationServiceImpl.java @@ -5,6 +5,8 @@ import javax.annotation.Resource; +import com.yeshi.fanli.entity.SystemEnum; +import com.yeshi.fanli.service.inter.user.UserInfoService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -22,143 +24,151 @@ @Service public class UserOrderMsgNotificationServiceImpl implements UserOrderMsgNotificationService { - @Resource - private MsgOrderDetailService msgOrderDetailService; + @Resource + private MsgOrderDetailService msgOrderDetailService; - @Resource - private PushService pushService; - + @Resource + private PushService pushService; - @Override - public void orderFanLiStatistic(Long uid, String orderId, int orderType, BigDecimal payMoney, BigDecimal money, - int goodsCount, int orderState, Date downTime) { - // 鏄惁閫氱煡 - boolean needNotify = (payMoney != null && payMoney.compareTo(new BigDecimal(0)) > 0) ? true : false; - // 淇濆瓨娑堟伅鏄庣粏娑堟伅 - addOrderStatistics(uid, orderId, orderType, Constant.TYPE_REBATE, goodsCount, payMoney, money, downTime, null, needNotify); - - if (needNotify) { - PushContentDTO dto = PushMsgFactory.createFanLiOrderStatisticed(orderType, orderId, money); - try { - pushService.pushZNX(uid, dto.getTitle(), dto.getContent(), null, null); - } catch (NumberFormatException e) { - e.printStackTrace(); - } catch (PushException e) { - e.printStackTrace(); - } - } - } + @Resource + private UserInfoService userInfoService; - @Override - public void orderShareStatistic(Long uid, String orderId, int orderType, BigDecimal payMoney, BigDecimal money, - int goodsCount, int orderState, Date downTime) { - // 鏄惁閫氱煡 - boolean needNotify = (payMoney != null && payMoney.compareTo(new BigDecimal(0)) > 0) ? true : false; - // 淇濆瓨娑堟伅鏄庣粏娑堟伅 - addOrderStatistics(uid, orderId, orderType, Constant.TYPE_SHAER, goodsCount, payMoney, money, downTime, null, needNotify); - + @Override + public void orderFanLiStatistic(Long uid, String orderId, int orderType, BigDecimal payMoney, BigDecimal money, + int goodsCount, int orderState, Date downTime) { + // 鏄惁閫氱煡 + boolean needNotify = (payMoney != null && payMoney.compareTo(new BigDecimal(0)) > 0) ? true : false; + // 淇濆瓨娑堟伅鏄庣粏娑堟伅 + addOrderStatistics(uid, orderId, orderType, Constant.TYPE_REBATE, goodsCount, payMoney, money, downTime, null, needNotify); - PushContentDTO dto = PushMsgFactory.createShareOrderStatisticed(orderType, orderId, money); - try { - pushService.pushZNX(uid, dto.getTitle(), dto.getContent(), null, null); - } catch (NumberFormatException e) { - e.printStackTrace(); - } catch (PushException e) { - e.printStackTrace(); - } + SystemEnum system = userInfoService.getUserSystem(uid); - } + if (needNotify) { + PushContentDTO dto = PushMsgFactory.createFanLiOrderStatisticed(orderType, orderId, money); + try { + pushService.pushZNX(uid, dto.getTitle(), dto.getContent(), null, null, system); + } catch (NumberFormatException e) { + e.printStackTrace(); + } catch (PushException e) { + e.printStackTrace(); + } + } + } - @Override - public void orderInviteStatistic(Long uid, String orderId, int orderType, BigDecimal payMoney, BigDecimal money, - BigDecimal subsidy, int goodsCount, int orderState, Date downTime) { - BigDecimal totalMoney = new BigDecimal(0); - if (money != null) { - totalMoney = totalMoney.add(money); - } - if (subsidy != null) { - totalMoney = totalMoney.add(subsidy); - } - - if (totalMoney.compareTo(new BigDecimal(0)) <= 0) { - return; - } - - // 淇濆瓨娑堟伅鏄庣粏娑堟伅 - addOrderStatistics(uid, orderId, orderType, Constant.TYPE_INVITE, goodsCount, payMoney, totalMoney, downTime, null, true); + @Override + public void orderShareStatistic(Long uid, String orderId, int orderType, BigDecimal payMoney, BigDecimal money, + int goodsCount, int orderState, Date downTime) { + // 鏄惁閫氱煡 + boolean needNotify = (payMoney != null && payMoney.compareTo(new BigDecimal(0)) > 0) ? true : false; + // 淇濆瓨娑堟伅鏄庣粏娑堟伅 + addOrderStatistics(uid, orderId, orderType, Constant.TYPE_SHAER, goodsCount, payMoney, money, downTime, null, needNotify); - PushContentDTO dto = PushMsgFactory.createInviteOrderStatisticed(orderType, orderId, money); - try { - pushService.pushZNX(uid, dto.getTitle(), dto.getContent(), null, null); - } catch (NumberFormatException e) { - e.printStackTrace(); - } catch (PushException e) { - e.printStackTrace(); - } - } - - /** - * 鍒涘缓璁㈠崟琚粺璁℃秷鎭� - * @param uid - * @param orderId 璁㈠崟鍙� - * @param source 璁㈠崟鏉ユ簮锛氭窐瀹濄�佷含涓溿�佸ぉ鐚� - * @param type 璁㈠崟绫诲瀷锛氳嚜璐�佸垎浜�佸洟闃� - * @param goodsCount 鍟嗗搧鏁伴噺 - * @param payMoney 浠樻閲戦 - * @param money 杩斿埄閲戦 - * @param downTime 涓嬪崟鏃堕棿 - * @param beiZhu 澶囨敞淇℃伅 - 闈炲繀濉� - * @return - */ - @Transactional(rollbackFor = Exception.class) - private void addOrderStatistics(Long uid, String orderId, int source, int type, int goodsCount, - BigDecimal payMoney, BigDecimal money, Date downTime, String beiZhu, boolean needNotify) { - try { - MsgOrderDetail detail = MsgOrderDetailFactory.createOrderStatistics(uid, orderId, source, type, goodsCount, payMoney, money, downTime, beiZhu); - // 娑堟伅 - msgOrderDetailService.addMsgOrderDetail(detail, needNotify); - } catch (MsgOrderDetailException e) { - e.printStackTrace(); - } - } + SystemEnum system = userInfoService.getUserSystem(uid); + + PushContentDTO dto = PushMsgFactory.createShareOrderStatisticed(orderType, orderId, money); + try { + pushService.pushZNX(uid, dto.getTitle(), dto.getContent(), null, null, system); + } catch (NumberFormatException e) { + e.printStackTrace(); + } catch (PushException e) { + e.printStackTrace(); + } + + } + @Override + public void orderInviteStatistic(Long uid, String orderId, int orderType, BigDecimal payMoney, BigDecimal money, + BigDecimal subsidy, int goodsCount, int orderState, Date downTime) { + BigDecimal totalMoney = new BigDecimal(0); + if (money != null) { + totalMoney = totalMoney.add(money); + } + if (subsidy != null) { + totalMoney = totalMoney.add(subsidy); + } - @Override - @Transactional(rollbackFor = Exception.class) - public void orderFoundSuccess(Long uid, String orderId, int orderSource, int type, BigDecimal payMoney, BigDecimal money, int goodsCount, Date submitTime) { - try { - MsgOrderDetail detail = MsgOrderDetailFactory.createOrderFoundSuccess(uid, orderId, orderSource, type, goodsCount, payMoney, money, submitTime, ""); - // 娑堟伅 - msgOrderDetailService.addMsgOrderDetail(detail, true); - } catch (MsgOrderDetailException e) { - e.printStackTrace(); - } - - } + if (totalMoney.compareTo(new BigDecimal(0)) <= 0) { + return; + } - @Override - public void orderFoundFail(Long uid, String orderId) { - try { - MsgOrderDetail detail = MsgOrderDetailFactory.createOrderFoundFail(uid, orderId, ""); - // 娑堟伅 - msgOrderDetailService.addMsgOrderDetail(detail, true); - } catch (MsgOrderDetailException e) { - e.printStackTrace(); - } - } + SystemEnum system = userInfoService.getUserSystem(uid); - - @Override - public void orderInvalidToBusinessRunning(Long uid, String orderId, int orderSource, int type) { - try { - MsgOrderDetail detail = MsgOrderDetailFactory.orderInvalidToBusinessRunning(uid, orderId, orderSource, type); - // 娑堟伅 - msgOrderDetailService.addMsgOrderDetail(detail, true); - } catch (MsgOrderDetailException e) { - e.printStackTrace(); - } - } + // 淇濆瓨娑堟伅鏄庣粏娑堟伅 + addOrderStatistics(uid, orderId, orderType, Constant.TYPE_INVITE, goodsCount, payMoney, totalMoney, downTime, null, true); + + PushContentDTO dto = PushMsgFactory.createInviteOrderStatisticed(orderType, orderId, money); + try { + pushService.pushZNX(uid, dto.getTitle(), dto.getContent(), null, null, system); + } catch (NumberFormatException e) { + e.printStackTrace(); + } catch (PushException e) { + e.printStackTrace(); + } + } + + /** + * 鍒涘缓璁㈠崟琚粺璁℃秷鎭� + * + * @param uid + * @param orderId 璁㈠崟鍙� + * @param source 璁㈠崟鏉ユ簮锛氭窐瀹濄�佷含涓溿�佸ぉ鐚� + * @param type 璁㈠崟绫诲瀷锛氳嚜璐�佸垎浜�佸洟闃� + * @param goodsCount 鍟嗗搧鏁伴噺 + * @param payMoney 浠樻閲戦 + * @param money 杩斿埄閲戦 + * @param downTime 涓嬪崟鏃堕棿 + * @param beiZhu 澶囨敞淇℃伅 - 闈炲繀濉� + * @return + */ + @Transactional(rollbackFor = Exception.class) + private void addOrderStatistics(Long uid, String orderId, int source, int type, int goodsCount, + BigDecimal payMoney, BigDecimal money, Date downTime, String beiZhu, boolean needNotify) { + try { + MsgOrderDetail detail = MsgOrderDetailFactory.createOrderStatistics(uid, orderId, source, type, goodsCount, payMoney, money, downTime, beiZhu); + // 娑堟伅 + msgOrderDetailService.addMsgOrderDetail(detail, needNotify); + } catch (MsgOrderDetailException e) { + e.printStackTrace(); + } + } + + + @Override + @Transactional(rollbackFor = Exception.class) + public void orderFoundSuccess(Long uid, String orderId, int orderSource, int type, BigDecimal payMoney, BigDecimal money, int goodsCount, Date submitTime) { + try { + MsgOrderDetail detail = MsgOrderDetailFactory.createOrderFoundSuccess(uid, orderId, orderSource, type, goodsCount, payMoney, money, submitTime, ""); + // 娑堟伅 + msgOrderDetailService.addMsgOrderDetail(detail, true); + } catch (MsgOrderDetailException e) { + e.printStackTrace(); + } + + } + + @Override + public void orderFoundFail(Long uid, String orderId) { + try { + MsgOrderDetail detail = MsgOrderDetailFactory.createOrderFoundFail(uid, orderId, ""); + // 娑堟伅 + msgOrderDetailService.addMsgOrderDetail(detail, true); + } catch (MsgOrderDetailException e) { + e.printStackTrace(); + } + } + + + @Override + public void orderInvalidToBusinessRunning(Long uid, String orderId, int orderSource, int type) { + try { + MsgOrderDetail detail = MsgOrderDetailFactory.orderInvalidToBusinessRunning(uid, orderId, orderSource, type); + // 娑堟伅 + msgOrderDetailService.addMsgOrderDetail(detail, true); + } catch (MsgOrderDetailException e) { + e.printStackTrace(); + } + } } -- Gitblit v1.8.0