| | |
| | | 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) {
|
| | |
| | | update.setBeiZhu(detail.getBeiZhu());
|
| | | msgOrderDetailMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | userMsgReadStateService.addOrderMsgUnReadCount(detail.getUser().getId(), 1);
|
| | | if (needNotify)
|
| | | userMsgReadStateService.addOrderMsgUnReadCount(detail.getUser().getId(), 1);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | }
|
| | |
|
| | | @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)
|
| | |
| | | update.setPayMoney(detail.getPayMoney());
|
| | | if (detail.getState().intValue() != msg.getState()) {
|
| | | update.setState(detail.getState());
|
| | | update.setUpdateTime(new Date());
|
| | | userMsgReadStateService.addOrderMsgUnReadCount(detail.getUser().getId(), 1);
|
| | | // update.setUpdateTime(new Date());
|
| | | if (needNotify)
|
| | | userMsgReadStateService.addOrderMsgUnReadCount(detail.getUser().getId(), 1);
|
| | | }
|
| | | msgOrderDetailMapper.updateByPrimaryKeySelective(update);
|
| | | }
|