admin
2020-05-06 24a8d17e007545f7426c48352109aa1a9c6587ee
fanli/src/main/java/com/yeshi/fanli/service/impl/money/msg/MsgMoneyDetailServiceImpl.java
@@ -16,6 +16,7 @@
import com.yeshi.fanli.service.inter.msg.MsgExtraService;
import com.yeshi.fanli.service.inter.msg.UserMsgReadStateService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
@Service
public class MsgMoneyDetailServiceImpl implements MsgMoneyDetailService {
@@ -31,10 +32,10 @@
   @Override
   public void addMsgMoneyDetail(MsgMoneyDetail detail) throws MsgMoneyDetailException {
      if (detail == null)
         throw new MsgMoneyDetailException(1, "消息为空");
      if (detail == null || detail.getUser() == null || StringUtil.isNullOrEmpty(detail.getExtraInfo()))
         throw new MsgMoneyDetailException(1, "消息信息不全");
      if (detail.getMsgType() == MsgTypeMoneyTypeEnum.extract) {
         if (detail.getExtract() == null || detail.getUser() == null)
         if (detail.getExtract() == null)
            throw new MsgMoneyDetailException(2, "消息信息不全");
         MsgMoneyDetail msg = msgMoneyDetailMapper.selectBySourceIdAndMsgType(detail.getExtract().getId(),
               MsgTypeMoneyTypeEnum.extract);
@@ -51,10 +52,10 @@
            update.setRead(false);
            update.setStateDesc(detail.getStateDesc());
            msgMoneyDetailMapper.updateByPrimaryKeySelective(update);
            msgExtraService.updateMsgExtra(detail.getId(), detail.getExtraInfo(), MsgExtra.MSG_TYPE_MONEY);
            msgExtraService.addMsgExtra(update.getId(), detail.getExtraInfo(), MsgExtra.MSG_TYPE_MONEY);
         }
      } else if (detail.getMsgType() == MsgTypeMoneyTypeEnum.extractValid) {
         if (detail.getAlipayAccountValid() == null || detail.getUser() == null)
         if (detail.getAlipayAccountValid() == null)
            throw new MsgMoneyDetailException(2, "消息信息不全");
         MsgMoneyDetail msg = msgMoneyDetailMapper.selectBySourceIdAndMsgType(detail.getAlipayAccountValid().getId(),
               MsgTypeMoneyTypeEnum.extractValid);
@@ -71,15 +72,14 @@
            update.setRead(false);
            update.setStateDesc(detail.getStateDesc());
            msgMoneyDetailMapper.updateByPrimaryKeySelective(update);
            msgExtraService.updateMsgExtra(detail.getId(), detail.getExtraInfo(), MsgExtra.MSG_TYPE_MONEY);
            msgExtraService.addMsgExtra(update.getId(), detail.getExtraInfo(), MsgExtra.MSG_TYPE_MONEY);
         }
      }  else {
         if(detail.getUser() == null)
            throw new MsgMoneyDetailException(2, "消息信息不全");
         detail.setCreateTime(new Date());
         detail.setUpdateTime(new Date());
         detail.setRead(false);
         msgMoneyDetailMapper.insertSelective(detail);
         msgExtraService.addMsgExtra(detail.getId(), detail.getExtraInfo(), MsgExtra.MSG_TYPE_MONEY);
      }
      userMsgReadStateService.addMoneyMsgUnReadCount(detail.getUser().getId(), 1);
   }