From 146f751f1af1a9587a0200231326a4b46e731013 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Thu, 21 Mar 2024 08:59:48 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=80=83=E8=AF=95=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9F=A5=E8=AF=A2=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/safeproduct/dto/TestDTO.java | 8 ++- .../hnac/hzims/safeproduct/entity/TestEntity.java | 1 + .../hzims/safeproduct/entity/TestScoreEntity.java | 12 +++++ .../com/hnac/hzims/safeproduct/vo/TestScoreVO.java | 3 ++ .../safeproduct/controller/TrainController.java | 9 ++-- .../safeproduct/service/ITestScoreService.java | 2 +- .../hzims/safeproduct/service/ITestService.java | 4 +- .../service/impl/TestScoreServiceImpl.java | 59 +++++++++++++++------- .../safeproduct/service/impl/TestServiceImpl.java | 42 +++++++++++---- 9 files changed, 105 insertions(+), 35 deletions(-) diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/TestDTO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/TestDTO.java index 6b55684..2c0e72f 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/TestDTO.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/TestDTO.java @@ -1,20 +1,26 @@ package com.hnac.hzims.safeproduct.dto; +import com.hnac.hzims.safeproduct.entity.TestEntity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import javax.validation.constraints.Size; + /** * @author liwen * @date 2023-12-25 */ @Data @ApiModel(value = "考试记录DTO类") -public class TestDTO { +public class TestDTO extends TestEntity { @ApiModelProperty("考试记录id") private Long id; @ApiModelProperty("考试记录名称") private String testName; + + @ApiModelProperty("参考人员Id,以,分隔") + private String peopleId; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java index 354920b..8292f97 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java @@ -67,6 +67,7 @@ public class TestEntity extends BaseEntity { @ApiModelProperty("参考人员") private String peopleName; + @Size(max = 1000, message = "考试图片字段长度不能超过1000") @ApiModelProperty("考试图片") private String imgPath; diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestScoreEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestScoreEntity.java index a95020e..9a2b8f3 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestScoreEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestScoreEntity.java @@ -29,6 +29,18 @@ public class TestScoreEntity extends BaseEntity { @ApiModelProperty("姓名") private String name; + @Size(max = 50, message = "姓名字段长度不能超过50") + @ApiModelProperty("姓名") + private String userId; + + @Size(max = 50, message = "姓名字段长度不能超过50") + @ApiModelProperty("机构名称") + private String deptName; + + @Size(max = 50, message = "姓名字段长度不能超过50") + @ApiModelProperty("机构Id") + private String deptId; + @NotNull @Min(value = 0, message = "成绩必须大于等于0") @Max(value = 100, message = "成绩必须小于等于100") 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 7de3c9a..f04fea1 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 @@ -24,6 +24,9 @@ public class TestScoreVO { @ApiModelProperty("姓名") private String name; + @ApiModelProperty("姓名") + private String userId; + @ApiModelProperty("成绩") private Integer score; } 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 e5cef0f..9dd6c2c 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 @@ -6,6 +6,7 @@ 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.TestScoreEntity; import com.hnac.hzims.safeproduct.entity.TrainPlanEntity; import com.hnac.hzims.safeproduct.entity.TrainRecordEntity; import com.hnac.hzims.safeproduct.service.ITestScoreService; @@ -142,14 +143,14 @@ public class TrainController extends BladeController { @PostMapping("/saveTest") @ApiOperation(value = "新增考试") @ApiOperationSupport(order = 12) - public R saveTest(@Valid @RequestBody TestEntity testEntity) { + public R saveTest(@Valid @RequestBody TestDTO testEntity) { return testService.saveTest(testEntity); } @PostMapping("/updateTest") @ApiOperation(value = "修改考试") @ApiOperationSupport(order = 13) - public R updateTest(@Valid @RequestBody TestEntity testEntity) { + public R updateTest(@Valid @RequestBody TestDTO testEntity) { return R.status(testService.updateTest(testEntity)); } @@ -192,8 +193,8 @@ public class TrainController extends BladeController { @GetMapping("/testScoreList") @ApiOperation(value = "考试成绩列表") @ApiOperationSupport(order = 18) - public R> testScoreList(@RequestParam Long testId, String name) { - List list = testScoreService.testScoreList(testId, name); + public R> testScoreList(@RequestParam Long testId, String name) { + List list = testScoreService.testScoreList(testId, name); return R.data(list); } @GetMapping("/testScoreSum") diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestScoreService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestScoreService.java index ce7e884..54ca22f 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestScoreService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestScoreService.java @@ -22,7 +22,7 @@ public interface ITestScoreService extends IService { * @param name 姓名 * @return 考试成绩列表 */ - List testScoreList(Long testId, String name); + List testScoreList(Long testId, String name); /** * 批量填写分数 diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestService.java index 4a59b6e..c1bfaf6 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestService.java @@ -23,7 +23,7 @@ public interface ITestService extends IService { * @param testEntity 考试记录实体类 * @return 返回结果封装类 */ - R saveTest(TestEntity testEntity); + R saveTest(TestDTO testEntity); /** * 根据编码查询考试记录 @@ -65,7 +65,7 @@ public interface ITestService extends IService { * @param testEntity 考试记录实体类 * @return true-成功,false-失败 */ - boolean updateTest(TestEntity testEntity); + boolean updateTest(TestDTO testEntity); /** * 考试记录分页 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 6e6b952..29d1b33 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 @@ -1,6 +1,7 @@ package com.hnac.hzims.safeproduct.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.safeproduct.dto.TestScoreDTO; import com.hnac.hzims.safeproduct.entity.TestEntity; @@ -10,8 +11,14 @@ import com.hnac.hzims.safeproduct.mapper.TestScoreMapper; import com.hnac.hzims.safeproduct.service.ITestScoreService; import com.hnac.hzims.safeproduct.vo.TestScoreSumVO; import com.hnac.hzims.safeproduct.vo.TestScoreVO; +import com.hnac.hzinfo.inspect.ai.entity.RobotTaskEntity; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang.StringUtils; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.system.feign.ISysClient; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; @@ -27,15 +34,19 @@ import java.util.stream.Collectors; * @date 2023-12-25 */ @Service +@RequiredArgsConstructor +@Slf4j public class TestScoreServiceImpl extends ServiceImpl implements ITestScoreService { + private final ISysClient sysClient; @Resource TestMapper testMapper; + /** * 查询考试成绩列表 */ @Override - public List testScoreList(Long testId, String name) { - return baseMapper.testScoreList(testId, name); + public List testScoreList(Long testId, String name) { + return baseMapper.selectList(Wrappers.lambdaQuery().eq(TestScoreEntity::getTestId, testId)); } /** @@ -43,15 +54,27 @@ public class TestScoreServiceImpl extends ServiceImpl scoreList = testScoreDTO.getScoreList(); - List testScoreEntities = new ArrayList<>(); - scoreList.forEach(score -> { - TestScoreEntity testScoreEntity = new TestScoreEntity(); - BeanUtils.copyProperties(score, testScoreEntity); - testScoreEntity.setTestId(testScoreDTO.getTestId()); - testScoreEntities.add(testScoreEntity); - }); - return this.updateBatchById(testScoreEntities); + boolean b = this.removeRelativeTestScore(testScoreDTO.getTestId()); + if (b) { + List scoreList = testScoreDTO.getScoreList(); + List testScoreEntities = new ArrayList<>(); + scoreList.forEach(score -> { + TestScoreEntity testScoreEntity = new TestScoreEntity(); + BeanUtils.copyProperties(score, testScoreEntity); + testScoreEntity.setTestId(testScoreDTO.getTestId()); + if (!"^".equals(score.getUserId())&&ObjectUtil.isNotEmpty(score.getDept())) { + R deptNameR = sysClient.getDeptName(score.getDept()); + if (deptNameR.isSuccess()&&StringUtils.isNotBlank(deptNameR.getData())){ + testScoreEntity.setDeptName(deptNameR.getData()); + } + }else { + testScoreEntity.setUserId(""); + } + testScoreEntities.add(testScoreEntity); + }); + return this.saveOrUpdateBatch(testScoreEntities); + } + return false; } /** @@ -87,20 +110,20 @@ public class TestScoreServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); queryWrapper.lambda().eq(TestScoreEntity::getTestId, testId); List list = this.list(queryWrapper); - if (CollectionUtils.isNotEmpty(list)){ - testScoreSumVO.setPeopleNum( list.size()); + if (CollectionUtils.isNotEmpty(list)) { + testScoreSumVO.setPeopleNum(list.size()); List collect = list.stream().filter(s -> s.getScore() > 60).collect(Collectors.toList()); - if (CollectionUtils.isNotEmpty(list)) { - testScoreSumVO.setPercentage(new Double(collect.size() / list.size())); - } + if (CollectionUtils.isNotEmpty(list)) { + testScoreSumVO.setPercentage(new Double(collect.size() / list.size())); + } } return testScoreSumVO; } 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 09cc4df..5d2b0d5 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 @@ -1,6 +1,7 @@ package com.hnac.hzims.safeproduct.service.impl; import cn.hutool.core.date.DatePattern; +import cn.hutool.core.util.ObjectUtil; import com.alibaba.excel.util.CollectionUtils; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -16,8 +17,14 @@ 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 lombok.RequiredArgsConstructor; +import org.apache.commons.lang.ObjectUtils; +import org.apache.commons.lang.StringUtils; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; +import org.springblade.system.feign.ISysClient; +import org.springblade.system.user.cache.UserCache; +import org.springblade.system.user.entity.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -36,8 +43,9 @@ import java.util.stream.Collectors; * @date 2023-12-25 */ @Service +@RequiredArgsConstructor public class TestServiceImpl extends ServiceImpl implements ITestService { - + private final ISysClient sysClient; @Autowired ITestScoreService testScoreService; @@ -49,7 +57,7 @@ public class TestServiceImpl extends ServiceImpl impleme */ @Transactional(rollbackFor = Exception.class) @Override - public R saveTest(TestEntity testEntity) { + public R saveTest(TestDTO testEntity) { // 判断培训计划是否需要考试,若不需要,则无法新增考试记录 TrainPlanEntity trainPlanEntity = trainPlanMapper.selectById(testEntity.getTrainPlanId()); if (trainPlanEntity.getIsTest().equals(SafeProductConstant.TRAIN_PLAN_HAS_NO_TEST)) { @@ -69,10 +77,12 @@ public class TestServiceImpl extends ServiceImpl impleme // 查询考试记录 TestEntity test = getTestByCode(testEntity.getCode()); // 获取姓名数组 - String people = test.getPeopleName(); + String people = testEntity.getPeopleName(); + String peopleId = testEntity.getPeopleId(); String[] person = people.split(","); + String[] peopleIds = peopleId.split(","); // 新增参考人员成绩数据 - List scoreList = getReferenceTestScore(test, person); + List scoreList = getReferenceTestScore(test, person,peopleIds); return R.status(testScoreService.saveBatch(scoreList)); } return R.fail("新增考试记录失败"); @@ -153,7 +163,7 @@ public class TestServiceImpl extends ServiceImpl impleme */ @Transactional(rollbackFor = Exception.class) @Override - public boolean updateTest(TestEntity testEntity) { + public boolean updateTest(TestDTO testEntity) { // 判断考试人员是否有变化 TestEntity oldTest = getTestByCode(testEntity.getCode()); // 更新考试记录 @@ -170,8 +180,9 @@ public class TestServiceImpl extends ServiceImpl impleme // 若删除成功,新增新的考试成绩数据 if (removeByIds) { String[] person = testEntity.getPeopleName().split(","); + String[] personId = testEntity.getPeopleId().split(","); // 新增参考人员成绩数据 - List scoreList = getReferenceTestScore(testEntity, person); + List scoreList = getReferenceTestScore(testEntity, person,personId); return testScoreService.saveBatch(scoreList); } } @@ -193,12 +204,25 @@ public class TestServiceImpl extends ServiceImpl impleme * @param person 参考人员 * @return 成绩列表 */ - private List getReferenceTestScore(TestEntity testEntity, String[] person) { + private List getReferenceTestScore(TestEntity testEntity, String[] person,String[] personId) { List res = new ArrayList<>(); - for (String name : person) { + for (int i = 0; i < person.length; i++) { TestScoreEntity testScoreEntity = new TestScoreEntity(); testScoreEntity.setTestId(testEntity.getId()); - testScoreEntity.setName(name); + testScoreEntity.setName(person[i]); + if (!"^".equals(personId[i])) { + testScoreEntity.setUserId(personId[i]); + User user = UserCache.getUser(Long.valueOf(personId[i])); + if (ObjectUtil.isNotEmpty(user)) { + testScoreEntity.setDeptId(user.getDeptId()); + R deptNameR = sysClient.getDeptName(Long.valueOf(personId[i])); + if (deptNameR.isSuccess() && StringUtils.isNotBlank(deptNameR.getData())) { + testScoreEntity.setDeptName(deptNameR.getData()); + } + } + }else { + testScoreEntity.setUserId(""); + } res.add(testScoreEntity); } return res; From 6ce757c8de57614604253204390f299a86f73837 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Thu, 21 Mar 2024 15:54:02 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=EF=BC=9A=E4=BC=9A?= =?UTF-8?q?=E8=AE=AE=E8=AE=B0=E5=BD=95=E3=80=81=E6=BC=94=E7=BB=83=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E3=80=81=E5=9F=B9=E8=AE=AD=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/safeproduct/vo/ConferenceRecordVO.java | 49 ++++++++++++++++++++ .../hzims/safeproduct/vo/RehearsalRecordlVO.java | 54 ++++++++++++++++++++++ .../hnac/hzims/safeproduct/vo/TrainRecordVO.java | 51 ++++++++++++++++++++ .../controller/ConferenceController.java | 5 +- .../controller/RehearsalController.java | 5 +- .../safeproduct/controller/TrainController.java | 4 +- .../service/IConferenceRecordService.java | 3 +- .../service/IRehearsalRecordService.java | 3 +- .../safeproduct/service/ITrainRecordService.java | 3 +- .../service/impl/ConferenceRecordServiceImpl.java | 26 +++++++++-- .../service/impl/RehearsalRecordServiceImpl.java | 27 ++++++++++- .../service/impl/TrainRecordServiceImpl.java | 22 ++++++++- .../safeproduct/src/main/resources/db/3.0.0.sql.1 | 4 ++ 13 files changed, 238 insertions(+), 18 deletions(-) create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/ConferenceRecordVO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordlVO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordVO.java create mode 100644 hzims-service/safeproduct/src/main/resources/db/3.0.0.sql.1 diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/ConferenceRecordVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/ConferenceRecordVO.java new file mode 100644 index 0000000..4be7da9 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/ConferenceRecordVO.java @@ -0,0 +1,49 @@ +package com.hnac.hzims.safeproduct.vo; + +import cn.afterturn.easypoi.entity.ImageEntity; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +/** + * @author liwen + * @date 2024-01-15 + */ +@Data +@ApiModel(value = "会议记录表VO类") +public class ConferenceRecordVO { + + @ApiModelProperty("编码") + private String code; + + @ApiModelProperty("单位") + private String unit; + + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty("会议计划开始时间") + private Date scheduledStartTime; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + @ApiModelProperty("会议实际开始时间") + private Date actualStartTime; + + + @ApiModelProperty("会议地点") + private String location; + + @ApiModelProperty("主持人") + private String host; + + @ApiModelProperty("会议方式") + private String conferenceMethod; + + @ApiModelProperty("会议主题") + private String theme; + + @ApiModelProperty("会议状态") + private String conferenceStatus; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordlVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordlVO.java new file mode 100644 index 0000000..fc888b2 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordlVO.java @@ -0,0 +1,54 @@ +package com.hnac.hzims.safeproduct.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * @author liwen + * @date 2024-01-15 + */ +@Data +@ApiModel(value = "演练记录表VO类") +public class RehearsalRecordlVO { + + @ApiModelProperty("编码") + private String code; + + @ApiModelProperty("单位") + private String unit; + + @ApiModelProperty("演练科目") + private String subject; + + @ApiModelProperty("计划演练时间") + private String planTime; + + @ApiModelProperty("参演人员") + private String peopleName; + + @ApiModelProperty("参演人员") + private String peopleNum; + + + @ApiModelProperty("演练地点") + private String location; + + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + @ApiModelProperty("演练实际开始时间") + private Date actualStartTime; + + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + @ApiModelProperty("演练实际结束时间") + private Date actualEndTime; + + @ApiModelProperty("演练状态") + private String rehearsalStatus; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordVO.java new file mode 100644 index 0000000..ef67b05 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordVO.java @@ -0,0 +1,51 @@ +package com.hnac.hzims.safeproduct.vo; + + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + + +/** + * @author liwen + * @date 2024-01-15 + */ +@Data +@ApiModel(value = "培训记录表VO类") +public class TrainRecordVO { + + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty("计划培训时间") + private Date scheduledStartTime; + + @ApiModelProperty("单位") + private String unit; + + @ApiModelProperty("培训地点") + private String location; + + @ApiModelProperty("培训方式") + private String trainMethod; + + @ApiModelProperty("培训讲师") + private String teacher; + + @ApiModelProperty("培训课程") + private String lesson; + + @ApiModelProperty("实际培训结束时间") + private Date actualEndTime; + + + @ApiModelProperty("关联考试:0-否,1-是") + private Integer isTest; + + + @ApiModelProperty("培训状态") + private String trainStatus; + + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/ConferenceController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/ConferenceController.java index d025f73..9310bc6 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/ConferenceController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/ConferenceController.java @@ -7,6 +7,7 @@ import com.hnac.hzims.safeproduct.entity.ConferenceRecordEntity; import com.hnac.hzims.safeproduct.service.IConferencePlanService; import com.hnac.hzims.safeproduct.service.IConferenceRecordService; import com.hnac.hzims.safeproduct.vo.ConferenceRecordDetailVO; +import com.hnac.hzims.safeproduct.vo.ConferenceRecordVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -115,8 +116,8 @@ public class ConferenceController extends BladeController { }) @ApiOperation(value = "会议记录分页") @ApiOperationSupport(order = 10) - public R> recordPage(@ApiIgnore @RequestParam Map param, Query query) { - IPage page = conferenceRecordService.recordPage(param, query); + public R> recordPage(@ApiIgnore @RequestParam Map param, Query query) { + IPage page = conferenceRecordService.recordPage(param, query); return R.data(page); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java index 4182137..50175f4 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java @@ -8,6 +8,7 @@ import com.hnac.hzims.safeproduct.service.IRehearsalPlanService; import com.hnac.hzims.safeproduct.service.IRehearsalRecordService; import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO; import com.hnac.hzims.safeproduct.vo.RehearsalMonthVO; +import com.hnac.hzims.safeproduct.vo.RehearsalRecordlVO; import com.hnac.hzims.safeproduct.vo.RehearsalYearVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -117,8 +118,8 @@ public class RehearsalController extends BladeController { }) @ApiOperation(value = "演练记录分页") @ApiOperationSupport(order = 10) - public R> rehearsalRecordPage(@ApiIgnore @RequestParam Map param, Query query) { - IPage page = rehearsalRecordService.rehearsalRecordPage(param, query); + public R> rehearsalRecordPage(@ApiIgnore @RequestParam Map param, Query query) { + IPage page = rehearsalRecordService.rehearsalRecordPage(param, query); return R.data(page); } 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 9dd6c2c..de236ad 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 @@ -127,8 +127,8 @@ public class TrainController extends BladeController { }) @ApiOperation(value = "培训记录分页") @ApiOperationSupport(order = 10) - public R> trainRecordPage(@ApiIgnore @RequestParam Map param, Query query) { - IPage page = trainRecordService.trainRecordPage(param, query); + public R> trainRecordPage(@ApiIgnore @RequestParam Map param, Query query) { + IPage page = trainRecordService.trainRecordPage(param, query); return R.data(page); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IConferenceRecordService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IConferenceRecordService.java index 569623e..45ca492 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IConferenceRecordService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IConferenceRecordService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.hnac.hzims.safeproduct.entity.ConferenceRecordEntity; import com.hnac.hzims.safeproduct.vo.ConferenceRecordDetailVO; +import com.hnac.hzims.safeproduct.vo.ConferenceRecordVO; import org.springblade.core.mp.support.Query; import javax.servlet.http.HttpServletResponse; @@ -51,5 +52,5 @@ public interface IConferenceRecordService extends IService recordPage(Map param, Query query); + IPage recordPage(Map param, Query query); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalRecordService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalRecordService.java index 92b08c8..eacaab1 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalRecordService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalRecordService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.hnac.hzims.safeproduct.entity.RehearsalRecordEntity; import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO; +import com.hnac.hzims.safeproduct.vo.RehearsalRecordlVO; import org.springblade.core.mp.support.Query; import javax.servlet.http.HttpServletResponse; @@ -58,5 +59,5 @@ public interface IRehearsalRecordService extends IService * @param query 分页类 * @return 演练记录数据 */ - IPage rehearsalRecordPage(Map param, Query query); + IPage rehearsalRecordPage(Map param, Query query); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainRecordService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainRecordService.java index 57d5d62..85af66a 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainRecordService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainRecordService.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.hnac.hzims.safeproduct.dto.TrainRecordDTO; import com.hnac.hzims.safeproduct.entity.TrainRecordEntity; import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO; +import com.hnac.hzims.safeproduct.vo.TrainRecordVO; import org.springblade.core.mp.support.Query; import javax.servlet.http.HttpServletResponse; @@ -74,5 +75,5 @@ public interface ITrainRecordService extends IService { * @param query 分页类 * @return 培训记录数据 */ - IPage trainRecordPage(Map param, Query query); + IPage trainRecordPage(Map param, Query query); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferenceRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferenceRecordServiceImpl.java index 5b6c913..22b129b 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferenceRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferenceRecordServiceImpl.java @@ -5,6 +5,7 @@ import cn.hutool.core.date.DatePattern; import com.alibaba.excel.util.CollectionUtils; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.common.logs.utils.StringUtils; import com.hnac.hzims.common.utils.Condition; @@ -19,16 +20,15 @@ import com.hnac.hzims.safeproduct.service.IConferenceRecordService; import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.utils.TimeUtils; import com.hnac.hzims.safeproduct.vo.ConferenceRecordDetailVO; -import com.hnac.hzims.ticket.constants.TicketConstants; +import com.hnac.hzims.safeproduct.vo.ConferenceRecordVO; import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.BeanUtil; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; -import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -153,7 +153,7 @@ public class ConferenceRecordServiceImpl extends ServiceImpl recordPage(Map param, Query query) { + public IPage recordPage(Map param, Query query) { QueryWrapper queryWrapper = new QueryWrapper<>(); String conferencePlanId = String.valueOf(param.get("conferencePlanId")); String startTime = String.valueOf(param.get("actualStartTime")); @@ -168,7 +168,23 @@ public class ConferenceRecordServiceImpl extends ServiceImpl page = this.page(Condition.getPage(query), queryWrapper); + IPage res=new Page<>(); + res.setSize(page.getSize()); + res.setTotal(page.getTotal()); + res.setPages(page.getPages()); + List records = page.getRecords(); + List recordlVOS =new ArrayList<>(); + for (ConferenceRecordEntity record : records) { + ConferenceRecordVO trainRecordVO = new ConferenceRecordVO(); + Long planId = record.getConferencePlanId(); + ConferencePlanEntity conferencePlanEntity = conferencePlanMapper.selectById(planId); + BeanUtil.copy(conferencePlanEntity,trainRecordVO); + trainRecordVO.setActualStartTime(record.getActualStartTime()); + recordlVOS.add(trainRecordVO); + } + res.setRecords(recordlVOS); + return res; } /** diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java index c4b7203..fda253d 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java @@ -5,6 +5,7 @@ import cn.hutool.core.date.DatePattern; import com.alibaba.excel.util.CollectionUtils; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.common.logs.utils.StringUtils; import com.hnac.hzims.common.utils.Condition; @@ -19,8 +20,10 @@ import com.hnac.hzims.safeproduct.service.IRehearsalRecordService; import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.utils.TimeUtils; import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO; +import com.hnac.hzims.safeproduct.vo.RehearsalRecordlVO; import lombok.extern.slf4j.Slf4j; import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.utils.BeanUtil; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -193,7 +196,7 @@ public class RehearsalRecordServiceImpl extends ServiceImpl rehearsalRecordPage(Map param, Query query) { + public IPage rehearsalRecordPage(Map param, Query query) { QueryWrapper queryWrapper = new QueryWrapper<>(); String rehearsalPlanId = String.valueOf(param.get("rehearsalPlanId")); String actualStartTime = String.valueOf(param.get("actualStartTime")); @@ -208,6 +211,26 @@ public class RehearsalRecordServiceImpl extends ServiceImpl rehearsalRecordList = this.page(Condition.getPage(query), queryWrapper); + IPage res=new Page<>(); + res.setSize(rehearsalRecordList.getSize()); + res.setTotal(rehearsalRecordList.getTotal()); + res.setPages(rehearsalRecordList.getPages()); + List records = rehearsalRecordList.getRecords(); + List recordlVOS =new ArrayList<>(); + for (RehearsalRecordEntity record : records) { + RehearsalRecordlVO rehearsalRecordlVO = new RehearsalRecordlVO(); + Long rehearsalPlanId1 = record.getRehearsalPlanId(); + RehearsalPlanEntity rehearsalPlanEntity = rehearsalPlanMapper.selectById(rehearsalPlanId1); + BeanUtil.copy(rehearsalPlanEntity,rehearsalRecordlVO); + rehearsalRecordlVO.setPeopleName(record.getPeopleName()); + int length = record.getPeopleName().split(",").length; + rehearsalRecordlVO.setPeopleNum(String.valueOf(length)); + rehearsalRecordlVO.setActualStartTime(record.getActualStartTime()); + rehearsalRecordlVO.setActualEndTime(record.getActualEndTime()); + recordlVOS.add(rehearsalRecordlVO); + } + res.setRecords(recordlVOS); + return res; } } 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 a47cd6b..be17274 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 @@ -21,7 +21,9 @@ import com.hnac.hzims.safeproduct.service.ITrainRecordService; import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.utils.TimeUtils; import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO; +import com.hnac.hzims.safeproduct.vo.TrainRecordVO; import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.utils.BeanUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -188,9 +190,25 @@ public class TrainRecordServiceImpl extends ServiceImpl trainRecordPage(Map param, Query query) { + public IPage trainRecordPage(Map param, Query query) { IPage page = new Page<>(query.getCurrent(), query.getSize()); - return baseMapper.trainRecordPage(page, param); + IPage trainRecordList = baseMapper.trainRecordPage(page, param); + IPage res=new Page<>(); + res.setSize(trainRecordList.getSize()); + res.setTotal(trainRecordList.getTotal()); + res.setPages(trainRecordList.getPages()); + List records = trainRecordList.getRecords(); + List recordlVOS =new ArrayList<>(); + for (TrainRecordEntity record : records) { + TrainRecordVO trainRecordVO = new TrainRecordVO(); + Long getTrainPlanId = record.getTrainPlanId(); + TrainPlanEntity trainPlanEntity = trainPlanMapper.selectById(getTrainPlanId); + BeanUtil.copy(trainPlanEntity,trainRecordVO); + trainRecordVO.setActualEndTime(record.getActualEndTime()); + recordlVOS.add(trainRecordVO); + } + res.setRecords(recordlVOS); + return res; } /** diff --git a/hzims-service/safeproduct/src/main/resources/db/3.0.0.sql.1 b/hzims-service/safeproduct/src/main/resources/db/3.0.0.sql.1 new file mode 100644 index 0000000..99497d7 --- /dev/null +++ b/hzims-service/safeproduct/src/main/resources/db/3.0.0.sql.1 @@ -0,0 +1,4 @@ +ALTER TABLE `hzims_test_score` +ADD COLUMN `user_id` bigint(20) NULL AFTER `is_deleted`, +ADD COLUMN `dept_name` varchar(255) NULL AFTER `user_id`, +ADD COLUMN `dept_id` bigint(20) NULL AFTER `dept_name`; \ No newline at end of file From 96ddb48341091358d590ea429207c291f50828ca Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Thu, 21 Mar 2024 16:28:10 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=9B=86=E4=B8=AD=E7=9B=91=E6=8E=A7?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java index bc15768..6e1cd30 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java @@ -112,8 +112,8 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl result = processClient.startProcessInstanceContainNameByKey(AlarmHandleConstant.dealAlarm, businessKey, processName, variable); // 流程开启失败 if (!result.isSuccess()) { + log.error("缺陷流程开启失败,错误描述 : " + result.getMsg()); throw new ServiceException("缺陷流程开启失败,错误描述 : " + result.getMsg()); } param.setProcessInstanceId(result.getData().getProcessInstanceId());