diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/RehearsalExportDTO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/RehearsalExportDTO.java index 1f2903b..800f911 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/RehearsalExportDTO.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/RehearsalExportDTO.java @@ -26,11 +26,11 @@ public class RehearsalExportDTO { private String subject; @ApiModelProperty("演练计划开始时间") - @ExcelProperty(value = "演练计划开始时间", index = 2) + @ExcelProperty(value = "计划开始时间", index = 2) private Date scheduledStartTime; @ApiModelProperty("演练计划结束时间") - @ExcelProperty(value = "演练计划结束时间", index = 3) + @ExcelProperty(value = "计划结束时间", index = 3) private Date scheduledEndTime; @ApiModelProperty("演练地点") diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/ConferencePlanEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/ConferencePlanEntity.java index a7261a9..914c031 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/ConferencePlanEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/ConferencePlanEntity.java @@ -1,6 +1,7 @@ package com.hnac.hzims.safeproduct.entity; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -32,10 +33,12 @@ public class ConferencePlanEntity extends BaseEntity { private String theme; @NotNull + @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty("会议计划开始时间") private Date scheduledStartTime; @NotNull + @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty("会议计划结束时间") private Date scheduledEndTime; diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/ConferenceRecordEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/ConferenceRecordEntity.java index 1aa0309..99e3341 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/ConferenceRecordEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/ConferenceRecordEntity.java @@ -41,7 +41,6 @@ public class ConferenceRecordEntity extends BaseEntity { @ApiModelProperty("记录人") private String recorder; - @Size(max = 250, message = "会议内容字段长度不能超过250") @ApiModelProperty("会议内容") private String content; diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/RehearsalPlanEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/RehearsalPlanEntity.java index bdff1a1..4cd4306 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/RehearsalPlanEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/RehearsalPlanEntity.java @@ -1,6 +1,7 @@ package com.hnac.hzims.safeproduct.entity; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -32,10 +33,12 @@ public class RehearsalPlanEntity extends BaseEntity { private String subject; @NotNull + @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty("演练计划开始时间") private Date scheduledStartTime; @NotNull + @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty("演练计划结束时间") private Date scheduledEndTime; diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainPlanEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainPlanEntity.java index 9b1b0fb..93db233 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainPlanEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainPlanEntity.java @@ -4,6 +4,7 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -32,12 +33,14 @@ public class TrainPlanEntity extends BaseEntity { private String unit; @NotNull - @ApiModelProperty("计划培训开始时间") + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty("计划开始时间") @ExcelProperty(value = "计划开始时间", index = 6) private Date scheduledStartTime; @NotNull - @ApiModelProperty("计划培训结束时间") + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty("计划结束时间") @ExcelProperty(value = "计划结束时间", index = 7) private Date scheduledEndTime; diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainRecordEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainRecordEntity.java index 24f2e2f..b8728dc 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainRecordEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainRecordEntity.java @@ -41,7 +41,6 @@ public class TrainRecordEntity extends BaseEntity { @ExcelProperty(value = "培训学员", index = 3) private String peopleName; - @Size(max = 5000, message = "培训内容字段长度超出限制范围") @ApiModelProperty("培训内容") @ExcelProperty(value = "培训内容", index = 2) private String content; diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalRecordController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java similarity index 97% rename from hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalRecordController.java rename to hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java index f80e0fa..58b036e 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalRecordController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java @@ -25,7 +25,7 @@ import javax.validation.Valid; import java.util.Map; /** - * 演练记录接口类 + * 演练管理接口类 * * @author liwen * @date 2023-12-13 @@ -33,8 +33,8 @@ import java.util.Map; @RestController @AllArgsConstructor @RequestMapping("/rehearsal") -@Api(value = "演练记录", tags = "演练记录接口") -public class RehearsalRecordController extends BladeController { +@Api(value = "演练管理", tags = "演练管理接口") +public class RehearsalController extends BladeController { private final IRehearsalRecordService rehearsalRecordService; diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java index d306a47..172a59b 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java @@ -83,8 +83,8 @@ public class TrainController extends BladeController { @GetMapping("/trainPlanPage") @ApiImplicitParams({ @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), - @ApiImplicitParam(name = "scheduledStartTime", value = "计划培训开始时间", dataType = "query", paramType = "string"), - @ApiImplicitParam(name = "scheduledEndTime", value = "计划培训结束时间", dataType = "query", paramType = "string") + @ApiImplicitParam(name = "scheduledStartTime", value = "计划开始时间", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string") }) @ApiOperation(value = "培训计划分页") @ApiOperationSupport(order = 5) diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferencePlanServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferencePlanServiceImpl.java index 2d742ce..803b972 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferencePlanServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferencePlanServiceImpl.java @@ -62,8 +62,8 @@ public class ConferencePlanServiceImpl extends ServiceImpl planPage(Map param, Query query) { QueryWrapper queryWrapper = new QueryWrapper<>(); String unit = String.valueOf(param.get("unit")); - String startTime = String.valueOf(param.get("startTime")); - String endTime = String.valueOf((param.get("endTime"))); + String startTime = String.valueOf(param.get("scheduledStartTime")); + String endTime = String.valueOf((param.get("scheduledEndTime"))); if (!unit.equals("null") && !unit.equals("")) { queryWrapper.lambda().like(ConferencePlanEntity::getUnit, unit); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferenceRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferenceRecordServiceImpl.java index 622683c..7350c86 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferenceRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferenceRecordServiceImpl.java @@ -4,7 +4,6 @@ import cn.hutool.core.date.DatePattern; import com.alibaba.excel.util.CollectionUtils; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.safeproduct.constants.SafeProductConstant; import com.hnac.hzims.safeproduct.entity.ConferencePlanEntity; import com.hnac.hzims.safeproduct.entity.ConferenceRecordEntity; @@ -12,6 +11,7 @@ import com.hnac.hzims.safeproduct.enums.RehearsalStatusEnum; import com.hnac.hzims.safeproduct.mapper.ConferencePlanMapper; import com.hnac.hzims.safeproduct.mapper.ConferenceRecordMapper; import com.hnac.hzims.safeproduct.service.IConferenceRecordService; +import com.hnac.hzims.safeproduct.utils.BaseUtil; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -59,21 +59,7 @@ public class ConferenceRecordServiceImpl extends ServiceImpl page = new Page<>(query.getCurrent(), query.getSize()); IPage unitPage = baseMapper.selectByMonth(page, month); List unitList = unitPage.getRecords(); + // 若无数据,返回空页面 + if (CollectionUtils.isEmpty(unitList)) { + return unitPage; + } // 查询当月各单位已完成的演练数据 IPage page1 = new Page<>(query.getCurrent(), query.getSize()); IPage finishedPage = baseMapper.selectFinishedDataByMonth(page1, month); @@ -102,7 +107,7 @@ public class RehearsalPlanServiceImpl extends ServiceImpl unitPage = baseMapper.selectUnitByYear(page, year); List records = unitPage.getRecords(); // 若无数据,返回空页面 - if (org.springframework.util.CollectionUtils.isEmpty(records)) { + if (CollectionUtils.isEmpty(records)) { return unitPage; } List unitList = records.stream().map(RehearsalYearVO::getUnit).collect(Collectors.toList()); diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java index b3a6701..6aa0b5d 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java @@ -12,6 +12,7 @@ import com.hnac.hzims.safeproduct.enums.RehearsalStatusEnum; import com.hnac.hzims.safeproduct.mapper.RehearsalPlanMapper; import com.hnac.hzims.safeproduct.mapper.RehearsalRecordMapper; import com.hnac.hzims.safeproduct.service.IRehearsalRecordService; +import com.hnac.hzims.safeproduct.utils.BaseUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -42,21 +43,7 @@ public class RehearsalRecordServiceImpl extends ServiceImpl impleme // 查询是否存在同月编号 String lastCode = getLastCode(currentMonth); // 若不存在,新增编号 - String code; - if (StringUtils.isNull(lastCode)) { - code = "KSJL" + currentMonth + "001"; - } else { // 若存在,编号递增 - String oldNum = lastCode.substring(lastCode.length() - 3); - int value = Integer.parseInt(oldNum) + 1; - // 根据数位拼接编号 - if (value < 10) { - code = "KSJL" + currentMonth + "00" + value; - } else if (value < 100) { - code = "KSJL" + currentMonth + "0" + value; - } else { - code = "KSJL" + currentMonth + value; - } - } + String code = BaseUtil.getUniqueCode("KSJL", lastCode, currentMonth); testEntity.setCode(code); boolean saveTest = this.save(testEntity); // 若新增考试记录成功,添加相关的参考人员数据 @@ -81,13 +67,7 @@ public class TestServiceImpl extends ServiceImpl impleme String people = test.getPeopleName(); String[] person = people.split(",|,"); // 新增参考人员成绩数据 - List scoreList = new ArrayList<>(); - for(String name : person) { - TestScoreEntity testScoreEntity = new TestScoreEntity(); - testScoreEntity.setTestId(test.getId()); - testScoreEntity.setName(name); - scoreList.add(testScoreEntity); - } + List scoreList = getReferenceTestScore(test, person); return R.status(testScoreService.saveBatch(scoreList)); } return R.fail("新增考试记录失败"); @@ -185,20 +165,31 @@ public class TestServiceImpl extends ServiceImpl impleme if (removeByIds) { String[] person = testEntity.getPeopleName().split(",|,"); // 新增参考人员成绩数据 - List res = new ArrayList<>(); - for (String name : person) { - TestScoreEntity testScoreEntity = new TestScoreEntity(); - testScoreEntity.setTestId(testEntity.getId()); - testScoreEntity.setName(name); - res.add(testScoreEntity); - } - return testScoreService.saveBatch(res); + List scoreList = getReferenceTestScore(testEntity, person); + return testScoreService.saveBatch(scoreList); } } return false; } /** + * 获取成绩列表 + * @param testEntity 考试记录实体类 + * @param person 参考人员 + * @return 成绩列表 + */ + private List getReferenceTestScore(TestEntity testEntity, String[] person) { + List res = new ArrayList<>(); + for (String name : person) { + TestScoreEntity testScoreEntity = new TestScoreEntity(); + testScoreEntity.setTestId(testEntity.getId()); + testScoreEntity.setName(name); + res.add(testScoreEntity); + } + return res; + } + + /** * 查询是否存在同月编号 * @param currentMonth 当月 * @return 存在则返回上一编号,否则返回null diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java index cba9def..27a8d8e 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java @@ -63,6 +63,10 @@ public class TrainPlanServiceImpl extends ServiceImpl page = new Page<>(query.getCurrent(), query.getSize()); IPage unitPage = baseMapper.selectByMonth(page, month); List unitList = unitPage.getRecords(); + // 若无数据,返回空页面 + if (CollectionUtils.isEmpty(unitList)) { + return unitPage; + } // 查询当月各单位已完成的培训数据 IPage page1 = new Page<>(query.getCurrent(), query.getSize()); IPage finishedPage = baseMapper.selectFinishedDataByMonth(page1, month); diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java index 230a4d2..79d9c05 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java @@ -10,7 +10,6 @@ import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.safeproduct.constants.SafeProductConstant; import com.hnac.hzims.safeproduct.dto.TrainRecordDTO; import com.hnac.hzims.safeproduct.entity.TrainPlanEntity; @@ -20,6 +19,7 @@ import com.hnac.hzims.safeproduct.mapper.TrainPlanMapper; import com.hnac.hzims.safeproduct.mapper.TrainRecordMapper; import com.hnac.hzims.safeproduct.service.ITestService; import com.hnac.hzims.safeproduct.service.ITrainRecordService; +import com.hnac.hzims.safeproduct.utils.BaseUtil; import org.springblade.core.log.exception.ServiceException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -61,21 +61,7 @@ public class TrainRecordServiceImpl extends ServiceImpl