diff --git a/hzims-service-api/common-api/src/main/java/com/hnac/hzims/vo/VoteChartVo.java b/hzims-service-api/common-api/src/main/java/com/hnac/hzims/vo/VoteChartVo.java index dcb909b..96d05be 100644 --- a/hzims-service-api/common-api/src/main/java/com/hnac/hzims/vo/VoteChartVo.java +++ b/hzims-service-api/common-api/src/main/java/com/hnac/hzims/vo/VoteChartVo.java @@ -16,12 +16,12 @@ import java.util.List; @ApiModel("各个票种统计表") public class VoteChartVo { @ApiModelProperty(value = "站点名称") - @ColumnWidth(value = 20) + @ColumnWidth(value = 25) @ExcelProperty(value = "站点名称", index = 0) private String name; @ApiModelProperty(value = "总数量") - @ExcelProperty(value = "总数量", index = 1) + @ExcelProperty(value = "总数量", index = 2) @ColumnWidth(value = 20) private int sumNum; @@ -30,7 +30,7 @@ public class VoteChartVo { private List sumIds; @ApiModelProperty(value = "未完成数量") - @ExcelProperty(value = "未完成数量", index = 2) + @ExcelProperty(value = "未完成数量", index = 3) @ColumnWidth(value = 20) private int undoneNum; @@ -40,7 +40,7 @@ public class VoteChartVo { @ApiModelProperty(value = "完成数量") @ColumnWidth(value = 20) - @ExcelProperty(value = "完成数量", index = 3) + @ExcelProperty(value = "完成数量", index = 4) private int finishNum; @ApiModelProperty(value = "完成id") @@ -48,7 +48,12 @@ public class VoteChartVo { private List finishIds; @ApiModelProperty(value = "完成率") - @ExcelProperty(value = "完成率", index = 4) + @ExcelProperty(value = "完成率", index = 5) @ColumnWidth(value = 20) private Double finishRate; + + @ApiModelProperty(value = "用戶名") + @ExcelProperty(value = "用戶名", index = 1) + @ColumnWidth(value = 20) + private String userName; } diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/entity/RobotEntity.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/entity/RobotEntity.java index e179398..efd4f1a 100644 --- a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/entity/RobotEntity.java +++ b/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; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.hnac.hzinfo.inspect.utils.QueryField; import com.hnac.hzinfo.inspect.utils.SqlCondition; @@ -72,4 +73,8 @@ public class RobotEntity extends TenantEntity { @ApiModelProperty(value = "描述信息") private Long remark; + @ApiModelProperty("用户名称") + @TableField(exist = false) + private String userName; + } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/TestDTO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/TestDTO.java index 6b55684..2c0e72f 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/TestDTO.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/TestDTO.java @@ -1,20 +1,26 @@ package com.hnac.hzims.safeproduct.dto; +import com.hnac.hzims.safeproduct.entity.TestEntity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import javax.validation.constraints.Size; + /** * @author liwen * @date 2023-12-25 */ @Data @ApiModel(value = "考试记录DTO类") -public class TestDTO { +public class TestDTO extends TestEntity { @ApiModelProperty("考试记录id") private Long id; @ApiModelProperty("考试记录名称") private String testName; + + @ApiModelProperty("参考人员Id,以,分隔") + private String peopleId; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java index 354920b..17e5119 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java @@ -1,11 +1,13 @@ package com.hnac.hzims.safeproduct.entity; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.core.mp.base.BaseEntity; +import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; @@ -41,10 +43,18 @@ public class TestEntity extends BaseEntity { private String unit; @NotNull + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + @DateTimeFormat( + pattern = "yyyy-MM-dd HH:mm" + ) @ApiModelProperty("考试开始时间") private Date testStartTime; @NotNull + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + @DateTimeFormat( + pattern = "yyyy-MM-dd HH:mm" + ) @ApiModelProperty("考试结束时间") private Date testEndTime; @@ -67,6 +77,7 @@ public class TestEntity extends BaseEntity { @ApiModelProperty("参考人员") private String peopleName; + @Size(max = 1000, message = "考试图片字段长度不能超过1000") @ApiModelProperty("考试图片") private String imgPath; diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestScoreEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestScoreEntity.java index a95020e..9a2b8f3 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestScoreEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestScoreEntity.java @@ -29,6 +29,18 @@ public class TestScoreEntity extends BaseEntity { @ApiModelProperty("姓名") private String name; + @Size(max = 50, message = "姓名字段长度不能超过50") + @ApiModelProperty("姓名") + private String userId; + + @Size(max = 50, message = "姓名字段长度不能超过50") + @ApiModelProperty("机构名称") + private String deptName; + + @Size(max = 50, message = "姓名字段长度不能超过50") + @ApiModelProperty("机构Id") + private String deptId; + @NotNull @Min(value = 0, message = "成绩必须大于等于0") @Max(value = 100, message = "成绩必须小于等于100") diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/ConferenceRecordVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/ConferenceRecordVO.java new file mode 100644 index 0000000..615c5aa --- /dev/null +++ b/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; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordlVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordlVO.java new file mode 100644 index 0000000..f92966e --- /dev/null +++ b/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; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreVO.java index 7de3c9a..f04fea1 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreVO.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreVO.java @@ -24,6 +24,9 @@ public class TestScoreVO { @ApiModelProperty("姓名") private String name; + @ApiModelProperty("姓名") + private String userId; + @ApiModelProperty("成绩") private Integer score; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordVO.java new file mode 100644 index 0000000..b1e8744 --- /dev/null +++ b/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; +} diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpAllocationController.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpAllocationController.java index 65c7295..9db6aa5 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpAllocationController.java +++ b/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.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.AssetsConstants; import com.hnac.hzims.common.logs.annotation.OperationAnnotation; import com.hnac.hzims.common.logs.enums.BusinessType; 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.service.ISpAllocationService; 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.ApiOperation; import io.swagger.annotations.ApiParam; @@ -34,6 +38,7 @@ import javax.validation.Valid; @AllArgsConstructor @RequestMapping("/sp_allocation") @Api(value = "调拨单管理", tags = "调拨单管理") +@Business(module = AssetsConstants.APP_NAME,value = "消息推送统计管理",ignore = false) public class SpAllocationController extends BladeController { private final ISpAllocationService sp_allocationService; @@ -44,6 +49,7 @@ public class SpAllocationController extends BladeController { @GetMapping("/detail") @ApiOperationSupport(order = 1) @ApiOperation(value = "详情", notes = "传入sp_allocation") + @Operate(label = "调拨单详情",type = com.hnac.hzinfo.log.contants.BusinessType.QUERY,ignore = false) public R detail(SpAllocationEntity sp_allocation) { SpAllocationVO detail = sp_allocationService.getDetail(sp_allocation); return R.data(detail); @@ -56,6 +62,7 @@ public class SpAllocationController extends BladeController { @ApiOperationSupport(order = 2) @ApiOperation(value = "分页", notes = "传入sp_allocation") @ApiIgnore + @Operate(label = "调拨单分页查询",type = com.hnac.hzinfo.log.contants.BusinessType.QUERY,ignore = false) public R> list(SpAllocationEntity sp_allocation, Query query) { IPage pages = sp_allocationService.page(Condition.getPage(query), Condition.getQueryWrapper(sp_allocation)); return R.data(pages); @@ -67,6 +74,7 @@ public class SpAllocationController extends BladeController { @GetMapping("/pageList") @ApiOperationSupport(order = 2) @ApiOperation(value = "分页", notes = "传入sp_allocation") + @Operate(label = "资产管理-调拨单详情",type = com.hnac.hzinfo.log.contants.BusinessType.QUERY,ignore = false) @OperationAnnotation(moduleName = "资产管理", title = "调泼单",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, action = "分页查询调泼单列表") @@ -81,6 +89,7 @@ public class SpAllocationController extends BladeController { @PostMapping("/save") @ApiOperationSupport(order = 4) @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) { return R.status(sp_allocationService.save(sp_allocation)); } @@ -91,6 +100,7 @@ public class SpAllocationController extends BladeController { @PostMapping("/update") @ApiOperationSupport(order = 5) @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) { return R.status(sp_allocationService.updateById(sp_allocation)); } @@ -100,6 +110,7 @@ public class SpAllocationController extends BladeController { */ @PostMapping("/submit") @ApiOperationSupport(order = 6) + @Operate(label = "调拨单新增或修改",type = com.hnac.hzinfo.log.contants.BusinessType.UPDATE,ignore = false) @ApiOperation(value = "新增或修改", notes = "传入sp_allocation") public R submit(@Valid @RequestBody SpAllocationEntity sp_allocation) { return R.status(sp_allocationService.saveOrUpdate(sp_allocation)); @@ -112,6 +123,7 @@ public class SpAllocationController extends BladeController { @PostMapping("/remove") @ApiOperationSupport(order = 7) @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) { return R.status(sp_allocationService.deleteLogic(Func.toLongList(ids))); } diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java index bc15768..6e1cd30 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java @@ -112,8 +112,8 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl result = processClient.startProcessInstanceContainNameByKey(AlarmHandleConstant.dealAlarm, businessKey, processName, variable); // 流程开启失败 if (!result.isSuccess()) { + log.error("缺陷流程开启失败,错误描述 : " + result.getMsg()); throw new ServiceException("缺陷流程开启失败,错误描述 : " + result.getMsg()); } param.setProcessInstanceId(result.getData().getProcessInstanceId()); diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/RobotController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/RobotController.java index 18f48a0..740a04d 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/RobotController.java +++ b/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.tool.api.R; 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.web.bind.annotation.*; 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.Map; +import java.util.Optional; /** * 控制器 @@ -80,6 +83,10 @@ public class RobotController extends BladeController { public R> list(@ApiIgnore @RequestParam Map st_robot, Query query) { QueryWrapper queryWrapper = Condition.getQueryWrapper( st_robot, RobotEntity.class); IPage 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); } @@ -157,7 +164,7 @@ public class RobotController extends BladeController { @ApiOperationSupport(order = 11) @ApiOperation(value = "获取机器人各项属性实时数据", notes = "获取机器人各项属性实时数据") @Operate(label = "获取机器人实时数据",type = BusinessType.QUERY,ignore = false) - public R> getRealDataByRobotCode(@RequestParam @ApiParam(value = "机器人编号", required = true) String robotCode) { + public R>> getRealDataByRobotCode(@RequestParam @ApiParam(value = "机器人编号", required = true) String robotCode) { return R.data(st_robotService.getRealDataByRobotCode(robotCode)); } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/IRobotService.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/IRobotService.java index 67a9929..ca7fc40 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/IRobotService.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/IRobotService.java @@ -39,7 +39,7 @@ public interface IRobotService extends BaseService { * @param robotCode 机器人编号 * @return 实时数据 */ - List getRealDataByRobotCode(String robotCode); + Map> getRealDataByRobotCode(String robotCode); IPage getRobotSoeData(String robotCode, String startTime, String endTime, Query query); } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotServiceImpl.java index 141abef..aa30f6b 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotServiceImpl.java +++ b/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.List; import java.util.Map; +import java.util.Optional; +import java.util.function.Function; import java.util.stream.Collectors; /** @@ -105,13 +107,11 @@ public class RobotServiceImpl extends BaseServiceImpl } @Override - public List getRealDataByRobotCode(String robotCode) { + public Map> getRealDataByRobotCode(String robotCode) { R> paramDeviceAttrR = deviceClient.getOnlineAttr(robotCode); Assert.isTrue(paramDeviceAttrR.isSuccess(), () -> { throw new ServiceException("获取设备实例属性失败!"); }); - - DeviceRealDataPO po = new DeviceRealDataPO(); po.setDeviceCode(robotCode); Result>>> realDataResult = deviceDataClient.getDeviceRealDataByCodes(Lists.newArrayList(po)); @@ -123,9 +123,12 @@ public class RobotServiceImpl extends BaseServiceImpl .flatMap(m -> m.entrySet().stream().map(k -> { RobotRealDataVO data = BeanUtil.copy(k.getValue(), RobotRealDataVO.class); data.setAttrName(k.getValue().getN()); + Optional 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; })).collect(Collectors.toList()); - return result; + return result.stream().collect(Collectors.groupingBy(RobotRealDataVO::getModelClassifyName)); } @Override diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/vo/robot/RobotRealDataVO.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/vo/robot/RobotRealDataVO.java index 7a50091..f3371a7 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/vo/robot/RobotRealDataVO.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/vo/robot/RobotRealDataVO.java @@ -12,6 +12,13 @@ import java.io.Serializable; @Data @EqualsAndHashCode public class RobotRealDataVO implements Serializable { + + @ApiModelProperty("模型分类") + private Long modelClassifyId; + + @ApiModelProperty("模型分类名称") + private String modelClassifyName; + @ApiModelProperty("数据上送时间") private String ts; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java index 25fb744..ded403b 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java @@ -491,46 +491,92 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl getMaintenanceListStatistics(String startTime, String endTime,Long deptId) { - List maintenanceTaskEntities = new ArrayList<>(); - R> deptByCurrentUser = sysClient.getDeptByCurrentUser(); - List deptIds; - if (deptByCurrentUser.isSuccess() && CollectionUtil.isNotEmpty(deptByCurrentUser.getData())) { - deptIds = deptByCurrentUser.getData().stream().map(s -> s.getId()).collect(Collectors.toList()); - } else { - throw new ServiceException("暂无机构权限"); - } - QueryWrapper queryWrapper = new QueryWrapper<>(); - if (ObjectUtil.isNotEmpty(deptId)) { - if (deptIds.contains(deptId)) { - queryWrapper.in(ObjectUtils.isNotNull(deptIds), "CREATE_DEPT", deptId); - } else { - throw new ServiceException("暂无该机构权限"); - } - } else { - queryWrapper.in(ObjectUtils.isNotNull(deptIds), "CREATE_DEPT", deptIds); - } - queryWrapper.ge(ObjectUtils.isNotNull(startTime), "CREATE_TIME", startTime); - queryWrapper.le(ObjectUtils.isNotNull(endTime), "CREATE_TIME", endTime); - maintenanceTaskEntities = baseMapper.selectList(queryWrapper); - - List res = new ArrayList<>(); - if (CollectionUtil.isNotEmpty(maintenanceTaskEntities)) { - VoteChartVo all = getVoteChartVo(maintenanceTaskEntities); - all.setName("总计"); - res.add(all); - Map> collect = Optional.ofNullable(maintenanceTaskEntities).orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getCreateDept)); - for (Map.Entry> longListEntry : collect.entrySet()) { - VoteChartVo voteChartVo = getVoteChartVo(longListEntry.getValue()); - R deptName = sysClient.getDeptName(longListEntry.getKey()); - voteChartVo.setName(deptName.isSuccess() ? deptName.getData() : ""); - res.add(voteChartVo); + List result = Lists.newArrayList(); + LambdaQueryWrapper wq = Wrappers.lambdaQuery() + .like(Func.isNotEmpty(deptId),OperMaintenanceTaskEntity::getCreateDept, deptId) + .ge(StringUtils.isNotBlank(startTime), OperMaintenanceTaskEntity::getDisposeTime, startTime) + .le(StringUtils.isNotBlank(endTime), OperMaintenanceTaskEntity::getDisposeTime, endTime) + .orderByAsc(OperMaintenanceTaskEntity::getCreateDept); + List taskList = this.list(wq); + Map> 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 deptR = sysClient.getDept(id); + if(deptR.isSuccess() && StringUtil.isNotBlank(deptR.getData().getDeptName())) { + Map> 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 sumIds = mt.stream().map(OperMaintenanceTaskEntity::getId).distinct().collect(Collectors.toList()); + chartVo.setSumNum(sumIds.size()); + chartVo.setSumIds(sumIds); + List 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)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); + }); } - } else { - VoteChartVo all = new VoteChartVo(); - all.setName("总计"); - res.add(all); + }); + // 合计 + if(CollectionUtil.isNotEmpty(result)) { + VoteChartVo chartVo = new VoteChartVo(); + chartVo.setName("合计"); + chartVo.setSumNum(result.stream().collect(Collectors.summingInt(VoteChartVo::getSumNum))); + chartVo.setFinishNum(result.stream().collect(Collectors.summingInt(VoteChartVo::getFinishNum))); + chartVo.setUndoneNum(result.stream().collect(Collectors.summingInt(VoteChartVo::getUndoneNum))); + chartVo.setFinishRate(new BigDecimal((double)chartVo.getFinishNum() / (double)chartVo.getSumNum() * 100).setScale(2,RoundingMode.HALF_UP).doubleValue()); + result.add(chartVo); } - return res; + return result; +// List maintenanceTaskEntities = new ArrayList<>(); +// R> deptByCurrentUser = sysClient.getDeptByCurrentUser(); +// List deptIds; +// if (deptByCurrentUser.isSuccess() && CollectionUtil.isNotEmpty(deptByCurrentUser.getData())) { +// deptIds = deptByCurrentUser.getData().stream().map(s -> s.getId()).collect(Collectors.toList()); +// } else { +// throw new ServiceException("暂无机构权限"); +// } +// QueryWrapper queryWrapper = new QueryWrapper<>(); +// if (ObjectUtil.isNotEmpty(deptId)) { +// if (deptIds.contains(deptId)) { +// queryWrapper.in(ObjectUtils.isNotNull(deptIds), "CREATE_DEPT", deptId); +// } else { +// throw new ServiceException("暂无该机构权限"); +// } +// } else { +// queryWrapper.in(ObjectUtils.isNotNull(deptIds), "CREATE_DEPT", deptIds); +// } +// queryWrapper.ge(ObjectUtils.isNotNull(startTime), "CREATE_TIME", startTime); +// queryWrapper.le(ObjectUtils.isNotNull(endTime), "CREATE_TIME", endTime); +// maintenanceTaskEntities = baseMapper.selectList(queryWrapper); +// +// List res = new ArrayList<>(); +// if (CollectionUtil.isNotEmpty(maintenanceTaskEntities)) { +// VoteChartVo all = getVoteChartVo(maintenanceTaskEntities); +// all.setName("总计"); +// res.add(all); +// Map> collect = Optional.ofNullable(maintenanceTaskEntities).orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getCreateDept)); +// for (Map.Entry> longListEntry : collect.entrySet()) { +// VoteChartVo voteChartVo = getVoteChartVo(longListEntry.getValue()); +// R 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 diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/ConferenceController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/ConferenceController.java index d025f73..9310bc6 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/ConferenceController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/ConferenceController.java @@ -7,6 +7,7 @@ import com.hnac.hzims.safeproduct.entity.ConferenceRecordEntity; import com.hnac.hzims.safeproduct.service.IConferencePlanService; import com.hnac.hzims.safeproduct.service.IConferenceRecordService; import com.hnac.hzims.safeproduct.vo.ConferenceRecordDetailVO; +import com.hnac.hzims.safeproduct.vo.ConferenceRecordVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -115,8 +116,8 @@ public class ConferenceController extends BladeController { }) @ApiOperation(value = "会议记录分页") @ApiOperationSupport(order = 10) - public R> recordPage(@ApiIgnore @RequestParam Map param, Query query) { - IPage page = conferenceRecordService.recordPage(param, query); + public R> recordPage(@ApiIgnore @RequestParam Map param, Query query) { + IPage page = conferenceRecordService.recordPage(param, query); return R.data(page); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java index 4182137..50175f4 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java @@ -8,6 +8,7 @@ import com.hnac.hzims.safeproduct.service.IRehearsalPlanService; import com.hnac.hzims.safeproduct.service.IRehearsalRecordService; import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO; import com.hnac.hzims.safeproduct.vo.RehearsalMonthVO; +import com.hnac.hzims.safeproduct.vo.RehearsalRecordlVO; import com.hnac.hzims.safeproduct.vo.RehearsalYearVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -117,8 +118,8 @@ public class RehearsalController extends BladeController { }) @ApiOperation(value = "演练记录分页") @ApiOperationSupport(order = 10) - public R> rehearsalRecordPage(@ApiIgnore @RequestParam Map param, Query query) { - IPage page = rehearsalRecordService.rehearsalRecordPage(param, query); + public R> rehearsalRecordPage(@ApiIgnore @RequestParam Map param, Query query) { + IPage page = rehearsalRecordService.rehearsalRecordPage(param, query); return R.data(page); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java index e5cef0f..de236ad 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java @@ -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> trainRecordPage(@ApiIgnore @RequestParam Map param, Query query) { - IPage page = trainRecordService.trainRecordPage(param, query); + public R> trainRecordPage(@ApiIgnore @RequestParam Map param, Query query) { + IPage page = trainRecordService.trainRecordPage(param, query); return R.data(page); } @@ -142,14 +143,14 @@ public class TrainController extends BladeController { @PostMapping("/saveTest") @ApiOperation(value = "新增考试") @ApiOperationSupport(order = 12) - public R saveTest(@Valid @RequestBody TestEntity testEntity) { + public R saveTest(@Valid @RequestBody TestDTO testEntity) { return testService.saveTest(testEntity); } @PostMapping("/updateTest") @ApiOperation(value = "修改考试") @ApiOperationSupport(order = 13) - public R updateTest(@Valid @RequestBody TestEntity testEntity) { + public R updateTest(@Valid @RequestBody TestDTO testEntity) { return R.status(testService.updateTest(testEntity)); } @@ -192,8 +193,8 @@ public class TrainController extends BladeController { @GetMapping("/testScoreList") @ApiOperation(value = "考试成绩列表") @ApiOperationSupport(order = 18) - public R> testScoreList(@RequestParam Long testId, String name) { - List list = testScoreService.testScoreList(testId, name); + public R> testScoreList(@RequestParam Long testId, String name) { + List list = testScoreService.testScoreList(testId, name); return R.data(list); } @GetMapping("/testScoreSum") diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IConferenceRecordService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IConferenceRecordService.java index 569623e..45ca492 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IConferenceRecordService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IConferenceRecordService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.hnac.hzims.safeproduct.entity.ConferenceRecordEntity; import com.hnac.hzims.safeproduct.vo.ConferenceRecordDetailVO; +import com.hnac.hzims.safeproduct.vo.ConferenceRecordVO; import org.springblade.core.mp.support.Query; import javax.servlet.http.HttpServletResponse; @@ -51,5 +52,5 @@ public interface IConferenceRecordService extends IService recordPage(Map param, Query query); + IPage recordPage(Map param, Query query); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalRecordService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalRecordService.java index 92b08c8..eacaab1 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalRecordService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalRecordService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.hnac.hzims.safeproduct.entity.RehearsalRecordEntity; import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO; +import com.hnac.hzims.safeproduct.vo.RehearsalRecordlVO; import org.springblade.core.mp.support.Query; import javax.servlet.http.HttpServletResponse; @@ -58,5 +59,5 @@ public interface IRehearsalRecordService extends IService * @param query 分页类 * @return 演练记录数据 */ - IPage rehearsalRecordPage(Map param, Query query); + IPage rehearsalRecordPage(Map param, Query query); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestScoreService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestScoreService.java index ce7e884..54ca22f 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestScoreService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestScoreService.java @@ -22,7 +22,7 @@ public interface ITestScoreService extends IService { * @param name 姓名 * @return 考试成绩列表 */ - List testScoreList(Long testId, String name); + List testScoreList(Long testId, String name); /** * 批量填写分数 diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestService.java index 4a59b6e..c1bfaf6 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestService.java @@ -23,7 +23,7 @@ public interface ITestService extends IService { * @param testEntity 考试记录实体类 * @return 返回结果封装类 */ - R saveTest(TestEntity testEntity); + R saveTest(TestDTO testEntity); /** * 根据编码查询考试记录 @@ -65,7 +65,7 @@ public interface ITestService extends IService { * @param testEntity 考试记录实体类 * @return true-成功,false-失败 */ - boolean updateTest(TestEntity testEntity); + boolean updateTest(TestDTO testEntity); /** * 考试记录分页 diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainRecordService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainRecordService.java index 57d5d62..85af66a 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainRecordService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainRecordService.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.hnac.hzims.safeproduct.dto.TrainRecordDTO; import com.hnac.hzims.safeproduct.entity.TrainRecordEntity; import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO; +import com.hnac.hzims.safeproduct.vo.TrainRecordVO; import org.springblade.core.mp.support.Query; import javax.servlet.http.HttpServletResponse; @@ -74,5 +75,5 @@ public interface ITrainRecordService extends IService { * @param query 分页类 * @return 培训记录数据 */ - IPage trainRecordPage(Map param, Query query); + IPage trainRecordPage(Map param, Query query); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferenceRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferenceRecordServiceImpl.java index 5b6c913..0977dff 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferenceRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferenceRecordServiceImpl.java @@ -5,6 +5,7 @@ import cn.hutool.core.date.DatePattern; import com.alibaba.excel.util.CollectionUtils; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.common.utils.Condition; @@ -19,16 +20,15 @@ import com.hnac.hzims.safeproduct.service.IConferenceRecordService; import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.utils.TimeUtils; import com.hnac.hzims.safeproduct.vo.ConferenceRecordDetailVO; -import com.hnac.hzims.ticket.constants.TicketConstants; +import com.hnac.hzims.safeproduct.vo.ConferenceRecordVO; import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.BeanUtil; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; -import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -153,7 +153,7 @@ public class ConferenceRecordServiceImpl extends ServiceImpl recordPage(Map param, Query query) { + public IPage recordPage(Map param, Query query) { QueryWrapper queryWrapper = new QueryWrapper<>(); String conferencePlanId = String.valueOf(param.get("conferencePlanId")); String startTime = String.valueOf(param.get("actualStartTime")); @@ -168,7 +168,28 @@ public class ConferenceRecordServiceImpl extends ServiceImpl page = this.page(Condition.getPage(query), queryWrapper); + IPage res=new Page<>(); + res.setSize(page.getSize()); + res.setTotal(page.getTotal()); + res.setPages(page.getPages()); + List records = page.getRecords(); + List recordlVOS =new ArrayList<>(); + for (ConferenceRecordEntity record : records) { + ConferenceRecordVO trainRecordVO = new ConferenceRecordVO(); + Long planId = record.getConferencePlanId(); + ConferencePlanEntity conferencePlanEntity = conferencePlanMapper.selectById(planId); + BeanUtil.copy(conferencePlanEntity,trainRecordVO); + trainRecordVO.setActualStartTime(record.getActualStartTime()); + 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; } /** diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java index c4b7203..d5f79c6 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java @@ -5,6 +5,7 @@ import cn.hutool.core.date.DatePattern; import com.alibaba.excel.util.CollectionUtils; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.common.utils.Condition; @@ -19,8 +20,10 @@ import com.hnac.hzims.safeproduct.service.IRehearsalRecordService; import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.utils.TimeUtils; import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO; +import com.hnac.hzims.safeproduct.vo.RehearsalRecordlVO; import lombok.extern.slf4j.Slf4j; import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.utils.BeanUtil; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -193,7 +196,7 @@ public class RehearsalRecordServiceImpl extends ServiceImpl rehearsalRecordPage(Map param, Query query) { + public IPage rehearsalRecordPage(Map param, Query query) { QueryWrapper queryWrapper = new QueryWrapper<>(); String rehearsalPlanId = String.valueOf(param.get("rehearsalPlanId")); String actualStartTime = String.valueOf(param.get("actualStartTime")); @@ -208,6 +211,30 @@ public class RehearsalRecordServiceImpl extends ServiceImpl rehearsalRecordList = this.page(Condition.getPage(query), queryWrapper); + IPage res=new Page<>(); + res.setSize(rehearsalRecordList.getSize()); + res.setTotal(rehearsalRecordList.getTotal()); + res.setPages(rehearsalRecordList.getPages()); + List records = rehearsalRecordList.getRecords(); + List recordlVOS =new ArrayList<>(); + for (RehearsalRecordEntity record : records) { + RehearsalRecordlVO rehearsalRecordlVO = new RehearsalRecordlVO(); + Long rehearsalPlanId1 = record.getRehearsalPlanId(); + RehearsalPlanEntity rehearsalPlanEntity = rehearsalPlanMapper.selectById(rehearsalPlanId1); + BeanUtil.copy(rehearsalPlanEntity,rehearsalRecordlVO); + rehearsalRecordlVO.setPeopleName(record.getPeopleName()); + int length = record.getPeopleName().split(",").length; + rehearsalRecordlVO.setPeopleNum(String.valueOf(length)); + rehearsalRecordlVO.setActualStartTime(record.getActualStartTime()); + rehearsalRecordlVO.setActualEndTime(record.getActualEndTime()); + 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; } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java index 6e6b952..ce59424 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java @@ -1,6 +1,7 @@ package com.hnac.hzims.safeproduct.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.safeproduct.dto.TestScoreDTO; import com.hnac.hzims.safeproduct.entity.TestEntity; @@ -10,12 +11,25 @@ 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.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.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -27,31 +41,58 @@ import java.util.stream.Collectors; * @date 2023-12-25 */ @Service +@RequiredArgsConstructor +@Slf4j public class TestScoreServiceImpl extends ServiceImpl implements ITestScoreService { + private final ISysClient sysClient; + private final IUserClient userClient; @Resource TestMapper testMapper; + /** * 查询考试成绩列表 */ @Override - public List testScoreList(Long testId, String name) { - return baseMapper.testScoreList(testId, name); + public List testScoreList(Long testId, String name) { + return baseMapper.selectList(Wrappers.lambdaQuery().eq(TestScoreEntity::getTestId, testId)); } /** * 批量填写分数 */ @Override + @Transactional(rollbackFor = Exception.class) public boolean updateBatchScore(TestScoreDTO testScoreDTO) { - List scoreList = testScoreDTO.getScoreList(); - List testScoreEntities = new ArrayList<>(); - scoreList.forEach(score -> { - TestScoreEntity testScoreEntity = new TestScoreEntity(); - BeanUtils.copyProperties(score, testScoreEntity); - testScoreEntity.setTestId(testScoreDTO.getTestId()); - testScoreEntities.add(testScoreEntity); - }); - return this.updateBatchById(testScoreEntities); + boolean b = this.removeRelativeTestScore(testScoreDTO.getTestId()); + if (b) { + List scoreList = testScoreDTO.getScoreList(); + List testScoreEntities = new ArrayList<>(); + R> deptListR = sysClient.getDeptList(); + if (!deptListR.isSuccess()&&CollectionUtils.isEmpty(deptListR.getData())){ + log.error("获取所有机构数据失败"); + } + List deptList = deptListR.getData(); + scoreList.forEach(score -> { + TestScoreEntity testScoreEntity = new TestScoreEntity(); + BeanUtils.copyProperties(score, testScoreEntity); + 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 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); + }); + return this.saveOrUpdateBatch(testScoreEntities); + } + return false; } /** @@ -87,20 +128,23 @@ public class TestScoreServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); queryWrapper.lambda().eq(TestScoreEntity::getTestId, testId); List list = this.list(queryWrapper); - if (CollectionUtils.isNotEmpty(list)){ - testScoreSumVO.setPeopleNum( list.size()); - List collect = list.stream().filter(s -> s.getScore() > 60).collect(Collectors.toList()); - if (CollectionUtils.isNotEmpty(list)) { - testScoreSumVO.setPercentage(new Double(collect.size() / list.size())); - } + list= list.stream().filter(s -> s.getScore() != null).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(list)) { + testScoreSumVO.setActualPeopleNum(list.size()); + List 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; } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java index 09cc4df..4179aae 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java @@ -1,6 +1,7 @@ package com.hnac.hzims.safeproduct.service.impl; import cn.hutool.core.date.DatePattern; +import cn.hutool.core.util.ObjectUtil; import com.alibaba.excel.util.CollectionUtils; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -16,8 +17,14 @@ import com.hnac.hzims.safeproduct.mapper.TrainPlanMapper; import com.hnac.hzims.safeproduct.service.ITestScoreService; import com.hnac.hzims.safeproduct.service.ITestService; import com.hnac.hzims.safeproduct.utils.BaseUtil; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang.ObjectUtils; +import org.apache.commons.lang.StringUtils; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; +import org.springblade.system.feign.ISysClient; +import org.springblade.system.user.cache.UserCache; +import org.springblade.system.user.entity.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -36,8 +43,9 @@ import java.util.stream.Collectors; * @date 2023-12-25 */ @Service +@RequiredArgsConstructor public class TestServiceImpl extends ServiceImpl implements ITestService { - + private final ISysClient sysClient; @Autowired ITestScoreService testScoreService; @@ -49,7 +57,7 @@ public class TestServiceImpl extends ServiceImpl impleme */ @Transactional(rollbackFor = Exception.class) @Override - public R saveTest(TestEntity testEntity) { + public R saveTest(TestDTO testEntity) { // 判断培训计划是否需要考试,若不需要,则无法新增考试记录 TrainPlanEntity trainPlanEntity = trainPlanMapper.selectById(testEntity.getTrainPlanId()); if (trainPlanEntity.getIsTest().equals(SafeProductConstant.TRAIN_PLAN_HAS_NO_TEST)) { @@ -69,10 +77,12 @@ public class TestServiceImpl extends ServiceImpl impleme // 查询考试记录 TestEntity test = getTestByCode(testEntity.getCode()); // 获取姓名数组 - String people = test.getPeopleName(); + String people = testEntity.getPeopleName(); + String peopleId = testEntity.getPeopleId(); String[] person = people.split(","); + String[] peopleIds = peopleId.split(","); // 新增参考人员成绩数据 - List scoreList = getReferenceTestScore(test, person); + List scoreList = getReferenceTestScore(test, person,peopleIds); return R.status(testScoreService.saveBatch(scoreList)); } return R.fail("新增考试记录失败"); @@ -153,7 +163,7 @@ public class TestServiceImpl extends ServiceImpl impleme */ @Transactional(rollbackFor = Exception.class) @Override - public boolean updateTest(TestEntity testEntity) { + public boolean updateTest(TestDTO testEntity) { // 判断考试人员是否有变化 TestEntity oldTest = getTestByCode(testEntity.getCode()); // 更新考试记录 @@ -170,8 +180,9 @@ public class TestServiceImpl extends ServiceImpl impleme // 若删除成功,新增新的考试成绩数据 if (removeByIds) { String[] person = testEntity.getPeopleName().split(","); + String[] personId = testEntity.getPeopleId().split(","); // 新增参考人员成绩数据 - List scoreList = getReferenceTestScore(testEntity, person); + List scoreList = getReferenceTestScore(testEntity, person,personId); return testScoreService.saveBatch(scoreList); } } @@ -193,12 +204,25 @@ public class TestServiceImpl extends ServiceImpl impleme * @param person 参考人员 * @return 成绩列表 */ - private List getReferenceTestScore(TestEntity testEntity, String[] person) { + private List getReferenceTestScore(TestEntity testEntity, String[] person,String[] personId) { List res = new ArrayList<>(); - for (String name : person) { + for (int i = 0; i < person.length; i++) { TestScoreEntity testScoreEntity = new TestScoreEntity(); testScoreEntity.setTestId(testEntity.getId()); - testScoreEntity.setName(name); + testScoreEntity.setName(person[i]); + if (!"^".equals(personId[i])) { + testScoreEntity.setUserId(personId[i]); + User user = UserCache.getUser(Long.valueOf(personId[i])); + if (ObjectUtil.isNotEmpty(user)) { + testScoreEntity.setDeptId(user.getDeptId()); + R deptNameR = sysClient.getDeptName(Long.valueOf(user.getDeptId())); + if (deptNameR.isSuccess() && StringUtils.isNotBlank(deptNameR.getData())) { + testScoreEntity.setDeptName(deptNameR.getData()); + } + } + }else { + testScoreEntity.setUserId(null); + } res.add(testScoreEntity); } return res; diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java index a47cd6b..866364c 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java @@ -21,7 +21,9 @@ import com.hnac.hzims.safeproduct.service.ITrainRecordService; import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.utils.TimeUtils; import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO; +import com.hnac.hzims.safeproduct.vo.TrainRecordVO; import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.utils.BeanUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -188,9 +190,32 @@ public class TrainRecordServiceImpl extends ServiceImpl trainRecordPage(Map param, Query query) { + public IPage trainRecordPage(Map param, Query query) { IPage page = new Page<>(query.getCurrent(), query.getSize()); - return baseMapper.trainRecordPage(page, param); + IPage trainRecordList = baseMapper.trainRecordPage(page, param); + IPage res=new Page<>(); + res.setSize(trainRecordList.getSize()); + res.setTotal(trainRecordList.getTotal()); + res.setPages(trainRecordList.getPages()); + List records = trainRecordList.getRecords(); + List recordlVOS =new ArrayList<>(); + for (TrainRecordEntity record : records) { + TrainRecordVO trainRecordVO = new TrainRecordVO(); + Long getTrainPlanId = record.getTrainPlanId(); + TrainPlanEntity trainPlanEntity = trainPlanMapper.selectById(getTrainPlanId); + BeanUtil.copy(trainPlanEntity,trainRecordVO); + trainRecordVO.setActualEndTime(record.getActualEndTime()); + 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; } /** diff --git a/hzims-service/safeproduct/src/main/resources/db/3.0.0.sql.1 b/hzims-service/safeproduct/src/main/resources/db/3.0.0.sql.1 new file mode 100644 index 0000000..99497d7 --- /dev/null +++ b/hzims-service/safeproduct/src/main/resources/db/3.0.0.sql.1 @@ -0,0 +1,4 @@ +ALTER TABLE `hzims_test_score` +ADD COLUMN `user_id` bigint(20) NULL AFTER `is_deleted`, +ADD COLUMN `dept_name` varchar(255) NULL AFTER `user_id`, +ADD COLUMN `dept_id` bigint(20) NULL AFTER `dept_name`; \ No newline at end of file