diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/ProjectGroupMapper.xml b/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/ProjectGroupMapper.xml index 4d05bcbee..09d0b8a1d 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/ProjectGroupMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/ProjectGroupMapper.xml @@ -3,18 +3,18 @@ diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/ProjectGroupServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/ProjectGroupServiceImpl.java index 4a5d1e581..79d38b3e9 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/ProjectGroupServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/ProjectGroupServiceImpl.java @@ -163,16 +163,16 @@ public class ProjectGroupServiceImpl extends ServiceImpl epcContractorId.equals(String.valueOf(s)))) { - throw new OpenAlertException("编辑失败,解绑的EPC承包商已被使用!"); - } - } +// for (String constructionUnitId : StrUtil.split(constructionUnitIds, ",")) { +// if (gConstructionUnitIds.stream().noneMatch(constructionUnitId::equals)) { +// throw new OpenAlertException("编辑失败,解绑的施工单位已被装置使用!"); +// } +// } +// for (String epcContractorId : StrUtil.split(epcContractorIds, ",")) { +// if (gEpcContractorIds.stream().noneMatch(s -> epcContractorId.equals(String.valueOf(s)))) { +// throw new OpenAlertException("编辑失败,解绑的EPC承包商已被装置使用!"); +// } +// } } } diff --git a/src/main/java/com/zhgd/xmgl/modules/car/service/impl/CarInfoServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/car/service/impl/CarInfoServiceImpl.java index 9500b984d..7894ca3dd 100644 --- a/src/main/java/com/zhgd/xmgl/modules/car/service/impl/CarInfoServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/car/service/impl/CarInfoServiceImpl.java @@ -261,14 +261,14 @@ public class CarInfoServiceImpl extends ServiceImpl impl .last(Cts.IGNORE_DATA_SCOPE_CONDITION) ).stream().collect(Collectors.toMap(CarType::getCarTypeName, Function.identity(), (o1, o2) -> o1)); for (Map importInfo : list) { - String carModuleType = importInfo.get("车辆类型"); - CarInfo dataCar = numMap.get(importInfo.get("车牌号")); + String carModuleType = importInfo.get("*车辆类型"); + CarInfo dataCar = numMap.get(importInfo.get("*车牌号")); CarInfo excelCar = new CarInfo(); - excelCar.setCarNumber(importInfo.get("车牌号")); - excelCar.setCarColor(importInfo.get("车辆颜色")); + excelCar.setCarNumber(importInfo.get("*车牌号")); + excelCar.setCarColor(importInfo.get("*车辆颜色")); excelCar.setAddTime(new Date()); excelCar.setProjectSn(projectSn); - String readWorkerName = importInfo.get("司机姓名"); + String readWorkerName = importInfo.get("*司机姓名"); if (!"临时车辆".equals(carModuleType)) { WorkerInfo workerInfo = workerMap.get(readWorkerName); if (workerInfo == null) { @@ -280,14 +280,14 @@ public class CarInfoServiceImpl extends ServiceImpl impl excelCar.setDriverWorkerId(String.valueOf(workerInfo.getId())); } excelCar.setDriverWorkerName(readWorkerName); - excelCar.setDriverTelephone(importInfo.get("司机电话")); - excelCar.setIsBlack(Objects.equals(importInfo.get("是否黑名单"), "是") ? 1 : 0); - excelCar.setCarType(Optional.ofNullable(carTypeMap.get(importInfo.get("车种类型"))).map(CarType::getId).orElse(null)); + excelCar.setDriverTelephone(importInfo.get("*司机电话")); + excelCar.setIsBlack(Objects.equals(importInfo.get("*是否黑名单"), "是") ? 1 : 0); + excelCar.setCarType(Optional.ofNullable(carTypeMap.get(importInfo.get("*车种类型"))).map(CarType::getId).orElse(null)); excelCar.setCarModuleType("固定车辆".equals(carModuleType) ? 1 : ("长期车辆".equals(carModuleType) ? 2 : 3)); excelCar.setReserveStartTime(DateUtil.parse(importInfo.get("预约开始时间"))); excelCar.setReserveEndTime(DateUtil.parse(importInfo.get("预约结束时间"))); excelCar.setEntryAndExitPermit("单次".equals(importInfo.get("允许进出次数")) ? 0 : 1); - excelCar.setEnterpriseId(Optional.ofNullable(enterpriseInfoMap.get(importInfo.get("单位"))).map(EnterpriseInfo::getId).orElse(null)); + excelCar.setEnterpriseId(Optional.ofNullable(enterpriseInfoMap.get(importInfo.get("*单位"))).map(EnterpriseInfo::getId).orElse(null)); if (dataCar == null) { this.addCarInfo(excelCar); } else { @@ -331,32 +331,32 @@ public class CarInfoServiceImpl extends ServiceImpl impl private void checkParams(List> list, String projectSn) { for (Map importInfo : list) { - if (StringUtils.isBlank(importInfo.get("单位"))) { + if (StringUtils.isBlank(importInfo.get("*单位"))) { throw new OpenAlertException("有单位未填写"); } - if (StringUtils.isBlank(importInfo.get("车辆类型"))) { + if (StringUtils.isBlank(importInfo.get("*车辆类型"))) { throw new OpenAlertException("有车辆类型未填写"); } - if (StringUtils.isBlank(importInfo.get("车牌号"))) { + if (StringUtils.isBlank(importInfo.get("*车牌号"))) { throw new OpenAlertException("有车牌号未填写"); } - if (StringUtils.isBlank(importInfo.get("车辆颜色"))) { + if (StringUtils.isBlank(importInfo.get("*车辆颜色"))) { throw new OpenAlertException("有车辆颜色未填写"); } - if (StringUtils.isBlank(importInfo.get("车种类型"))) { + if (StringUtils.isBlank(importInfo.get("*车种类型"))) { throw new OpenAlertException("有车种类型未填写"); } - if (StringUtils.isBlank(importInfo.get("司机姓名"))) { + if (StringUtils.isBlank(importInfo.get("*司机姓名"))) { throw new OpenAlertException("有司机姓名未填写"); } - if (StringUtils.isBlank(importInfo.get("司机电话"))) { + if (StringUtils.isBlank(importInfo.get("*司机电话"))) { throw new OpenAlertException("有司机电话未填写"); } - if (StringUtils.isBlank(importInfo.get("司机电话"))) { + if (StringUtils.isBlank(importInfo.get("*司机电话"))) { throw new OpenAlertException("有司机电话未填写"); } - if (!"固定车辆".equals(importInfo.get("车辆类型")) && DateUtil.compare(DateUtil.parse(importInfo.get("预约结束时间")), new Date()) < 0) { - throw new OpenAlertException("预约时间已失效,车辆" + importInfo.get("车牌号") + "无法下发,请重新提交"); + if (!"固定车辆".equals(importInfo.get("*车辆类型")) && DateUtil.compare(DateUtil.parse(importInfo.get("预约结束时间")), new Date()) < 0) { + throw new OpenAlertException("预约时间已失效,车辆" + importInfo.get("*车牌号") + "无法下发,请重新提交"); } } } diff --git a/src/main/java/com/zhgd/xmgl/modules/worker/controller/WorkerInfoController.java b/src/main/java/com/zhgd/xmgl/modules/worker/controller/WorkerInfoController.java index ab6df854f..b6f918eea 100644 --- a/src/main/java/com/zhgd/xmgl/modules/worker/controller/WorkerInfoController.java +++ b/src/main/java/com/zhgd/xmgl/modules/worker/controller/WorkerInfoController.java @@ -63,6 +63,7 @@ public class WorkerInfoController { @Lazy @Autowired MinioUtils minioUtils; + @Lazy @Autowired private IWorkerInfoService workerInfoService; @Autowired @@ -885,5 +886,17 @@ public class WorkerInfoController { return Result.success(new JoBuilder().put("file", foldName + ".zip").build()); } - + @OperLog(operModul = "劳务管理", operType = "批量移动劳务人员", operDesc = "批量移动劳务人员") + @ApiOperation(value = "批量移动劳务人员", notes = "批量移动劳务人员", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "enterpriseId", value = "所属企业", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "personType", value = "人员类型 1、劳务人员 2、管理人员", paramType = "body", required = false, dataType = "String"), + @ApiImplicitParam(name = "moveId", value = "工种id或岗位id", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "workerIdStr", value = "人员Id,多个逗号分割", paramType = "body", required = true, dataType = "String"), + }) + @PostMapping(value = "/updateWorkerOrg") + public Result updateWorkerOrg(@RequestBody Map map) { + workerInfoService.updateWorkerOrg(map); + return Result.ok(); + } } diff --git a/src/main/java/com/zhgd/xmgl/modules/worker/service/IWorkerInfoService.java b/src/main/java/com/zhgd/xmgl/modules/worker/service/IWorkerInfoService.java index d92606567..a22856021 100644 --- a/src/main/java/com/zhgd/xmgl/modules/worker/service/IWorkerInfoService.java +++ b/src/main/java/com/zhgd/xmgl/modules/worker/service/IWorkerInfoService.java @@ -589,5 +589,7 @@ public interface IWorkerInfoService extends IService { void updateWorkerEnter(WorkerInfo workerInfo); - List> getPostWorkTypeList(Map map); + List> getPostWorkTypeList(Map map); + + void updateWorkerOrg(Map map); } diff --git a/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/EnterpriseInfoServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/EnterpriseInfoServiceImpl.java index 2e71eefc7..682fd8de7 100644 --- a/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/EnterpriseInfoServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/EnterpriseInfoServiceImpl.java @@ -21,6 +21,9 @@ import com.zhgd.xmgl.async.AsyncHikvision; import com.zhgd.xmgl.async.AsyncJiLianDa; import com.zhgd.xmgl.async.AsyncWorker; import com.zhgd.xmgl.base.CompanyVo; +import com.zhgd.xmgl.modules.baotou.security.entity.XzSecurityQualityInspectionRecord; +import com.zhgd.xmgl.modules.baotou.security.enums.XzSecurityQualityInspectionRecordStatusEnum; +import com.zhgd.xmgl.modules.baotou.security.service.IXzSecurityQualityInspectionRecordService; import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService; import com.zhgd.xmgl.modules.basicdata.service.impl.CompanyServiceImpl; import com.zhgd.xmgl.modules.exam.entity.ExamTrain; @@ -35,8 +38,8 @@ import com.zhgd.xmgl.modules.project.mapper.ProjectEnterpriseMapper; import com.zhgd.xmgl.modules.project.mapper.ProjectMapper; import com.zhgd.xmgl.modules.project.service.impl.ProjectEnterpriseServiceImpl; import com.zhgd.xmgl.modules.quality.entity.QualityInspectionRecord; -import com.zhgd.xmgl.modules.quality.service.IQualityInspectionRecordService; import com.zhgd.xmgl.modules.quality.enums.QualityInspectionRecordStatusEnum; +import com.zhgd.xmgl.modules.quality.service.IQualityInspectionRecordService; import com.zhgd.xmgl.modules.worker.entity.*; import com.zhgd.xmgl.modules.worker.entity.vo.StatsEnterpriseWeekVo; import com.zhgd.xmgl.modules.worker.mapper.DepartmentInfoMapper; @@ -44,12 +47,10 @@ import com.zhgd.xmgl.modules.worker.mapper.EnterpriseInfoMapper; import com.zhgd.xmgl.modules.worker.mapper.TeamInfoMapper; import com.zhgd.xmgl.modules.worker.mapper.WorkerAttendanceMapper; import com.zhgd.xmgl.modules.worker.service.IEnterpriseInfoService; +import com.zhgd.xmgl.modules.worker.service.ITeamInfoService; import com.zhgd.xmgl.modules.worker.service.IUserEnterpriseService; import com.zhgd.xmgl.modules.worker.service.IWorkerInfoService; import com.zhgd.xmgl.modules.xz.emergency.service.IXzEmergencyRecordService; -import com.zhgd.xmgl.modules.baotou.security.entity.XzSecurityQualityInspectionRecord; -import com.zhgd.xmgl.modules.baotou.security.enums.XzSecurityQualityInspectionRecordStatusEnum; -import com.zhgd.xmgl.modules.baotou.security.service.IXzSecurityQualityInspectionRecordService; import com.zhgd.xmgl.modules.xz.service.impl.XzSupplierQualificationApplyServiceImpl; import com.zhgd.xmgl.modules.xz.special.entity.*; import com.zhgd.xmgl.modules.xz.special.service.*; @@ -77,6 +78,9 @@ import java.util.stream.Collectors; @Service @Transactional(rollbackFor = Exception.class) public class EnterpriseInfoServiceImpl extends ServiceImpl implements IEnterpriseInfoService { + @Lazy + @Autowired + ITeamInfoService teamInfoService; @Autowired IUserEnterpriseService userEnterpriseService; @Autowired @@ -273,21 +277,21 @@ public class EnterpriseInfoServiceImpl extends ServiceImpl map) { - QueryWrapper wrapper = new QueryWrapper<>(); String enterpriseId = MapUtils.getString(map, "enterpriseId"); String projectSn = MapUtils.getString(map, "projectSn"); - wrapper.lambda().eq(TeamInfo::getEnterpriseId, enterpriseId) - .eq(TeamInfo::getProjectSn, projectSn); - int count = teamInfoMapper.selectCount(wrapper); - if (count > 0) { - throw new OpenAlertException(MessageUtil.get("notDeleteEnterpriseErr")); - } +// QueryWrapper wrapper = new QueryWrapper<>(); +// wrapper.lambda().eq(TeamInfo::getEnterpriseId, enterpriseId) +// .eq(TeamInfo::getProjectSn, projectSn); +// int count = teamInfoMapper.selectCount(wrapper); +// if (count > 0) { +// throw new OpenAlertException(MessageUtil.get("notDeleteEnterpriseErr")); +// } Integer dCount = departmentInfoMapper.selectCount(new LambdaQueryWrapper() .eq(DepartmentInfo::getEnterpriseId, enterpriseId) .eq(DepartmentInfo::getProjectSn, projectSn) ); if (dCount > 0) { - throw new OpenAlertException("企业下存在部门,不允许删除"); + throw new OpenAlertException("企业下存在岗位,不允许删除"); } Integer parentEnterpriseNum = projectEnterpriseMapper.selectCount(new QueryWrapper().lambda() .eq(ProjectEnterprise::getParentEnterpriseId, enterpriseId) @@ -295,7 +299,20 @@ public class EnterpriseInfoServiceImpl extends ServiceImpl() + .eq(WorkerInfo::getProjectSn, projectSn) + .eq(WorkerInfo::getEnterpriseId, enterpriseId) + ); + if (workerCount != 0) { + throw new OpenAlertException("企业下存在人员,不允许删除"); + } + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(TeamInfo::getEnterpriseId, enterpriseId) + .eq(TeamInfo::getProjectSn, projectSn); + List teamInfos = teamInfoMapper.selectList(wrapper); + for (TeamInfo teamInfo : teamInfos) { + teamInfoService.removeTeamInfo(String.valueOf(teamInfo.getId())); + } QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.lambda().eq(ProjectEnterprise::getEnterpriseId, enterpriseId) .eq(ProjectEnterprise::getProjectSn, projectSn); diff --git a/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerInfoServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerInfoServiceImpl.java index 246f80047..0e7bd7d56 100644 --- a/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerInfoServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerInfoServiceImpl.java @@ -609,7 +609,7 @@ public class WorkerInfoServiceImpl extends ServiceImpl map) { + Integer personType = MapUtils.getInteger(map, "personType"); + String workerIdStr = MapUtils.getString(map, "workerIdStr"); + if (StringUtils.isNotEmpty(workerIdStr)) { + for (String id : workerIdStr.split(Cts.COMMA)) { + if (personType == 1) { + WorkerInfo info = JSON.parseObject(JSON.toJSONString(workerInfoMapper.selectById(Long.valueOf(id))), WorkerInfo.class); + info.setPersonType(personType); + info.setWorkerTypeId(MapUtils.getLong(map, "moveId")); + info.setEnterpriseId(MapUtils.getLong(map, "enterpriseId")); + this.editWorkerInfo(info); + } else { + WorkerInfo info = workerInfoMapper.selectById(Long.valueOf(id)); + info.setPersonType(personType); + info.setDepartmentId(MapUtils.getLong(map, "moveId")); + info.setEnterpriseId(MapUtils.getLong(map, "enterpriseId")); + this.editWorkerInfo(info); + } + } + } + } + /** * 获取是否合格 * diff --git a/src/main/resources/excel/车辆导入模板.xlsx b/src/main/resources/excel/车辆导入模板.xlsx index 7a722f839..49d09da87 100644 Binary files a/src/main/resources/excel/车辆导入模板.xlsx and b/src/main/resources/excel/车辆导入模板.xlsx differ