From 5d8bbbb6787813c958b472a1a79272f54b555371 Mon Sep 17 00:00:00 2001 From: liwen Date: Wed, 27 Dec 2023 09:40:08 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0=E5=9F=B9=E8=AE=AD?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=83=A8=E5=88=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../safeproduct/constants/SafeProductConstant.java | 3 +++ .../hzims/safeproduct/enums/TrainStatusEnum.java | 31 ++++++++++++++++++++++ .../com/hnac/hzims/safeproduct/vo/TestScoreVO.java | 3 +++ .../safeproduct/controller/TrainController.java | 3 ++- .../hzims/safeproduct/mapper/TestScoreMapper.xml | 2 +- .../hzims/safeproduct/mapper/TrainPlanMapper.xml | 12 ++++----- .../service/impl/TestScoreServiceImpl.java | 1 + .../safeproduct/service/impl/TestServiceImpl.java | 5 ++-- .../service/impl/TrainRecordServiceImpl.java | 18 +++++++++++-- 9 files changed, 66 insertions(+), 12 deletions(-) create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/TrainStatusEnum.java diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/SafeProductConstant.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/SafeProductConstant.java index af9d10a..84ae0c6 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/SafeProductConstant.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/SafeProductConstant.java @@ -8,6 +8,9 @@ package com.hnac.hzims.safeproduct.constants; */ public interface SafeProductConstant { + int SUCCESS = 1; + int FAILURE = 0; + int TRAIN_PLAN_HAS_TEST = 1; int TRAIN_PLAN_HAS_NO_TEST = 0; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/TrainStatusEnum.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/TrainStatusEnum.java new file mode 100644 index 0000000..bb156f0 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/TrainStatusEnum.java @@ -0,0 +1,31 @@ +package com.hnac.hzims.safeproduct.enums; + +/** + * 培训计划状态枚举类 + * + * @author liwen + * @date 2023-12-27 + */ +public enum TrainStatusEnum { + + WAITING("WAITING", "未开始"), + UNFINISHED("UNFINISHED", "未完成"), + FINISHED("FINISHED", "已完成"); + + private final String value; + + private final String desc; + + TrainStatusEnum(String value, String desc) { + this.value = value; + this.desc = desc; + } + + public String getValue() { + return value; + } + + public String getDesc() { + return desc; + } +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreVO.java index 2e33809..019d7b0 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreVO.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreVO.java @@ -12,6 +12,9 @@ import lombok.Data; @ApiModel(value = "考试成绩VO类") public class TestScoreVO { + @ApiModelProperty("考试成绩id") + private Long id; + @ApiModelProperty("姓名") private String name; 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 1dd2f50..70ec717 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 @@ -175,6 +175,7 @@ public class TrainController extends BladeController { @GetMapping("/testPage") @ApiImplicitParams({ + @ApiImplicitParam(name = "trainPlanId", value = "培训计划id", dataType = "query", paramType = "string"), @ApiImplicitParam(name = "trainRecordId", value = "培训记录id", dataType = "query", paramType = "string") }) @ApiOperation(value = "考试记录分页") @@ -203,7 +204,7 @@ public class TrainController extends BladeController { @PostMapping("/updateBatchScore") @ApiOperation(value = "批量填写分数") @ApiOperationSupport(order = 19) - public R updateBatchScore(TestScoreDTO testScoreDTO) { + public R updateBatchScore(@RequestBody TestScoreDTO testScoreDTO) { return R.status(testScoreService.updateBatchScore(testScoreDTO)); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestScoreMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestScoreMapper.xml index 53333d0..cf6795a 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestScoreMapper.xml +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestScoreMapper.xml @@ -4,7 +4,7 @@ diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java index 11b47ce..2607bc8 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java @@ -41,6 +41,7 @@ public class TestScoreServiceImpl extends ServiceImpl { TestScoreEntity testScoreEntity = new TestScoreEntity(); BeanUtils.copyProperties(score, testScoreEntity); + testScoreEntity.setTestId(testScoreDTO.getTestId()); testScoreEntities.add(testScoreEntity); }); return this.updateBatchById(testScoreEntities); diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java index 8325630..f9d1d66 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java @@ -14,7 +14,6 @@ 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; @@ -24,6 +23,7 @@ import javax.annotation.Resource; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.stream.Collectors; /** * 考试记录服务实现类 @@ -175,7 +175,8 @@ public class TestServiceImpl extends ServiceImpl impleme } // 若存在变化,查询并删除关联考试成绩 List testScoreList = testScoreService.getRelativeTestScore(testEntity.getId()); - boolean removeByIds = testScoreService.removeByIds(testScoreList); + List scoreIds = testScoreList.stream().map(TestScoreEntity::getId).collect(Collectors.toList()); + boolean removeByIds = testScoreService.removeByIds(scoreIds); // 若删除成功,新增新的考试成绩数据 if (removeByIds) { String[] person = testEntity.getPeopleName().split(",|,"); 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 be310d4..ae3e85f 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 @@ -11,10 +11,12 @@ 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.RehearsalRecordEntity; import com.hnac.hzims.safeproduct.entity.TrainPlanEntity; import com.hnac.hzims.safeproduct.entity.TrainRecordEntity; +import com.hnac.hzims.safeproduct.enums.TrainStatusEnum; +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; @@ -23,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @@ -43,9 +46,13 @@ public class TrainRecordServiceImpl extends ServiceImpl