Browse Source

add: 培训管理模块

zhongwei
liwen 11 months ago
parent
commit
72e783c7bb
  1. 13
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/SafeProductConstant.java
  2. 4
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/AnalysisYearDTO.java
  3. 95
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/RehearsalRecordDTO.java
  4. 20
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/TestDTO.java
  5. 23
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/TestScoreDTO.java
  6. 20
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/TrainRecordDTO.java
  7. 77
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java
  8. 37
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestScoreEntity.java
  9. 64
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainPlanEntity.java
  10. 59
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainRecordEntity.java
  11. 20
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreVO.java
  12. 31
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainMonthVO.java
  13. 53
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainYearVO.java
  14. 261
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java
  15. 25
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.java
  16. 14
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.xml
  17. 25
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestScoreMapper.java
  18. 18
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestScoreMapper.xml
  19. 53
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.java
  20. 64
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.xml
  21. 25
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.java
  22. 18
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.xml
  23. 45
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestScoreService.java
  24. 66
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestService.java
  25. 50
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainPlanService.java
  26. 60
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainRecordService.java
  27. 75
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java
  28. 220
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java
  29. 228
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java
  30. 217
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java
  31. 116
      hzims-service/safeproduct/src/main/resources/db/1.0.1.sql

13
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/SafeProductConstant.java

@ -0,0 +1,13 @@
package com.hnac.hzims.safeproduct.constants;
/**
* safeproduct 常量类
*
* @author liwen
* @date 2023-12-25
*/
public interface SafeProductConstant {
int TRAIN_PLAN_HAS_TEST = 1;
int TRAIN_PLAN_HAS_NO_TEST = 0;
}

4
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/RehearsalYearDTO.java → hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/AnalysisYearDTO.java

@ -9,8 +9,8 @@ import lombok.Data;
* @date 2023-12-14 * @date 2023-12-14
*/ */
@Data @Data
@ApiModel(value = "演练年度统计DTO类") @ApiModel(value = "年度数据统计DTO类")
public class RehearsalYearDTO { public class AnalysisYearDTO {
@ApiModelProperty("单位") @ApiModelProperty("单位")
private String unit; private String unit;

95
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/RehearsalRecordDTO.java

@ -1,95 +0,0 @@
package com.hnac.hzims.safeproduct.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
/**
* @author liwen
* @date 2023-12-15
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "演练记录DTO类")
public class RehearsalRecordDTO extends BaseEntity {
@Size(max = 50, message = "编码字段长度不能超过50")
@ApiModelProperty("编码")
private String code;
@NotNull
@Size(max = 50, message = "单位字段长度不能超过50")
@ApiModelProperty("单位")
private String unit;
@NotNull
@Size(max = 50, message = "演练科目字段长度不能超过50")
@ApiModelProperty("演练科目")
private String subject;
@NotNull
@ApiModelProperty("演练计划开始时间")
private Date scheduledStartTime;
@NotNull
@ApiModelProperty("演练计划结束时间")
private Date scheduledEndTime;
@NotNull
@Size(max = 255, message = "演练地点字段长度不能超过255")
@ApiModelProperty("演练地点")
private String location;
@Min(value = 0, message = "参演人数不能小于0")
@Max(value = 1000, message = "参演人数字段长度超出限制范围")
@ApiModelProperty("参演人数")
private Integer peopleNum;
@Size(max = 5000, message = "参演人员字段长度超出限制范围")
@ApiModelProperty("参演人员")
private String[] people;
@NotNull
@Size(max = 10, message = "总指挥字段长度不能超过10")
@ApiModelProperty("总指挥")
private String commander;
@ApiModelProperty("演练实际开始时间")
private Date actualStartTime;
@ApiModelProperty("演练实际结束时间")
private Date actualEndTime;
@Size(max = 250, message = "演练记录字段长度不能超过250")
@ApiModelProperty("演练记录")
private String record;
@Size(max = 250, message = "演练评价字段长度不能超过250")
@ApiModelProperty("演练评价")
private String comment;
@Size(max = 20, message = "演练方式字段长度不能超过20")
@ApiModelProperty("演练方式")
private String rehearsalMethod;
@NotNull
@Size(max = 20, message = "演练状态字段长度不能超过20")
@ApiModelProperty("演练状态")
private String rehearsalStatus;
@Size(max = 1000, message = "演练图片字段长度不能超过1000")
@ApiModelProperty("演练图片")
private String[] images;
@Size(max = 1000, message = "演练附件字段长度不能超过1000")
@ApiModelProperty("演练附件")
private String[] files;
}

20
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/TestDTO.java

@ -0,0 +1,20 @@
package com.hnac.hzims.safeproduct.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author liwen
* @date 2023-12-25
*/
@Data
@ApiModel(value = "考试记录DTO类")
public class TestDTO {
@ApiModelProperty("考试记录id")
private Long id;
@ApiModelProperty("考试记录名称")
private String testName;
}

23
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/TestScoreDTO.java

@ -0,0 +1,23 @@
package com.hnac.hzims.safeproduct.dto;
import com.hnac.hzims.safeproduct.vo.TestScoreVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author liwen
* @date 2023-12-25
*/
@Data
@ApiModel(value = "考试成绩DTO类")
public class TestScoreDTO {
@ApiModelProperty("考试记录id")
private Long testId;
@ApiModelProperty("考试成绩列表")
private List<TestScoreVO> scoreList;
}

20
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/TrainRecordDTO.java

@ -0,0 +1,20 @@
package com.hnac.hzims.safeproduct.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author liwen
* @date 2023-12-25
*/
@Data
@ApiModel(value = "培训记录DTO类")
public class TrainRecordDTO {
@ApiModelProperty("培训记录id")
private Long id;
@ApiModelProperty("培训记录名称")
private String trainRecordName;
}

77
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java

@ -0,0 +1,77 @@
package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
/**
* @author liwen
* @date 2023-12-25
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("hzims_test")
@ApiModel(value = "考试记录实体类")
public class TestEntity extends BaseEntity {
@ApiModelProperty("培训计划id")
private Long trainPlanId;
@ApiModelProperty("培训记录id")
private Long trainRecordId;
@Size(max = 50, message = "名称字段长度不能超过50")
@ApiModelProperty("考试记录名称")
private String testName;
@Size(max = 50, message = "编码字段长度不能超过50")
@ApiModelProperty("编码")
private String code;
@NotNull
@Size(max = 50, message = "单位字段长度不能超过50")
@ApiModelProperty("单位")
private String unit;
@NotNull
@ApiModelProperty("考试开始时间")
private Date testStartTime;
@NotNull
@ApiModelProperty("考试结束时间")
private Date testEndTime;
@NotNull
@Size(max = 255, message = "考试地点字段长度不能超过255")
@ApiModelProperty("考试地点")
private String location;
@NotNull
@Size(max = 50, message = "考试科目字段长度不能超过50")
@ApiModelProperty("考试科目")
private String subject;
@NotNull
@Size(max = 20, message = "监考人字段长度不能超过20")
@ApiModelProperty("监考人")
private String proctor;
@Size(max = 1000, message = "参考人员字段长度超出限制范围")
@ApiModelProperty("参考人员")
private String peopleName;
@Size(max = 1000, message = "考试图片字段长度不能超过1000")
@ApiModelProperty("考试图片")
private String imgPath;
@Size(max = 1000, message = "考试附件字段长度不能超过1000")
@ApiModelProperty("考试附件")
private String filePath;
}

37
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestScoreEntity.java

@ -0,0 +1,37 @@
package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
* @author liwen
* @date 2023-12-25
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("hzims_test_score")
@ApiModel(value = "考试记录实体类")
public class TestScoreEntity extends BaseEntity {
@ApiModelProperty("考试记录id")
private Long testId;
@Size(max = 50, message = "姓名字段长度不能超过50")
@ApiModelProperty("姓名")
private String name;
@NotNull
@Min(value = 0, message = "成绩必须大于等于0")
@Max(value = 100, message = "成绩必须小于等于100")
@ApiModelProperty("成绩")
private Integer score;
}

64
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainPlanEntity.java

@ -0,0 +1,64 @@
package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
/**
* @author liwen
* @date 2023-12-25
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("hzims_train_plan")
@ApiModel(value = "培训计划实体类")
public class TrainPlanEntity extends BaseEntity {
@NotNull
@Size(max = 50, message = "单位字段长度不能超过50")
@ApiModelProperty("单位")
private String unit;
@NotNull
@ApiModelProperty("计划培训开始时间")
private Date scheduledStartTime;
@NotNull
@ApiModelProperty("计划培训结束时间")
private Date scheduledEndTime;
@NotNull
@Size(max = 255, message = "单位字段长度不能超过255")
@ApiModelProperty("培训课程")
private String lesson;
@NotNull
@Size(max = 255, message = "培训地点字段长度不能超过255")
@ApiModelProperty("培训地点")
private String location;
@Size(max = 20, message = "培训方式字段长度不能超过20")
@ApiModelProperty("培训方式")
private String trainMethod;
@NotNull
@Size(max = 20, message = "培训讲师字段长度不能超过20")
@ApiModelProperty("培训讲师")
private String teacher;
@NotNull
@Size(max = 20, message = "培训状态字段长度不能超过20")
@ApiModelProperty("培训状态")
private String trainStatus;
@NotNull
@ApiModelProperty("关联考试:0-否,1-是")
private Integer isTest;
}

59
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainRecordEntity.java

@ -0,0 +1,59 @@
package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import javax.validation.constraints.Size;
import java.util.Date;
/**
* @author liwen
* @date 2023-12-25
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("hzims_train_record")
@ApiModel(value = "培训记录实体类")
public class TrainRecordEntity extends BaseEntity {
@ApiModelProperty("培训计划id")
private Long trainPlanId;
@Size(max = 50, message = "名称字段长度不能超过50")
@ApiModelProperty("培训记录名称")
private String trainRecordName;
@Size(max = 50, message = "编码字段长度不能超过50")
@ApiModelProperty("编码")
private String code;
@Size(max = 5000, message = "培训学员字段长度超出限制范围")
@ApiModelProperty("培训学员")
private String peopleName;
@Size(max = 5000, message = "培训内容字段长度超出限制范围")
@ApiModelProperty("培训内容")
private String content;
@ApiModelProperty("实际培训开始时间")
private Date actualStartTime;
@ApiModelProperty("实际培训结束时间")
private Date actualEndTime;
@Size(max = 250, message = "培训评价字段长度不能超过250")
@ApiModelProperty("培训评价")
private String command;
@Size(max = 1000, message = "培训图片字段长度不能超过1000")
@ApiModelProperty("培训图片")
private String imgPath;
@Size(max = 1000, message = "培训附件字段长度不能超过1000")
@ApiModelProperty("培训附件")
private String filePath;
}

20
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreVO.java

@ -0,0 +1,20 @@
package com.hnac.hzims.safeproduct.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author liwen
* @date 2023-12-25
*/
@Data
@ApiModel(value = "考试成绩VO类")
public class TestScoreVO {
@ApiModelProperty("姓名")
private String name;
@ApiModelProperty("成绩")
private Integer score;
}

31
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainMonthVO.java

@ -0,0 +1,31 @@
package com.hnac.hzims.safeproduct.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author liwen
* @date 2023-12-25
*/
@Data
@ApiModel(value = "培训月度统计VO类")
public class TrainMonthVO {
@ApiModelProperty("单位")
private String unit;
@ApiModelProperty("应完成次数")
private Long scheduledTrainNum;
@ApiModelProperty("已完成次数")
private Long finishedTrainNum;
@ApiModelProperty("未完成次数")
private Long unfinishedTrainNum;
@ApiModelProperty("完成率")
private BigDecimal completionRate;
}

53
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainYearVO.java

@ -0,0 +1,53 @@
package com.hnac.hzims.safeproduct.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author liwen
* @date 2023-12-25
*/
@Data
@ApiModel(value = "培训年度统计VO类")
public class TrainYearVO {
@ApiModelProperty("单位")
private String unit;
@ApiModelProperty("1月完成数")
private Long januaryNum;
@ApiModelProperty("2月完成数")
private Long februaryNum;
@ApiModelProperty("3月完成数")
private Long marchNum;
@ApiModelProperty("4月完成数")
private Long aprilNum;
@ApiModelProperty("5月完成数")
private Long mayNum;
@ApiModelProperty("6月完成数")
private Long juneNum;
@ApiModelProperty("7月完成数")
private Long julyNum;
@ApiModelProperty("8月完成数")
private Long augustNum;
@ApiModelProperty("9月完成数")
private Long septemberNum;
@ApiModelProperty("10月完成数")
private Long octoberNum;
@ApiModelProperty("11月完成数")
private Long novemberNum;
@ApiModelProperty("12月完成数")
private Long decemberNum;
}

261
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java

@ -0,0 +1,261 @@
package com.hnac.hzims.safeproduct.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.utils.Condition;
import com.hnac.hzims.safeproduct.dto.TestDTO;
import com.hnac.hzims.safeproduct.dto.TestScoreDTO;
import com.hnac.hzims.safeproduct.dto.TrainRecordDTO;
import com.hnac.hzims.safeproduct.entity.TestEntity;
import com.hnac.hzims.safeproduct.entity.TrainPlanEntity;
import com.hnac.hzims.safeproduct.entity.TrainRecordEntity;
import com.hnac.hzims.safeproduct.service.ITestScoreService;
import com.hnac.hzims.safeproduct.service.ITestService;
import com.hnac.hzims.safeproduct.service.ITrainPlanService;
import com.hnac.hzims.safeproduct.service.ITrainRecordService;
import com.hnac.hzims.safeproduct.vo.TestScoreVO;
import com.hnac.hzims.safeproduct.vo.TrainMonthVO;
import com.hnac.hzims.safeproduct.vo.TrainYearVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.tool.api.R;
import org.springblade.system.feign.ISysClient;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
/**
* 培训管理接口类
*
* @author liwen
* @date 2023-12-25
*/
@RestController
@AllArgsConstructor
@RequestMapping("/train")
@Api(value = "培训管理", tags = "培训管理接口")
public class TrainController extends BladeController {
private final ITrainPlanService trainPlanService;
private final ITrainRecordService trainRecordService;
private final ITestService testService;
private final ITestScoreService testScoreService;
private final ISysClient sysClient;
@PostMapping("/saveTrainPlan")
@ApiOperation(value = "新增培训计划")
@ApiOperationSupport(order = 1)
public R saveTrainPlan(@Valid @RequestBody TrainPlanEntity trainPlanEntity) {
return R.status(trainPlanService.save(trainPlanEntity));
}
@PostMapping("/updateTrainPlan")
@ApiOperation(value = "修改培训计划")
@ApiOperationSupport(order = 2)
public R updateTrainPlan(@Valid @RequestBody TrainPlanEntity trainPlanEntity) {
return R.status(trainPlanService.updateById(trainPlanEntity));
}
@PostMapping("/removeTrainPlan")
@ApiOperation(value = "删除培训计划")
@ApiOperationSupport(order = 3)
public R removeTrainPlan(@RequestParam Long id) {
return R.status(trainPlanService.removeTrainPlan(id));
}
@GetMapping("/trainPlanDetail")
@ApiOperation(value = "培训计划详情")
@ApiOperationSupport(order = 4)
public R<TrainPlanEntity> trainPlanDetail(@RequestParam Long id) {
return R.data(trainPlanService.getById(id));
}
@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")
})
@ApiOperation(value = "培训计划分页")
@ApiOperationSupport(order = 5)
public R<IPage<TrainPlanEntity>> trainPlanPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<TrainPlanEntity> page = trainPlanService.page(Condition.getPage(query), Condition.getQueryWrapper(param, TrainPlanEntity.class));
return R.data(page);
}
@PostMapping("/saveTrainRecord")
@ApiOperation(value = "新增培训记录")
@ApiOperationSupport(order = 6)
public R saveTrainRecord(@Valid @RequestBody TrainRecordEntity trainRecordEntity) {
return R.status(trainRecordService.saveTrainRecord(trainRecordEntity));
}
@PostMapping("/updateTrainRecord")
@ApiOperation(value = "修改培训记录")
@ApiOperationSupport(order = 7)
public R updateTrainRecord(@Valid @RequestBody TrainRecordEntity trainRecordEntity) {
return R.status(trainRecordService.updateById(trainRecordEntity));
}
@PostMapping("/removeTrainRecord")
@ApiOperation(value = "删除培训记录")
@ApiOperationSupport(order = 8)
public R removeTrainRecord(@RequestParam Long id) {
return R.status(trainRecordService.removeTrainRecord(id));
}
@GetMapping("/trainRecordDetail")
@ApiOperation(value = "培训记录详情")
@ApiOperationSupport(order = 9)
public R<TrainRecordEntity> trainRecordDetail(@RequestParam Long id) {
return R.data(trainRecordService.getById(id));
}
@GetMapping("/trainRecordPage")
@ApiImplicitParams({
@ApiImplicitParam(name = "trainPlanId", value = "培训计划id", dataType = "query", paramType = "string")
})
@ApiOperation(value = "培训记录分页")
@ApiOperationSupport(order = 10)
public R<IPage<TrainRecordEntity>> trainRecordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<TrainRecordEntity> page = trainRecordService.page(Condition.getPage(query), Condition.getQueryWrapper(param, TrainRecordEntity.class));
return R.data(page);
}
@GetMapping("/getTrainRecordNameList")
@ApiOperation(value = "培训记录名称列表")
@ApiOperationSupport(order = 11)
public R<List<TrainRecordDTO>> getTrainRecordNameList(@RequestParam String trainPlanId) {
List<TrainRecordDTO> list = trainRecordService.getTrainRecordNameList(trainPlanId);
return R.data(list);
}
@PostMapping("/saveTest")
@ApiOperation(value = "新增考试")
@ApiOperationSupport(order = 12)
public R saveTest(@Valid @RequestBody TestEntity testEntity) {
return testService.saveTest(testEntity);
}
@PostMapping("/updateTest")
@ApiOperation(value = "修改考试")
@ApiOperationSupport(order = 13)
public R updateTest(@Valid @RequestBody TestEntity testEntity) {
return R.status(testService.updateTest(testEntity));
}
@PostMapping("/removeTest")
@ApiOperation(value = "删除考试")
@ApiOperationSupport(order = 14)
public R removeTest(@RequestParam Long id) {
return R.status(testService.removeTest(id));
}
@GetMapping("/testDetail")
@ApiOperation(value = "考试详情")
@ApiOperationSupport(order = 15)
public R<TestEntity> testDetail(@RequestParam Long id) {
return R.data(testService.getById(id));
}
@GetMapping("/testPage")
@ApiImplicitParams({
@ApiImplicitParam(name = "trainRecordId", value = "培训记录id", dataType = "query", paramType = "string")
})
@ApiOperation(value = "考试记录分页")
@ApiOperationSupport(order = 16)
public R<IPage<TestEntity>> testPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<TestEntity> page = testService.page(Condition.getPage(query), Condition.getQueryWrapper(param, TestEntity.class));
return R.data(page);
}
@GetMapping("/getTestNameList")
@ApiOperation(value = "考试记录名称列表")
@ApiOperationSupport(order = 17)
public R<List<TestDTO>> getTestNameList(@RequestParam String trainPlanId) {
List<TestDTO> list = testService.getTestNameList(trainPlanId);
return R.data(list);
}
@GetMapping("/testScoreList")
@ApiOperation(value = "考试成绩列表")
@ApiOperationSupport(order = 18)
public R<List<TestScoreVO>> testScoreList(@RequestParam Long testId) {
List<TestScoreVO> list = testScoreService.testScoreList(testId);
return R.data(list);
}
@PostMapping("/updateBatchScore")
@ApiOperation(value = "批量填写分数")
@ApiOperationSupport(order = 19)
public R updateBatchScore(TestScoreDTO testScoreDTO) {
return R.status(testScoreService.updateBatchScore(testScoreDTO));
}
@GetMapping("/trainDataByMonth")
@ApiOperation(value = "培训月度统计表")
@ApiOperationSupport(order = 20)
public R<IPage<TrainMonthVO>> trainDataByMonth(@RequestParam String month, Query query) {
IPage<TrainMonthVO> page = trainPlanService.dataByMonth(month, query);
return R.data(page);
}
@GetMapping("/trainDataByYear")
@ApiOperation(value = "培训年度统计表")
@ApiOperationSupport(order = 21)
public R<IPage<TrainYearVO>> trainDataByYear(@RequestParam String year, Query query) {
IPage<TrainYearVO> page = trainPlanService.dataByYear(year, query);
return R.data(page);
}
@GetMapping("/getDeptName")
@ApiOperation(value = "获取所属机构名")
@ApiOperationSupport(order = 22)
public R<String> getDeptName() {
BladeUser bladeUser = getUser();
String deptId = bladeUser.getDeptId();
if (StringUtils.isNotBlank(deptId)) {
return sysClient.getDeptName(Long.valueOf(deptId));
}
return R.data(null, "所属机构为空");
}
@GetMapping("/exportTrainPlanData")
@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")
})
@ApiOperation(value = "培训计划数据导出")
@ApiOperationSupport(order = 23)
public void exportTrainPlanData(@ApiIgnore @RequestParam Map<String, Object> param, HttpServletResponse response) {
trainPlanService.exportTrainPlanData(param, response);
}
@GetMapping("/exportTrainRecordData")
@ApiImplicitParams({
@ApiImplicitParam(name = "scheduledStartTime", value = "计划开始时间", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string")
})
@ApiOperation(value = "培训记录数据导出")
@ApiOperationSupport(order = 24)
public void exportTrainRecordData(@ApiIgnore @RequestParam Map<String, Object> param, HttpServletResponse response) {
trainRecordService.exportTrainRecordData(param, response);
}
}

25
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.java

@ -0,0 +1,25 @@
package com.hnac.hzims.safeproduct.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.safeproduct.dto.TestDTO;
import com.hnac.hzims.safeproduct.entity.TestEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 考试记录Mapper类
*
* @author liwen
* @date 2023-12-25
*/
@Mapper
public interface TestMapper extends BaseMapper<TestEntity> {
/**
* 查询考试记录名称列表
* @param trainPlanId 培训计划id
* @return 考试记录名称列表
*/
List<TestDTO> getTestNameList(String trainPlanId);
}

14
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.xml

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.safeproduct.mapper.TestMapper">
<select id="getTestNameList" resultType="com.hnac.hzims.safeproduct.dto.TestDTO">
SELECT
id, test_name
FROM
hzims_test
WHERE
is_deleted = 0
AND train_plan_id = #{trainPlanId}
</select>
</mapper>

25
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestScoreMapper.java

@ -0,0 +1,25 @@
package com.hnac.hzims.safeproduct.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.safeproduct.entity.TestScoreEntity;
import com.hnac.hzims.safeproduct.vo.TestScoreVO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 考试成绩Mapper类
*
* @author liwen
* @date 2023-12-25
*/
@Mapper
public interface TestScoreMapper extends BaseMapper<TestScoreEntity> {
/**
* 查询考试成绩列表
* @param testId 考试记录id
* @return 考试成绩列表
*/
List<TestScoreVO> testScoreList(Long testId);
}

18
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestScoreMapper.xml

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.safeproduct.mapper.TestScoreMapper">
<select id="testScoreList" resultType="com.hnac.hzims.safeproduct.vo.TestScoreVO">
SELECT
name, score
FROM
hzims_test_score
WHERE
is_deleted = 0
<if test="testId != null and testId != ''">
AND test_id = #{testId}
</if>
ORDER BY
score DESC
</select>
</mapper>

53
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.java

@ -0,0 +1,53 @@
package com.hnac.hzims.safeproduct.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.safeproduct.dto.AnalysisYearDTO;
import com.hnac.hzims.safeproduct.entity.TrainPlanEntity;
import com.hnac.hzims.safeproduct.vo.TrainMonthVO;
import com.hnac.hzims.safeproduct.vo.TrainYearVO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 培训计划Mapper类
*
* @author liwen
* @date 2023-12-25
*/
@Mapper
public interface TrainPlanMapper extends BaseMapper<TrainPlanEntity> {
/**
* 查询当月各单位的培训计划总数
* @param page 分页类
* @param month 月份
* @return 当月培训计划总数
*/
IPage<TrainMonthVO> selectByMonth(IPage<TrainMonthVO> page, String month);
/**
* 查询当月各单位已完成的培训计划数据
* @param page1 分页类
* @param month 月份
* @return 当月已完成培训计划数
*/
IPage<TrainMonthVO> selectFinishedDataByMonth(IPage<TrainMonthVO> page1, String month);
/**
* 查询当年的所有单位
* @param page 分页类
* @param year 年份
* @return 年度单位数据
*/
IPage<TrainYearVO> selectUnitByYear(IPage<TrainYearVO> page, String year);
/**
* 查询各单位全年已完成的培训计划数
* @param unitList 单元列表
* @param year 年份
* @return 单位各月的培训计划数
*/
List<AnalysisYearDTO> selectFinishedDataByUnit(List<String> unitList, String year);
}

64
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.xml

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.safeproduct.mapper.TrainPlanMapper">
<select id="selectByMonth" resultType="com.hnac.hzims.safeproduct.vo.TrainMonthVO">
SELECT
unit, count(1) as scheduled_train_num
FROM
hzims_train_plan
WHERE
is_deleted = 0
AND scheduled_train_time like concat('%', #{month}, '%')
GROUP BY
unit
ORDER BY
unit
</select>
<select id="selectFinishedDataByMonth" resultType="com.hnac.hzims.safeproduct.vo.TrainMonthVO">
SELECT
unit, count(1) as finished_train_num
FROM
hzims_train_plan
WHERE
is_deleted = 0
AND scheduled_train_time like concat('%', #{month}, '%')
AND train_status = 'FINISHED'
GROUP BY
unit
ORDER BY
unit
</select>
<select id="selectUnitByYear" resultType="com.hnac.hzims.safeproduct.vo.TrainYearVO">
SELECT
distinct unit
FROM
hzims_train_plan
WHERE
is_deleted = 0
AND actual_train_time like concat('%', #{year}, '%')
ORDER BY
unit
</select>
<select id="selectFinishedDataByUnit" resultType="com.hnac.hzims.safeproduct.dto.AnalysisYearDTO">
SELECT
unit, DATE_FORMAT(actual_train_time, '%m') as dateTime, count(1) as finished_num
FROM
hzims_train_plan
WHERE
is_deleted = 0
AND actual_train_time like concat('%', #{year}, '%')
AND train_status = 'FINISHED'
AND unit in
<foreach collection="unitList" item="unit" open="(" close=")" separator=",">
#{unit}
</foreach>
GROUP BY
unit, DATE_FORMAT(actual_train_time, '%m')
ORDER BY
unit
</select>
</mapper>

25
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.java

@ -0,0 +1,25 @@
package com.hnac.hzims.safeproduct.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.safeproduct.dto.TrainRecordDTO;
import com.hnac.hzims.safeproduct.entity.TrainRecordEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 培训记录Mapper类
*
* @author liwen
* @date 2023-12-25
*/
@Mapper
public interface TrainRecordMapper extends BaseMapper<TrainRecordEntity> {
/**
* 查询培训记录名称列表
* @param trainPlanId 培训计划id
* @return 培训记录名称列表
*/
List<TrainRecordDTO> getTrainRecordNameList(String trainPlanId);
}

18
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.xml

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.safeproduct.mapper.TrainRecordMapper">
<select id="getTrainRecordNameList" resultType="com.hnac.hzims.safeproduct.dto.TrainRecordDTO">
SELECT
id, train_record_name
FROM
hzims_train_record
WHERE
is_deleted = 0
<if test="trainPlanId != null and trainPlanId != ''">
AND train_plan_id = #{trainPlanId}
</if>
ORDER BY
create_time DESC
</select>
</mapper>

45
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestScoreService.java

@ -0,0 +1,45 @@
package com.hnac.hzims.safeproduct.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.dto.TestScoreDTO;
import com.hnac.hzims.safeproduct.entity.TestScoreEntity;
import com.hnac.hzims.safeproduct.vo.TestScoreVO;
import java.util.List;
/**
* 考试成绩服务类
*
* @author liwen
* @date 2023-12-25
*/
public interface ITestScoreService extends IService<TestScoreEntity> {
/**
* 查询考试成绩列表
* @param testId 考试记录id
* @return 考试成绩列表
*/
List<TestScoreVO> testScoreList(Long testId);
/**
* 批量填写分数
* @param testScoreDTO 考试成绩DTO类
* @return true-成功false-失败
*/
boolean updateBatchScore(TestScoreDTO testScoreDTO);
/**
* 删除关联考试成绩
* @param testId 考试记录id
* @return true-成功false-失败
*/
boolean removeRelativeTestScore(Long testId);
/**
* 查询关联考试成绩
* @param testId 考试记录id
* @return 考试成绩列表
*/
List<TestScoreEntity> getRelativeTestScore(Long testId);
}

66
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestService.java

@ -0,0 +1,66 @@
package com.hnac.hzims.safeproduct.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.dto.TestDTO;
import com.hnac.hzims.safeproduct.entity.TestEntity;
import org.springblade.core.tool.api.R;
import java.util.List;
/**
* 考试记录服务类
*
* @author liwen
* @date 2023-12-25
*/
public interface ITestService extends IService<TestEntity> {
/**
* 新增考试记录
* @param testEntity 考试记录实体类
* @return 返回结果封装类
*/
R saveTest(TestEntity testEntity);
/**
* 根据编码查询考试记录
* @param code 编码
* @return 考试记录实体类
*/
TestEntity getTestByCode(String code);
/**
* 删除关联考试记录
* @param trainRecordId 培训记录id
* @return true-成功false-失败
*/
boolean removeRelativeTest(Long trainRecordId);
/**
* 查询关联考试记录
* @param trainRecordId 培训记录id
* @return 考试记录列表
*/
List<TestEntity> getRelativeTest(Long trainRecordId);
/**
* 删除考试记录
* @param id 考试记录id
* @return true-成功false-失败
*/
boolean removeTest(Long id);
/**
* 查询考试记录名称列表
* @param trainPlanId 培训计划id
* @return 考试记录名称列表
*/
List<TestDTO> getTestNameList(String trainPlanId);
/**
* 修改考试记录
* @param testEntity 考试记录实体类
* @return true-成功false-失败
*/
boolean updateTest(TestEntity testEntity);
}

50
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainPlanService.java

@ -0,0 +1,50 @@
package com.hnac.hzims.safeproduct.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.entity.TrainPlanEntity;
import com.hnac.hzims.safeproduct.vo.TrainMonthVO;
import com.hnac.hzims.safeproduct.vo.TrainYearVO;
import org.springblade.core.mp.support.Query;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
/**
* 培训计划服务类
*
* @author liwen
* @date 2023-12-25
*/
public interface ITrainPlanService extends IService<TrainPlanEntity> {
/**
* 月度培训数据
* @param month 月份
* @param query 分页类
* @return 月度培训分页
*/
IPage<TrainMonthVO> dataByMonth(String month, Query query);
/**
* 年度培训数据
* @param year 年份
* @param query 分页类
* @return 年度培训分页
*/
IPage<TrainYearVO> dataByYear(String year, Query query);
/**
* 删除培训计划
* @param id 培训计划id
* @return true-成功false-失败
*/
boolean removeTrainPlan(Long id);
/**
* 培训计划数据导出
* @param param 入参
* @param response 响应类
*/
void exportTrainPlanData(Map<String, Object> param, HttpServletResponse response);
}

60
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainRecordService.java

@ -0,0 +1,60 @@
package com.hnac.hzims.safeproduct.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.dto.TrainRecordDTO;
import com.hnac.hzims.safeproduct.entity.TrainRecordEntity;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 培训记录服务类
*
* @author liwen
* @date 2023-12-25
*/
public interface ITrainRecordService extends IService<TrainRecordEntity> {
/**
* 新增培训记录
* @param trainRecordEntity 培训记录实体类
* @return true-成功false-失败
*/
boolean saveTrainRecord(TrainRecordEntity trainRecordEntity);
/**
* 删除关联培训记录
* @param trainPlanId 培训计划id
* @return true-成功false-失败
*/
boolean removeRelativeTrainRecord(Long trainPlanId);
/**
* 查询关联培训记录
* @param trainPlanId 培训计划id
* @return 培训记录列表
*/
List<TrainRecordEntity> getRelativeTrainRecord(Long trainPlanId);
/**
* 删除培训记录
* @param id 培训记录id
* @return true-成功false-失败
*/
boolean removeTrainRecord(Long id);
/**
* 查询培训记录名称列表
* @param trainPlanId 培训计划id
* @return 培训记录名称列表
*/
List<TrainRecordDTO> getTrainRecordNameList(String trainPlanId);
/**
* 培训记录数据导出
* @param param 入参
* @param response 响应类
*/
void exportTrainRecordData(Map<String, Object> param, HttpServletResponse response);
}

75
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java

@ -0,0 +1,75 @@
package com.hnac.hzims.safeproduct.service.impl;
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.safeproduct.dto.TestScoreDTO;
import com.hnac.hzims.safeproduct.entity.TestScoreEntity;
import com.hnac.hzims.safeproduct.mapper.TestScoreMapper;
import com.hnac.hzims.safeproduct.service.ITestScoreService;
import com.hnac.hzims.safeproduct.vo.TestScoreVO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* 考试成绩服务实现类
*
* @author liwen
* @date 2023-12-25
*/
@Service
public class TestScoreServiceImpl extends ServiceImpl<TestScoreMapper, TestScoreEntity> implements ITestScoreService {
/**
* 查询考试成绩列表
*/
@Override
public List<TestScoreVO> testScoreList(Long testId) {
return baseMapper.testScoreList(testId);
}
/**
* 批量填写分数
*/
@Override
public boolean updateBatchScore(TestScoreDTO testScoreDTO) {
List<TestScoreVO> scoreList = testScoreDTO.getScoreList();
List<TestScoreEntity> testScoreEntities = new ArrayList<>();
scoreList.forEach(score -> {
TestScoreEntity testScoreEntity = new TestScoreEntity();
BeanUtils.copyProperties(score, testScoreEntity);
testScoreEntities.add(testScoreEntity);
});
return this.updateBatchById(testScoreEntities);
}
/**
* 删除关联考试成绩
*/
@Override
public boolean removeRelativeTestScore(Long testId) {
// 查询关联考试成绩
QueryWrapper<TestScoreEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(TestScoreEntity::getTestId, testId);
List<TestScoreEntity> testScoreList = this.list(queryWrapper);
// 若无关联考试成绩,直接返回true
if (CollectionUtils.isEmpty(testScoreList)) {
return true;
}
// 删除关联考试成绩
return this.removeByIds(testScoreList);
}
/**
* 查询关联考试成绩
*/
@Override
public List<TestScoreEntity> getRelativeTestScore(Long testId) {
QueryWrapper<TestScoreEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(TestScoreEntity::getTestId, testId);
return this.list(queryWrapper);
}
}

220
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java

@ -0,0 +1,220 @@
package com.hnac.hzims.safeproduct.service.impl;
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;
import com.hnac.hzims.safeproduct.entity.TestScoreEntity;
import com.hnac.hzims.safeproduct.entity.TrainPlanEntity;
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.vo.TestScoreVO;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 考试记录服务实现类
*
* @author liwen
* @date 2023-12-25
*/
@Service
public class TestServiceImpl extends ServiceImpl<TestMapper, TestEntity> implements ITestService {
@Autowired
ITestScoreService testScoreService;
@Resource
TrainPlanMapper trainPlanMapper;
/**
* 新增考试记录
*/
@Transactional(rollbackFor = Exception.class)
@Override
public R saveTest(TestEntity testEntity) {
// 判断培训计划是否需要考试,若不需要,则无法新增考试记录
TrainPlanEntity trainPlanEntity = trainPlanMapper.selectById(testEntity.getTrainPlanId());
if (trainPlanEntity.getIsTest().equals(SafeProductConstant.TRAIN_PLAN_HAS_NO_TEST)) {
return R.fail("该培训计划无法新增考试");
}
// 获取当月时间(yyyymm)
String currentMonth = DatePattern.SIMPLE_MONTH_FORMAT.format(new Date());
// 查询是否存在同月编号
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;
}
}
testEntity.setCode(code);
boolean saveTest = this.save(testEntity);
// 若新增考试记录成功,添加相关的参考人员数据
if (saveTest) {
// 查询考试记录
TestEntity test = getTestByCode(testEntity.getCode());
// 获取姓名数组
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);
}
return R.status(testScoreService.saveBatch(scoreList));
}
return R.fail("新增考试记录失败");
}
/**
* 根据编码查询考试记录
*/
@Override
public TestEntity getTestByCode(String code) {
QueryWrapper<TestEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(TestEntity::getCode, code);
return this.getOne(queryWrapper);
}
/**
* 删除关联考试记录
*/
@Override
public boolean removeRelativeTest(Long trainRecordId) {
// 查询关联考试记录
List<TestEntity> testList = getRelativeTest(trainRecordId);
// 若无关联考试记录,直接返回true
if (CollectionUtils.isEmpty(testList)) {
return true;
}
// 删除关联考试记录
boolean remove = this.removeByIds(testList);
// 若删除考试记录成功,删除关联考试成绩
if (remove) {
for (TestEntity test : testList) {
boolean removeTestScore = testScoreService.removeRelativeTestScore(test.getId());
if (!removeTestScore) {
return false;
}
}
return true;
}
return false;
}
/**
* 查询关联考试记录
*/
@Override
public List<TestEntity> getRelativeTest(Long trainRecordId) {
QueryWrapper<TestEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(TestEntity::getTrainRecordId, trainRecordId);
return this.list(queryWrapper);
}
/**
* 删除考试记录
*/
@Transactional(rollbackFor = Exception.class)
@Override
public boolean removeTest(Long id) {
boolean remove = this.removeById(id);
// 若考试记录删除成功,删除关联考试成绩
if (remove) {
return testScoreService.removeRelativeTestScore(id);
}
return false;
}
/**
* 查询考试记录名称列表
*/
@Override
public List<TestDTO> getTestNameList(String trainPlanId) {
return baseMapper.getTestNameList(trainPlanId);
}
/**
* 修改考试记录
*/
@Transactional(rollbackFor = Exception.class)
@Override
public boolean updateTest(TestEntity testEntity) {
// 判断考试人员是否有变化
TestEntity oldTest = getTestByCode(testEntity.getCode());
// 若不存在变化,更新考试记录
if (oldTest.getPeopleName().equals(testEntity.getPeopleName())) {
return this.updateById(testEntity);
}
// 若存在变化,查询并删除关联考试成绩
List<TestScoreEntity> testScoreList = testScoreService.getRelativeTestScore(testEntity.getId());
boolean removeByIds = testScoreService.removeByIds(testScoreList);
// 若删除成功,新增新的考试成绩数据
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);
}
return false;
}
/**
* 查询是否存在同月编号
* @param currentMonth 当月
* @return 存在则返回上一编号否则返回null
*/
private String getLastCode(String currentMonth) {
String month = currentMonth.substring(currentMonth.length() - 2);
List<TestEntity> list = getTestByMonth(month);
if (CollectionUtils.isEmpty(list)) {
return null;
}
return list.get(0).getCode();
}
/**
* 查询当月考试记录
* @param month 当月
* @return 当月考试记录
*/
public List<TestEntity> getTestByMonth(String month) {
QueryWrapper<TestEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().like(TestEntity::getCreateTime, month)
.orderByDesc(TestEntity::getCode);
return this.list(queryWrapper);
}
}

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

@ -0,0 +1,228 @@
package com.hnac.hzims.safeproduct.service.impl;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.converters.longconverter.LongStringConverter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.safeproduct.dto.AnalysisYearDTO;
import com.hnac.hzims.safeproduct.entity.RehearsalRecordEntity;
import com.hnac.hzims.safeproduct.entity.TrainPlanEntity;
import com.hnac.hzims.safeproduct.entity.TrainRecordEntity;
import com.hnac.hzims.safeproduct.mapper.TrainPlanMapper;
import com.hnac.hzims.safeproduct.service.ITestService;
import com.hnac.hzims.safeproduct.service.ITrainPlanService;
import com.hnac.hzims.safeproduct.service.ITrainRecordService;
import com.hnac.hzims.safeproduct.vo.TrainMonthVO;
import com.hnac.hzims.safeproduct.vo.TrainYearVO;
import org.springblade.core.log.exception.ServiceException;
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;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* 培训计划服务实现类
*
* @author liwen
* @date 2023-12-25
*/
@Service
public class TrainPlanServiceImpl extends ServiceImpl<TrainPlanMapper, TrainPlanEntity> implements ITrainPlanService {
@Autowired
ITrainRecordService trainRecordService;
@Autowired
ITestService testService;
/**
* 月度培训数据
*/
@Override
public IPage<TrainMonthVO> dataByMonth(String month, Query query) {
// 查询当月各单位的培训计划总数
IPage<TrainMonthVO> page = new Page<>(query.getCurrent(), query.getSize());
IPage<TrainMonthVO> unitPage = baseMapper.selectByMonth(page, month);
List<TrainMonthVO> unitList = unitPage.getRecords();
// 查询当月各单位已完成的培训数据
IPage<TrainMonthVO> page1 = new Page<>(query.getCurrent(), query.getSize());
IPage<TrainMonthVO> finishedPage = baseMapper.selectFinishedDataByMonth(page1, month);
List<TrainMonthVO> finishedList = finishedPage.getRecords();
// 处理统计数据
for (TrainMonthVO unit : unitList) {
Long taskNum = unit.getScheduledTrainNum();
Optional<TrainMonthVO> finishedRehearsal = finishedList.stream().filter(x -> x.getUnit().equals(unit.getUnit())).findFirst();
Long finishedTaskNum = finishedRehearsal.isPresent() ? finishedRehearsal.get().getFinishedTrainNum() : 0L;
unit.setFinishedTrainNum(finishedTaskNum);
unit.setUnfinishedTrainNum(taskNum - finishedTaskNum);
BigDecimal taskDecimal = new BigDecimal(taskNum);
BigDecimal finishedDecimal = new BigDecimal(finishedTaskNum);
unit.setCompletionRate(finishedDecimal.divide(taskDecimal, 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100"))
.setScale(2, RoundingMode.HALF_UP));
}
unitPage.setRecords(unitList);
return unitPage;
}
/**
* 年度培训数据
*/
@Override
public IPage<TrainYearVO> dataByYear(String year, Query query) {
IPage<TrainYearVO> page = new Page<>(query.getCurrent(), query.getSize());
// 查询当年的所有单位
IPage<TrainYearVO> unitPage = baseMapper.selectUnitByYear(page, year);
List<TrainYearVO> records = unitPage.getRecords();
// 若无数据,返回空页面
if (CollectionUtils.isEmpty(records)) {
return unitPage;
}
List<String> unitList = records.stream().map(TrainYearVO::getUnit).collect(Collectors.toList());
// 查询各单位全年已完成的培训计划数
List<AnalysisYearDTO> unitMonthDataList = baseMapper.selectFinishedDataByUnit(unitList, year);
// 将各单位每个月的培训计划数据写入统计列表
unitMonthDataList.forEach(data -> {
TrainYearVO trainYearVO = records.stream().filter(x -> x.getUnit().equals(data.getUnit()))
.collect(Collectors.toList()).get(0);
// 根据月份匹配写入对应字段
switch (data.getDateTime()) {
case "01":
trainYearVO.setJanuaryNum(data.getFinishedNum());
break;
case "02":
trainYearVO.setFebruaryNum(data.getFinishedNum());
break;
case "03":
trainYearVO.setMarchNum(data.getFinishedNum());
break;
case "04":
trainYearVO.setAprilNum(data.getFinishedNum());
break;
case "05":
trainYearVO.setMayNum(data.getFinishedNum());
break;
case "06":
trainYearVO.setJuneNum(data.getFinishedNum());
break;
case "07":
trainYearVO.setJulyNum(data.getFinishedNum());
break;
case "08":
trainYearVO.setAugustNum(data.getFinishedNum());
break;
case "09":
trainYearVO.setSeptemberNum(data.getFinishedNum());
break;
case "10":
trainYearVO.setOctoberNum(data.getFinishedNum());
break;
case "11":
trainYearVO.setNovemberNum(data.getFinishedNum());
break;
case "12":
trainYearVO.setDecemberNum(data.getFinishedNum());
}
});
unitPage.setRecords(records);
return unitPage;
}
/**
* 删除培训计划
*/
@Transactional(rollbackFor = Exception.class)
@Override
public boolean removeTrainPlan(Long id) {
boolean remove = this.removeById(id);
// 若培训计划删除成功,删除关联培训记录
if (remove) {
return trainRecordService.removeRelativeTrainRecord(id);
}
return false;
}
/**
* 培训计划数据导出
*/
@Override
public void exportTrainPlanData(Map<String, Object> param, HttpServletResponse response) {
ServletOutputStream outputStream = null;
try {
outputStream = response.getOutputStream();
String unit = String.valueOf(param.get("unit"));
String startTime = String.valueOf(param.get("scheduledStartTime"));
String endTime = String.valueOf(param.get("scheduledEndTime"));
List<TrainPlanEntity> rehearsalRecordList = getTrainPlanByUnitAndDate(unit, startTime, endTime);
// 设置响应头
// URLEncoder.encode防止中文乱码
String fileName = URLEncoder.encode("培训计划表", "UTF-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("UTF-8");
// ExcelWriter初始化
ExcelWriter excelWriter = EasyExcel
.write(response.getOutputStream())
.autoCloseStream(Boolean.TRUE)
.registerConverter(new LongStringConverter())
.registerWriteHandler(new SimpleColumnWidthStyleStrategy(25))
.build();
WriteSheet writeSheet = EasyExcel.writerSheet(1, "培训计划表").head(TrainPlanEntity.class)
.build();
excelWriter.write(rehearsalRecordList, writeSheet);
excelWriter.finish();
} catch (Exception e) {
// 重置response
response.reset();
response.setContentType("application/json");
response.setCharacterEncoding("utf-8");
throw new ServiceException("培训计划数据导出异常: " + e.getMessage());
} finally {
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
log.error("培训计划导出响应头输出流关闭异常: " + e.getMessage());
}
}
}
}
/**
* 根据单位和计划时间查询培训计划数据
* @param unit 单位
* @param startTime 计划开始时间
* @param endTime 计划结束时间
* @return 培训计划列表
*/
public List<TrainPlanEntity> getTrainPlanByUnitAndDate(String unit, String startTime, String endTime) {
LambdaQueryWrapper<TrainPlanEntity> queryWrapper = new LambdaQueryWrapper<>();
if (!unit.equals("null")) {
queryWrapper.eq(TrainPlanEntity::getUnit, unit);
}
if (!startTime.equals("null")) {
queryWrapper.ge(TrainPlanEntity::getScheduledStartTime, startTime);
}
if (!endTime.equals("null")) {
queryWrapper.lt(TrainPlanEntity::getScheduledEndTime, endTime);
}
queryWrapper.orderByDesc(TrainPlanEntity::getScheduledEndTime);
return this.list(queryWrapper);
}
}

217
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java

@ -0,0 +1,217 @@
package com.hnac.hzims.safeproduct.service.impl;
import cn.hutool.core.date.DatePattern;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.converters.longconverter.LongStringConverter;
import com.alibaba.excel.util.CollectionUtils;
import com.alibaba.excel.write.metadata.WriteSheet;
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.dto.TrainRecordDTO;
import com.hnac.hzims.safeproduct.entity.RehearsalRecordEntity;
import com.hnac.hzims.safeproduct.entity.TrainPlanEntity;
import com.hnac.hzims.safeproduct.entity.TrainRecordEntity;
import com.hnac.hzims.safeproduct.mapper.TrainRecordMapper;
import com.hnac.hzims.safeproduct.service.ITestService;
import com.hnac.hzims.safeproduct.service.ITrainRecordService;
import org.springblade.core.log.exception.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 培训记录服务实现类
*
* @author liwen
* @date 2023-12-25
*/
@Service
public class TrainRecordServiceImpl extends ServiceImpl<TrainRecordMapper, TrainRecordEntity> implements ITrainRecordService {
@Autowired
ITestService testService;
/**
* 新增培训记录
*/
@Override
public boolean saveTrainRecord(TrainRecordEntity trainRecordEntity) {
// 获取当月时间(yyyymm)
String currentMonth = DatePattern.SIMPLE_MONTH_FORMAT.format(new Date());
// 查询是否存在同月编号
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;
}
}
trainRecordEntity.setCode(code);
return this.save(trainRecordEntity);
}
/**
* 删除关联培训记录
*/
@Transactional(rollbackFor = Exception.class)
@Override
public boolean removeRelativeTrainRecord(Long trainPlanId) {
// 查询关联培训记录
List<TrainRecordEntity> trainRecordList = getRelativeTrainRecord(trainPlanId);
// 若无关联培训记录,直接返回true
if (CollectionUtils.isEmpty(trainRecordList)) {
return true;
}
// 删除关联培训记录
boolean remove = this.removeByIds(trainRecordList);
// 若删除培训记录成功,则删除关联考试记录
if (remove) {
for (TrainRecordEntity trainRecord : trainRecordList) {
boolean removeTest = testService.removeRelativeTest(trainRecord.getId());
if (!removeTest) {
return false;
}
}
return true;
}
return false;
}
/**
* 查询关联培训记录
*/
@Override
public List<TrainRecordEntity> getRelativeTrainRecord(Long trainPlanId) {
QueryWrapper<TrainRecordEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(TrainRecordEntity::getTrainPlanId, trainPlanId);
return this.list(queryWrapper);
}
/**
* 删除培训记录
*/
@Transactional(rollbackFor = Exception.class)
@Override
public boolean removeTrainRecord(Long id) {
boolean remove = this.removeById(id);
// 若培训记录删除成功,删除关联考试记录
if (remove) {
return testService.removeRelativeTest(id);
}
return false;
}
/**
* 查询培训记录名称列表
*/
@Override
public List<TrainRecordDTO> getTrainRecordNameList(String trainPlanId) {
return baseMapper.getTrainRecordNameList(trainPlanId);
}
/**
* 培训记录数据导出
*/
@Override
public void exportTrainRecordData(Map<String, Object> param, HttpServletResponse response) {
ServletOutputStream outputStream = null;
try {
outputStream = response.getOutputStream();
String trainPlanId = String.valueOf(param.get("trainPlanId"));
List<TrainRecordEntity> rehearsalRecordList = getTrainRecordByTrainPlanId(trainPlanId);
// 设置响应头
// URLEncoder.encode防止中文乱码
String fileName = URLEncoder.encode("培训记录表", "UTF-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("UTF-8");
// ExcelWriter初始化
ExcelWriter excelWriter = EasyExcel
.write(response.getOutputStream())
.autoCloseStream(Boolean.TRUE)
.registerConverter(new LongStringConverter())
.registerWriteHandler(new SimpleColumnWidthStyleStrategy(25))
.build();
WriteSheet writeSheet = EasyExcel.writerSheet(1, "培训记录表").head(TrainRecordEntity.class)
.build();
excelWriter.write(rehearsalRecordList, writeSheet);
excelWriter.finish();
} catch (Exception e) {
// 重置response
response.reset();
response.setContentType("application/json");
response.setCharacterEncoding("utf-8");
throw new ServiceException("培训记录数据导出异常: " + e.getMessage());
} finally {
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
log.error("培训记录导出响应头输出流关闭异常: " + e.getMessage());
}
}
}
}
/**
* 查询是否存在同月编号
* @param currentMonth 当月
* @return 存在则返回上一编号否则返回null
*/
private String getLastCode(String currentMonth) {
String month = currentMonth.substring(currentMonth.length() - 2);
List<TrainRecordEntity> list = getTrainByMonth(month);
if (CollectionUtils.isEmpty(list)) {
return null;
}
return list.get(0).getCode();
}
/**
* 查询当月培训记录
* @param month 当月
* @return 当月培训记录
*/
public List<TrainRecordEntity> getTrainByMonth(String month) {
QueryWrapper<TrainRecordEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().like(TrainRecordEntity::getCreateTime, month)
.orderByDesc(TrainRecordEntity::getCode);
return this.list(queryWrapper);
}
/**
* 根据培训计划id查询培训记录数据
* @param trainPlanId 培训计划id
* @return 培训记录列表
*/
public List<TrainRecordEntity> getTrainRecordByTrainPlanId(String trainPlanId) {
LambdaQueryWrapper<TrainRecordEntity> queryWrapper = new LambdaQueryWrapper<>();
if (!trainPlanId.equals("null")) {
queryWrapper.ge(TrainRecordEntity::getTrainPlanId, trainPlanId);
}
queryWrapper.orderByDesc(TrainRecordEntity::getActualEndTime);
return this.list(queryWrapper);
}
}

116
hzims-service/safeproduct/src/main/resources/db/1.0.1.sql

@ -11,7 +11,7 @@ create table document_management
) comment '文档管理'; ) comment '文档管理';
CREATE TABLE `hzims`.`hzims_rehearsal_record` ( CREATE TABLE `hzims_rehearsal_plan` (
`id` bigint(20) NOT NULL COMMENT '主键id', `id` bigint(20) NOT NULL COMMENT '主键id',
`code` varchar(50) NOT NULL COMMENT '编号', `code` varchar(50) NOT NULL COMMENT '编号',
`unit` varchar(50) NOT NULL COMMENT '单位', `unit` varchar(50) NOT NULL COMMENT '单位',
@ -38,4 +38,116 @@ CREATE TABLE `hzims`.`hzims_rehearsal_record` (
`status` int(2) NOT NULL DEFAULT '1' COMMENT '状态', `status` int(2) NOT NULL DEFAULT '1' COMMENT '状态',
`is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除', `is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='演练记录表' ROW_FORMAT=Dynamic; ) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='演练计划表' ROW_FORMAT=Dynamic;
CREATE TABLE `hzims_rehearsal_record` (
`id` bigint(20) NOT NULL COMMENT '主键id',
`code` varchar(50) NOT NULL COMMENT '编号',
`unit` varchar(50) NOT NULL COMMENT '单位',
`subject` varchar(50) NOT NULL COMMENT '演练科目',
`scheduled_start_time` datetime NOT NULL COMMENT '演练计划开始时间',
`scheduled_end_time` datetime NOT NULL COMMENT '演练计划结束时间',
`location` varchar(255) NOT NULL COMMENT '演练地点',
`people_num` int(10) NOT NULL DEFAULT '0' COMMENT '参演人数',
`people_name` varchar(5000) DEFAULT '' COMMENT '参演人员',
`commander` varchar(10) NOT NULL COMMENT '总指挥',
`actual_start_time` datetime DEFAULT NULL COMMENT '演练实际开始时间',
`actual_end_time` datetime DEFAULT NULL COMMENT '演练实际结束时间',
`record` varchar(250) DEFAULT '' COMMENT '演练记录',
`comment` varchar(250) DEFAULT '' DEFAULT '' COMMENT '演练评价',
`rehearsal_method` varchar(20) DEFAULT '' COMMENT '演练方式',
`rehearsal_status` varchar(20) NOT NULL DEFAULT 'WAITING' COMMENT '演练状态',
`img_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '演练图片',
`file_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '演练附件',
`create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人',
`create_dept` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建部门',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_user` bigint(20) DEFAULT '-1' COMMENT '更新人',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
`status` int(2) NOT NULL DEFAULT '1' COMMENT '状态',
`is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='演练记录表' ROW_FORMAT=Dynamic;
CREATE TABLE `hzims_train_plan` (
`id` bigint(20) NOT NULL COMMENT '主键id',
`unit` varchar(50) NOT NULL COMMENT '单位',
`scheduled_start_time` datetime NOT NULL COMMENT '计划培训开始时间',
`scheduled_end_time` datetime NOT NULL COMMENT '计划培训结束时间',
`lesson` varchar(255) NOT NULL COMMENT '培训课程',
`location` varchar(255) NOT NULL COMMENT '培训地点',
`train_method` varchar(20) DEFAULT '' COMMENT '培训方式',
`teacher` varchar(20) NOT NULL DEFAULT '' COMMENT '培训讲师',
`train_status` varchar(20) NOT NULL DEFAULT 'WAITING' COMMENT '培训状态',
`is_test` int(2) NOT NULL DEFAULT '0' COMMENT '关联考试:0-否,1-是',
`create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人',
`create_dept` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建部门',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_user` bigint(20) DEFAULT '-1' COMMENT '更新人',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
`status` int(2) NOT NULL DEFAULT '1' COMMENT '状态',
`is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='培训计划表' ROW_FORMAT=Dynamic;
CREATE TABLE `hzims_train_record` (
`id` bigint(20) NOT NULL COMMENT '主键id',
`train_plan_id` bigint(20) DEFAULT NULL COMMENT '培训计划id',
`train_record_name` varchar(50) NOT NULL DEFAULT '' COMMENT '培训记录名称',
`code` varchar(50) NOT NULL COMMENT '编号',
`people_name` varchar(5000) DEFAULT '' COMMENT '培训学员',
`content` varchar(5000) DEFAULT '' COMMENT '培训内容',
`actual_start_time` datetime DEFAULT NULL COMMENT '实际培训开始时间',
`actual_end_time` datetime DEFAULT NULL COMMENT '实际培训结束时间',
`command` varchar(250) DEFAULT NULL COMMENT '培训评价',
`img_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '培训图片',
`file_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '培训附件',
`create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人',
`create_dept` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建部门',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_user` bigint(20) DEFAULT '-1' COMMENT '更新人',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
`status` int(2) NOT NULL DEFAULT '1' COMMENT '状态',
`is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='培训记录表' ROW_FORMAT=Dynamic;
CREATE TABLE `hzims_test` (
`id` bigint(20) NOT NULL COMMENT '主键id',
`train_plan_id` bigint(20) DEFAULT NULL COMMENT '培训计划id',
`train_record_id` bigint(20) DEFAULT NULL COMMENT '培训记录id',
`test_name` varchar(50) NOT NULL DEFAULT '' COMMENT '考试记录名称',
`code` varchar(50) NOT NULL COMMENT '编号',
`unit` varchar(50) NOT NULL COMMENT '单位',
`test_start_time` datetime NOT NULL COMMENT '考试开始时间',
`test_end_time` datetime NOT NULL COMMENT '考试结束时间',
`location` varchar(255) NOT NULL COMMENT '考试地点',
`subject` varchar(50) NOT NULL COMMENT '考试科目',
`proctor` varchar(20) NOT NULL COMMENT '监考人',
`people_name` varchar(1000) DEFAULT '' COMMENT '参考人员',
`img_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '考试图片',
`file_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '考试附件',
`create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人',
`create_dept` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建部门',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_user` bigint(20) DEFAULT '-1' COMMENT '更新人',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
`status` int(2) NOT NULL DEFAULT '1' COMMENT '状态',
`is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='考试记录表' ROW_FORMAT=Dynamic;
CREATE TABLE `hzims_test_score` (
`id` bigint(20) NOT NULL COMMENT '主键id',
`test_id` bigint(20) DEFAULT NULL COMMENT '考试记录id',
`name` varchar(50) NOT NULL COMMENT '姓名',
`score` int(10) DEFAULT NULL COMMENT '成绩',
`create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人',
`create_dept` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建部门',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_user` bigint(20) DEFAULT '-1' COMMENT '更新人',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
`status` int(2) NOT NULL DEFAULT '1' COMMENT '状态',
`is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='考试成绩表' ROW_FORMAT=Dynamic;
Loading…
Cancel
Save