admin
2019-07-11 3824cbcaec6e6c67418d5280a53e9c2fedeef6f9
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOrderDetailServiceImpl.java
@@ -12,6 +12,7 @@
import com.yeshi.fanli.entity.order.CommonOrder;
import com.yeshi.fanli.exception.msg.MsgOrderDetailException;
import com.yeshi.fanli.service.inter.msg.MsgOrderDetailService;
import com.yeshi.fanli.service.inter.msg.UserMsgReadStateService;
import com.yeshi.fanli.util.Constant;
@Service
@@ -20,12 +21,15 @@
   @Resource
   private MsgOrderDetailMapper msgOrderDetailMapper;
   @Resource
   private UserMsgReadStateService userMsgReadStateService;
   @Override
   public void addMsgOrderDetail(MsgOrderDetail detail) throws MsgOrderDetailException {
   public void addMsgOrderDetail(MsgOrderDetail detail, boolean needNotify) throws MsgOrderDetailException {
      if (detail == null)
         throw new MsgOrderDetailException(1, "消息为空");
      if (detail.getOrderId() == null || detail.getGoodsCount() == null || detail.getType() == null
            || detail.getState() == null || detail.getPayMoney() == null || detail.getUser() == null)
      if (detail.getOrderId() == null || detail.getType() == null || detail.getState() == null
            || detail.getUser() == null)
         throw new MsgOrderDetailException(2, "消息不完整");
      MsgOrderDetail old = msgOrderDetailMapper.selectByUidAndOrderId(detail.getUser().getId(), detail.getOrderId());
      if (old == null) {
@@ -44,6 +48,8 @@
         update.setBeiZhu(detail.getBeiZhu());
         msgOrderDetailMapper.updateByPrimaryKeySelective(update);
      }
      if (needNotify)
         userMsgReadStateService.addOrderMsgUnReadCount(detail.getUser().getId(), 1);
   }
   @Override
@@ -62,7 +68,7 @@
   }
   @Override
   public void updateMsgOrderDetail(MsgOrderDetail detail) throws MsgOrderDetailException {
   public void updateMsgOrderDetail(MsgOrderDetail detail, boolean needNotify) throws MsgOrderDetailException {
      if (detail == null)
         throw new MsgOrderDetailException(1, "消息为空");
      if (detail.getOrderId() == null || detail.getState() == null || detail.getUser() == null)
@@ -76,12 +82,14 @@
         return;
      MsgOrderDetail update = new MsgOrderDetail();
      update.setId(detail.getId());
      update.setId(msg.getId());
      update.setHongBaoMoney(detail.getHongBaoMoney());
      update.setPayMoney(detail.getPayMoney());
      if (detail.getState().intValue() != msg.getState()) {
         update.setState(detail.getState());
         update.setUpdateTime(new Date());
//         update.setUpdateTime(new Date());
         if (needNotify)
            userMsgReadStateService.addOrderMsgUnReadCount(detail.getUser().getId(), 1);
      }
      msgOrderDetailMapper.updateByPrimaryKeySelective(update);
   }