Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
yang_shj 8 months ago
parent
commit
5282c490aa
  1. 15
      hzims-service-api/common-api/src/main/java/com/hnac/hzims/vo/VoteChartVo.java
  2. 5
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/entity/RobotEntity.java
  3. 8
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/TestDTO.java
  4. 11
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java
  5. 12
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestScoreEntity.java
  6. 64
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/ConferenceRecordVO.java
  7. 71
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordlVO.java
  8. 3
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreVO.java
  9. 70
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordVO.java
  10. 12
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpAllocationController.java
  11. 5
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java
  12. 9
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/RobotController.java
  13. 2
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/IRobotService.java
  14. 11
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotServiceImpl.java
  15. 7
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/vo/robot/RobotRealDataVO.java
  16. 124
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java
  17. 5
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/ConferenceController.java
  18. 5
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java
  19. 13
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java
  20. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IConferenceRecordService.java
  21. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalRecordService.java
  22. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestScoreService.java
  23. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestService.java
  24. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainRecordService.java
  25. 31
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferenceRecordServiceImpl.java
  26. 31
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java
  27. 64
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java
  28. 42
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java
  29. 29
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java
  30. 4
      hzims-service/safeproduct/src/main/resources/db/3.0.0.sql.1

15
hzims-service-api/common-api/src/main/java/com/hnac/hzims/vo/VoteChartVo.java

@ -16,12 +16,12 @@ import java.util.List;
@ApiModel("各个票种统计表") @ApiModel("各个票种统计表")
public class VoteChartVo { public class VoteChartVo {
@ApiModelProperty(value = "站点名称") @ApiModelProperty(value = "站点名称")
@ColumnWidth(value = 20) @ColumnWidth(value = 25)
@ExcelProperty(value = "站点名称", index = 0) @ExcelProperty(value = "站点名称", index = 0)
private String name; private String name;
@ApiModelProperty(value = "总数量") @ApiModelProperty(value = "总数量")
@ExcelProperty(value = "总数量", index = 1) @ExcelProperty(value = "总数量", index = 2)
@ColumnWidth(value = 20) @ColumnWidth(value = 20)
private int sumNum; private int sumNum;
@ -30,7 +30,7 @@ public class VoteChartVo {
private List<Long> sumIds; private List<Long> sumIds;
@ApiModelProperty(value = "未完成数量") @ApiModelProperty(value = "未完成数量")
@ExcelProperty(value = "未完成数量", index = 2) @ExcelProperty(value = "未完成数量", index = 3)
@ColumnWidth(value = 20) @ColumnWidth(value = 20)
private int undoneNum; private int undoneNum;
@ -40,7 +40,7 @@ public class VoteChartVo {
@ApiModelProperty(value = "完成数量") @ApiModelProperty(value = "完成数量")
@ColumnWidth(value = 20) @ColumnWidth(value = 20)
@ExcelProperty(value = "完成数量", index = 3) @ExcelProperty(value = "完成数量", index = 4)
private int finishNum; private int finishNum;
@ApiModelProperty(value = "完成id") @ApiModelProperty(value = "完成id")
@ -48,7 +48,12 @@ public class VoteChartVo {
private List<Long> finishIds; private List<Long> finishIds;
@ApiModelProperty(value = "完成率") @ApiModelProperty(value = "完成率")
@ExcelProperty(value = "完成率", index = 4) @ExcelProperty(value = "完成率", index = 5)
@ColumnWidth(value = 20) @ColumnWidth(value = 20)
private Double finishRate; private Double finishRate;
@ApiModelProperty(value = "用戶名")
@ExcelProperty(value = "用戶名", index = 1)
@ColumnWidth(value = 20)
private String userName;
} }

5
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/entity/RobotEntity.java

@ -1,5 +1,6 @@
package com.hnac.hzinfo.inspect.ai.entity; package com.hnac.hzinfo.inspect.ai.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.hnac.hzinfo.inspect.utils.QueryField; import com.hnac.hzinfo.inspect.utils.QueryField;
import com.hnac.hzinfo.inspect.utils.SqlCondition; import com.hnac.hzinfo.inspect.utils.SqlCondition;
@ -72,4 +73,8 @@ public class RobotEntity extends TenantEntity {
@ApiModelProperty(value = "描述信息") @ApiModelProperty(value = "描述信息")
private Long remark; private Long remark;
@ApiModelProperty("用户名称")
@TableField(exist = false)
private String userName;
} }

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; package com.hnac.hzims.safeproduct.dto;
import com.hnac.hzims.safeproduct.entity.TestEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Size;
/** /**
* @author liwen * @author liwen
* @date 2023-12-25 * @date 2023-12-25
*/ */
@Data @Data
@ApiModel(value = "考试记录DTO类") @ApiModel(value = "考试记录DTO类")
public class TestDTO { public class TestDTO extends TestEntity {
@ApiModelProperty("考试记录id") @ApiModelProperty("考试记录id")
private Long id; private Long id;
@ApiModelProperty("考试记录名称") @ApiModelProperty("考试记录名称")
private String testName; private String testName;
@ApiModelProperty("参考人员Id,以,分隔")
private String peopleId;
} }

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

@ -1,11 +1,13 @@
package com.hnac.hzims.safeproduct.entity; package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity; import org.springblade.core.mp.base.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
@ -41,10 +43,18 @@ public class TestEntity extends BaseEntity {
private String unit; private String unit;
@NotNull @NotNull
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm"
)
@ApiModelProperty("考试开始时间") @ApiModelProperty("考试开始时间")
private Date testStartTime; private Date testStartTime;
@NotNull @NotNull
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm"
)
@ApiModelProperty("考试结束时间") @ApiModelProperty("考试结束时间")
private Date testEndTime; private Date testEndTime;
@ -67,6 +77,7 @@ public class TestEntity extends BaseEntity {
@ApiModelProperty("参考人员") @ApiModelProperty("参考人员")
private String peopleName; private String peopleName;
@Size(max = 1000, message = "考试图片字段长度不能超过1000") @Size(max = 1000, message = "考试图片字段长度不能超过1000")
@ApiModelProperty("考试图片") @ApiModelProperty("考试图片")
private String imgPath; 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("姓名") @ApiModelProperty("姓名")
private String name; 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 @NotNull
@Min(value = 0, message = "成绩必须大于等于0") @Min(value = 0, message = "成绩必须大于等于0")
@Max(value = 100, message = "成绩必须小于等于100") @Max(value = 100, message = "成绩必须小于等于100")

64
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/ConferenceRecordVO.java

@ -0,0 +1,64 @@
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("id")
private String id;
@ApiModelProperty("编码")
private String code;
@ApiModelProperty("单位")
private String unit;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("会议计划开始时间")
private Date scheduledStartTime;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("会议计划开始时间")
private Date scheduledEndTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
@ApiModelProperty("会议实际开始时间")
private Date actualStartTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
@ApiModelProperty("会议实际开始时间")
private Date actualEndTime;
@ApiModelProperty("会议地点")
private String location;
@ApiModelProperty("主持人")
private String host;
@ApiModelProperty("会议方式")
private String conferenceMethod;
@ApiModelProperty("会议主题")
private String theme;
@ApiModelProperty("会议状态")
private String conferenceStatus;
@ApiModelProperty("记录人")
private String recorder;
@ApiModelProperty("会议内容")
private String content;
}

71
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordlVO.java

@ -0,0 +1,71 @@
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.springblade.core.tool.utils.DateUtil;
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("id")
private String id;
@ApiModelProperty("单位")
private String unit;
@ApiModelProperty("演练科目")
private String subject;
@JsonFormat(pattern = DateUtil.PATTERN_DATE)
@ApiModelProperty("演练计划开始时间")
private Date scheduledStartTime;
@JsonFormat(pattern = DateUtil.PATTERN_DATE)
@ApiModelProperty("演练计划结束时间")
private Date scheduledEndTime;
@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;
@ApiModelProperty("演练记录")
private String record;
@ApiModelProperty("演练评价")
private String comment;
}

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

@ -24,6 +24,9 @@ public class TestScoreVO {
@ApiModelProperty("姓名") @ApiModelProperty("姓名")
private String name; private String name;
@ApiModelProperty("姓名")
private String userId;
@ApiModelProperty("成绩") @ApiModelProperty("成绩")
private Integer score; private Integer score;
} }

70
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordVO.java

@ -0,0 +1,70 @@
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 javax.validation.constraints.Size;
import java.util.Date;
/**
* @author liwen
* @date 2024-01-15
*/
@Data
@ApiModel(value = "培训记录表VO类")
public class TrainRecordVO {
@ApiModelProperty("id")
private String id;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("计划培训时间")
private Date scheduledStartTime;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("计划培训时间")
private Date scheduledEndTime;
@ApiModelProperty("单位")
private String unit;
@ApiModelProperty("记录名称")
private String trainRecordName;
@ApiModelProperty("培训地点")
private String location;
@ApiModelProperty("培训方式")
private String trainMethod;
@ApiModelProperty("培训讲师")
private String teacher;
@ApiModelProperty("培训课程")
private String lesson;
@ApiModelProperty("实际培训结束时间")
private Date actualEndTime;
@ApiModelProperty("实际培训开始时间")
private Date actualStartTime;
@ApiModelProperty("关联考试:0-否,1-是")
private Integer isTest;
@ApiModelProperty("培训状态")
private String trainStatus;
@ApiModelProperty("编码")
private String code;
@ApiModelProperty("培训内容")
private String content;
@ApiModelProperty("培训评价")
private String command;
}

12
hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpAllocationController.java

@ -2,12 +2,16 @@ package com.hnac.hzims.spare.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.AssetsConstants;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation; import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType; import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType; import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.spare.entity.SpAllocationEntity; import com.hnac.hzims.spare.entity.SpAllocationEntity;
import com.hnac.hzims.spare.service.ISpAllocationService; import com.hnac.hzims.spare.service.ISpAllocationService;
import com.hnac.hzims.spare.vo.SpAllocationVO; import com.hnac.hzims.spare.vo.SpAllocationVO;
import com.hnac.hzinfo.log.annotation.Business;
import com.hnac.hzinfo.log.annotation.Operate;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
@ -34,6 +38,7 @@ import javax.validation.Valid;
@AllArgsConstructor @AllArgsConstructor
@RequestMapping("/sp_allocation") @RequestMapping("/sp_allocation")
@Api(value = "调拨单管理", tags = "调拨单管理") @Api(value = "调拨单管理", tags = "调拨单管理")
@Business(module = AssetsConstants.APP_NAME,value = "消息推送统计管理",ignore = false)
public class SpAllocationController extends BladeController { public class SpAllocationController extends BladeController {
private final ISpAllocationService sp_allocationService; private final ISpAllocationService sp_allocationService;
@ -44,6 +49,7 @@ public class SpAllocationController extends BladeController {
@GetMapping("/detail") @GetMapping("/detail")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入sp_allocation") @ApiOperation(value = "详情", notes = "传入sp_allocation")
@Operate(label = "调拨单详情",type = com.hnac.hzinfo.log.contants.BusinessType.QUERY,ignore = false)
public R<SpAllocationVO> detail(SpAllocationEntity sp_allocation) { public R<SpAllocationVO> detail(SpAllocationEntity sp_allocation) {
SpAllocationVO detail = sp_allocationService.getDetail(sp_allocation); SpAllocationVO detail = sp_allocationService.getDetail(sp_allocation);
return R.data(detail); return R.data(detail);
@ -56,6 +62,7 @@ public class SpAllocationController extends BladeController {
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入sp_allocation") @ApiOperation(value = "分页", notes = "传入sp_allocation")
@ApiIgnore @ApiIgnore
@Operate(label = "调拨单分页查询",type = com.hnac.hzinfo.log.contants.BusinessType.QUERY,ignore = false)
public R<IPage<SpAllocationEntity>> list(SpAllocationEntity sp_allocation, Query query) { public R<IPage<SpAllocationEntity>> list(SpAllocationEntity sp_allocation, Query query) {
IPage<SpAllocationEntity> pages = sp_allocationService.page(Condition.getPage(query), Condition.getQueryWrapper(sp_allocation)); IPage<SpAllocationEntity> pages = sp_allocationService.page(Condition.getPage(query), Condition.getQueryWrapper(sp_allocation));
return R.data(pages); return R.data(pages);
@ -67,6 +74,7 @@ public class SpAllocationController extends BladeController {
@GetMapping("/pageList") @GetMapping("/pageList")
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入sp_allocation") @ApiOperation(value = "分页", notes = "传入sp_allocation")
@Operate(label = "资产管理-调拨单详情",type = com.hnac.hzinfo.log.contants.BusinessType.QUERY,ignore = false)
@OperationAnnotation(moduleName = "资产管理", @OperationAnnotation(moduleName = "资产管理",
title = "调泼单",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, title = "调泼单",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE,
action = "分页查询调泼单列表") action = "分页查询调泼单列表")
@ -81,6 +89,7 @@ public class SpAllocationController extends BladeController {
@PostMapping("/save") @PostMapping("/save")
@ApiOperationSupport(order = 4) @ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入sp_allocation") @ApiOperation(value = "新增", notes = "传入sp_allocation")
@Operate(label = "调拨单新增",type = com.hnac.hzinfo.log.contants.BusinessType.INSERT,ignore = false)
public R save(@Valid @RequestBody SpAllocationEntity sp_allocation) { public R save(@Valid @RequestBody SpAllocationEntity sp_allocation) {
return R.status(sp_allocationService.save(sp_allocation)); return R.status(sp_allocationService.save(sp_allocation));
} }
@ -91,6 +100,7 @@ public class SpAllocationController extends BladeController {
@PostMapping("/update") @PostMapping("/update")
@ApiOperationSupport(order = 5) @ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入sp_allocation") @ApiOperation(value = "修改", notes = "传入sp_allocation")
@Operate(label = "调拨单修改",type = com.hnac.hzinfo.log.contants.BusinessType.UPDATE,ignore = false)
public R update(@Valid @RequestBody SpAllocationEntity sp_allocation) { public R update(@Valid @RequestBody SpAllocationEntity sp_allocation) {
return R.status(sp_allocationService.updateById(sp_allocation)); return R.status(sp_allocationService.updateById(sp_allocation));
} }
@ -100,6 +110,7 @@ public class SpAllocationController extends BladeController {
*/ */
@PostMapping("/submit") @PostMapping("/submit")
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
@Operate(label = "调拨单新增或修改",type = com.hnac.hzinfo.log.contants.BusinessType.UPDATE,ignore = false)
@ApiOperation(value = "新增或修改", notes = "传入sp_allocation") @ApiOperation(value = "新增或修改", notes = "传入sp_allocation")
public R submit(@Valid @RequestBody SpAllocationEntity sp_allocation) { public R submit(@Valid @RequestBody SpAllocationEntity sp_allocation) {
return R.status(sp_allocationService.saveOrUpdate(sp_allocation)); return R.status(sp_allocationService.saveOrUpdate(sp_allocation));
@ -112,6 +123,7 @@ public class SpAllocationController extends BladeController {
@PostMapping("/remove") @PostMapping("/remove")
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
@ApiOperation(value = "逻辑删除", notes = "传入ids") @ApiOperation(value = "逻辑删除", notes = "传入ids")
@Operate(label = "调拨单逻辑删除",type = com.hnac.hzinfo.log.contants.BusinessType.DELETE,ignore = false)
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(sp_allocationService.deleteLogic(Func.toLongList(ids))); return R.status(sp_allocationService.deleteLogic(Func.toLongList(ids)));
} }

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); R r = iFdpDiagnoseClient.setFaultStatusInfo(map);
if (!r.isSuccess()){ if (!r.isSuccess()){
log.error("setFaultStatusInfo接口修改处理状态异常参数为:"+param); log.error("setFaultStatusInfo接口修改处理状态异常,请求数据为:"+map+"\n"+"参数为:"+param+r.getMsg());
throw new ServiceException("修改告警状态异常,请稍后重试!"); // throw new ServiceException("修改告警状态异常,请稍后重试!");
} }
} }
//开启流程 //开启流程
@ -127,6 +127,7 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl<AlarmHandleMapper, A
R<BladeFlow> result = processClient.startProcessInstanceContainNameByKey(AlarmHandleConstant.dealAlarm, businessKey, processName, variable); R<BladeFlow> result = processClient.startProcessInstanceContainNameByKey(AlarmHandleConstant.dealAlarm, businessKey, processName, variable);
// 流程开启失败 // 流程开启失败
if (!result.isSuccess()) { if (!result.isSuccess()) {
log.error("缺陷流程开启失败,错误描述 : " + result.getMsg());
throw new ServiceException("缺陷流程开启失败,错误描述 : " + result.getMsg()); throw new ServiceException("缺陷流程开启失败,错误描述 : " + result.getMsg());
} }
param.setProcessInstanceId(result.getData().getProcessInstanceId()); param.setProcessInstanceId(result.getData().getProcessInstanceId());

9
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/RobotController.java

@ -29,6 +29,8 @@ import org.springblade.core.oss.OssTemplate;
import org.springblade.core.oss.model.BladeFile; import org.springblade.core.oss.model.BladeFile;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@ -39,6 +41,7 @@ import com.hnac.hzinfo.inspect.ai.service.IRobotService;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
/** /**
* 控制器 * 控制器
@ -80,6 +83,10 @@ public class RobotController extends BladeController {
public R<IPage<RobotEntity>> list(@ApiIgnore @RequestParam Map<String,Object> st_robot, Query query) { public R<IPage<RobotEntity>> list(@ApiIgnore @RequestParam Map<String,Object> st_robot, Query query) {
QueryWrapper<RobotEntity> queryWrapper = Condition.getQueryWrapper( st_robot, RobotEntity.class); QueryWrapper<RobotEntity> queryWrapper = Condition.getQueryWrapper( st_robot, RobotEntity.class);
IPage<RobotEntity> pages = st_robotService.page(Condition.getPage(query), queryWrapper); IPage<RobotEntity> pages = st_robotService.page(Condition.getPage(query), queryWrapper);
pages.getRecords().stream().filter(robot -> Func.isNotEmpty(robot.getUserId())).forEach(robotEntity -> {
User user = UserCache.getUser(robotEntity.getUserId());
robotEntity.setUserName(Optional.ofNullable(user).map(User::getName).orElse(null));
});
return R.data(pages); return R.data(pages);
} }
@ -157,7 +164,7 @@ public class RobotController extends BladeController {
@ApiOperationSupport(order = 11) @ApiOperationSupport(order = 11)
@ApiOperation(value = "获取机器人各项属性实时数据", notes = "获取机器人各项属性实时数据") @ApiOperation(value = "获取机器人各项属性实时数据", notes = "获取机器人各项属性实时数据")
@Operate(label = "获取机器人实时数据",type = BusinessType.QUERY,ignore = false) @Operate(label = "获取机器人实时数据",type = BusinessType.QUERY,ignore = false)
public R<List<RobotRealDataVO>> getRealDataByRobotCode(@RequestParam @ApiParam(value = "机器人编号", required = true) String robotCode) { public R<Map<String,List<RobotRealDataVO>>> getRealDataByRobotCode(@RequestParam @ApiParam(value = "机器人编号", required = true) String robotCode) {
return R.data(st_robotService.getRealDataByRobotCode(robotCode)); return R.data(st_robotService.getRealDataByRobotCode(robotCode));
} }

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/IRobotService.java

@ -39,7 +39,7 @@ public interface IRobotService extends BaseService<RobotEntity> {
* @param robotCode 机器人编号 * @param robotCode 机器人编号
* @return 实时数据 * @return 实时数据
*/ */
List<RobotRealDataVO> getRealDataByRobotCode(String robotCode); Map<String,List<RobotRealDataVO>> getRealDataByRobotCode(String robotCode);
IPage getRobotSoeData(String robotCode, String startTime, String endTime, Query query); IPage getRobotSoeData(String robotCode, String startTime, String endTime, Query query);
} }

11
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotServiceImpl.java

@ -47,6 +47,8 @@ import org.springframework.util.Assert;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -105,13 +107,11 @@ public class RobotServiceImpl extends BaseServiceImpl<RobotMapper, RobotEntity>
} }
@Override @Override
public List<RobotRealDataVO> getRealDataByRobotCode(String robotCode) { public Map<String,List<RobotRealDataVO>> getRealDataByRobotCode(String robotCode) {
R<List<DeviceInstanceAttrVO>> paramDeviceAttrR = deviceClient.getOnlineAttr(robotCode); R<List<DeviceInstanceAttrVO>> paramDeviceAttrR = deviceClient.getOnlineAttr(robotCode);
Assert.isTrue(paramDeviceAttrR.isSuccess(), () -> { Assert.isTrue(paramDeviceAttrR.isSuccess(), () -> {
throw new ServiceException("获取设备实例属性失败!"); throw new ServiceException("获取设备实例属性失败!");
}); });
DeviceRealDataPO po = new DeviceRealDataPO(); DeviceRealDataPO po = new DeviceRealDataPO();
po.setDeviceCode(robotCode); po.setDeviceCode(robotCode);
Result<List<List<Map<String, RealDataRedisVO>>>> realDataResult = deviceDataClient.getDeviceRealDataByCodes(Lists.newArrayList(po)); Result<List<List<Map<String, RealDataRedisVO>>>> realDataResult = deviceDataClient.getDeviceRealDataByCodes(Lists.newArrayList(po));
@ -123,9 +123,12 @@ public class RobotServiceImpl extends BaseServiceImpl<RobotMapper, RobotEntity>
.flatMap(m -> m.entrySet().stream().map(k -> { .flatMap(m -> m.entrySet().stream().map(k -> {
RobotRealDataVO data = BeanUtil.copy(k.getValue(), RobotRealDataVO.class); RobotRealDataVO data = BeanUtil.copy(k.getValue(), RobotRealDataVO.class);
data.setAttrName(k.getValue().getN()); data.setAttrName(k.getValue().getN());
Optional<DeviceInstanceAttrVO> attrOptional = paramDeviceAttrR.getData().stream().filter(deviceAttr -> k.getValue().getN().equals(deviceAttr.getName())).findFirst();
data.setModelClassifyId(attrOptional.get().getModelClassifyId());
data.setModelClassifyName(attrOptional.get().getModelClassifyName());
return data; return data;
})).collect(Collectors.toList()); })).collect(Collectors.toList());
return result; return result.stream().collect(Collectors.groupingBy(RobotRealDataVO::getModelClassifyName));
} }
@Override @Override

7
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/vo/robot/RobotRealDataVO.java

@ -12,6 +12,13 @@ import java.io.Serializable;
@Data @Data
@EqualsAndHashCode @EqualsAndHashCode
public class RobotRealDataVO implements Serializable { public class RobotRealDataVO implements Serializable {
@ApiModelProperty("模型分类")
private Long modelClassifyId;
@ApiModelProperty("模型分类名称")
private String modelClassifyName;
@ApiModelProperty("数据上送时间") @ApiModelProperty("数据上送时间")
private String ts; private String ts;

124
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java

@ -491,46 +491,92 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
@Override @Override
public List<VoteChartVo> getMaintenanceListStatistics(String startTime, String endTime,Long deptId) { public List<VoteChartVo> getMaintenanceListStatistics(String startTime, String endTime,Long deptId) {
List<OperMaintenanceTaskEntity> maintenanceTaskEntities = new ArrayList<>(); List<VoteChartVo> result = Lists.newArrayList();
R<List<Dept>> deptByCurrentUser = sysClient.getDeptByCurrentUser(); LambdaQueryWrapper<OperMaintenanceTaskEntity> wq = Wrappers.<OperMaintenanceTaskEntity>lambdaQuery()
List<Long> deptIds; .like(Func.isNotEmpty(deptId),OperMaintenanceTaskEntity::getCreateDept, deptId)
if (deptByCurrentUser.isSuccess() && CollectionUtil.isNotEmpty(deptByCurrentUser.getData())) { .ge(StringUtils.isNotBlank(startTime), OperMaintenanceTaskEntity::getDisposeTime, startTime)
deptIds = deptByCurrentUser.getData().stream().map(s -> s.getId()).collect(Collectors.toList()); .le(StringUtils.isNotBlank(endTime), OperMaintenanceTaskEntity::getDisposeTime, endTime)
} else { .orderByAsc(OperMaintenanceTaskEntity::getCreateDept);
throw new ServiceException("暂无机构权限"); List<OperMaintenanceTaskEntity> taskList = this.list(wq);
Map<Long, List<OperMaintenanceTaskEntity>> taskMapList = taskList.stream().filter(t -> Func.isNotEmpty(t.getDisposer()))
.flatMap(t -> Func.toLongList(t.getDisposer()).stream().filter(Func::isNotEmpty).map(u -> {
OperMaintenanceTaskEntity task = BeanUtil.copy(t, OperMaintenanceTaskEntity.class);
task.setDisposer(u.toString());
return task;
}))
.collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getCreateDept));
taskMapList.forEach((id,list) -> {
R<Dept> deptR = sysClient.getDept(id);
if(deptR.isSuccess() && StringUtil.isNotBlank(deptR.getData().getDeptName())) {
Map<String, List<OperMaintenanceTaskEntity>> userTaskMap = list.stream().collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getDisposer));
userTaskMap.forEach((userId,mt) -> {
VoteChartVo chartVo = new VoteChartVo();
chartVo.setName(deptR.getData().getDeptName());
chartVo.setUserName(Optional.of(userId).map(Long::parseLong).map(UserCache::getUser).map(User::getName).orElse("-"));
List<Long> sumIds = mt.stream().map(OperMaintenanceTaskEntity::getId).distinct().collect(Collectors.toList());
chartVo.setSumNum(sumIds.size());
chartVo.setSumIds(sumIds);
List<Long> finishIds = mt.stream().filter(task -> "结束".equals(task.getFlowTaskName())).map(OperMaintenanceTaskEntity::getId).distinct().collect(Collectors.toList());
chartVo.setFinishIds(finishIds);
chartVo.setFinishNum(finishIds.size());
chartVo.setUndoneIds((List<Long>)org.apache.commons.collections4.CollectionUtils.subtract(sumIds, finishIds));
chartVo.setUndoneNum(sumIds.size() - finishIds.size());
chartVo.setFinishRate(new BigDecimal((double)finishIds.size() / (double)sumIds.size() * 100).setScale(2,RoundingMode.HALF_UP).doubleValue());
result.add(chartVo);
});
} }
QueryWrapper<OperMaintenanceTaskEntity> queryWrapper = new QueryWrapper<>(); });
if (ObjectUtil.isNotEmpty(deptId)) { // 合计
if (deptIds.contains(deptId)) { if(CollectionUtil.isNotEmpty(result)) {
queryWrapper.in(ObjectUtils.isNotNull(deptIds), "CREATE_DEPT", deptId); VoteChartVo chartVo = new VoteChartVo();
} else { chartVo.setName("合计");
throw new ServiceException("暂无该机构权限"); chartVo.setSumNum(result.stream().collect(Collectors.summingInt(VoteChartVo::getSumNum)));
} chartVo.setFinishNum(result.stream().collect(Collectors.summingInt(VoteChartVo::getFinishNum)));
} else { chartVo.setUndoneNum(result.stream().collect(Collectors.summingInt(VoteChartVo::getUndoneNum)));
queryWrapper.in(ObjectUtils.isNotNull(deptIds), "CREATE_DEPT", deptIds); chartVo.setFinishRate(new BigDecimal((double)chartVo.getFinishNum() / (double)chartVo.getSumNum() * 100).setScale(2,RoundingMode.HALF_UP).doubleValue());
} result.add(chartVo);
queryWrapper.ge(ObjectUtils.isNotNull(startTime), "CREATE_TIME", startTime); }
queryWrapper.le(ObjectUtils.isNotNull(endTime), "CREATE_TIME", endTime); return result;
maintenanceTaskEntities = baseMapper.selectList(queryWrapper); // List<OperMaintenanceTaskEntity> maintenanceTaskEntities = new ArrayList<>();
// R<List<Dept>> deptByCurrentUser = sysClient.getDeptByCurrentUser();
List<VoteChartVo> res = new ArrayList<>(); // List<Long> deptIds;
if (CollectionUtil.isNotEmpty(maintenanceTaskEntities)) { // if (deptByCurrentUser.isSuccess() && CollectionUtil.isNotEmpty(deptByCurrentUser.getData())) {
VoteChartVo all = getVoteChartVo(maintenanceTaskEntities); // deptIds = deptByCurrentUser.getData().stream().map(s -> s.getId()).collect(Collectors.toList());
all.setName("总计"); // } else {
res.add(all); // throw new ServiceException("暂无机构权限");
Map<Long, List<OperMaintenanceTaskEntity>> collect = Optional.ofNullable(maintenanceTaskEntities).orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getCreateDept)); // }
for (Map.Entry<Long, List<OperMaintenanceTaskEntity>> longListEntry : collect.entrySet()) { // QueryWrapper<OperMaintenanceTaskEntity> queryWrapper = new QueryWrapper<>();
VoteChartVo voteChartVo = getVoteChartVo(longListEntry.getValue()); // if (ObjectUtil.isNotEmpty(deptId)) {
R<String> deptName = sysClient.getDeptName(longListEntry.getKey()); // if (deptIds.contains(deptId)) {
voteChartVo.setName(deptName.isSuccess() ? deptName.getData() : ""); // queryWrapper.in(ObjectUtils.isNotNull(deptIds), "CREATE_DEPT", deptId);
res.add(voteChartVo); // } else {
} // throw new ServiceException("暂无该机构权限");
} else { // }
VoteChartVo all = new VoteChartVo(); // } else {
all.setName("总计"); // queryWrapper.in(ObjectUtils.isNotNull(deptIds), "CREATE_DEPT", deptIds);
res.add(all); // }
} // queryWrapper.ge(ObjectUtils.isNotNull(startTime), "CREATE_TIME", startTime);
return res; // queryWrapper.le(ObjectUtils.isNotNull(endTime), "CREATE_TIME", endTime);
// maintenanceTaskEntities = baseMapper.selectList(queryWrapper);
//
// List<VoteChartVo> res = new ArrayList<>();
// if (CollectionUtil.isNotEmpty(maintenanceTaskEntities)) {
// VoteChartVo all = getVoteChartVo(maintenanceTaskEntities);
// all.setName("总计");
// res.add(all);
// Map<Long, List<OperMaintenanceTaskEntity>> collect = Optional.ofNullable(maintenanceTaskEntities).orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getCreateDept));
// for (Map.Entry<Long, List<OperMaintenanceTaskEntity>> longListEntry : collect.entrySet()) {
// VoteChartVo voteChartVo = getVoteChartVo(longListEntry.getValue());
// R<String> deptName = sysClient.getDeptName(longListEntry.getKey());
// voteChartVo.setName(deptName.isSuccess() ? deptName.getData() : "");
// res.add(voteChartVo);
// }
// } else {
// VoteChartVo all = new VoteChartVo();
// all.setName("总计");
// res.add(all);
// }
// return res;
} }
@Override @Override

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.IConferencePlanService;
import com.hnac.hzims.safeproduct.service.IConferenceRecordService; import com.hnac.hzims.safeproduct.service.IConferenceRecordService;
import com.hnac.hzims.safeproduct.vo.ConferenceRecordDetailVO; import com.hnac.hzims.safeproduct.vo.ConferenceRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.ConferenceRecordVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
@ -115,8 +116,8 @@ public class ConferenceController extends BladeController {
}) })
@ApiOperation(value = "会议记录分页") @ApiOperation(value = "会议记录分页")
@ApiOperationSupport(order = 10) @ApiOperationSupport(order = 10)
public R<IPage<ConferenceRecordEntity>> recordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) { public R<IPage<ConferenceRecordVO>> recordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<ConferenceRecordEntity> page = conferenceRecordService.recordPage(param, query); IPage<ConferenceRecordVO> page = conferenceRecordService.recordPage(param, query);
return R.data(page); 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.service.IRehearsalRecordService;
import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO; import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.RehearsalMonthVO; import com.hnac.hzims.safeproduct.vo.RehearsalMonthVO;
import com.hnac.hzims.safeproduct.vo.RehearsalRecordlVO;
import com.hnac.hzims.safeproduct.vo.RehearsalYearVO; import com.hnac.hzims.safeproduct.vo.RehearsalYearVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
@ -117,8 +118,8 @@ public class RehearsalController extends BladeController {
}) })
@ApiOperation(value = "演练记录分页") @ApiOperation(value = "演练记录分页")
@ApiOperationSupport(order = 10) @ApiOperationSupport(order = 10)
public R<IPage<RehearsalRecordEntity>> rehearsalRecordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) { public R<IPage<RehearsalRecordlVO>> rehearsalRecordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<RehearsalRecordEntity> page = rehearsalRecordService.rehearsalRecordPage(param, query); IPage<RehearsalRecordlVO> page = rehearsalRecordService.rehearsalRecordPage(param, query);
return R.data(page); 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.TestScoreDTO;
import com.hnac.hzims.safeproduct.dto.TrainRecordDTO; import com.hnac.hzims.safeproduct.dto.TrainRecordDTO;
import com.hnac.hzims.safeproduct.entity.TestEntity; 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.TrainPlanEntity;
import com.hnac.hzims.safeproduct.entity.TrainRecordEntity; import com.hnac.hzims.safeproduct.entity.TrainRecordEntity;
import com.hnac.hzims.safeproduct.service.ITestScoreService; import com.hnac.hzims.safeproduct.service.ITestScoreService;
@ -126,8 +127,8 @@ public class TrainController extends BladeController {
}) })
@ApiOperation(value = "培训记录分页") @ApiOperation(value = "培训记录分页")
@ApiOperationSupport(order = 10) @ApiOperationSupport(order = 10)
public R<IPage<TrainRecordEntity>> trainRecordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) { public R<IPage<TrainRecordVO>> trainRecordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<TrainRecordEntity> page = trainRecordService.trainRecordPage(param, query); IPage<TrainRecordVO> page = trainRecordService.trainRecordPage(param, query);
return R.data(page); return R.data(page);
} }
@ -142,14 +143,14 @@ public class TrainController extends BladeController {
@PostMapping("/saveTest") @PostMapping("/saveTest")
@ApiOperation(value = "新增考试") @ApiOperation(value = "新增考试")
@ApiOperationSupport(order = 12) @ApiOperationSupport(order = 12)
public R saveTest(@Valid @RequestBody TestEntity testEntity) { public R saveTest(@Valid @RequestBody TestDTO testEntity) {
return testService.saveTest(testEntity); return testService.saveTest(testEntity);
} }
@PostMapping("/updateTest") @PostMapping("/updateTest")
@ApiOperation(value = "修改考试") @ApiOperation(value = "修改考试")
@ApiOperationSupport(order = 13) @ApiOperationSupport(order = 13)
public R updateTest(@Valid @RequestBody TestEntity testEntity) { public R updateTest(@Valid @RequestBody TestDTO testEntity) {
return R.status(testService.updateTest(testEntity)); return R.status(testService.updateTest(testEntity));
} }
@ -192,8 +193,8 @@ public class TrainController extends BladeController {
@GetMapping("/testScoreList") @GetMapping("/testScoreList")
@ApiOperation(value = "考试成绩列表") @ApiOperation(value = "考试成绩列表")
@ApiOperationSupport(order = 18) @ApiOperationSupport(order = 18)
public R<List<TestScoreVO>> testScoreList(@RequestParam Long testId, String name) { public R<List<TestScoreEntity>> testScoreList(@RequestParam Long testId, String name) {
List<TestScoreVO> list = testScoreService.testScoreList(testId, name); List<TestScoreEntity> list = testScoreService.testScoreList(testId, name);
return R.data(list); return R.data(list);
} }
@GetMapping("/testScoreSum") @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.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.entity.ConferenceRecordEntity; import com.hnac.hzims.safeproduct.entity.ConferenceRecordEntity;
import com.hnac.hzims.safeproduct.vo.ConferenceRecordDetailVO; import com.hnac.hzims.safeproduct.vo.ConferenceRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.ConferenceRecordVO;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -51,5 +52,5 @@ public interface IConferenceRecordService extends IService<ConferenceRecordEntit
* @param query 分页类 * @param query 分页类
* @return 会议记录数据 * @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.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.entity.RehearsalRecordEntity; import com.hnac.hzims.safeproduct.entity.RehearsalRecordEntity;
import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO; import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.RehearsalRecordlVO;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -58,5 +59,5 @@ public interface IRehearsalRecordService extends IService<RehearsalRecordEntity>
* @param query 分页类 * @param query 分页类
* @return 演练记录数据 * @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 姓名 * @param name 姓名
* @return 考试成绩列表 * @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 考试记录实体类 * @param testEntity 考试记录实体类
* @return 返回结果封装类 * @return 返回结果封装类
*/ */
R saveTest(TestEntity testEntity); R saveTest(TestDTO testEntity);
/** /**
* 根据编码查询考试记录 * 根据编码查询考试记录
@ -65,7 +65,7 @@ public interface ITestService extends IService<TestEntity> {
* @param testEntity 考试记录实体类 * @param testEntity 考试记录实体类
* @return true-成功false-失败 * @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.dto.TrainRecordDTO;
import com.hnac.hzims.safeproduct.entity.TrainRecordEntity; import com.hnac.hzims.safeproduct.entity.TrainRecordEntity;
import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO; 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.mp.support.Query;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -74,5 +75,5 @@ public interface ITrainRecordService extends IService<TrainRecordEntity> {
* @param query 分页类 * @param query 分页类
* @return 培训记录数据 * @return 培训记录数据
*/ */
IPage<TrainRecordEntity> trainRecordPage(Map<String, Object> param, Query query); IPage<TrainRecordVO> trainRecordPage(Map<String, Object> param, Query query);
} }

31
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.alibaba.excel.util.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.common.utils.Condition; 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.BaseUtil;
import com.hnac.hzims.safeproduct.utils.TimeUtils; import com.hnac.hzims.safeproduct.utils.TimeUtils;
import com.hnac.hzims.safeproduct.vo.ConferenceRecordDetailVO; 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.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.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -153,7 +153,7 @@ public class ConferenceRecordServiceImpl extends ServiceImpl<ConferenceRecordMap
* 会议记录分页 * 会议记录分页
*/ */
@Override @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<>(); QueryWrapper<ConferenceRecordEntity> queryWrapper = new QueryWrapper<>();
String conferencePlanId = String.valueOf(param.get("conferencePlanId")); String conferencePlanId = String.valueOf(param.get("conferencePlanId"));
String startTime = String.valueOf(param.get("actualStartTime")); String startTime = String.valueOf(param.get("actualStartTime"));
@ -168,7 +168,28 @@ public class ConferenceRecordServiceImpl extends ServiceImpl<ConferenceRecordMap
queryWrapper.lambda().le(ConferenceRecordEntity::getActualEndTime, endTime); queryWrapper.lambda().le(ConferenceRecordEntity::getActualEndTime, endTime);
} }
queryWrapper.lambda().orderByDesc(ConferenceRecordEntity::getCreateTime); 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());
trainRecordVO.setActualEndTime(record.getActualEndTime());
trainRecordVO.setRecorder(record.getRecorder());
trainRecordVO.setContent(record.getContent());
trainRecordVO.setCode(record.getCode());
trainRecordVO.setId(record.getId().toString());
recordlVOS.add(trainRecordVO);
}
res.setRecords(recordlVOS);
return res;
} }
/** /**

31
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.alibaba.excel.util.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.common.utils.Condition; 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.BaseUtil;
import com.hnac.hzims.safeproduct.utils.TimeUtils; import com.hnac.hzims.safeproduct.utils.TimeUtils;
import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO; import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.RehearsalRecordlVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.utils.BeanUtil;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -193,7 +196,7 @@ public class RehearsalRecordServiceImpl extends ServiceImpl<RehearsalRecordMappe
* 演练记录分页 * 演练记录分页
*/ */
@Override @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<>(); QueryWrapper<RehearsalRecordEntity> queryWrapper = new QueryWrapper<>();
String rehearsalPlanId = String.valueOf(param.get("rehearsalPlanId")); String rehearsalPlanId = String.valueOf(param.get("rehearsalPlanId"));
String actualStartTime = String.valueOf(param.get("actualStartTime")); String actualStartTime = String.valueOf(param.get("actualStartTime"));
@ -208,6 +211,30 @@ public class RehearsalRecordServiceImpl extends ServiceImpl<RehearsalRecordMappe
queryWrapper.lambda().le(RehearsalRecordEntity::getActualEndTime, actualEndTime); queryWrapper.lambda().le(RehearsalRecordEntity::getActualEndTime, actualEndTime);
} }
queryWrapper.lambda().orderByDesc(RehearsalRecordEntity::getCreateTime); 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());
rehearsalRecordlVO.setCode(record.getCode());
rehearsalRecordlVO.setComment(record.getComment());
rehearsalRecordlVO.setRecord(record.getRecord());
rehearsalRecordlVO.setId(record.getId().toString());
recordlVOS.add(rehearsalRecordlVO);
}
res.setRecords(recordlVOS);
return res;
} }
} }

64
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; package com.hnac.hzims.safeproduct.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.safeproduct.dto.TestScoreDTO; import com.hnac.hzims.safeproduct.dto.TestScoreDTO;
import com.hnac.hzims.safeproduct.entity.TestEntity; import com.hnac.hzims.safeproduct.entity.TestEntity;
@ -10,12 +11,25 @@ import com.hnac.hzims.safeproduct.mapper.TestScoreMapper;
import com.hnac.hzims.safeproduct.service.ITestScoreService; import com.hnac.hzims.safeproduct.service.ITestScoreService;
import com.hnac.hzims.safeproduct.vo.TestScoreSumVO; import com.hnac.hzims.safeproduct.vo.TestScoreSumVO;
import com.hnac.hzims.safeproduct.vo.TestScoreVO; 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.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -27,31 +41,58 @@ import java.util.stream.Collectors;
* @date 2023-12-25 * @date 2023-12-25
*/ */
@Service @Service
@RequiredArgsConstructor
@Slf4j
public class TestScoreServiceImpl extends ServiceImpl<TestScoreMapper, TestScoreEntity> implements ITestScoreService { public class TestScoreServiceImpl extends ServiceImpl<TestScoreMapper, TestScoreEntity> implements ITestScoreService {
private final ISysClient sysClient;
private final IUserClient userClient;
@Resource @Resource
TestMapper testMapper; TestMapper testMapper;
/** /**
* 查询考试成绩列表 * 查询考试成绩列表
*/ */
@Override @Override
public List<TestScoreVO> testScoreList(Long testId, String name) { public List<TestScoreEntity> testScoreList(Long testId, String name) {
return baseMapper.testScoreList(testId, name); return baseMapper.selectList(Wrappers.<TestScoreEntity>lambdaQuery().eq(TestScoreEntity::getTestId, testId));
} }
/** /**
* 批量填写分数 * 批量填写分数
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class)
public boolean updateBatchScore(TestScoreDTO testScoreDTO) { public boolean updateBatchScore(TestScoreDTO testScoreDTO) {
boolean b = this.removeRelativeTestScore(testScoreDTO.getTestId());
if (b) {
List<TestScoreVO> scoreList = testScoreDTO.getScoreList(); List<TestScoreVO> scoreList = testScoreDTO.getScoreList();
List<TestScoreEntity> testScoreEntities = new ArrayList<>(); List<TestScoreEntity> testScoreEntities = new ArrayList<>();
R<List<Dept>> deptListR = sysClient.getDeptList();
if (!deptListR.isSuccess()&&CollectionUtils.isEmpty(deptListR.getData())){
log.error("获取所有机构数据失败");
}
List<Dept> deptList = deptListR.getData();
scoreList.forEach(score -> { scoreList.forEach(score -> {
TestScoreEntity testScoreEntity = new TestScoreEntity(); TestScoreEntity testScoreEntity = new TestScoreEntity();
BeanUtils.copyProperties(score, testScoreEntity); BeanUtils.copyProperties(score, testScoreEntity);
testScoreEntity.setTestId(testScoreDTO.getTestId()); testScoreEntity.setTestId(testScoreDTO.getTestId());
if (!"^".equals(score.getUserId())&&StringUtils.isEmpty(score.getDeptName())) {
User user = UserCache.getUser(Long.valueOf(score.getUserId()));
if (ObjectUtil.isNotEmpty(user)&&StringUtils.isNotBlank(user.getDeptId())){
testScoreEntity.setDeptId(user.getDeptId());
List<Dept> depts = deptList.stream().filter(s -> Long.valueOf(user.getDeptId()).equals(s.getId())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(depts)) {
testScoreEntity.setDeptName(depts.get(0).getDeptName());
}
}
}else {
testScoreEntity.setUserId(null);
}
testScoreEntities.add(testScoreEntity); testScoreEntities.add(testScoreEntity);
}); });
return this.updateBatchById(testScoreEntities); return this.saveOrUpdateBatch(testScoreEntities);
}
return false;
} }
/** /**
@ -87,19 +128,22 @@ public class TestScoreServiceImpl extends ServiceImpl<TestScoreMapper, TestScore
TestScoreSumVO testScoreSumVO = new TestScoreSumVO(); TestScoreSumVO testScoreSumVO = new TestScoreSumVO();
TestEntity testEntity = testMapper.selectById(testId); TestEntity testEntity = testMapper.selectById(testId);
String peopleName = testEntity.getPeopleName(); String peopleName = testEntity.getPeopleName();
if (StringUtils.isNotBlank(peopleName)){ if (StringUtils.isNotBlank(peopleName)) {
String[] split = peopleName.split(","); String[] split = peopleName.split(",");
testScoreSumVO.setPeopleNum( split.length); testScoreSumVO.setPeopleNum(split.length);
} }
QueryWrapper<TestScoreEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<TestScoreEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(TestScoreEntity::getTestId, testId); queryWrapper.lambda().eq(TestScoreEntity::getTestId, testId);
List<TestScoreEntity> list = this.list(queryWrapper); List<TestScoreEntity> list = this.list(queryWrapper);
if (CollectionUtils.isNotEmpty(list)){ list= list.stream().filter(s -> s.getScore() != null).collect(Collectors.toList());
testScoreSumVO.setPeopleNum( list.size());
List<TestScoreEntity> collect = list.stream().filter(s -> s.getScore() > 60).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
testScoreSumVO.setPercentage(new Double(collect.size() / list.size())); testScoreSumVO.setActualPeopleNum(list.size());
List<TestScoreEntity> passCollect = list.stream().filter(s -> s.getScore() > 60).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(list)&&CollectionUtils.isNotEmpty(passCollect)) {
double result = BigDecimal.valueOf(passCollect.size()).divide(BigDecimal.valueOf(list.size()),2, RoundingMode.UP).doubleValue();
testScoreSumVO.setPercentage(result);
}else {
testScoreSumVO.setPercentage(0.0);
} }
} }
return testScoreSumVO; 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; package com.hnac.hzims.safeproduct.service.impl;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.util.CollectionUtils; import com.alibaba.excel.util.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.ITestScoreService;
import com.hnac.hzims.safeproduct.service.ITestService; import com.hnac.hzims.safeproduct.service.ITestService;
import com.hnac.hzims.safeproduct.utils.BaseUtil; 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.mp.support.Query;
import org.springblade.core.tool.api.R; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -36,8 +43,9 @@ import java.util.stream.Collectors;
* @date 2023-12-25 * @date 2023-12-25
*/ */
@Service @Service
@RequiredArgsConstructor
public class TestServiceImpl extends ServiceImpl<TestMapper, TestEntity> implements ITestService { public class TestServiceImpl extends ServiceImpl<TestMapper, TestEntity> implements ITestService {
private final ISysClient sysClient;
@Autowired @Autowired
ITestScoreService testScoreService; ITestScoreService testScoreService;
@ -49,7 +57,7 @@ public class TestServiceImpl extends ServiceImpl<TestMapper, TestEntity> impleme
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public R saveTest(TestEntity testEntity) { public R saveTest(TestDTO testEntity) {
// 判断培训计划是否需要考试,若不需要,则无法新增考试记录 // 判断培训计划是否需要考试,若不需要,则无法新增考试记录
TrainPlanEntity trainPlanEntity = trainPlanMapper.selectById(testEntity.getTrainPlanId()); TrainPlanEntity trainPlanEntity = trainPlanMapper.selectById(testEntity.getTrainPlanId());
if (trainPlanEntity.getIsTest().equals(SafeProductConstant.TRAIN_PLAN_HAS_NO_TEST)) { 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()); TestEntity test = getTestByCode(testEntity.getCode());
// 获取姓名数组 // 获取姓名数组
String people = test.getPeopleName(); String people = testEntity.getPeopleName();
String peopleId = testEntity.getPeopleId();
String[] person = people.split(","); 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.status(testScoreService.saveBatch(scoreList));
} }
return R.fail("新增考试记录失败"); return R.fail("新增考试记录失败");
@ -153,7 +163,7 @@ public class TestServiceImpl extends ServiceImpl<TestMapper, TestEntity> impleme
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public boolean updateTest(TestEntity testEntity) { public boolean updateTest(TestDTO testEntity) {
// 判断考试人员是否有变化 // 判断考试人员是否有变化
TestEntity oldTest = getTestByCode(testEntity.getCode()); TestEntity oldTest = getTestByCode(testEntity.getCode());
// 更新考试记录 // 更新考试记录
@ -170,8 +180,9 @@ public class TestServiceImpl extends ServiceImpl<TestMapper, TestEntity> impleme
// 若删除成功,新增新的考试成绩数据 // 若删除成功,新增新的考试成绩数据
if (removeByIds) { if (removeByIds) {
String[] person = testEntity.getPeopleName().split(","); 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); return testScoreService.saveBatch(scoreList);
} }
} }
@ -193,12 +204,25 @@ public class TestServiceImpl extends ServiceImpl<TestMapper, TestEntity> impleme
* @param person 参考人员 * @param person 参考人员
* @return 成绩列表 * @return 成绩列表
*/ */
private List<TestScoreEntity> getReferenceTestScore(TestEntity testEntity, String[] person) { private List<TestScoreEntity> getReferenceTestScore(TestEntity testEntity, String[] person,String[] personId) {
List<TestScoreEntity> res = new ArrayList<>(); List<TestScoreEntity> res = new ArrayList<>();
for (String name : person) { for (int i = 0; i < person.length; i++) {
TestScoreEntity testScoreEntity = new TestScoreEntity(); TestScoreEntity testScoreEntity = new TestScoreEntity();
testScoreEntity.setTestId(testEntity.getId()); 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(user.getDeptId()));
if (deptNameR.isSuccess() && StringUtils.isNotBlank(deptNameR.getData())) {
testScoreEntity.setDeptName(deptNameR.getData());
}
}
}else {
testScoreEntity.setUserId(null);
}
res.add(testScoreEntity); res.add(testScoreEntity);
} }
return res; return res;

29
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.BaseUtil;
import com.hnac.hzims.safeproduct.utils.TimeUtils; import com.hnac.hzims.safeproduct.utils.TimeUtils;
import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO; 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.mp.support.Query;
import org.springblade.core.tool.utils.BeanUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -188,9 +190,32 @@ public class TrainRecordServiceImpl extends ServiceImpl<TrainRecordMapper, Train
* 培训记录分页 * 培训记录分页
*/ */
@Override @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()); 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());
trainRecordVO.setActualStartTime(record.getActualStartTime());
trainRecordVO.setScheduledStartTime(record.getActualStartTime());
trainRecordVO.setTrainRecordName(record.getTrainRecordName());
trainRecordVO.setContent(record.getContent());
trainRecordVO.setCommand(record.getCommand());
trainRecordVO.setCode(record.getCode());
trainRecordVO.setId(record.getId().toString());
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