|  |  |  | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private MemberMapper memberMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private AliSmsService aliSmsService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemDictDataBiz systemDictDataBiz; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private CategoryMapper categoryMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | @Transactional(rollbackFor = {BusinessException.class,Exception.class}) | 
|---|
|  |  |  | 
|---|
|  |  |  | ){ | 
|---|
|  |  |  | 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) | 
|---|
|  |  |  | 
|---|
|  |  |  | .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(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|