rk
2025-09-28 2304d7b140c5c5b4bf3a83f9ced8bff37d20c42e
server/services/src/main/java/com/doumee/service/business/impl/IdentityInfoServiceImpl.java
@@ -11,12 +11,14 @@
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.CategoryMapper;
import com.doumee.dao.business.IdentityInfoMapper;
import com.doumee.dao.business.MemberMapper;
import com.doumee.dao.business.model.IdentityInfo;
import com.doumee.dao.business.model.Member;
import com.doumee.dao.dto.AuditDTO;
import com.doumee.dao.system.model.SystemUser;
import com.doumee.service.business.AliSmsService;
import com.doumee.service.business.IdentityInfoService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -51,7 +53,11 @@
    @Autowired
    private MemberMapper memberMapper;
    @Autowired
    private AliSmsService aliSmsService;
    @Autowired
    private SystemDictDataBiz systemDictDataBiz;
    @Autowired
    private CategoryMapper categoryMapper;
    @Override
    @Transactional(rollbackFor = {BusinessException.class,Exception.class})
@@ -73,9 +79,18 @@
        ){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        if(Objects.nonNull(identityInfo.getId())){
            this.updateById(identityInfo);
        }else{
            IdentityInfo model = identityInfoMapper.selectOne(new QueryWrapper<IdentityInfo>().lambda()
                    .eq(IdentityInfo::getMemberId,identityInfo.getMemberId())
                    .eq(IdentityInfo::getType,identityInfo.getType())
                    .last("limit 1")
            );
            if(Objects.nonNull(model)){
                identityInfo.setId(model.getId());
                this.updateById(identityInfo);
                return identityInfo.getId();
            }
            //查询用户是否已存在当前身份
            if(identityInfoMapper.selectCount(new QueryWrapper<IdentityInfo>().lambda()
                    .eq(IdentityInfo::getDeleted,Constants.ZERO)
@@ -94,7 +109,6 @@
                    .set(Constants.equalsInteger(identityInfo.getType(),Constants.ONE),Member::getDriverIdentity,Constants.ONE)
                    .set(Constants.equalsInteger(identityInfo.getType(),Constants.TWO),Member::getChefIdentity,Constants.ONE)
                    .eq(Member::getId,identityInfo.getMemberId()));
        }
        return identityInfo.getId();
    }
@@ -148,6 +162,7 @@
        if(!Constants.equalsInteger(model.getAuditStatus(),Constants.THREE)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"当前状态无法进行该操作");
        }
        identityInfo.setAuditRemark("");
        identityInfo.setUpdateTime(new Date());
        identityInfo.setAuditStatus(Constants.ONE);
        identityInfoMapper.updateById(identityInfo);
@@ -459,22 +474,22 @@
        memberMapper.update(new UpdateWrapper<Member>().lambda()
                .set(Member::getUpdateUser,user.getId())
                .set(Member::getUpdateTime,date)
                .set(Constants.equalsInteger(auditDTO.getAuditStatus(),Constants.ZERO),Member::getAutoReceiveStatus,Constants.ONE)
                .set(Constants.equalsInteger(identityInfo.getType(),Constants.ZERO),Member::getWorkerIdentity, auditDTO.getAuditStatus() )
                .set(Constants.equalsInteger(identityInfo.getType(),Constants.ONE),Member::getDriverIdentity , auditDTO.getAuditStatus() )
                .set(Constants.equalsInteger(identityInfo.getType(),Constants.TWO),Member::getChefIdentity , auditDTO.getAuditStatus() )
                .eq(Member::getId,identityInfo.getMemberId())
        );
        try{
            //发送微信通知
            if(StringUtils.isNotBlank(member.getOpenid())){
                sendWxMessage.identityInfoMessage(member.getOpenid(),identityInfo);
            }
        }catch (WxErrorException wxErrorException){
        //发送微信通知
        if(StringUtils.isNotBlank(member.getOpenid())){
            sendWxMessage.identityInfoMessage(member.getOpenid(),identityInfo);
        }
        //短信通知
        aliSmsService.businessSendSms(Constants.smsContent.authentication.getKey(),
                member.getTelephone(),null,null,
                identityInfo,categoryMapper);
    }
}