Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
yang_shj 11 months ago
parent
commit
a049958d1f
  1. 4
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/RehearsalExportDTO.java
  2. 3
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/ConferencePlanEntity.java
  3. 1
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/ConferenceRecordEntity.java
  4. 3
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/RehearsalPlanEntity.java
  5. 7
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainPlanEntity.java
  6. 1
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainRecordEntity.java
  7. 6
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java
  8. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java
  9. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferencePlanServiceImpl.java
  10. 18
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferenceRecordServiceImpl.java
  11. 7
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalPlanServiceImpl.java
  12. 17
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java
  13. 53
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java
  14. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java
  15. 18
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java
  16. 39
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java

4
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("演练地点")

3
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;

1
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;

3
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;

7
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;

1
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;

6
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalRecordController.java → 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;

4
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)

4
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferencePlanServiceImpl.java

@ -62,8 +62,8 @@ public class ConferencePlanServiceImpl extends ServiceImpl<ConferencePlanMapper,
public IPage<ConferencePlanEntity> planPage(Map<String, Object> param, Query query) {
QueryWrapper<ConferencePlanEntity> 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);
}

18
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<ConferenceRecordMap
// 查询是否存在同月编号
String lastCode = getLastCode(currentMonth);
// 若不存在,新增编号
String code;
if (StringUtils.isNull(lastCode)) {
code = "HYJL" + currentMonth + "001";
} else { // 若存在,编号递增
String oldNum = lastCode.substring(lastCode.length() - 3);
int value = Integer.parseInt(oldNum) + 1;
// 根据数位拼接编号
if (value < 10) {
code = "HYJL" + currentMonth + "00" + value;
} else if (value < 100) {
code = "HYJL" + currentMonth + "0" + value;
} else {
code = "HYJL" + currentMonth + value;
}
}
String code = BaseUtil.getUniqueCode("HYJL", lastCode, currentMonth);
conferenceRecord.setCode(code);
boolean save = this.save(conferenceRecord);
// 若会议记录新增成功,修改会议计划状态为已完成

7
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalPlanServiceImpl.java

@ -24,6 +24,7 @@ import org.springblade.core.mp.support.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
@ -72,6 +73,10 @@ public class RehearsalPlanServiceImpl extends ServiceImpl<RehearsalPlanMapper, R
IPage<RehearsalMonthVO> page = new Page<>(query.getCurrent(), query.getSize());
IPage<RehearsalMonthVO> unitPage = baseMapper.selectByMonth(page, month);
List<RehearsalMonthVO> unitList = unitPage.getRecords();
// 若无数据,返回空页面
if (CollectionUtils.isEmpty(unitList)) {
return unitPage;
}
// 查询当月各单位已完成的演练数据
IPage<RehearsalMonthVO> page1 = new Page<>(query.getCurrent(), query.getSize());
IPage<RehearsalMonthVO> finishedPage = baseMapper.selectFinishedDataByMonth(page1, month);
@ -102,7 +107,7 @@ public class RehearsalPlanServiceImpl extends ServiceImpl<RehearsalPlanMapper, R
IPage<RehearsalYearVO> unitPage = baseMapper.selectUnitByYear(page, year);
List<RehearsalYearVO> records = unitPage.getRecords();
// 若无数据,返回空页面
if (org.springframework.util.CollectionUtils.isEmpty(records)) {
if (CollectionUtils.isEmpty(records)) {
return unitPage;
}
List<String> unitList = records.stream().map(RehearsalYearVO::getUnit).collect(Collectors.toList());

17
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<RehearsalRecordMappe
// 查询是否存在同月编号
String lastCode = getLastCode(currentMonth);
// 若不存在,新增编号
String code;
if (StringUtils.isNull(lastCode)) {
code = "YLJL" + currentMonth + "001";
} else { // 若存在,编号递增
String oldNum = lastCode.substring(lastCode.length() - 3);
int value = Integer.parseInt(oldNum) + 1;
// 根据数位拼接编号
if (value < 10) {
code = "YLJL" + currentMonth + "00" + value;
} else if (value < 100) {
code = "YLJL" + currentMonth + "0" + value;
} else {
code = "YLJL" + currentMonth + value;
}
}
String code = BaseUtil.getUniqueCode("YLJL", lastCode, currentMonth);
rehearsalRecord.setCode(code);
// 参演人数
String peopleName = rehearsalRecord.getPeopleName();

53
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.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.dto.TestDTO;
import com.hnac.hzims.safeproduct.entity.TestEntity;
@ -14,6 +13,7 @@ import com.hnac.hzims.safeproduct.mapper.TestMapper;
import com.hnac.hzims.safeproduct.mapper.TrainPlanMapper;
import com.hnac.hzims.safeproduct.service.ITestScoreService;
import com.hnac.hzims.safeproduct.service.ITestService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -56,21 +56,7 @@ public class TestServiceImpl extends ServiceImpl<TestMapper, TestEntity> 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<TestMapper, TestEntity> impleme
String people = test.getPeopleName();
String[] person = people.split(",|,");
// 新增参考人员成绩数据
List<TestScoreEntity> scoreList = new ArrayList<>();
for(String name : person) {
TestScoreEntity testScoreEntity = new TestScoreEntity();
testScoreEntity.setTestId(test.getId());
testScoreEntity.setName(name);
scoreList.add(testScoreEntity);
}
List<TestScoreEntity> scoreList = getReferenceTestScore(test, person);
return R.status(testScoreService.saveBatch(scoreList));
}
return R.fail("新增考试记录失败");
@ -185,20 +165,31 @@ public class TestServiceImpl extends ServiceImpl<TestMapper, TestEntity> impleme
if (removeByIds) {
String[] person = testEntity.getPeopleName().split(",|,");
// 新增参考人员成绩数据
List<TestScoreEntity> 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<TestScoreEntity> scoreList = getReferenceTestScore(testEntity, person);
return testScoreService.saveBatch(scoreList);
}
}
return false;
}
/**
* 获取成绩列表
* @param testEntity 考试记录实体类
* @param person 参考人员
* @return 成绩列表
*/
private List<TestScoreEntity> getReferenceTestScore(TestEntity testEntity, String[] person) {
List<TestScoreEntity> 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

4
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java

@ -63,6 +63,10 @@ public class TrainPlanServiceImpl extends ServiceImpl<TrainPlanMapper, TrainPlan
IPage<TrainMonthVO> page = new Page<>(query.getCurrent(), query.getSize());
IPage<TrainMonthVO> unitPage = baseMapper.selectByMonth(page, month);
List<TrainMonthVO> unitList = unitPage.getRecords();
// 若无数据,返回空页面
if (CollectionUtils.isEmpty(unitList)) {
return unitPage;
}
// 查询当月各单位已完成的培训数据
IPage<TrainMonthVO> page1 = new Page<>(query.getCurrent(), query.getSize());
IPage<TrainMonthVO> finishedPage = baseMapper.selectFinishedDataByMonth(page1, month);

18
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<TrainRecordMapper, Train
// 查询是否存在同月编号
String lastCode = getLastCode(currentMonth);
// 若不存在,新增编号
String code;
if (StringUtils.isNull(lastCode)) {
code = "PXJL" + currentMonth + "001";
} else { // 若存在,编号递增
String oldNum = lastCode.substring(lastCode.length() - 3);
int value = Integer.parseInt(oldNum) + 1;
// 根据数位拼接编号
if (value < 10) {
code = "PXJL" + currentMonth + "00" + value;
} else if (value < 100) {
code = "PXJL" + currentMonth + "0" + value;
} else {
code = "PXJL" + currentMonth + value;
}
}
String code = BaseUtil.getUniqueCode("PXJL", lastCode, currentMonth);
trainRecordEntity.setCode(code);
boolean save = this.save(trainRecordEntity);
// 若培训记录新增成功,修改培训计划状态为已完成

39
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java

@ -0,0 +1,39 @@
package com.hnac.hzims.safeproduct.utils;
import com.hnac.hzims.common.logs.utils.StringUtils;
/**
* 公用工具类
*
* @author liwen
* @date 2024-01-02
*/
public class BaseUtil {
/**
* 生成编码规则模块首字母 + 日期yyyymm + 编号三位
* @param module 模块首字母
* @param lastCode 已存在的最新编号
* @param currentMonth 日期
* @return 编码
*/
public static String getUniqueCode(String module, String lastCode, String currentMonth) {
// 若不存在,新增编号
String code;
if (StringUtils.isNull(lastCode)) {
code = module + currentMonth + "001";
} else { // 若存在,编号递增
String oldNum = lastCode.substring(lastCode.length() - 3);
int value = Integer.parseInt(oldNum) + 1;
// 根据数位拼接编号
if (value < 10) {
code = module + currentMonth + "00" + value;
} else if (value < 100) {
code = module + currentMonth + "0" + value;
} else {
code = module + currentMonth + value;
}
}
return code;
}
}
Loading…
Cancel
Save