Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 8 months ago
parent
commit
30fff98af0
  1. 8
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/TestDTO.java
  2. 1
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java
  3. 12
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestScoreEntity.java
  4. 49
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/ConferenceRecordVO.java
  5. 54
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordlVO.java
  6. 3
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreVO.java
  7. 51
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordVO.java
  8. 5
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java
  9. 5
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/ConferenceController.java
  10. 5
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java
  11. 13
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java
  12. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IConferenceRecordService.java
  13. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalRecordService.java
  14. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestScoreService.java
  15. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestService.java
  16. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainRecordService.java
  17. 26
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferenceRecordServiceImpl.java
  18. 27
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java
  19. 59
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java
  20. 42
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java
  21. 22
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java
  22. 4
      hzims-service/safeproduct/src/main/resources/db/3.0.0.sql.1

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

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

12
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")

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

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

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

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

5
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<AlarmHandleMapper, A
}
R r = iFdpDiagnoseClient.setFaultStatusInfo(map);
if (!r.isSuccess()){
log.error("setFaultStatusInfo接口修改处理状态异常参数为:"+param);
throw new ServiceException("修改告警状态异常,请稍后重试!");
log.error("setFaultStatusInfo接口修改处理状态异常,请求数据为:"+map+"\n"+"参数为:"+param+r.getMsg());
// throw new ServiceException("修改告警状态异常,请稍后重试!");
}
}
//开启流程
@ -127,6 +127,7 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl<AlarmHandleMapper, A
R<BladeFlow> 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());

5
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<IPage<ConferenceRecordEntity>> recordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<ConferenceRecordEntity> page = conferenceRecordService.recordPage(param, query);
public R<IPage<ConferenceRecordVO>> recordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<ConferenceRecordVO> page = conferenceRecordService.recordPage(param, query);
return R.data(page);
}

5
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<IPage<RehearsalRecordEntity>> rehearsalRecordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<RehearsalRecordEntity> page = rehearsalRecordService.rehearsalRecordPage(param, query);
public R<IPage<RehearsalRecordlVO>> rehearsalRecordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<RehearsalRecordlVO> page = rehearsalRecordService.rehearsalRecordPage(param, query);
return R.data(page);
}

13
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;
@ -126,8 +127,8 @@ public class TrainController extends BladeController {
})
@ApiOperation(value = "培训记录分页")
@ApiOperationSupport(order = 10)
public R<IPage<TrainRecordEntity>> trainRecordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<TrainRecordEntity> page = trainRecordService.trainRecordPage(param, query);
public R<IPage<TrainRecordVO>> trainRecordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<TrainRecordVO> page = trainRecordService.trainRecordPage(param, query);
return R.data(page);
}
@ -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<List<TestScoreVO>> testScoreList(@RequestParam Long testId, String name) {
List<TestScoreVO> list = testScoreService.testScoreList(testId, name);
public R<List<TestScoreEntity>> testScoreList(@RequestParam Long testId, String name) {
List<TestScoreEntity> list = testScoreService.testScoreList(testId, name);
return R.data(list);
}
@GetMapping("/testScoreSum")

3
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<ConferenceRecordEntit
* @param query 分页类
* @return 会议记录数据
*/
IPage<ConferenceRecordEntity> recordPage(Map<String, Object> param, Query query);
IPage<ConferenceRecordVO> recordPage(Map<String, Object> param, Query query);
}

3
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<RehearsalRecordEntity>
* @param query 分页类
* @return 演练记录数据
*/
IPage<RehearsalRecordEntity> rehearsalRecordPage(Map<String, Object> param, Query query);
IPage<RehearsalRecordlVO> rehearsalRecordPage(Map<String, Object> param, Query query);
}

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

@ -22,7 +22,7 @@ public interface ITestScoreService extends IService<TestScoreEntity> {
* @param name 姓名
* @return 考试成绩列表
*/
List<TestScoreVO> testScoreList(Long testId, String name);
List<TestScoreEntity> testScoreList(Long testId, String name);
/**
* 批量填写分数

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

@ -23,7 +23,7 @@ public interface ITestService extends IService<TestEntity> {
* @param testEntity 考试记录实体类
* @return 返回结果封装类
*/
R saveTest(TestEntity testEntity);
R saveTest(TestDTO testEntity);
/**
* 根据编码查询考试记录
@ -65,7 +65,7 @@ public interface ITestService extends IService<TestEntity> {
* @param testEntity 考试记录实体类
* @return true-成功false-失败
*/
boolean updateTest(TestEntity testEntity);
boolean updateTest(TestDTO testEntity);
/**
* 考试记录分页

3
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<TrainRecordEntity> {
* @param query 分页类
* @return 培训记录数据
*/
IPage<TrainRecordEntity> trainRecordPage(Map<String, Object> param, Query query);
IPage<TrainRecordVO> trainRecordPage(Map<String, Object> param, Query query);
}

26
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<ConferenceRecordMap
* 会议记录分页
*/
@Override
public IPage<ConferenceRecordEntity> recordPage(Map<String, Object> param, Query query) {
public IPage<ConferenceRecordVO> recordPage(Map<String, Object> param, Query query) {
QueryWrapper<ConferenceRecordEntity> 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<ConferenceRecordMap
queryWrapper.lambda().le(ConferenceRecordEntity::getActualEndTime, endTime);
}
queryWrapper.lambda().orderByDesc(ConferenceRecordEntity::getCreateTime);
return this.page(Condition.getPage(query), queryWrapper);
IPage<ConferenceRecordEntity> page = this.page(Condition.getPage(query), queryWrapper);
IPage<ConferenceRecordVO> res=new Page<>();
res.setSize(page.getSize());
res.setTotal(page.getTotal());
res.setPages(page.getPages());
List<ConferenceRecordEntity> records = page.getRecords();
List<ConferenceRecordVO> 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;
}
/**

27
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<RehearsalRecordMappe
* 演练记录分页
*/
@Override
public IPage<RehearsalRecordEntity> rehearsalRecordPage(Map<String, Object> param, Query query) {
public IPage<RehearsalRecordlVO> rehearsalRecordPage(Map<String, Object> param, Query query) {
QueryWrapper<RehearsalRecordEntity> 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<RehearsalRecordMappe
queryWrapper.lambda().le(RehearsalRecordEntity::getActualEndTime, actualEndTime);
}
queryWrapper.lambda().orderByDesc(RehearsalRecordEntity::getCreateTime);
return this.page(Condition.getPage(query), queryWrapper);
IPage<RehearsalRecordEntity> rehearsalRecordList = this.page(Condition.getPage(query), queryWrapper);
IPage<RehearsalRecordlVO> res=new Page<>();
res.setSize(rehearsalRecordList.getSize());
res.setTotal(rehearsalRecordList.getTotal());
res.setPages(rehearsalRecordList.getPages());
List<RehearsalRecordEntity> records = rehearsalRecordList.getRecords();
List<RehearsalRecordlVO> 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;
}
}

59
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<TestScoreMapper, TestScoreEntity> implements ITestScoreService {
private final ISysClient sysClient;
@Resource
TestMapper testMapper;
/**
* 查询考试成绩列表
*/
@Override
public List<TestScoreVO> testScoreList(Long testId, String name) {
return baseMapper.testScoreList(testId, name);
public List<TestScoreEntity> testScoreList(Long testId, String name) {
return baseMapper.selectList(Wrappers.<TestScoreEntity>lambdaQuery().eq(TestScoreEntity::getTestId, testId));
}
/**
@ -43,15 +54,27 @@ public class TestScoreServiceImpl extends ServiceImpl<TestScoreMapper, TestScore
*/
@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);
testScoreEntity.setTestId(testScoreDTO.getTestId());
testScoreEntities.add(testScoreEntity);
});
return this.updateBatchById(testScoreEntities);
boolean b = this.removeRelativeTestScore(testScoreDTO.getTestId());
if (b) {
List<TestScoreVO> scoreList = testScoreDTO.getScoreList();
List<TestScoreEntity> 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<String> 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<TestScoreMapper, TestScore
TestScoreSumVO testScoreSumVO = new TestScoreSumVO();
TestEntity testEntity = testMapper.selectById(testId);
String peopleName = testEntity.getPeopleName();
if (StringUtils.isNotBlank(peopleName)){
if (StringUtils.isNotBlank(peopleName)) {
String[] split = peopleName.split(",");
testScoreSumVO.setPeopleNum( split.length);
testScoreSumVO.setPeopleNum(split.length);
}
QueryWrapper<TestScoreEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(TestScoreEntity::getTestId, testId);
List<TestScoreEntity> list = this.list(queryWrapper);
if (CollectionUtils.isNotEmpty(list)){
testScoreSumVO.setPeopleNum( list.size());
if (CollectionUtils.isNotEmpty(list)) {
testScoreSumVO.setPeopleNum(list.size());
List<TestScoreEntity> 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;
}

42
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<TestMapper, TestEntity> implements ITestService {
private final ISysClient sysClient;
@Autowired
ITestScoreService testScoreService;
@ -49,7 +57,7 @@ public class TestServiceImpl extends ServiceImpl<TestMapper, TestEntity> 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<TestMapper, TestEntity> 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<TestScoreEntity> scoreList = getReferenceTestScore(test, person);
List<TestScoreEntity> scoreList = getReferenceTestScore(test, person,peopleIds);
return R.status(testScoreService.saveBatch(scoreList));
}
return R.fail("新增考试记录失败");
@ -153,7 +163,7 @@ public class TestServiceImpl extends ServiceImpl<TestMapper, TestEntity> 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<TestMapper, TestEntity> impleme
// 若删除成功,新增新的考试成绩数据
if (removeByIds) {
String[] person = testEntity.getPeopleName().split(",");
String[] personId = testEntity.getPeopleId().split(",");
// 新增参考人员成绩数据
List<TestScoreEntity> scoreList = getReferenceTestScore(testEntity, person);
List<TestScoreEntity> scoreList = getReferenceTestScore(testEntity, person,personId);
return testScoreService.saveBatch(scoreList);
}
}
@ -193,12 +204,25 @@ public class TestServiceImpl extends ServiceImpl<TestMapper, TestEntity> impleme
* @param person 参考人员
* @return 成绩列表
*/
private List<TestScoreEntity> getReferenceTestScore(TestEntity testEntity, String[] person) {
private List<TestScoreEntity> getReferenceTestScore(TestEntity testEntity, String[] person,String[] personId) {
List<TestScoreEntity> 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<String> 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;

22
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<TrainRecordMapper, Train
* 培训记录分页
*/
@Override
public IPage<TrainRecordEntity> trainRecordPage(Map<String, Object> param, Query query) {
public IPage<TrainRecordVO> trainRecordPage(Map<String, Object> param, Query query) {
IPage<TrainRecordEntity> page = new Page<>(query.getCurrent(), query.getSize());
return baseMapper.trainRecordPage(page, param);
IPage<TrainRecordEntity> trainRecordList = baseMapper.trainRecordPage(page, param);
IPage<TrainRecordVO> res=new Page<>();
res.setSize(trainRecordList.getSize());
res.setTotal(trainRecordList.getTotal());
res.setPages(trainRecordList.getPages());
List<TrainRecordEntity> records = trainRecordList.getRecords();
List<TrainRecordVO> 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;
}
/**

4
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`;
Loading…
Cancel
Save