diff --git a/zc-business/src/main/java/com/zc/business/controller/DcEmployeesController.java b/zc-business/src/main/java/com/zc/business/controller/DcEmployeesController.java index 04736454..20159da9 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcEmployeesController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcEmployeesController.java @@ -32,7 +32,7 @@ import com.ruoyi.common.core.page.TableDataInfo; */ @RestController @RequestMapping("/business/employees") -@Api(tags = {"人员信息(应急人员与值班人员)"}) + public class DcEmployeesController extends BaseController { @Autowired @@ -41,7 +41,7 @@ public class DcEmployeesController extends BaseController /** * 查询值班人员信息列表 */ - @ApiOperation("获取人员信息列表") + //@ApiOperation("获取人员信息列表") @PreAuthorize("@ss.hasPermi('business:employees:list')") @GetMapping("/list") public TableDataInfo list(DcEmployees dcEmployees) @@ -77,7 +77,7 @@ public class DcEmployeesController extends BaseController /** * 新增值班人员信息 */ - @ApiOperation(value = "新增人员信息", notes = "新增人员信息") + //@ApiOperation(value = "新增人员信息", notes = "新增人员信息") @PreAuthorize("@ss.hasPermi('business:employees:add')") @Log(title = "值班人员信息", businessType = BusinessType.INSERT) @PostMapping @@ -89,7 +89,7 @@ public class DcEmployeesController extends BaseController /** * 修改值班人员信息 */ - @ApiOperation(value = "修改人员信息", notes = "修改人员信息") + //@ApiOperation(value = "修改人员信息", notes = "修改人员信息") @PreAuthorize("@ss.hasPermi('business:employees:edit')") @Log(title = "值班人员信息", businessType = BusinessType.UPDATE) @PutMapping @@ -111,7 +111,7 @@ public class DcEmployeesController extends BaseController } //查询全部机构id与名称信息 - @ApiOperation(value = "查询全部机构id与名称信息", notes = "查询全部机构id与名称信息") + //@ApiOperation(value = "查询全部机构id与名称信息", notes = "查询全部机构id与名称信息") @PostMapping("/organization") public AjaxResult selectOrganizationAll(){ return AjaxResult.success(dcEmployeesService.selectOrganizationAll()); diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java index ca598ef5..346a6482 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java @@ -106,13 +106,20 @@ public class DcShiftsServiceImpl implements IDcShiftsService @Transactional(rollbackFor = ServiceException.class) public int updateDcShifts(DcShifts dcShifts) throws Exception{ String msg = ""; - Long id = dcShifts.getId(); + dcShifts.setUpdateTime(DateUtils.getNowDate()); + int updateDcShifts = dcShiftsMapper.updateDcShifts(dcShifts); + if (updateDcShifts == 0) { + msg = "修改用户信息失败"; + throw new ServiceException(msg); + } Long idBefore = dcShifts.getIdBefore(); DcEmployees dcShiftsBefore = dcEmployeesMapper.selectDcEmployeesById(idBefore);//拿到修改前的数据 String nameBefore = dcShiftsBefore.getName();//修改前名称 String postNameBefore = dcShiftsBefore.getPostName();//修改前职位 Long employeesId = dcShifts.getEmployeesId();//修改后人员id - if (!idBefore.equals(employeesId)){ + if (!idBefore.equals(employeesId)) { + Long id = dcShifts.getId(); + DcShifts dcShiftsById = dcShiftsMapper.selectDcShiftsById(id);//查询值班信息 DcEmployees dcEmployees = dcEmployeesMapper.selectDcEmployeesById(employeesId);//查询修改后的人员信息 String name = dcEmployees.getName();//修改后的人名 String postName = dcEmployees.getPostName();//修改后的岗位 @@ -120,16 +127,15 @@ public class DcShiftsServiceImpl implements IDcShiftsService dcShiftsRecord.setOperator(SecurityUtils.getUserId());//操作人员id dcShiftsRecord.setOperationType("EDIT");//操作类型 dcShiftsRecord.setOperationTime(DateUtils.getNowDate());//操作时间 - dcShiftsRecord.setShiftsDate(dcShifts.getDate());//值班日期 - dcShiftsRecord.setModifyContent("岗位"+postNameBefore+"姓名"+nameBefore+"修改为"+postName+name); + dcShiftsRecord.setShiftsDate(dcShiftsById.getDate());//值班日期 + dcShiftsRecord.setModifyContent("岗位" + postNameBefore + "姓名" + nameBefore + "修改为" + postName + name); int shiftsRecord = dcShiftsMapper.insertDcShiftsRecord(dcShiftsRecord); - if (shiftsRecord==0){ - msg="操作日志记录失败"; + if (shiftsRecord == 0) { + msg = "操作日志记录失败"; throw new ServiceException(msg); } } - dcShifts.setUpdateTime(DateUtils.getNowDate()); - return dcShiftsMapper.updateDcShifts(dcShifts); + return 1; } /** @@ -186,22 +192,24 @@ public class DcShiftsServiceImpl implements IDcShiftsService //List equipmentList = util.importExcel("值班人员数据",file.getInputStream(),0); BeanValidators.validateWithException(validator, equipmentList);//对象属性验证 - - for (int i=0;i map = dcShiftsMapper.contactNumber(contactNumber);//手机号获取人员id - if (map==null){ - msg="没有查询到"+name+"的手机号绑定的信息,请查看手机号是否正确"; + if (map == null) { + msg = "没有查询到" + name + "的手机号绑定的信息,请查看手机号是否正确"; throw new ServiceException(msg); } - Long id = (Long) map.get("id"); dcShifts.setEmployeesId(id); dcShifts.setCreateTime(DateUtils.getNowDate()); int shifts = dcShiftsMapper.insertDcShifts(dcShifts); - if (shifts==0){ + if (shifts == 0) { msg = "添加值班信息‘" + dcShifts.getName() + "’失败,请检查后重新导入"; throw new ServiceException(msg); } diff --git a/zc-business/src/main/resources/excelTemplate/值班示例模板.xlsx b/zc-business/src/main/resources/excelTemplate/值班示例模板.xlsx index 8d921d8d..4ce7809a 100644 Binary files a/zc-business/src/main/resources/excelTemplate/值班示例模板.xlsx and b/zc-business/src/main/resources/excelTemplate/值班示例模板.xlsx differ