k94314517
2024-05-24 df59cad917c6db1db3b36a23f4b3e7be510e9ed0
server/service/src/main/java/com/doumee/service/business/impl/DispatchUnitServiceImpl.java
@@ -10,10 +10,7 @@
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.*;
import com.doumee.dao.business.dto.*;
import com.doumee.dao.business.join.DispatchUnitJoinMapper;
import com.doumee.dao.business.join.DuLogJoinMapper;
import com.doumee.dao.business.join.DuSolutionJoinMapper;
import com.doumee.dao.business.join.DuWorkTypeJoinMapper;
import com.doumee.dao.business.join.*;
import com.doumee.dao.business.model.*;
import com.doumee.dao.system.model.SystemUser;
import com.doumee.service.business.DispatchUnitService;
@@ -49,6 +46,9 @@
    @Autowired
    private DuSolutionMapper duSolutionMapper;
    @Autowired
    private SolutionWorktypeJoinMapper solutionWorktypeJoinMapper;
    @Autowired
    private DuWorktypeMapper    duWorktypeMapper;
@@ -156,7 +156,8 @@
            newVersion = dispatchUnitMapper.selectOne(new QueryWrapper<DispatchUnit>().lambda()
                    .eq(DispatchUnit::getIsdeleted,Constants.ZERO)
                    .eq(DispatchUnit::getDataType,Constants.TWO)
                    .eq(DispatchUnit::getBaseId,model.getId()).last(" limit 1"));
                    .eq(DispatchUnit::getBaseId,model.getId())
                    .last(" limit 1"));
        }
        if(Objects.isNull(newVersion)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到派遣单位最新版本");
@@ -403,6 +404,7 @@
        }
        if(dispatchUnitMapper.selectCount(new QueryWrapper<DispatchUnit>().lambda()
                .ne(DispatchUnit::getId,saveDispatchUnitDTO.getId())
                .ne(DispatchUnit::getBaseId,saveDispatchUnitDTO.getId())
                .eq(DispatchUnit::getCompanyId,loginUserInfo.getCompanyId())
                .eq(DispatchUnit::getName,saveDispatchUnitDTO.getName())
                .eq(DispatchUnit::getIsdeleted,Constants.ZERO)
@@ -416,6 +418,11 @@
        dispatchUnit.setEditDate(new Date());
        dispatchUnit.setEditor(loginUserInfo.getId());
        dispatchUnitMapper.updateById(dispatchUnit);
        dispatchUnitMapper.update(null,new UpdateWrapper<DispatchUnit>().lambda().set(DispatchUnit::getDataType,Constants.ONE).eq(DispatchUnit::getBaseId,dispatchUnit.getId())
                .eq(DispatchUnit::getDataType,Constants.TWO)
        );
        //存储操作记录
        this.saveDuLog(dispatchUnit,Constants.DispatchUnitLogType.EDIT_UNIT,null);
@@ -506,6 +513,11 @@
                if(Objects.isNull(saveDuWorkTypeDTO.getWorkTypeId())){
                    throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"【"+saveDuSolutionDTO.getSolutionName()+"】该方案下"+saveDuWorkTypeDTO.getWorkTypeName()+"该工种信息异常");
                }
                //验证方案与工种的关系
                if(solutionWorktypeJoinMapper.selectCount(new QueryWrapper<SolutionWorktype>().lambda().eq(SolutionWorktype::getSolutionId,saveDuSolutionDTO.getSolutionId())
                        .eq(SolutionWorktype::getWorktypeId,saveDuWorkTypeDTO.getWorkTypeId()))<=0){
                    throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"【"+saveDuSolutionDTO.getSolutionName()+"】该方案下"+saveDuWorkTypeDTO.getWorkTypeName()+"该工种信息无绑定关系");
                };
                if(duWorktypeMapper.selectCount(new QueryWrapper<DuWorktype>()
                        .lambda().eq(DuWorktype::getDuSolutionId,duSolution.getId())
                        .eq(DuWorktype::getIsdeleted,Constants.ZERO)