jiangping
2025-07-15 da5a270302880181d5c7fe790d9c024215aa9ef1
server/services/src/main/java/com/doumee/service/business/impl/IdentityInfoServiceImpl.java
@@ -6,6 +6,7 @@
import com.doumee.core.constants.Constants;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.LoginUserInfo;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Utils;
@@ -13,6 +14,7 @@
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.IdentityInfoService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -21,9 +23,12 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import io.swagger.annotations.ApiModelProperty;
import nonapi.io.github.classgraph.json.Id;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
@@ -362,8 +367,39 @@
    }
    public void audit(){
    @Override
    @Transactional(rollbackFor = {BusinessException.class,Exception.class})
    public void audit(AuditDTO auditDTO){
        if(Objects.isNull(auditDTO)
        || Objects.isNull(auditDTO.getId())
        || Objects.isNull(auditDTO.getAuditStatus())){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        IdentityInfo identityInfo = identityInfoMapper.selectById(auditDTO.getId());
        if(Objects.nonNull(identityInfo)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
        if(!Constants.equalsInteger(identityInfo.getAuditStatus(),Constants.ONE)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"已审批,请勿重复操作");
        }
        identityInfoMapper.update(new UpdateWrapper<IdentityInfo>().lambda()
                .set(IdentityInfo::getAuditStatus,Constants.equalsInteger(auditDTO.getAuditStatus(),Constants.ZERO)?Constants.TWO:Constants.THREE)
                .set(StringUtils.isNotBlank(auditDTO.getAuditRemark()),IdentityInfo::getAuditRemark,auditDTO.getAuditRemark())
                .set(IdentityInfo::getAuditTime,"now()")
                .set(IdentityInfo::getUpdateUser,user.getId())
                .set(IdentityInfo::getUpdateTime,"now()")
                .eq(IdentityInfo::getId,identityInfo.getId())
        );
        memberMapper.update(new UpdateWrapper<Member>().lambda()
                .set(Member::getUpdateUser,user.getId())
                .set(Member::getUpdateTime,"now()")
                .set(Constants.equalsInteger(identityInfo.getType(),Constants.ZERO),Member::getWorkerIdentity,Constants.equalsInteger(auditDTO.getAuditStatus(),Constants.ZERO)?Constants.TWO:Constants.THREE)
                .set(Constants.equalsInteger(identityInfo.getType(),Constants.ONE),Member::getDriverIdentity,Constants.equalsInteger(auditDTO.getAuditStatus(),Constants.ZERO)?Constants.TWO:Constants.THREE)
                .set(Constants.equalsInteger(identityInfo.getType(),Constants.TWO),Member::getChefIdentity,Constants.equalsInteger(auditDTO.getAuditStatus(),Constants.ZERO)?Constants.TWO:Constants.THREE)
                .eq(Member::getId,identityInfo.getMemberId())
        );
    }