| | |
| | | dispatchUnitMapper.updateById(update); |
| | | if(Constants.equalsInteger(param.getWorktypeStatus(),Constants.ONE)){ |
| | | //审核通过,修改状态,产生历史版本 |
| | | newVersionData(dispatchUnitMapper.selectById(param.getId()),update); |
| | | newVersionData(dispatchUnitMapper.selectById(param.getId()),update,false); |
| | | //存储操作历史 |
| | | this.saveDuLog(update,Constants.DispatchUnitLogType.WORK_TYPE_AUDIT_PASS,update.getCheckInfo()); |
| | | |
| | |
| | | return 1; |
| | | } |
| | | |
| | | private void newVersionData(DispatchUnit model, DispatchUnit update) { |
| | | private void newVersionData(DispatchUnit model, DispatchUnit update,Boolean flag) { |
| | | DispatchUnit newVersion = new DispatchUnit(); |
| | | if(flag){ |
| | | dispatchUnitMapper.update(null,new UpdateWrapper<DispatchUnit>().lambda() |
| | | .set(DispatchUnit::getDataType,Constants.ZERO) |
| | | .eq(DispatchUnit::getIsdeleted,Constants.ZERO) |
| | | .eq(DispatchUnit::getBaseId,model.getId())); |
| | | DispatchUnit newVersion = new DispatchUnit(); |
| | | BeanUtils.copyProperties(model, newVersion); |
| | | newVersion.setWorktypeStatus(Constants.ONE); |
| | | newVersion.setCheckDate(update.getEditDate()); |
| | |
| | | newVersion.setCheckInfo(update.getCheckInfo()); |
| | | newVersion.setCreateDate(update.getCreateDate()); |
| | | newVersion.setCreator(update.getEditor()); |
| | | newVersion.setBaseId(model.getBaseId()); |
| | | newVersion.setBaseId(model.getId()); |
| | | newVersion.setDataType(Constants.TWO); |
| | | dispatchUnitMapper.insert(newVersion); |
| | | |
| | | }else{ |
| | | 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")); |
| | | } |
| | | if(Objects.isNull(newVersion)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到派遣单位最新版本"); |
| | | } |
| | | List<DuWorktype> newWorktypes = new ArrayList<>(); |
| | | List<DuSolution> solutions = duSolutionMapper.selectList(new QueryWrapper<DuSolution>().lambda() |
| | | .eq(DuSolution::getIsdeleted,Constants.ZERO) |
| | |
| | | .eq(DuSolution::getStatus,Constants.ZERO) |
| | | .eq(DuSolution::getDispatchUnitId,model.getId()) |
| | | ); |
| | | |
| | | |
| | | |
| | | if(solutions == null || solutions.size() ==0){ |
| | |
| | | DispatchUnit dispatchUnit = dispatchUnitMapper.selectById(param.getId()); |
| | | if(Constants.equalsInteger(param.getUnitStatus(),Constants.ONE)){ |
| | | //审核通过,修改状态,产生历史版本 |
| | | newVersionData(dispatchUnit,update); |
| | | newVersionData(dispatchUnit,update,true); |
| | | //存储操作历史 |
| | | this.saveDuLog(dispatchUnit,Constants.DispatchUnitLogType.AUDIT_PASS,update.getCheckInfo()); |
| | | }else{ |
| | |
| | | } |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | DispatchUnit dispatchUnit = this.dispatchUnitMapper.selectById(saveDispatchUnitDTO.getId()); |
| | | if(!dispatchUnit.getUnitStatus().equals(Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"派遣单位未审批通过,无法进行该操作"); |
| | | } |
| | | dispatchUnit.setWorktypeStatus(Constants.ZERO); |
| | | dispatchUnit.setEditDate(new Date()); |
| | | dispatchUnit.setEditor(loginUserInfo.getId()); |