From 3005c6196f72632ede07af0adc47043422eb13f4 Mon Sep 17 00:00:00 2001 From: tyty Date: Thu, 17 Aug 2023 17:04:25 +0800 Subject: [PATCH 01/33] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=99=BA=E8=83=BD?= =?UTF-8?q?=E8=AF=8A=E6=96=ADbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java index 5561d68..364ca2d 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java @@ -523,6 +523,7 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl Date: Fri, 18 Aug 2023 10:06:29 +0800 Subject: [PATCH 02/33] =?UTF-8?q?=E5=B7=A1=E6=A3=80-=E6=97=A5=E5=B8=B8-?= =?UTF-8?q?=E6=A3=80=E4=BF=AE-=E6=B6=88=E7=BC=BA=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hzims-service-api/common-api/pom.xml | 4 ++ .../main/java/com/hnac/hzims/vo/VoteChartVo.java | 39 ++++++++++++ .../defect/vo/OperDefectStatisticsVO.java | 11 +++- .../maintenance/dto/OperMaintenanceTaskDTO.java | 8 ++- .../operational/report/vo/CheckVoteChartVo.java | 45 +++++++++++++ .../com/hnac/hzinfo/inspect/task/dto/TaskDTO.java | 7 +++ .../inspect/task/controller/TaskController.java | 68 ++++++++++++++++---- .../hzinfo/inspect/task/service/ITaskService.java | 7 ++- .../inspect/task/service/impl/TaskServiceImpl.java | 65 ++++++++++++++++++- .../hnac/hzinfo/inspect/task/vo/TaskListQuery.java | 6 +- .../controller/OperAccessStatisticsController.java | 3 +- .../controller/OperAccessTaskController.java | 51 +++++++++++++++ .../access/dto/OperAccessStatisticsDTO.java | 3 +- .../access/mapper/OperAccessStatisticsMapper.xml | 6 ++ .../access/service/IOperAccessTaskService.java | 5 +- .../service/impl/OperAccessTaskServiceImpl.java | 64 +++++++++++++++++++ .../census/service/impl/TargetServiceImpl.java | 4 +- .../controller/OperDefectStatisticsController.java | 12 ++-- .../controller/OperPhenomenonController.java | 50 +++++++++++++++ .../defect/service/IOperPhenomenonService.java | 6 +- .../impl/OperDefectStatisticsServiceImpl.java | 3 + .../service/impl/OperPhenomenonServiceImpl.java | 72 +++++++++++++++++++-- .../controller/OperMaintenanceTaskController.java | 67 ++++++++++++++++---- .../service/IOperMaintenanceTaskService.java | 7 ++- .../impl/OperMaintenanceTaskServiceImpl.java | 73 +++++++++++++++++++++- 25 files changed, 630 insertions(+), 56 deletions(-) create mode 100644 hzims-service-api/common-api/src/main/java/com/hnac/hzims/vo/VoteChartVo.java create mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/CheckVoteChartVo.java diff --git a/hzims-service-api/common-api/pom.xml b/hzims-service-api/common-api/pom.xml index dad68bd..49c639e 100644 --- a/hzims-service-api/common-api/pom.xml +++ b/hzims-service-api/common-api/pom.xml @@ -22,6 +22,10 @@ + + com.alibaba + easyexcel + 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 new file mode 100644 index 0000000..788f4cd --- /dev/null +++ b/hzims-service-api/common-api/src/main/java/com/hnac/hzims/vo/VoteChartVo.java @@ -0,0 +1,39 @@ +package com.hnac.hzims.vo; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author hx + */ +@Data +@ApiModel("各个票种统计表") +public class VoteChartVo { + @ApiModelProperty(value = "站点名称") + @ExcelProperty(value = "站点名称", index = 0) + private String name; + + @ApiModelProperty(value = "总数量") + @ExcelProperty(value = "总数量", index = 1) + private int sumNum; + @ApiModelProperty(value = "总数量id") + @ExcelIgnore + private List sumIds; + @ApiModelProperty(value = "未完成数量") + @ExcelProperty(value = "未完成数量", index = 2) + private int undoneNum; + @ApiModelProperty(value = "未完成id") + @ExcelIgnore + private List undoneIds; + @ApiModelProperty(value = "完成数量") + @ExcelProperty(value = "完成数量", index = 3) + private int finishNum; + @ApiModelProperty(value = "完成id") + @ExcelIgnore + private List finishIds; +} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperDefectStatisticsVO.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperDefectStatisticsVO.java index e420e57..bb1120c 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperDefectStatisticsVO.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperDefectStatisticsVO.java @@ -1,13 +1,14 @@ package com.hnac.hzims.operational.defect.vo; import com.fasterxml.jackson.annotation.JsonFormat; +import com.hnac.hzims.operational.defect.entity.OperDefectStatisticsEntity; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; -import com.hnac.hzims.operational.defect.entity.OperDefectStatisticsEntity; import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; +import java.util.List; /** * 模型VO @@ -22,7 +23,8 @@ public class OperDefectStatisticsVO extends OperDefectStatisticsEntity { @ApiModelProperty(value = "问题发现人名称") private String finderName; - + @ApiModelProperty(value = "现象Ids") + private List defectCodeList; @ApiModelProperty(value = "甄别人名称") private String discriminatorName; @@ -69,4 +71,9 @@ public class OperDefectStatisticsVO extends OperDefectStatisticsEntity { ) @ApiModelProperty(value = "定论时间范围-最晚") private Date createEndTime; + + @ApiModelProperty("当前页") + private Integer current; + @ApiModelProperty("每页的数量") + private Integer size; } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/dto/OperMaintenanceTaskDTO.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/dto/OperMaintenanceTaskDTO.java index bd32e77..5d82099 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/dto/OperMaintenanceTaskDTO.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/dto/OperMaintenanceTaskDTO.java @@ -1,6 +1,5 @@ package com.hnac.hzims.operational.maintenance.dto; -import com.baomidou.mybatisplus.annotation.TableField; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -24,6 +23,8 @@ public class OperMaintenanceTaskDTO extends OperMaintenanceTaskEntity { @ApiModelProperty("任务Id 多个按逗号分隔") private String taskIds; + @ApiModelProperty("任务Id 多个按逗号分隔") + private List taskList; @ApiModelProperty("任务Id 多个按逗号分隔") private List deptIds; @@ -33,4 +34,9 @@ public class OperMaintenanceTaskDTO extends OperMaintenanceTaskEntity { @ApiModelProperty("结束时间") private String endTime; + + @ApiModelProperty("当前页") + private Integer current; + @ApiModelProperty("每页的数量") + private Integer size; } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/CheckVoteChartVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/CheckVoteChartVo.java new file mode 100644 index 0000000..0c4234b --- /dev/null +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/CheckVoteChartVo.java @@ -0,0 +1,45 @@ +package com.hnac.hzims.operational.report.vo; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author hx + */ +@Data +@ApiModel("缺陷统计表") +public class CheckVoteChartVo { + @ApiModelProperty(value = "站点名称") + @ExcelProperty(value = "站点名称", index = 0) + private String name; + + @ApiModelProperty(value = "现象数量") + @ExcelProperty(value = "现象数量", index = 1) + private int phenomenonNum; + @ApiModelProperty(value = "现象数量id") + @ExcelIgnore + private List phenomenonIds; + @ApiModelProperty(value = "缺陷数量") + @ExcelProperty(value = "缺陷数量", index = 2) + private int defectNum; + @ApiModelProperty(value = "缺陷code") + @ExcelIgnore + private List defectIds; + @ApiModelProperty(value = "处理数量") + @ExcelProperty(value = "处理数量", index = 3) + private int handleNum; + @ApiModelProperty(value = "处理code") + @ExcelIgnore + private List handleIds; + @ApiModelProperty(value = "定论数量") + @ExcelProperty(value = "定论数量", index = 4) + private int conclusionNum; + @ApiModelProperty(value = "定论code") + @ExcelIgnore + private List conclusionIds; +} diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/dto/TaskDTO.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/dto/TaskDTO.java index 2d6a4a2..fd8d81d 100644 --- a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/dto/TaskDTO.java +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/dto/TaskDTO.java @@ -11,6 +11,7 @@ import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.time.LocalDateTime; +import java.util.List; /** * @ClassName TaskDTO @@ -34,4 +35,10 @@ public class TaskDTO extends TaskEntity implements Serializable { @ApiModelProperty(value = "任务计划开始时间-止") private LocalDateTime planStartTimeEnd; + @ApiModelProperty(value = "id集合") + private List ids; + @ApiModelProperty("当前页") + private Integer current; + @ApiModelProperty("每页的数量") + private Integer size; } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java index 90b5af1..aceb616 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java @@ -1,16 +1,15 @@ package com.hnac.hzinfo.inspect.task.controller; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.alibaba.excel.EasyExcel; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.fasterxml.jackson.annotation.JsonRawValue; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.google.common.collect.Lists; 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.vo.VoteChartVo; import com.hnac.hzinfo.core.push.enums.PushAudienceType; import com.hnac.hzinfo.core.push.model.PushAudience; import com.hnac.hzinfo.core.push.model.PushInfo; @@ -31,14 +30,14 @@ import com.hnac.hzinfo.inspect.utils.Condition; import io.swagger.annotations.*; import lombok.AllArgsConstructor; import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.cache.utils.CacheUtil; +import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.support.BladePage; import org.springblade.core.mp.support.Query; import org.springblade.core.secure.annotation.PreAuth; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.Func; +import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.resource.feign.IPushClient; import org.springblade.resource.vo.PushInfoVO; import org.springblade.system.user.cache.UserCache; @@ -46,7 +45,13 @@ import org.springblade.system.user.entity.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import java.util.*; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.net.URLEncoder; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** @@ -104,26 +109,29 @@ public class TaskController extends BladeController { return R.data(detail); } - @GetMapping("/listPage") + @PostMapping("/listPage") @ApiOperation(value = "巡检任务分页查询-站长级", notes = "传入task") @ApiOperationSupport(order = 1) - public R> listPage(TaskDTO taskDTO, Query query) { - return R.data(taskService.page(taskDTO,query)); + public R> listPage(@RequestBody TaskDTO taskDTO) { + return R.data(taskService.page(taskDTO)); } /** * PC端分页显示任务列表 */ - @GetMapping("/list") + @PostMapping("/list") @ApiOperation(value = "分页显示任务列表", notes = "传入task") @OperationAnnotation(moduleName = "巡检管理",title = "我的巡检任务",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, action = "分页显示任务列表") - public R> list(TaskListQuery task, Query query) { + public R> list(@RequestBody TaskListQuery task) { //CacheUtil.put("test#2","inspect","test","12"); // LambdaQueryWrapper queryWrapper = Condition.getQueryWrapper(new TaskEntity(),task); // queryWrapper.orderByDesc(TaskEntity::getUpdateTime); // IPage pages = taskService.page(Condition.getPage(query), queryWrapper); + Query query = new Query(); + query.setSize(task.getSize()); + query.setCurrent(task.getCurrent()); IPage pages = Condition.getPage(query); if(!AuthUtil.isAdministrator()){ task.setCurUserId(AuthUtil.getUserId()); @@ -370,5 +378,43 @@ public class TaskController extends BladeController { return R.data(pageList); } + /** + * 巡检计划统计 + */ + @GetMapping("/getTaskListStatistics") + @ApiOperation(value = "巡检计划统计", notes = "传入计划id") + public R> getTaskListStatistics(String startTime,String endTime,Long deptId) { + if(ObjectUtil.isEmpty(AuthUtil.getUser())||ObjectUtil.isEmpty(AuthUtil.getUser().getUserId())){ + return R.fail("暂无权限查看,请稍后重试"); + } + List list=taskService.getTaskListStatistics(startTime,endTime,deptId); + return R.data(list); + } + /** + * 巡检计划统计 + */ + @GetMapping("/importTaskListStatistics") + @ApiOperation(value = "导出", notes = "传入计划id") + public void importTaskListStatistics(HttpServletResponse response, String startTime, String endTime,Long deptId) { + if(ObjectUtil.isEmpty(AuthUtil.getUser())||ObjectUtil.isEmpty(AuthUtil.getUser().getUserId())){ + throw new ServiceException ("暂无权限查看,请稍后重试"); + } + List list=taskService.getTaskListStatistics(startTime,endTime,deptId); + // 下载导出 + String filename = "(" + startTime+"-"+endTime + ")巡检统计表"; + // 设置头信息 + response.setCharacterEncoding("UTF-8"); + response.setContentType("application/vnd.ms-excel"); + try { + //设置xlsx格式 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename + ".xlsx", "UTF-8")); + //创建一个输出流 + EasyExcel.write(response.getOutputStream(), VoteChartVo.class).autoCloseStream(Boolean.TRUE).sheet(1,"巡检计划统计表") + .doWrite(list); + response.getOutputStream().close(); + } catch (IOException e) { + e.printStackTrace(); + } + } } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/ITaskService.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/ITaskService.java index e0f7ec3..7f62c5a 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/ITaskService.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/ITaskService.java @@ -3,15 +3,14 @@ package com.hnac.hzinfo.inspect.task.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.hnac.hzims.vo.SafeCheckStatisticVO; +import com.hnac.hzims.vo.VoteChartVo; import com.hnac.hzinfo.inspect.task.dto.TaskDTO; import com.hnac.hzinfo.inspect.task.entity.InspectionTaskSMS; import com.hnac.hzinfo.inspect.task.entity.TaskEntity; import com.hnac.hzinfo.inspect.task.vo.*; import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.support.BladePage; -import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; -import org.springframework.web.bind.annotation.RequestParam; import java.util.List; import java.util.Map; @@ -65,7 +64,7 @@ public interface ITaskService extends BaseService { */ List getTaskById(Long id); - IPage page(TaskDTO taskDTO, Query query); + IPage page(TaskDTO taskDTO); /** * PC端任务列表 @@ -189,4 +188,6 @@ public interface ITaskService extends BaseService { * @return */ BladePage selectPage(Page pageInfo, TaskListQuery task); + + List getTaskListStatistics(String startTime, String endTime,Long deptId); } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java index 3f7e0df..d7527c4 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java @@ -14,6 +14,7 @@ import com.hnac.hzims.safeproduct.Constants; import com.hnac.hzims.safeproduct.entity.ImsMonCameraInfoEntity; import com.hnac.hzims.safeproduct.feign.IImsMonCameraInfoClient; import com.hnac.hzims.vo.SafeCheckStatisticVO; +import com.hnac.hzims.vo.VoteChartVo; import com.hnac.hzinfo.inspect.ai.service.IRobotService; import com.hnac.hzinfo.inspect.obj.ObjContants; import com.hnac.hzinfo.inspect.obj.services.IObjectDangerService; @@ -44,6 +45,7 @@ import org.springblade.core.tool.api.R; import org.springblade.core.tool.jackson.JsonUtil; import org.springblade.core.tool.utils.*; import org.springblade.system.cache.DictCache; +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; @@ -521,13 +523,17 @@ public class TaskServiceImpl extends BaseServiceImpl imp } @Override - public IPage page(TaskDTO taskDTO, Query query) { + public IPage page(TaskDTO taskDTO) { + Query query = new Query(); + query.setSize(taskDTO.getSize()); + query.setCurrent(taskDTO.getCurrent()); TaskEntity request = BeanUtil.copy(taskDTO,TaskEntity.class); LambdaQueryWrapper queryWrapper = Condition.getQueryWrapper(TaskEntity.class,request); queryWrapper.ge(Func.isNotEmpty(taskDTO.getPlanStartTime()),TaskEntity::getPlanStartTime,taskDTO.getPlanStartTime()); queryWrapper.le(Func.isNotEmpty(taskDTO.getPlanStartTimeEnd()),TaskEntity::getPlanStartTime,taskDTO.getPlanStartTimeEnd()); queryWrapper.eq(Func.isNotEmpty(taskDTO.getCreateDept()),TaskEntity::getCreateDept,taskDTO.getCreateDept()); queryWrapper.eq(Func.isNotEmpty(taskDTO.getStatus()),TaskEntity::getStatus,taskDTO.getStatus()); + queryWrapper.in(Func.isNotEmpty(taskDTO.getIds()),TaskEntity::getId,taskDTO.getIds()); queryWrapper.orderByDesc(TaskEntity::getCreateTime); IPage page = this.page(Condition.getPage(query), queryWrapper); List records = page.getRecords(); @@ -954,6 +960,49 @@ public class TaskServiceImpl extends BaseServiceImpl imp } + @Override + public List getTaskListStatistics(String startTime, String endTime,Long deptId) { + List taskEntities=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); + taskEntities= baseMapper.selectList(queryWrapper); + List res=new ArrayList<>(); + if (CollectionUtil.isNotEmpty(taskEntities)) { + VoteChartVo all = getVoteChartVo(taskEntities); + all.setName("总计"); + res.add(all); + Map> collect = Optional.ofNullable(taskEntities).orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(TaskEntity::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; + } + /** * 巡检任务分页 * @@ -1018,4 +1067,18 @@ public class TaskServiceImpl extends BaseServiceImpl imp } return null; } + + private VoteChartVo getVoteChartVo(List list) { + VoteChartVo voteChartVo = new VoteChartVo(); + List finishIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getStatus() == 3).map(s -> s.getId()).collect(Collectors.toList()); + List undoneIds =Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getStatus() != 3).map(s -> s.getId()).collect(Collectors.toList()); + voteChartVo.setSumNum(list.size()); + voteChartVo.setSumIds(list.stream().map(s -> s.getId()).collect(Collectors.toList())); + voteChartVo.setFinishNum(finishIds.size()); + voteChartVo.setFinishIds(finishIds); + voteChartVo.setUndoneNum(undoneIds.size()); + voteChartVo.setUndoneIds(undoneIds); + return voteChartVo; + } + } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskListQuery.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskListQuery.java index b36c94d..6343e9c 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskListQuery.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskListQuery.java @@ -8,7 +8,6 @@ import lombok.Setter; import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; -import java.time.LocalDate; import java.time.LocalDateTime; import java.time.YearMonth; @@ -130,4 +129,9 @@ public class TaskListQuery implements Serializable { * 创建机构 */ private Long createDept; + + @ApiModelProperty("当前页") + private Integer current; + @ApiModelProperty("每页的数量") + private Integer size; } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessStatisticsController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessStatisticsController.java index 0093523..cc71673 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessStatisticsController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessStatisticsController.java @@ -20,7 +20,6 @@ import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springframework.web.bind.annotation.*; -import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; /** @@ -87,7 +86,7 @@ public class OperAccessStatisticsController extends BladeController { @OperationAnnotation(moduleName = "检修管理",title = "检修记录",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, action = "分页查询检修记录列表") - public R> list(OperAccessStatisticsDTO req, Query query) { + public R> list(@RequestBody OperAccessStatisticsDTO req, Query query) { return service.list(req, Condition.getPage(query)); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessTaskController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessTaskController.java index 1ac99e2..9e40bf2 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessTaskController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessTaskController.java @@ -1,5 +1,6 @@ package com.hnac.hzims.operational.access.controller; +import com.alibaba.excel.EasyExcel; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.hzims.common.logs.annotation.OperationAnnotation; @@ -10,18 +11,25 @@ import com.hnac.hzims.operational.access.dto.OperAccessTaskFlowDTO; import com.hnac.hzims.operational.access.service.IOperAccessTaskService; import com.hnac.hzims.operational.access.vo.OperAccessTaskVO; import com.hnac.hzims.operational.access.vo.RepairBillVO; +import com.hnac.hzims.vo.VoteChartVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.log.annotation.ApiLog; +import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.support.Query; +import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; +import org.springblade.core.tool.utils.ObjectUtil; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; +import java.io.IOException; +import java.net.URLEncoder; import java.util.List; /** @@ -104,4 +112,47 @@ public class OperAccessTaskController extends BladeController { public R> getAccessTaskByEmCode(String emCode, String startTime, String endTime) { return R.data(service.getRepairBill(emCode, startTime, endTime)); } + + /** + * 检修计划统计 + */ + @GetMapping("/getAccessListStatistics") + @ApiOperation(value = "检修计划统计", notes = "传入时间") + public R> getAccessListStatistics(String startTime, String endTime,Long deptId) { + if(ObjectUtil.isEmpty(AuthUtil.getUser())||ObjectUtil.isEmpty(AuthUtil.getUser().getUserId())){ + return R.fail("暂无权限查看,请稍后重试"); + } + List list=service.getAccessListStatistics(startTime,endTime,deptId); + return R.data(list); + } + + /** + * 检修计划统计 + */ + @GetMapping("/importAccessListStatistics") + @ApiOperation(value = "导出", notes = "传入时间") + public void importAccessListStatistics(HttpServletResponse response, String startTime, String endTime,Long deptId) { + if(ObjectUtil.isEmpty(AuthUtil.getUser())||ObjectUtil.isEmpty(AuthUtil.getUser().getUserId())){ + throw new ServiceException("暂无权限查看,请稍后重试"); + } + List list=service.getAccessListStatistics(startTime,endTime,deptId); + // 下载导出 + String filename = "(" + startTime+"-"+endTime + ")检修计划统计表"; + // 设置头信息 + response.setCharacterEncoding("UTF-8"); + response.setContentType("application/vnd.ms-excel"); + try { + //设置xlsx格式 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename + ".xlsx", "UTF-8")); + //创建一个输出流 + EasyExcel.write(response.getOutputStream(), VoteChartVo.class).autoCloseStream(Boolean.TRUE).sheet(1,"检修计划统计表") + .doWrite(list); + response.getOutputStream().close(); + // 关闭 + response.getOutputStream().close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessStatisticsDTO.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessStatisticsDTO.java index 62db8b3..bb9effb 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessStatisticsDTO.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessStatisticsDTO.java @@ -25,7 +25,8 @@ public class OperAccessStatisticsDTO extends OperAccessStatisticsEntity { @ApiModelProperty(value = "创建机构集合") private List deptIds; - + @ApiModelProperty(value = "id集合") + private List ids; /** * 月份 */ diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml index e390f35..994ab75 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml @@ -28,6 +28,12 @@ JOIN hzims_oper_access_task OT ON OS.`TASK_ID` = OT.`ID` WHERE OS.IS_DELETED = 0 + + and OS.id in + + #{item} + + and OT.`NAME` like concat('%',#{dto.taskName},'%') diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessTaskService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessTaskService.java index 54335f3..07012b4 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessTaskService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessTaskService.java @@ -2,14 +2,13 @@ package com.hnac.hzims.operational.access.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.hnac.hzims.operational.access.dto.OperAccessStatisticsDTO; import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO; import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; -import com.hnac.hzims.operational.access.vo.OperAccessStatisticsVO; import com.hnac.hzims.operational.access.vo.OperAccessTaskVO; import com.hnac.hzims.operational.access.vo.RepairBillVO; import com.hnac.hzims.operational.report.vo.AccessReportVO; import com.hnac.hzims.vo.SafeCheckStatisticVO; +import com.hnac.hzims.vo.VoteChartVo; import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; @@ -76,4 +75,6 @@ public interface IOperAccessTaskService extends BaseService selectPage(Page dbPage, OperAccessTaskEntity result); List getRepairBill(String emCode, String startTime, String endTime); + + List getAccessListStatistics(String startTime, String endTime,Long deptId); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java index 7b819ce..0aad039 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.hnac.hzims.equipment.entity.EmInfoEntity; @@ -39,6 +40,7 @@ import com.hnac.hzims.safeproduct.feign.IDangerSourceClient; import com.hnac.hzims.spare.entity.SpRecordEntity; import com.hnac.hzims.spare.feign.ISpareClient; import com.hnac.hzims.vo.SafeCheckStatisticVO; +import com.hnac.hzims.vo.VoteChartVo; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.RandomUtils; @@ -55,6 +57,8 @@ import org.springblade.flow.core.feign.IFlowClient; import org.springblade.flow.core.utils.FlowUtil; import org.springblade.flow.core.utils.TaskUtil; import org.springblade.flow.core.vo.ComleteTask; +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; @@ -86,6 +90,8 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl getAccessListStatistics(String startTime, String endTime,Long deptId) { + List operAccessTaskEntityList; + 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); + operAccessTaskEntityList= baseMapper.selectList(queryWrapper); + + List res=new ArrayList<>(); + if (CollectionUtil.isNotEmpty(operAccessTaskEntityList)) { + VoteChartVo all = getVoteChartVo(operAccessTaskEntityList); + all.setName("总计"); + res.add(all); + Map> collect = Optional.ofNullable(operAccessTaskEntityList).orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(OperAccessTaskEntity::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; + } + + private VoteChartVo getVoteChartVo(List list) { + VoteChartVo voteChartVo = new VoteChartVo(); + List finishIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getStatus() == 4).map(s -> s.getId()).collect(Collectors.toList()); + List undoneIds =Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getStatus() != 4).map(s -> s.getId()).collect(Collectors.toList()); + voteChartVo.setSumNum(list.size()); + voteChartVo.setSumIds(list.stream().map(s -> s.getId()).collect(Collectors.toList())); + voteChartVo.setFinishNum(finishIds.size()); + voteChartVo.setFinishIds(finishIds); + voteChartVo.setUndoneNum(undoneIds.size()); + voteChartVo.setUndoneIds(undoneIds); + return voteChartVo; + } + /*** * 根据流程ID和处理人完成任务 * @param comleteTask diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java index 1693d5d..022e1eb 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java @@ -730,7 +730,9 @@ public class TargetServiceImpl implements TargetService { } // 查询日常维护任务 params.setDeptIds(areas.keySet().stream().map(Dept::getId).collect(Collectors.toList())); - return maintenanceTaskService.list(params,query); + params.setCurrent(query.getCurrent()); + params.setSize(query.getSize()); + return maintenanceTaskService.list(params); } /** diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectStatisticsController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectStatisticsController.java index d8e798a..cd4e5b2 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectStatisticsController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectStatisticsController.java @@ -25,10 +25,7 @@ import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.system.entity.Dept; import org.springblade.system.feign.ISysClient; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.stream.Collectors; @@ -64,14 +61,17 @@ public class OperDefectStatisticsController extends BladeController { * 分页 代码自定义代号 */ @ApiLog - @GetMapping("/list") + @PostMapping("/list") @ApiOperationSupport(order = 2) @ApiOperation(value = "分页", notes = "传入statistics") @ApiImplicitParams({ }) @OperationAnnotation(moduleName = "缺陷管理",title = "缺陷记录",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE,action = "分页查询缺陷记录列表") - public R> list( OperDefectStatisticsVO entity, Query query) { + public R> list(@RequestBody OperDefectStatisticsVO entity) { + Query query=new Query(); + query.setCurrent(entity.getCurrent()); + query.setSize(entity.getSize()); LambdaQueryWrapper queryWrapper = statisticsService.getQueryWrapper(entity); IPage pages = statisticsService.page(Condition.getPage(query), queryWrapper); IPage vos = OperDefectStatisticsWrapper.build().pageVO(pages); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperPhenomenonController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperPhenomenonController.java index 1abf0d9..11c37b0 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperPhenomenonController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperPhenomenonController.java @@ -1,5 +1,6 @@ package com.hnac.hzims.operational.defect.controller; +import com.alibaba.excel.EasyExcel; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; @@ -12,6 +13,7 @@ import com.hnac.hzims.operational.defect.entity.OperAppearanceEntity; import com.hnac.hzims.operational.defect.service.IOperAppearanceService; import com.hnac.hzims.operational.defect.service.IOperPhenomenonService; import com.hnac.hzims.operational.defect.vo.OperAppearanceVO; +import com.hnac.hzims.operational.report.vo.CheckVoteChartVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; @@ -19,14 +21,22 @@ import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.log.annotation.ApiLog; +import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; +import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; +import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.flow.core.entity.BladeFlow; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.net.URLEncoder; +import java.util.List; + /** * 控制器 * @@ -131,4 +141,44 @@ public class OperPhenomenonController extends BladeController { public R getFdpTaskByDefectCode(@RequestParam("defectCode") String defectCode) { return R.data(phenomenonService.getFdpTaskByDefectCode(defectCode)); } + + /** + * 缺陷记录统计 + */ + @GetMapping("/getDefectListStatistics") + @ApiOperation(value = "缺陷记录统计", notes = "传入时间") + public R> getDefectListStatistics(String startTime, String endTime, Long deptId) { + if(ObjectUtil.isEmpty(AuthUtil.getUser())||ObjectUtil.isEmpty(AuthUtil.getUser().getUserId())){ + return R.fail("暂无权限查看,请稍后重试"); + } + List list=phenomenonService.getDefectListStatistics(startTime,endTime,deptId); + return R.data(list); + } + + /** + * 缺陷记录统计 + */ + @GetMapping("/importDefectListStatistics") + @ApiOperation(value = "导出", notes = "传入时间") + public void importDefectListStatistics(HttpServletResponse response, String startTime, String endTime, Long deptId) { + if(ObjectUtil.isEmpty(AuthUtil.getUser())||ObjectUtil.isEmpty(AuthUtil.getUser().getUserId())){ + throw new ServiceException ("暂无权限查看,请稍后重试"); + } + List list=phenomenonService.getDefectListStatistics(startTime,endTime,deptId); + // 下载导出 + String filename = "(" + startTime+"-"+endTime + ")缺陷统计表"; + // 设置头信息 + response.setCharacterEncoding("UTF-8"); + response.setContentType("application/vnd.ms-excel"); + try { + //设置xlsx格式 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename + ".xlsx", "UTF-8")); + //创建一个输出流 + EasyExcel.write(response.getOutputStream(), CheckVoteChartVo.class).autoCloseStream(Boolean.TRUE).sheet(1,"缺陷统计表") + .doWrite(list); + response.getOutputStream().close(); + } catch (IOException e) { + e.printStackTrace(); + } + } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperPhenomenonService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperPhenomenonService.java index 3b3f6d0..1f3bf57 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperPhenomenonService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperPhenomenonService.java @@ -4,14 +4,12 @@ import com.hnac.hzims.fdp.entity.FdpTaskEntity; import com.hnac.hzims.operational.defect.dto.OperMainDefectDTO; import com.hnac.hzims.operational.defect.dto.OperPhenomenonDTO; import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; -import com.hnac.hzims.operational.defect.vo.OperPhenomenonVO; import com.hnac.hzims.operational.duty.vo.MainOperPhenomenonVo; +import com.hnac.hzims.operational.report.vo.CheckVoteChartVo; import com.hnac.hzims.operational.report.vo.DutyDefectVO; import org.springblade.core.mp.base.BaseService; -import org.springblade.core.tool.api.R; import org.springblade.flow.core.entity.BladeFlow; -import java.time.LocalDateTime; import java.util.List; import java.util.Map; @@ -95,4 +93,6 @@ public interface IOperPhenomenonService extends BaseService getDefectListStatistics(String startTime, String endTime, Long deptId); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectStatisticsServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectStatisticsServiceImpl.java index 208566e..837e107 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectStatisticsServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectStatisticsServiceImpl.java @@ -41,6 +41,9 @@ public class OperDefectStatisticsServiceImpl extends BaseServiceImpl getQueryWrapper(OperDefectStatisticsVO statistics) { LambdaQueryWrapper queryWrapper = Condition.getQueryWrapper(new OperDefectStatisticsEntity(),statistics); if(Func.isNotEmpty(statistics)) { + if (Func.isNotEmpty(statistics.getDefectCodeList())) { + queryWrapper.in(OperDefectStatisticsEntity::getDefectCode, statistics.getDefectCodeList()); + } if (statistics.getActStartTime() != null) { queryWrapper.ge(OperDefectStatisticsEntity::getActStartTime, statistics.getActStartTime()); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperPhenomenonServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperPhenomenonServiceImpl.java index cf8acfa..f9f0ac1 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperPhenomenonServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperPhenomenonServiceImpl.java @@ -3,12 +3,12 @@ package com.hnac.hzims.operational.defect.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hnac.hzims.fdp.entity.FdpTaskEntity; import com.hnac.hzims.fdp.feign.IFdpTaskClient; import com.hnac.hzims.operational.defect.config.DefectConfiguration; import com.hnac.hzims.operational.defect.constants.DefectConstant; -import com.hnac.hzims.operational.defect.constants.RepairConstant; import com.hnac.hzims.operational.defect.dto.OperMainDefectDTO; import com.hnac.hzims.operational.defect.dto.OperPhenomenonDTO; import com.hnac.hzims.operational.defect.entity.OperDefectEntity; @@ -20,16 +20,13 @@ import com.hnac.hzims.operational.defect.service.IOperDefectService; import com.hnac.hzims.operational.defect.service.IOperDefectStatisticsService; import com.hnac.hzims.operational.defect.service.IOperPhenomenonService; import com.hnac.hzims.operational.defect.vo.OperPhenomenonVO; -import com.hnac.hzims.operational.defect.wrapper.OperPhenomenonWrapper; import com.hnac.hzims.operational.duty.vo.MainOperPhenomenonVo; +import com.hnac.hzims.operational.report.vo.CheckVoteChartVo; import com.hnac.hzims.operational.report.vo.DutyDefectVO; -import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity; import com.hnac.hzims.operational.util.GenerateCode; -import com.hnac.hzims.ticket.repair.entity.RepairEntity; import lombok.extern.slf4j.Slf4j; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseServiceImpl; -import org.springblade.core.mp.support.Condition; import org.springblade.core.redis.lock.LockType; import org.springblade.core.redis.lock.RedisLock; import org.springblade.core.secure.utils.AuthUtil; @@ -43,6 +40,8 @@ import org.springblade.flow.core.utils.FlowUtil; import org.springblade.flow.core.utils.TaskUtil; import org.springblade.flow.core.vo.ComleteTask; import org.springblade.system.cache.DictCache; +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; @@ -67,6 +66,8 @@ import java.util.stream.Collectors; public class OperPhenomenonServiceImpl extends BaseServiceImpl implements IOperPhenomenonService,GenerateCode{ @Autowired + private ISysClient sysClient; + @Autowired private IFlowClient flowClient; @Autowired @@ -582,4 +583,65 @@ public class OperPhenomenonServiceImpl extends BaseServiceImpl getDefectListStatistics(String startTime, String endTime, Long deptId) { + List operPhenomenonEntities; + 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); + operPhenomenonEntities = baseMapper.selectList(queryWrapper); + + List res = new ArrayList<>(); + if (CollectionUtil.isNotEmpty(operPhenomenonEntities)) { + CheckVoteChartVo all = getCheckVoteChartVo(operPhenomenonEntities); + all.setName("总计"); + res.add(all); + Map> collect = Optional.ofNullable(operPhenomenonEntities).orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(OperPhenomenonEntity::getCreateDept)); + for (Map.Entry> longListEntry : collect.entrySet()) { + CheckVoteChartVo chartVo= getCheckVoteChartVo(longListEntry.getValue()); + R deptName = sysClient.getDeptName(longListEntry.getKey()); + chartVo.setName(deptName.isSuccess() ? deptName.getData() : ""); + res.add(chartVo); + } + } else { + CheckVoteChartVo all = new CheckVoteChartVo(); + all.setName("总计"); + res.add(all); + } + return res; + } + + private CheckVoteChartVo getCheckVoteChartVo(List list) { + CheckVoteChartVo voteChartVo = new CheckVoteChartVo(); + List checkIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getIsDefect() !=null).filter(s -> s.getIsDefect() == 1).map(s -> s.getDefectCode()).collect(Collectors.toList()); + List handerIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getIsDefect() !=null).filter(s -> "1".equals(s.getHandleStatus())).map(s -> s.getDefectCode()).collect(Collectors.toList()); + List conclusionIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getIsDefect() !=null).filter(s -> "1".equals(s.getConclusionStatus())).map(s -> s.getDefectCode()).collect(Collectors.toList()); + voteChartVo.setPhenomenonNum(list.size()); + voteChartVo.setPhenomenonIds(list.stream().map(s -> s.getId()).collect(Collectors.toList())); + voteChartVo.setDefectNum(checkIds.size()); + voteChartVo.setDefectIds(checkIds); + voteChartVo.setHandleNum(handerIds.size()); + voteChartVo.setHandleIds(handerIds); + voteChartVo.setConclusionNum(conclusionIds.size()); + voteChartVo.setConclusionIds(conclusionIds); + return voteChartVo; + } + } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceTaskController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceTaskController.java index 49ef934..0f53e7e 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceTaskController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceTaskController.java @@ -1,42 +1,44 @@ package com.hnac.hzims.operational.maintenance.controller; +import com.alibaba.excel.EasyExcel; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.hzims.common.invalid.DictInvalid; import com.hnac.hzims.common.invalid.ObjectRequiredInvalid; 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.operational.maintenance.constants.MaintenanceConstant; import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.scheduled.MaintenanceTaskCreateTask; import com.hnac.hzims.operational.maintenance.scheduled.MaintenanceTaskPushMsg; import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService; import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO; -import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo; -import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskVo; -import io.swagger.annotations.*; +import com.hnac.hzims.vo.VoteChartVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.log.annotation.ApiLog; -import org.springblade.core.mp.support.Query; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.flow.core.vo.ComleteTask; -import org.springframework.data.domain.Sort; -import org.springframework.data.web.SortDefault; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import springfox.documentation.annotations.ApiIgnore; +import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; +import java.io.IOException; +import java.net.URLEncoder; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -105,15 +107,15 @@ public class OperMaintenanceTaskController extends BladeController { * 分页 */ @ApiLog - @GetMapping("/list") + @PostMapping("/list") @ApiOperationSupport(order = 50) @ApiOperation(value = "分页 查询参数:refLibraryId,processInstanceId,disposer,content,status") @ApiImplicitParams({ }) @OperationAnnotation(moduleName = "日常维护", title = "日常维护记录", operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE, action = "分页查询日常维护记录列表") - public R> list(OperMaintenanceTaskDTO req, Query query) { - return taskService.list(req, query); + public R> list(@RequestBody OperMaintenanceTaskDTO req) { + return taskService.list(req); } @@ -161,6 +163,47 @@ public class OperMaintenanceTaskController extends BladeController { return taskService.deleteTaskBatch(taskIdList); } + /** + * 日常计划统计 + */ + @GetMapping("/getMaintenanceListStatistics") + @ApiOperation(value = "日常计划统计", notes = "传入时间") + public R> getMaintenanceListStatistics(String startTime, String endTime,Long deptId) { + if(ObjectUtil.isEmpty(AuthUtil.getUser())||ObjectUtil.isEmpty(AuthUtil.getUser().getUserId())){ + return R.fail("暂无权限查看,请稍后重试"); + } + List list=taskService.getMaintenanceListStatistics(startTime,endTime,deptId); + return R.data(list); + } + + /** + * 日常计划统计 + */ + @GetMapping("/importMaintenanceListStatistics") + @ApiOperation(value = "导出", notes = "传入时间") + public void importMaintenanceListStatistics(HttpServletResponse response, String startTime, String endTime,Long deptId) { + if(ObjectUtil.isEmpty(AuthUtil.getUser())||ObjectUtil.isEmpty(AuthUtil.getUser().getUserId())){ + throw new ServiceException("暂无权限查看,请稍后重试"); + } + List list=taskService.getMaintenanceListStatistics(startTime,endTime,deptId); + // 下载导出 + String filename = "(" + startTime+"-"+endTime + ")日常维护计划统计表"; + // 设置头信息 + response.setCharacterEncoding("UTF-8"); + response.setContentType("application/vnd.ms-excel"); + try { + //设置xlsx格式 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename + ".xlsx", "UTF-8")); + //创建一个输出流 + EasyExcel.write(response.getOutputStream(), VoteChartVo.class).autoCloseStream(Boolean.TRUE).sheet(1,"日常计划统计") + .doWrite(list); + response.getOutputStream().close(); + // 关闭 + response.getOutputStream().close(); + } catch (IOException e) { + e.printStackTrace(); + } + } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceTaskService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceTaskService.java index c821f1c..d4f10e1 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceTaskService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceTaskService.java @@ -2,16 +2,16 @@ package com.hnac.hzims.operational.maintenance.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.operational.main.vo.RegularWorkVO; import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO; -import com.hnac.hzims.operational.main.vo.RegularWorkVO; import com.hnac.hzims.operational.report.vo.MaintenanceReportVO; import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskVo; import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskWithAreaVo; import com.hnac.hzims.vo.SafeCheckStatisticVO; +import com.hnac.hzims.vo.VoteChartVo; import org.springblade.core.mp.base.BaseService; -import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springblade.flow.core.vo.ComleteTask; import org.springframework.web.bind.annotation.RequestParam; @@ -31,7 +31,7 @@ public interface IOperMaintenanceTaskService extends BaseService detail(@RequestParam Long id); - R> list(OperMaintenanceTaskDTO req, Query query); + R> list(OperMaintenanceTaskDTO req); String genTaskCode(Integer num); @@ -96,4 +96,5 @@ public interface IOperMaintenanceTaskService extends BaseService queryLogMaintenancePageList(Page pageParam, MaintenanceTaskWithAreaVo areaMonthlyVo); + List getMaintenanceListStatistics(String startTime, String endTime,Long deptId); } 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 87178e9..dab8118 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 @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; @@ -25,6 +26,7 @@ import com.hnac.hzims.safeproduct.feign.IDangerSourceClient; import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskVo; import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskWithAreaVo; import com.hnac.hzims.vo.SafeCheckStatisticVO; +import com.hnac.hzims.vo.VoteChartVo; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; @@ -40,6 +42,8 @@ import org.springblade.flow.core.feign.IFlowClient; import org.springblade.flow.core.vo.ComleteTask; import org.springblade.flow.core.vo.EndVo; import org.springblade.system.cache.DictCache; +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; @@ -70,6 +74,8 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl> list(OperMaintenanceTaskDTO req, Query query) { + public R> list(OperMaintenanceTaskDTO req) { + Query query=new Query(); + query.setSize(req.getSize()); + query.setCurrent(req.getCurrent()); Wrapper queryWrapper = new LambdaQueryWrapper() {{ orderByDesc(OperMaintenanceTaskEntity::getDisposeTime); if (StringUtil.isNotBlank(req.getTaskIds())) { in(OperMaintenanceTaskEntity::getId, Lists.newArrayList(req.getTaskIds().split(","))); } + if (CollectionUtil.isNotEmpty(req.getTaskList())) { + in(OperMaintenanceTaskEntity::getId, req.getTaskList()); + } if (req.getRefLibraryId() != null) { eq(OperMaintenanceTaskEntity::getRefLibraryId, req.getRefLibraryId()); } @@ -126,7 +138,7 @@ 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); + } + } else { + VoteChartVo all = new VoteChartVo(); + all.setName("总计"); + res.add(all); + } + return res; + } + + private VoteChartVo getVoteChartVo(List list) { + VoteChartVo voteChartVo = new VoteChartVo(); + List finishIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getStatus() == 3).map(s -> s.getId()).collect(Collectors.toList()); + List undoneIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getStatus() != 3).map(s -> s.getId()).collect(Collectors.toList()); + voteChartVo.setSumNum(list.size()); + voteChartVo.setSumIds(list.stream().map(s -> s.getId()).collect(Collectors.toList())); + voteChartVo.setFinishNum(finishIds.size()); + voteChartVo.setFinishIds(finishIds); + voteChartVo.setUndoneNum(undoneIds.size()); + voteChartVo.setUndoneIds(undoneIds); + return voteChartVo; + } } From 28dc691f638ee49c93c61dc8b95f751255fc5c2f Mon Sep 17 00:00:00 2001 From: tyty Date: Fri, 18 Aug 2023 10:32:34 +0800 Subject: [PATCH 03/33] =?UTF-8?q?=E5=B7=A1=E6=A3=80-=E6=97=A5=E5=B8=B8-?= =?UTF-8?q?=E6=A3=80=E4=BF=AE-=E6=B6=88=E7=BC=BA=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/operational/report/vo/CheckVoteChartVo.java | 2 +- .../operational/defect/service/impl/OperPhenomenonServiceImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/CheckVoteChartVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/CheckVoteChartVo.java index 0c4234b..9946e8f 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/CheckVoteChartVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/CheckVoteChartVo.java @@ -23,7 +23,7 @@ public class CheckVoteChartVo { private int phenomenonNum; @ApiModelProperty(value = "现象数量id") @ExcelIgnore - private List phenomenonIds; + private List phenomenonIds; @ApiModelProperty(value = "缺陷数量") @ExcelProperty(value = "缺陷数量", index = 2) private int defectNum; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperPhenomenonServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperPhenomenonServiceImpl.java index f9f0ac1..2624f0a 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperPhenomenonServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperPhenomenonServiceImpl.java @@ -634,7 +634,7 @@ public class OperPhenomenonServiceImpl extends BaseServiceImpl handerIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getIsDefect() !=null).filter(s -> "1".equals(s.getHandleStatus())).map(s -> s.getDefectCode()).collect(Collectors.toList()); List conclusionIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getIsDefect() !=null).filter(s -> "1".equals(s.getConclusionStatus())).map(s -> s.getDefectCode()).collect(Collectors.toList()); voteChartVo.setPhenomenonNum(list.size()); - voteChartVo.setPhenomenonIds(list.stream().map(s -> s.getId()).collect(Collectors.toList())); + voteChartVo.setPhenomenonIds(list.stream().map(s -> s.getDefectCode()).collect(Collectors.toList())); voteChartVo.setDefectNum(checkIds.size()); voteChartVo.setDefectIds(checkIds); voteChartVo.setHandleNum(handerIds.size()); From 8e17c9cbd6edb4ef5110ba93221baf98e4e73581 Mon Sep 17 00:00:00 2001 From: tyty Date: Fri, 18 Aug 2023 11:10:26 +0800 Subject: [PATCH 04/33] =?UTF-8?q?=E5=B7=A1=E6=A3=80-=E6=97=A5=E5=B8=B8-?= =?UTF-8?q?=E6=A3=80=E4=BF=AE-=E6=B6=88=E7=BC=BA=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=9B=B4=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operational/access/controller/OperAccessStatisticsController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessStatisticsController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessStatisticsController.java index cc71673..92435c4 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessStatisticsController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessStatisticsController.java @@ -80,7 +80,7 @@ public class OperAccessStatisticsController extends BladeController { * 分页 */ @ApiLog - @GetMapping("/list") + @PostMapping("/list") @ApiOperationSupport(order = 50) @ApiOperation(value = "分页 查询参数:pid,taskId,manager") @OperationAnnotation(moduleName = "检修管理",title = "检修记录",operatorType = OperatorType.MOBILE,businessType = From 97ade655a446029589c8d7893a986dbd9d5e6a25 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Fri, 18 Aug 2023 14:46:57 +0800 Subject: [PATCH 05/33] =?UTF-8?q?#=E8=B7=AF=E7=94=B1=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java index 732f6ce..f64551f 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java @@ -64,6 +64,9 @@ public class MainWorkBenchServiceImpl extends BaseServiceImpl pages = super.page(Condition.getPage(query), lambdaQueryWrapper); IPage vos = MainWorkBenchWrapper.builder().pageVO(pages); From d54d5911102d42a1cf9a69bfa563cffee3c246ca Mon Sep 17 00:00:00 2001 From: tyty Date: Fri, 18 Aug 2023 16:54:15 +0800 Subject: [PATCH 06/33] =?UTF-8?q?=E5=B7=A1=E6=A3=80-=E6=97=A5=E5=B8=B8-?= =?UTF-8?q?=E6=A3=80=E4=BF=AE-=E6=B6=88=E7=BC=BA=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=9B=B4=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzinfo/inspect/task/controller/TaskController.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java index aceb616..3309ca8 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java @@ -119,19 +119,16 @@ public class TaskController extends BladeController { /** * PC端分页显示任务列表 */ - @PostMapping("/list") + @GetMapping("/list") @ApiOperation(value = "分页显示任务列表", notes = "传入task") @OperationAnnotation(moduleName = "巡检管理",title = "我的巡检任务",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, action = "分页显示任务列表") - public R> list(@RequestBody TaskListQuery task) { + public R> list(TaskListQuery task, Query query) { //CacheUtil.put("test#2","inspect","test","12"); // LambdaQueryWrapper queryWrapper = Condition.getQueryWrapper(new TaskEntity(),task); // queryWrapper.orderByDesc(TaskEntity::getUpdateTime); // IPage pages = taskService.page(Condition.getPage(query), queryWrapper); - Query query = new Query(); - query.setSize(task.getSize()); - query.setCurrent(task.getCurrent()); IPage pages = Condition.getPage(query); if(!AuthUtil.isAdministrator()){ task.setCurUserId(AuthUtil.getUserId()); From 9b8f9dcc968e938e8ef388a602139ef065dedc31 Mon Sep 17 00:00:00 2001 From: tanghaihao <850814414@qq.com> Date: Fri, 18 Aug 2023 17:06:57 +0800 Subject: [PATCH 07/33] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E6=8E=92=E7=8F=AD=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../duty/controller/ImsDutyMainController.java | 3 +++ .../hzims/operational/duty/utils/ExcelTool.java | 27 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/utils/ExcelTool.java diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyMainController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyMainController.java index 48b64ed..df43d2c 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyMainController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyMainController.java @@ -10,6 +10,7 @@ import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity; import com.hnac.hzims.operational.duty.entity.ImsDutyMainReportExcel; import com.hnac.hzims.operational.duty.service.IImsDutyMainService; import com.hnac.hzims.operational.duty.utils.ExcelMergeHandler; +import com.hnac.hzims.operational.duty.utils.ExcelTool; import com.hnac.hzims.operational.duty.vo.ChangeDutyMainVo; import com.hnac.hzims.operational.duty.vo.HomePageDutyMainInfoVo; import com.hnac.hzims.operational.duty.vo.ImsSchedulingVo; @@ -246,6 +247,8 @@ public class ImsDutyMainController extends BladeController { int mergeRowIndex = 2; // 需要合并的列 int[] mergeColumeIndex = {0}; + + ExcelTool.resetCellMaxTextLength(); // 导出Excel,合并第一列相同内容的单元格 EasyExcel.write(response.getOutputStream(), ImsDutyMainReportExcel.class) .registerWriteHandler(new ExcelMergeHandler(mergeRowIndex, mergeColumeIndex)).sheet().doWrite(list); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/utils/ExcelTool.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/utils/ExcelTool.java new file mode 100644 index 0000000..a0d56b3 --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/utils/ExcelTool.java @@ -0,0 +1,27 @@ +package com.hnac.hzims.operational.duty.utils; + +import org.apache.poi.ss.SpreadsheetVersion; + +import java.lang.reflect.Field; + +/** + * 设置Excel导出的最大字符数 + * @author tanghaihao + * @date 2023年08月18日 16:40 + */ +public class ExcelTool { + + public static void resetCellMaxTextLength() { + SpreadsheetVersion excel2007 = SpreadsheetVersion.EXCEL2007; + if (Integer.MAX_VALUE != excel2007.getMaxTextLength()) { + Field field; + try { + field = excel2007.getClass().getDeclaredField("_maxTextLength"); + field.setAccessible(true); + field.set(excel2007, Integer.MAX_VALUE); + } catch (Exception e) { + e.printStackTrace(); + } + } + } +} From f14db5133962474c282406836938711a0fa9fbd1 Mon Sep 17 00:00:00 2001 From: tyty Date: Mon, 21 Aug 2023 09:54:05 +0800 Subject: [PATCH 08/33] =?UTF-8?q?=E5=BC=80=E5=90=AF=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E7=94=A8userCache=EF=BC=8C=E6=94=B9=E7=94=A8?= =?UTF-8?q?AuthUtil?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operational/defect/service/impl/DefectCheckServiceImpl.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java index 83097ad..ebca68e 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java @@ -12,8 +12,6 @@ import com.hnac.hzims.message.MessageConstants; import com.hnac.hzims.message.dto.BusinessMessageDTO; import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; -import com.hnac.hzims.operational.access.service.IOperAccessPlanService; -import com.hnac.hzims.operational.access.service.IOperAccessTaskService; import com.hnac.hzims.operational.defect.constants.TreatMethodConstant; import com.hnac.hzims.operational.defect.entity.OperAppearanceEntity; import com.hnac.hzims.operational.defect.entity.OperDefectEntity; @@ -26,7 +24,6 @@ import com.hnac.hzims.operational.defect.service.IOperDefectService; import com.hnac.hzims.operational.defect.service.IOperDefectStatisticsService; import com.hnac.hzims.operational.defect.vo.SolveHomeVO; import com.hnac.hzims.operational.util.TimeUtils; -import com.hnac.hzims.ticket.repair.fegin.IRepairClient; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.log.exception.ServiceException; @@ -42,7 +39,6 @@ import org.springblade.flow.core.feign.IFlowClient; import org.springblade.flow.core.utils.FlowUtil; import org.springblade.system.cache.DictCache; import org.springblade.system.feign.ISysClient; -import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.feign.IUserClient; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -72,6 +68,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl Date: Mon, 21 Aug 2023 14:51:39 +0800 Subject: [PATCH 09/33] =?UTF-8?q?=E5=AF=B9=E5=B9=B3=E5=8F=B0=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E7=9A=84=E6=8E=A5=E5=8F=A3=E5=81=9A=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operational/duty/service/impl/ImsAnalyseExampleServiceImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsAnalyseExampleServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsAnalyseExampleServiceImpl.java index 46dfbd9..162ba11 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsAnalyseExampleServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsAnalyseExampleServiceImpl.java @@ -65,6 +65,9 @@ public class ImsAnalyseExampleServiceImpl extends BaseServiceImpl> analyzeDataByAnalyzeCode = searchClient.getAnalyzeDataByAnalyzeCode(analyzeDataCondition); + if(!analyzeDataByAnalyzeCode.isSuccess()) { + throw new ServiceException("设备数据查询异常,请检查好配置后重试!"); + } return analyzeDataByAnalyzeCode; } @@ -131,6 +134,9 @@ public class ImsAnalyseExampleServiceImpl extends BaseServiceImpl Date: Tue, 22 Aug 2023 11:22:17 +0800 Subject: [PATCH 10/33] =?UTF-8?q?=E5=B7=A1=E6=A3=80=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E5=8F=AF=E6=92=A4=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/operational/OperationalConstants.java | 2 +- .../inspect/plan/controller/PlanController.java | 19 +++++++++---------- .../hzinfo/inspect/plan/service/IPlanService.java | 2 ++ .../inspect/plan/service/impl/PlanServiceImpl.java | 15 +++++++++++++++ 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java index 93810fc..16f31e5 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java @@ -4,7 +4,7 @@ import lombok.Getter; public class OperationalConstants { - public final static String APP_NAME = "hzims-operational"; + public final static String APP_NAME = "hzims-operational-ty"; diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java index df2452c..bc04f66 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java @@ -1,15 +1,11 @@ package com.hnac.hzinfo.inspect.plan.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; 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.hzinfo.inspect.Constants; -import com.hnac.hzinfo.inspect.invalid.DictInvalid; import com.hnac.hzinfo.inspect.obj.utils.CodeUtils; import com.hnac.hzinfo.inspect.plan.PlanContants; import com.hnac.hzinfo.inspect.plan.entity.PlanEntity; @@ -24,7 +20,6 @@ import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.support.Query; import org.springblade.core.secure.BladeUser; -import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.constant.BladeConstant; import org.springblade.core.tool.utils.Func; @@ -32,11 +27,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; -import javax.validation.constraints.Size; import java.time.LocalDate; -import java.time.LocalDateTime; import java.util.List; @@ -113,7 +104,15 @@ public class PlanController extends BladeController { public R> addAndChecked(@Valid @RequestBody PlanVO plan) { return R.data(planService.addAndChecked(plan)); } - + /** + * 撤销 + */ + @PostMapping("/revoke") + @ApiOperationSupport(order = 6) + @ApiOperation(value = "撤销", notes = "传入plan") + public R revoke(@Valid @RequestBody Long planId) { + return R.data(planService.revoke(planId)); + } /** * 删除 diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/service/IPlanService.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/service/IPlanService.java index e3ce4ec..bf491d2 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/service/IPlanService.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/service/IPlanService.java @@ -59,4 +59,6 @@ public interface IPlanService extends BaseService { Boolean deletePlanAndRelatives(Long id); List getPlans(List planIds); + + Boolean revoke(Long planId); } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/service/impl/PlanServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/service/impl/PlanServiceImpl.java index 6c1b0b7..81ae5a8 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/service/impl/PlanServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/service/impl/PlanServiceImpl.java @@ -109,6 +109,21 @@ public class PlanServiceImpl extends BaseServiceImpl imp } /** + *巡检计划撤销 + * @param planId + * @return + */ + @Override + public Boolean revoke(Long planId) { + boolean re; + LambdaUpdateWrapper uw = new UpdateWrapper().lambda(); + uw.set(PlanEntity::getStatus, PlanContants.PlanStatusEnum.PLAN_SUBMIT); + uw.eq(PlanEntity::getId, planId); + re = update(uw); + return re; + } + + /** * 保存巡检计划 */ @Transactional(rollbackFor = Exception.class) From 6960dacf4cab878943499932f35239482cecea66 Mon Sep 17 00:00:00 2001 From: tyty Date: Tue, 22 Aug 2023 11:24:24 +0800 Subject: [PATCH 11/33] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/hnac/hzims/operational/OperationalConstants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java index 16f31e5..93810fc 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java @@ -4,7 +4,7 @@ import lombok.Getter; public class OperationalConstants { - public final static String APP_NAME = "hzims-operational-ty"; + public final static String APP_NAME = "hzims-operational"; From c5ba0661d5d83f75fc6c433a656e951d9a6767a6 Mon Sep 17 00:00:00 2001 From: tyty Date: Tue, 22 Aug 2023 12:01:26 +0800 Subject: [PATCH 12/33] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8E=92=E7=8F=AD?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operational/duty/service/impl/ImsDutyMainServiceImpl.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java index 3901698..ecc07ca 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java @@ -1409,6 +1409,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl personWrapper = new LambdaQueryWrapper(); personWrapper.eq(ImsDutyMainPersonEntity::getCreateDept, deptId); + personWrapper.like(ImsDutyMainPersonEntity::getDutyDate, yearAndMonth); List deptPersonList = imsDutyMainPersonMapper.selectList(personWrapper); // 获取本月天数 @@ -1438,13 +1439,15 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl list = imsDutyGroupPService.list(groupPWrapper); managerName = deptUserMap.get(deptDutyGroupMap.get(imsDutyMainEntity.getDutyGroupId()).getManagerId()); - personIds = list.stream().map(ImsDutyGroupPEntity::getPersonId).collect(Collectors.toList()); + personIds = list.stream() +// 过滤出组长 + .filter(s->!s.getPersonId().equals(deptDutyGroupMap.get(imsDutyMainEntity.getDutyGroupId()).getManagerId())) + .map(ImsDutyGroupPEntity::getPersonId).collect(Collectors.toList()); } else { // 不存在分组id从排班人员中获取组长和组员 List personList = deptPersonList.stream().filter(var -> var.getDutyMainId().equals(imsDutyMainEntity.getId())).collect(Collectors.toList()); - managerName = deptUserMap.get(personList.get(0).getDutyChargePerson()); - personIds = personList.stream().map(ImsDutyMainPersonEntity::getDutyPerson).collect(Collectors.toList()); + personIds = personList.stream().filter(s->!s.getDutyPerson().equals(personList.get(0).getDutyChargePerson())).map(ImsDutyMainPersonEntity::getDutyPerson).collect(Collectors.toList()); } String personNames = ""; From 39095d5090136278173bb1d8da4d6a4ea63ff4aa Mon Sep 17 00:00:00 2001 From: tyty Date: Tue, 22 Aug 2023 16:50:24 +0800 Subject: [PATCH 13/33] =?UTF-8?q?=E5=B7=A1=E6=A3=80=E6=92=A4=E9=94=80?= =?UTF-8?q?=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzinfo/inspect/plan/controller/PlanController.java | 11 +++++------ .../hzinfo/inspect/plan/service/impl/PlanServiceImpl.java | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java index bc04f66..00ca26a 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java @@ -7,7 +7,6 @@ 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.hzinfo.inspect.obj.utils.CodeUtils; -import com.hnac.hzinfo.inspect.plan.PlanContants; import com.hnac.hzinfo.inspect.plan.entity.PlanEntity; import com.hnac.hzinfo.inspect.plan.service.IPlanObjectTemplateService; import com.hnac.hzinfo.inspect.plan.service.IPlanService; @@ -74,9 +73,9 @@ public class PlanController extends BladeController { if(plan.getEndTime()!=null){ queryWrapper.le(PlanEntity::getEndTime,plan.getEndTime()); } - if(plan.getStatus()==null){ - queryWrapper.ne(PlanEntity::getStatus, PlanContants.PlanStatusEnum.PLAN_AUTH.getStatus()); - } +// if(plan.getStatus()==null){ +// queryWrapper.ne(PlanEntity::getStatus, PlanContants.PlanStatusEnum.PLAN_AUTH.getStatus()); +// } if(plan.getCreateDept()!=null){ queryWrapper.eq(PlanEntity::getCreateDept,plan.getCreateDept()); } @@ -107,10 +106,10 @@ public class PlanController extends BladeController { /** * 撤销 */ - @PostMapping("/revoke") + @GetMapping("/revoke") @ApiOperationSupport(order = 6) @ApiOperation(value = "撤销", notes = "传入plan") - public R revoke(@Valid @RequestBody Long planId) { + public R revoke(@RequestParam Long planId) { return R.data(planService.revoke(planId)); } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/service/impl/PlanServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/service/impl/PlanServiceImpl.java index 81ae5a8..b060ace 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/service/impl/PlanServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/service/impl/PlanServiceImpl.java @@ -117,7 +117,7 @@ public class PlanServiceImpl extends BaseServiceImpl imp public Boolean revoke(Long planId) { boolean re; LambdaUpdateWrapper uw = new UpdateWrapper().lambda(); - uw.set(PlanEntity::getStatus, PlanContants.PlanStatusEnum.PLAN_SUBMIT); + uw.set(PlanEntity::getStatus, PlanContants.PlanStatusEnum.PLAN_SUBMIT.getStatus()); uw.eq(PlanEntity::getId, planId); re = update(uw); return re; From cf6064baa3863c942d420f42030c66aa8d97187a Mon Sep 17 00:00:00 2001 From: tyty Date: Wed, 23 Aug 2023 10:03:03 +0800 Subject: [PATCH 14/33] =?UTF-8?q?=E7=BC=BA=E9=99=B7=E5=AE=9E=E4=BE=8B?= =?UTF-8?q?=E7=B1=BB=E7=94=9F=E6=88=90bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wrapper/OperDefectStatisticsWrapper.java | 31 +++++++++++----------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/wrapper/OperDefectStatisticsWrapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/wrapper/OperDefectStatisticsWrapper.java index 326bb0b..5cac3e6 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/wrapper/OperDefectStatisticsWrapper.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/wrapper/OperDefectStatisticsWrapper.java @@ -1,12 +1,10 @@ package com.hnac.hzims.operational.defect.wrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.operational.defect.entity.OperDefectStatisticsEntity; import com.hnac.hzims.operational.defect.vo.OperDefectStatisticsVO; import org.springblade.core.mp.support.BaseEntityWrapper; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.Func; -import org.springblade.system.entity.Dept; import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; @@ -30,19 +28,22 @@ public class OperDefectStatisticsWrapper extends BaseEntityWrapper Date: Wed, 23 Aug 2023 11:47:38 +0800 Subject: [PATCH 15/33] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E4=BF=AE?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../access/controller/OperAccessStatisticsController.java | 4 ++-- .../operational/access/controller/OperAccessTaskController.java | 7 +++++-- .../com/hnac/hzims/operational/access/dto/OperAccessTaskDTO.java | 7 ++++++- .../hzims/operational/access/mapper/OperAccessStatisticsMapper.xml | 6 ------ .../hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml | 6 ++++++ 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessStatisticsController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessStatisticsController.java index 92435c4..13b9364 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessStatisticsController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessStatisticsController.java @@ -80,13 +80,13 @@ public class OperAccessStatisticsController extends BladeController { * 分页 */ @ApiLog - @PostMapping("/list") + @GetMapping("/list") @ApiOperationSupport(order = 50) @ApiOperation(value = "分页 查询参数:pid,taskId,manager") @OperationAnnotation(moduleName = "检修管理",title = "检修记录",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, action = "分页查询检修记录列表") - public R> list(@RequestBody OperAccessStatisticsDTO req, Query query) { + public R> list(OperAccessStatisticsDTO req, Query query) { return service.list(req, Condition.getPage(query)); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessTaskController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessTaskController.java index 9e40bf2..c5df91c 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessTaskController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessTaskController.java @@ -91,13 +91,16 @@ public class OperAccessTaskController extends BladeController { * 分页 */ @ApiLog - @GetMapping("/list") + @PostMapping("/list") @ApiOperationSupport(order = 50) @OperationAnnotation(moduleName = "检修管理",title = "我的检修任务",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, action = "分页查询我的检修任务列表") @ApiOperation(value = "分页 查询参数:name,code,handler,status,planId,planCode") - public R> list(OperAccessTaskDTO req, Query query) { + public R> list(@RequestBody OperAccessTaskDTO req) { + Query query=new Query(); + query.setCurrent(req.getCurrent()); + query.setSize(req.getSize()); return service.list(req, query); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessTaskDTO.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessTaskDTO.java index ae0d3b3..a3a3508 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessTaskDTO.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessTaskDTO.java @@ -21,7 +21,8 @@ public class OperAccessTaskDTO extends OperAccessTaskEntity { @ApiModelProperty(value = "创建机构集合") private List deptIds; - + @ApiModelProperty(value = "ids") + private List ids; @ApiModelProperty(value = "工作流Key") private String procDefId; @@ -39,4 +40,8 @@ public class OperAccessTaskDTO extends OperAccessTaskEntity { @ApiModelProperty("结束时间") private String endTime; + @ApiModelProperty("当前页") + private Integer current; + @ApiModelProperty("每页的数量") + private Integer size; } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml index 994ab75..e390f35 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml @@ -28,12 +28,6 @@ JOIN hzims_oper_access_task OT ON OS.`TASK_ID` = OT.`ID` WHERE OS.IS_DELETED = 0 - - and OS.id in - - #{item} - - and OT.`NAME` like concat('%',#{dto.taskName},'%') diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml index 640690d..13cbc3b 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml @@ -65,6 +65,12 @@ AND t.`CODE` LIKE CONCAT('%',#{req.code},'%') + + AND t.id in + + #{item} + + AND t.`HANDLER`=#{req.handler} From 25ce94c2600d32ac138e88a43566ac585ef6c4fb Mon Sep 17 00:00:00 2001 From: tyty Date: Wed, 23 Aug 2023 14:03:39 +0800 Subject: [PATCH 16/33] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E4=BF=AE?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=BB=9F=E8=AE=A1=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/OperAccessTaskController.java | 19 ++++++-- .../access/mapper/OperAccessTaskMapper.java | 3 ++ .../access/mapper/OperAccessTaskMapper.xml | 50 +++++++++++++++++++--- .../access/service/IOperAccessTaskService.java | 1 + .../service/impl/OperAccessTaskServiceImpl.java | 8 ++++ 5 files changed, 71 insertions(+), 10 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessTaskController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessTaskController.java index c5df91c..de3219d 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessTaskController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessTaskController.java @@ -87,24 +87,37 @@ public class OperAccessTaskController extends BladeController { return service.detail(id); } + /** * 分页 */ @ApiLog - @PostMapping("/list") + @GetMapping("/list") @ApiOperationSupport(order = 50) @OperationAnnotation(moduleName = "检修管理",title = "我的检修任务",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, action = "分页查询我的检修任务列表") @ApiOperation(value = "分页 查询参数:name,code,handler,status,planId,planCode") + public R> list(OperAccessTaskDTO req, Query query) { + return service.list(req, query); + } + /** + * 分页 + */ + @ApiLog + @PostMapping("/listByStatus") + @ApiOperationSupport(order = 50) + @OperationAnnotation(moduleName = "检修管理",title = "检修任务",operatorType = OperatorType.MOBILE,businessType = + BusinessType.GENCODE, + action = "分页查询我的检修任务列表") + @ApiOperation(value = "分页 查询参数:name,code,handler,status,planId,planCode") public R> list(@RequestBody OperAccessTaskDTO req) { Query query=new Query(); query.setCurrent(req.getCurrent()); query.setSize(req.getSize()); - return service.list(req, query); + return service.listByStatus(req, query); } - /** * 获取检修台账 */ diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.java index b9ca2b3..b45f846 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.java @@ -28,6 +28,9 @@ public interface OperAccessTaskMapper extends UserDataScopeBaseMapper pageCondition(IPage page, @Param("req") OperAccessTaskDTO req); + + List pageConditionByStatus(IPage page, @Param("req") OperAccessTaskDTO req); + List selectByEmCode(String emCode,List list); @SqlParser(filter = true) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml index 13cbc3b..6efe664 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml @@ -65,12 +65,7 @@ AND t.`CODE` LIKE CONCAT('%',#{req.code},'%') - - AND t.id in - - #{item} - - + AND t.`HANDLER`=#{req.handler} @@ -97,7 +92,48 @@ ORDER BY t.create_time DESC - + - + diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IMainWorkBenchService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IMainWorkBenchService.java index cc9e0cd..f52a203 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IMainWorkBenchService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IMainWorkBenchService.java @@ -38,4 +38,5 @@ public interface IMainWorkBenchService extends BaseService InDustryVo getHomePageWorkBench(RoutingParamVo vo); + InDustryVo route(RoutingParamVo vo); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java index f64551f..3ff6723 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java @@ -26,6 +26,7 @@ import org.springblade.core.tool.utils.CollectionUtil; 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.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -176,7 +177,7 @@ public class MainWorkBenchServiceImpl extends BaseServiceImpl list = this.baseMapper.selectMainWorkBenchByType(deptCategory.toString(), null, vo.getRefTerminal(), stations.stream().map(StationEntity::getType).collect(Collectors.toList()), deptList,dept.getId(),user.getUserId()); + List list = this.baseMapper.selectMainWorkBenchByType(deptCategory.toString(), null, vo.getRefTerminal(), stations.stream().map(StationEntity::getType).distinct().collect(Collectors.toList()), deptList,dept.getId(),user.getUserId()); // 路由列表包含指定用户,过滤非指定用户数据 boolean isDesign = CollectionUtil.isNotEmpty(list.stream().filter(o->StringUtils.isNotEmpty(o.getAscriptionUser())).collect(Collectors.toList())); if(isDesign){ @@ -187,4 +188,76 @@ public class MainWorkBenchServiceImpl extends BaseServiceImpl stations = stationService.list(); + if(CollectionUtil.isEmpty(stations)){ + return new InDustryVo(); + } + List types = stations.stream().map(StationEntity::getType).distinct().collect(Collectors.toList()); + // 用户权限机构 + R> result = sysClient.getDeptByCurrentUser(); + if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ + return new InDustryVo(); + } + // 首页分类 + int category = this.userCategory(result.getData()); + List routes = this.baseMapper.stagingRoute(terminal,types,category); + if(CollectionUtil.isEmpty(routes)){ + return new InDustryVo(); + } + // 所属机构 + List depts = result.getData().stream().map(o->o.getId().toString()).collect(Collectors.toList()); + // 所属用户 + String user = AuthUtil.getUserId().toString(); + InDustryVo dustry = new InDustryVo(); + MainWorkBenchExtendVo workBench = new MainWorkBenchExtendVo(); + if(CollectionUtil.isEmpty(routes.stream().filter(o->StringUtils.isNotEmpty(o.getRefDept())).collect(Collectors.toList())) && + CollectionUtil.isEmpty(routes.stream().filter(o->StringUtils.isNotEmpty(o.getAscriptionUser())).collect(Collectors.toList()))){ + // 设置结果集 + workBench.setMainWorkBenchEntityList(routes); + }else if(CollectionUtil.isEmpty(routes.stream().filter(o->StringUtils.isNotEmpty(o.getRefDept())).collect(Collectors.toList()))){ + // 设置结果集 + workBench.setMainWorkBenchEntityList(routes.stream().filter(o->o.getAscriptionUser().contains(user)).collect(Collectors.toList())); + }else{ + // 设置结果集 + workBench.setMainWorkBenchEntityList(routes.stream().filter(o->{ + for(String deptId: depts) { + if (o.getRefDept().contains(deptId)) { + return true; + } + } + return false; + }).collect(Collectors.toList())); + } + if(CollectionUtil.isEmpty(workBench.getMainWorkBenchEntityList())){ + workBench.setMainWorkBenchEntityList(routes.stream().filter(o-> StringUtils.isEmpty(o.getAscriptionUser()) && StringUtils.isEmpty(o.getRefDept())).collect(Collectors.toList())); + } + dustry.setMainWorkBenchExtendVo(workBench); + return dustry; + } + + /** + * 用户所属机构分类 + * @return + */ + private int userCategory(List depts) { + Dept dept = depts.stream().min(Comparator.comparing(Dept::getDeptCategory)).get(); + if(ObjectUtil.isEmpty(dept)){ + return HomePageConstant.STATION; + } + return dept.getDeptCategory(); + } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java index df67928..37d83d0 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java @@ -450,7 +450,6 @@ public class StationServiceImpl extends BaseServiceImpl getStationType(Integer serveType, List typeList, List departIdList,boolean make) { return this.list(new LambdaQueryWrapper() {{ - eq(StationEntity::getIsDeleted, 0); if (ObjectUtil.isNotEmpty(serveType)) { eq(StationEntity::getServeType, serveType); } From 7032ffffd6b094069e0bfbf3ccc3395a3401180a Mon Sep 17 00:00:00 2001 From: tyty Date: Fri, 25 Aug 2023 14:01:22 +0800 Subject: [PATCH 24/33] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=8A=A5=E8=A1=A8-?= =?UTF-8?q?=E7=BC=BA=E9=99=B7=E6=8A=A5=E8=A1=A8=E4=BF=AE=E6=AD=A3bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/controller/MainReportController.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/MainReportController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/MainReportController.java index 105b5dd..f8520ed 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/MainReportController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/MainReportController.java @@ -9,14 +9,12 @@ import com.hnac.hzims.operational.access.constants.AccessConstants; import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; import com.hnac.hzims.operational.access.service.IOperAccessTaskService; import com.hnac.hzims.operational.defect.constants.DefectConstant; -import com.hnac.hzims.operational.defect.entity.OperDefectEntity; +import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; import com.hnac.hzims.operational.defect.service.IOperDefectService; +import com.hnac.hzims.operational.defect.service.IOperPhenomenonService; import com.hnac.hzims.operational.main.bo.OperationalReportBO; -import com.hnac.hzims.operational.main.service.IMainReportService; import com.hnac.hzims.operational.main.vo.DefectReportVO; import com.hnac.hzims.operational.main.vo.OperationalReportVO; -import com.hnac.hzims.operational.report.vo.PersonalMonthReportVO; -import com.hnac.hzims.operational.report.vo.StationReportAllVO; import com.hnac.hzims.operational.maintenance.constants.MaintenanceConstant; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService; @@ -55,7 +53,7 @@ public class MainReportController extends BladeController { private final IOperMaintenanceTaskService maintenanceTaskService; private final IOperAccessTaskService accessTaskService; - + private final IOperPhenomenonService operPhenomenonService; @ApiLog @ApiOperationSupport(order = 10) @@ -68,16 +66,16 @@ public class MainReportController extends BladeController { Date startTime = DateUtil.parse(startDate, DateUtil.PATTERN_DATE); Date endTime = DateUtil.plusDays(DateUtil.parse(endDate, DateUtil.PATTERN_DATE), 1); - List list = defectService.list(new LambdaQueryWrapper() {{ - gt(OperDefectEntity::getCreateTime, startTime); - le(OperDefectEntity::getCreateTime, endTime); + List list = operPhenomenonService.list(new LambdaQueryWrapper() {{ + ge(OperPhenomenonEntity::getCreateTime, startTime); + le(OperPhenomenonEntity::getCreateTime, endTime); }}); if (CollectionUtil.isEmpty(list)) { return R.data(new HashMap<>()); } //按照日期将查询结果分类 - Map> map = list.stream().collect(Collectors.groupingBy(o -> DateUtil.formatDate(o.getCreateTime()))); + Map> map = list.stream().collect(Collectors.groupingBy(o -> DateUtil.formatDate(o.getCreateTime()))); Map data = new TreeMap<>(); Date date = DateUtil.plusDays(startTime, 0); do { From e1f9b7a87a571f21a93795c3c5c1b4036c04f0f4 Mon Sep 17 00:00:00 2001 From: tyty Date: Fri, 25 Aug 2023 14:49:32 +0800 Subject: [PATCH 25/33] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=8A=A5=E8=A1=A8-?= =?UTF-8?q?=E7=BC=BA=E9=99=B7=E6=8A=A5=E8=A1=A8=E4=BF=AE=E6=AD=A3bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/hnac/hzims/operational/OperationalConstants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java index 16f31e5..93810fc 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java @@ -4,7 +4,7 @@ import lombok.Getter; public class OperationalConstants { - public final static String APP_NAME = "hzims-operational-ty"; + public final static String APP_NAME = "hzims-operational"; From 910f6ec019314ed17b19df8640425f46aa021559 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Fri, 25 Aug 2023 17:40:02 +0800 Subject: [PATCH 26/33] =?UTF-8?q?#=E9=A2=84=E8=AD=A6=E5=A4=84=E7=90=86?= =?UTF-8?q?=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task/feign/InspectTaskReportClient.java | 2 +- .../alert/mapper/AlarmHandleMapper.java | 2 +- .../operational/alert/mapper/AlarmHandleMapper.xml | 3 -- .../alert/service/impl/AlarmHandleServiceImpl.java | 8 ++++-- .../service/impl/StAlamRecordServiceImpl.java | 14 ++++++++-- .../hnac/hzims/operational/config/vo/FaultVo.java | 2 ++ .../main/service/impl/AppHomeServiceImpl.java | 1 + .../service/impl/MaintenanceServiceImpl.java | 32 ++++++++++------------ 8 files changed, 37 insertions(+), 27 deletions(-) diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/feign/InspectTaskReportClient.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/feign/InspectTaskReportClient.java index b018474..1fbca6a 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/feign/InspectTaskReportClient.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/feign/InspectTaskReportClient.java @@ -131,7 +131,7 @@ public class InspectTaskReportClient implements IInspectTaskReportClient { if(CollectionUtil.isEmpty(taskList)){ return R.data(dutyInspectTaskVO); } - dutyInspectTaskVO.setInspectTaskIds(taskList.stream().map(TaskEntity::getId).map(id->id.toString()).collect(Collectors.joining(","))); + dutyInspectTaskVO.setInspectTaskIds(taskList.stream().map(TaskEntity::getId).map(Object::toString).collect(Collectors.joining(","))); dutyInspectTaskVO.setInspectTaskSum(taskList.size()); // 所有处理完成巡检任务 List finshList = taskList.stream().filter(o-> null != o.getStatus() && o.getStatus().equals(3)).collect(Collectors.toList()); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.java index 0c55878..c989ecc 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.java @@ -20,5 +20,5 @@ public interface AlarmHandleMapper extends UserDataScopeBaseMapper selectHandlePage(IPage page,@Param("param") HandleQueryVo param); - List handles(@Param("types") List types,@Param("alarm") Integer alarm,@Param("start") String start,@Param("end") String end); + List handles(@Param("types") List types,@Param("start") String start,@Param("end") String end); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.xml index ec557f8..18304a2 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.xml +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.xml @@ -51,9 +51,6 @@ and handler.create_time between #{start} and #{end} - - and type = #{alarm} - and (detail.DELAY_TIME > #{end} or detail.DELAY_TIME is null) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java index a151d74..73129be 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java @@ -151,9 +151,13 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl handles(List types,Integer alarm) { + public List handles(List types,Integer isEarly) { + if(AbnormalAlarmConstant.INTELLIGENCE_ALARM.equals(isEarly)){ + String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME); + return this.baseMapper.handles(types,null,null); + } String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00"; String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME); - return this.baseMapper.handles(types,alarm,start,end); + return this.baseMapper.handles(types,start,end); } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java index c636df2..96c0805 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java @@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hnac.hzims.equipment.feign.IEmInfoClient; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.fdp.feign.IFdpMonitorClient; @@ -739,10 +740,17 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl handles = handleService.handles(Collections.singletonList(AbnormalAlarmConstant.EARLY_WARNING),AbnormalAlarmConstant.INTELLIGENCE_ALARM); Map map = stations.stream().collect(Collectors.toMap(StationEntity::getCode,StationEntity::getName)); - return list.stream().filter(fault -> map.containsKey(fault.getStation())).peek(o-> o.setStationName(map.get(o.getStation()))).collect(Collectors.toList()); + return list.stream().filter(fault -> map.containsKey(fault.getStation())).peek(record -> { + record.setStationName(map.get(record.getStation())); + if(CollectionUtil.isEmpty(handles)){ + record.setIsHandle(false); + }else{ + record.setIsHandle(handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(String.valueOf(record.getFaultId()))); + } + }).collect(Collectors.toList()); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/vo/FaultVo.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/vo/FaultVo.java index 74a0f60..a76ef46 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/vo/FaultVo.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/vo/FaultVo.java @@ -27,4 +27,6 @@ public class FaultVo { private String info; private String name; + + private Boolean isHandle; } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AppHomeServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AppHomeServiceImpl.java index e750044..e9a531c 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AppHomeServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AppHomeServiceImpl.java @@ -539,6 +539,7 @@ public class AppHomeServiceImpl implements IAppHomeService { e.printStackTrace(); Thread.currentThread().interrupt(); } + pool.shutdown(); // 任务完成率 int taskSum = item.getDefectSum() + item.getInspectionTaskCount() + item.getMaintenanceTaskCount() + item.getOverhaulTaskCount(); int finishSum = item.getSolvedCount() + item.getInspectionTaskFinishCount() + item.getMaintenanceTaskFinishCount() + item.getOverhaulTaskFinishCount(); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java index 8983c96..db53664 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java @@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.hnac.hzims.common.utils.DateUtil; import com.hnac.hzims.message.MessageConstants; import com.hnac.hzims.message.dto.BusinessMessageDTO; -import com.hnac.hzims.message.dto.MessagePushRecordDto; import com.hnac.hzims.message.dto.PlanMsgRecordDto; import com.hnac.hzims.message.entity.config.MessageTemplateEntity; import com.hnac.hzims.message.fegin.IMessageClient; @@ -34,8 +33,6 @@ import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.*; import org.springblade.flow.core.feign.IFlowClient; import org.springblade.system.feign.ISysClient; -import org.springblade.system.user.cache.UserCache; -import org.springblade.system.user.entity.User; import org.springframework.beans.BeanUtils; import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.stereotype.Service; @@ -51,10 +48,8 @@ import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.*; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; import java.util.concurrent.ThreadPoolExecutor; import java.util.stream.Collectors; -import java.util.stream.Stream; import static org.springblade.core.tool.utils.DateUtil.PATTERN_DATE; @@ -273,7 +268,7 @@ public class MaintenanceServiceImpl implements MaintenanceService { //拆分设备 每个设备生成一条任务 if (StringUtil.isNotBlank(finalPlanEntity.getEmCode())) { log.info("finalPlanEntity.getEmCode() : {}", finalPlanEntity.getEmCode()); - List emCodeList = Arrays.asList(finalPlanEntity.getEmCode().split(",")); + String[] emCodeList = finalPlanEntity.getEmCode().split(","); for (String emCode : emCodeList) { taskEntity.setEmCode(emCode); this.fillTask(taskEntity, finalPlanEntity); @@ -359,23 +354,26 @@ public class MaintenanceServiceImpl implements MaintenanceService { BeanUtils.copyProperties(taskEntity, operMaintenanceTaskEntityVo); Map params = new HashMap<>(); params.put("taskId", taskEntity.getId()); - List userIdList = Stream.of(taskEntity.getDisposer().split(",")).collect(Collectors.toList()); - String taskUsers = userIdList.stream().filter(o -> StringUtils.isNotBlank(o)).map(s -> { - return "taskUser_".concat(s); - }).collect(Collectors.joining(",")); - params.put("initUserIds", taskUsers); + int index = 1; + for(String userId :taskEntity.getDisposer().split(",")){ + if(index > 1){ + params.put("initUserIds" + index , "taskUser_".concat(userId)); + }else{ + params.put("initUserIds", "taskUser_".concat(userId)); + } + index++; + } params.put("operMaintenanceTaskEntityVo", operMaintenanceTaskEntityVo); - return flowClient.startProcessInstanceContainNameByKey(processDefinitionKey, String.valueOf(taskEntity.getId()), taskEntity.getTitle(), params).getData().getProcessInstanceId(); } - /** - * 推送日常维护任务消息 - * - * @return void + /* + 推送日常维护任务消息 + + @return void * @Param taskEntity 日常维护任务 - **/ + */ private void pushTaskMessage(OperMaintenanceTaskEntity taskEntity) { log.info("开始保存{}的日常维护消息推送记录", taskEntity.getDisposer()); R templateR = messageClient.getMsgTemplateById(taskEntity.getMessageTemplateId()); From 91ef45944781d88a968a782bce0db4043ade46ff Mon Sep 17 00:00:00 2001 From: tyty Date: Fri, 25 Aug 2023 18:06:28 +0800 Subject: [PATCH 27/33] =?UTF-8?q?=E5=B7=A5=E5=85=B7=E9=80=80=E5=9B=9E-?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=A8=A1=E7=B3=8A=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/hnac/hzims/spare/mapper/SpReceivesMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpReceivesMapper.xml b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpReceivesMapper.xml index 29c592e..5cfb451 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpReceivesMapper.xml +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpReceivesMapper.xml @@ -45,7 +45,7 @@ wt_sp_receives wr JOIN wt_sp_warehouse sw ON wr.STORAGE_ROOM = sw.id - and wr.code = #{params.code} + and wr.code like concat('%',#{params.code},'%') and wr.CREATE_USER = #{params.createUser} From 03d8d1252d2aa8fe25eaf2bee0a01a989d949985 Mon Sep 17 00:00:00 2001 From: tyty Date: Mon, 28 Aug 2023 09:23:45 +0800 Subject: [PATCH 28/33] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E7=89=A9=E8=B5=84=E5=8F=B0=E8=B4=A6=E6=9D=83=E9=99=90=E6=9F=A5?= =?UTF-8?q?=E7=9C=8Bbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.java index f9dbf68..74bf8bb 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.java +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.java @@ -1,6 +1,5 @@ package com.hnac.hzims.spare.mapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hnac.hzims.spare.entity.SpTemporaryStockDetailEntity; import com.hnac.hzims.spare.entity.WtSpBasicEntity; import com.hnac.hzims.spare.vo.WtSpBasicVO; @@ -15,7 +14,7 @@ import java.util.Map; * * @author Chill */ -public interface WtSpBasicMapper extends BaseMapper { +public interface WtSpBasicMapper extends UserDataScopeBaseMapper { /** * 备品备件基础信息列表 * @param params From 0546eddfa68a9fd8ce77a88bb4722da13b69348a Mon Sep 17 00:00:00 2001 From: tyty Date: Mon, 28 Aug 2023 10:10:48 +0800 Subject: [PATCH 29/33] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B0=83=E6=8B=A8?= =?UTF-8?q?=E5=8D=95bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/spare/service/impl/SpAllocationServiceImpl.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpAllocationServiceImpl.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpAllocationServiceImpl.java index fa00a7c..3a3bcb4 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpAllocationServiceImpl.java +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpAllocationServiceImpl.java @@ -14,14 +14,13 @@ import com.hnac.hzims.spare.vo.WtSpBasicVO; import lombok.AllArgsConstructor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springblade.core.launch.constant.FlowConstant; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; -import org.springblade.core.tool.support.Kv; +import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.StringUtil; import org.springblade.system.entity.Dept; import org.springblade.system.feign.IDictBizClient; @@ -31,7 +30,6 @@ import org.springblade.system.user.feign.IUserClient; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import javax.annotation.Resource; import java.math.BigDecimal; import java.time.LocalDate; import java.time.format.DateTimeFormatter; @@ -39,7 +37,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; /** * 服务实现类 @@ -246,7 +243,11 @@ public class SpAllocationServiceImpl extends BaseServiceImpl Date: Mon, 28 Aug 2023 11:42:59 +0800 Subject: [PATCH 30/33] =?UTF-8?q?#=E9=A2=84=E8=AD=A6=E5=A4=84=E7=90=86?= =?UTF-8?q?=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/StAlamRecordServiceImpl.java | 3 ++- .../scheduled/MaintenanceTaskCreateTask.java | 8 +++---- .../maintenance/service/MaintenanceService.java | 2 +- .../service/impl/MaintenanceServiceImpl.java | 27 +++++++++++++--------- .../impl/OperMaintenancePlanServiceImpl.java | 2 +- 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java index 96c0805..9865756 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java @@ -25,6 +25,7 @@ import com.hnac.hzims.operational.config.service.StAlamRecordService; import com.hnac.hzims.operational.config.service.StFocusPropertiesService; import com.hnac.hzims.operational.config.vo.*; import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService; +import com.hnac.hzims.operational.main.vo.RealDeviceVo; import com.hnac.hzims.operational.main.vo.SoeDataVo; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.service.IStationService; @@ -750,7 +751,7 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl emCodeList = Arrays.asList(planEntity.getEmCode().split(",")); for(String emCode : emCodeList){ taskEntity.setEmCode(emCode); - maintenanceService.fillTask(taskEntity,planEntity); + maintenanceService.fillTask(taskEntity,planEntity,flag); } } else { - maintenanceService.fillTask(taskEntity,planEntity); + maintenanceService.fillTask(taskEntity,planEntity,flag); } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/MaintenanceService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/MaintenanceService.java index c370508..d58df2a 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/MaintenanceService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/MaintenanceService.java @@ -38,5 +38,5 @@ public interface MaintenanceService { * @param taskEntity * @param finalPlanEntity */ - void fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity); + void fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity,Boolean flag); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java index db53664..a884ff5 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java @@ -271,10 +271,10 @@ public class MaintenanceServiceImpl implements MaintenanceService { String[] emCodeList = finalPlanEntity.getEmCode().split(","); for (String emCode : emCodeList) { taskEntity.setEmCode(emCode); - this.fillTask(taskEntity, finalPlanEntity); + this.fillTask(taskEntity, finalPlanEntity,false); } } else { - this.fillTask(taskEntity, finalPlanEntity); + this.fillTask(taskEntity, finalPlanEntity,false); } } @@ -286,7 +286,7 @@ public class MaintenanceServiceImpl implements MaintenanceService { * @param taskEntity * @param finalPlanEntity */ - public void fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity) { + public void fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity,Boolean flag) { DefaultTransactionDefinition defaultTransactionDefinition = new DefaultTransactionDefinition(); defaultTransactionDefinition.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); TransactionStatus transaction = dataSourceTransactionManager.getTransaction(defaultTransactionDefinition); @@ -322,7 +322,7 @@ public class MaintenanceServiceImpl implements MaintenanceService { taskService.save(taskEntity); dataSourceTransactionManager.commit(transaction); //启动流程 - String processInstanceId = this.startProcess(finalPlanEntity.getProcDefId(), taskEntity); + String processInstanceId = this.startProcess(finalPlanEntity.getProcDefId(), taskEntity,flag); //推送消息 CompletableFuture operMaintenanceTaskEntityCompletableFuture = CompletableFuture.runAsync(() -> { @@ -349,19 +349,24 @@ public class MaintenanceServiceImpl implements MaintenanceService { * * @author xiashandong **/ - private String startProcess(String processDefinitionKey, OperMaintenanceTaskEntity taskEntity) { + private String startProcess(String processDefinitionKey, OperMaintenanceTaskEntity taskEntity,Boolean flag) { OperMaintenanceTaskEntityVo operMaintenanceTaskEntityVo = new OperMaintenanceTaskEntityVo(); BeanUtils.copyProperties(taskEntity, operMaintenanceTaskEntityVo); Map params = new HashMap<>(); params.put("taskId", taskEntity.getId()); - int index = 1; - for(String userId :taskEntity.getDisposer().split(",")){ - if(index > 1){ - params.put("initUserIds" + index , "taskUser_".concat(userId)); + if(flag){ + params.put("startFlowUserId", taskEntity.getCreateUser().toString()); + } + String[] userArr = taskEntity.getDisposer().split(","); + for(int index = 0; index < userArr.length ; index++){ + if(index > 4){ + continue; + } + if(index > 0){ + params.put("initUserIds" + index , "taskUser_".concat(userArr[index])); }else{ - params.put("initUserIds", "taskUser_".concat(userId)); + params.put("initUserIds", "taskUser_".concat(userArr[index])); } - index++; } params.put("operMaintenanceTaskEntityVo", operMaintenanceTaskEntityVo); return flowClient.startProcessInstanceContainNameByKey(processDefinitionKey, String.valueOf(taskEntity.getId()), taskEntity.getTitle(), params).getData().getProcessInstanceId(); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenancePlanServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenancePlanServiceImpl.java index 59297a6..2099a87 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenancePlanServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenancePlanServiceImpl.java @@ -108,7 +108,7 @@ public class OperMaintenancePlanServiceImpl extends BaseServiceImpl { try{ - schedule.generateTaskByPlan(planEntity); + schedule.generateTaskByPlan(planEntity,false); //更新任务派发时间 this.update(new LambdaUpdateWrapper().set(OperMaintenancePlanEntity::getCreateTaskTime,new Date()) .eq(OperMaintenancePlanEntity::getId,planEntity.getId())); From 2c7d9196d3383fa4d7a5fed2b52bb3bc86bd15fa Mon Sep 17 00:00:00 2001 From: tyty Date: Mon, 28 Aug 2023 14:20:06 +0800 Subject: [PATCH 31/33] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E5=AF=BC=E5=85=A5bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java index b9c6e9f..4c8bcde 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java @@ -567,7 +567,7 @@ public class WtSpBasicServiceImpl extends BaseServiceImpl r = this.validExcel(libraryExcel, codeList, counter); - if (r.getMsg()!=null|| !r.isSuccess()) { + if ( !r.isSuccess()) { return r; } } From da4059e44d903043c4602394699d380a39965ccd Mon Sep 17 00:00:00 2001 From: tyty Date: Mon, 28 Aug 2023 14:40:08 +0800 Subject: [PATCH 32/33] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E5=AF=BC=E5=85=A5bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java index 4c8bcde..8955c81 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java @@ -552,9 +552,9 @@ public class WtSpBasicServiceImpl extends BaseServiceImpl data = new ArrayList<>(); List error = new ArrayList<>(); error = JSONArray.parseArray(JSON.toJSONString(entityList), WtSpBasicEntity.class).stream() - .filter(entity -> Func.isEmpty(entity.getName())).collect(Collectors.toList()); + .filter(entity -> Func.isEmpty(entity.getCode())).collect(Collectors.toList()); data = JSONArray.parseArray(JSON.toJSONString(entityList), WtSpBasicEntity.class).stream() - .filter(entity -> Func.isNotEmpty(entity.getName())).collect(Collectors.toList()); + .filter(entity -> Func.isNotEmpty(entity.getCode())).collect(Collectors.toList()); Assert.isTrue(CollectionUtil.isEmpty(error), () -> { throw new ServiceException("填入工器具编码不能为空"); }); From 9be1542c22b02a98044f4bdb1dcb1380d65d3cd0 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Mon, 28 Aug 2023 17:15:05 +0800 Subject: [PATCH 33/33] =?UTF-8?q?#=E5=BE=AE=E4=BF=A1=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=8E=A8=E9=80=81&=E5=B7=A1=E6=A3=80=E5=86=85=E5=AE=B9bug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/message/dto/WxMessageDTO.java | 2 +- .../obj/services/IContentDefinitionService.java | 4 +- hzims-service/message/pom.xml | 1 + .../hnac/hzims/message/fegin/MessageClient.java | 8 +-- .../service/impl/MessagePushRecordServiceImpl.java | 12 ++--- .../message/service/impl/WxMessageServiceImpl.java | 62 ++++++---------------- .../census/controller/DeviceDataController.java | 7 +++ .../census/service/DeviceDataService.java | 2 + .../census/service/impl/DeviceDataServiceImpl.java | 49 +++++++++++++++++ 9 files changed, 87 insertions(+), 60 deletions(-) diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/WxMessageDTO.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/WxMessageDTO.java index 0c40b50..6846b6d 100644 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/WxMessageDTO.java +++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/WxMessageDTO.java @@ -45,7 +45,7 @@ public class WxMessageDTO implements Serializable { @NotNull @ApiModelProperty(value = "推送消息键值对") - private Map map; + private Map map; @NotNull @ApiModelProperty(value = "内容") diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/IContentDefinitionService.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/IContentDefinitionService.java index 2393be5..38d45d9 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/IContentDefinitionService.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/IContentDefinitionService.java @@ -29,7 +29,9 @@ public interface IContentDefinitionService extends BaseService queryWrapper = Condition.getQueryWrapper(entity,ContentDefinitionEntity.class); queryWrapper.eq(Func.isNotEmpty(entity.getCreateDept()), ContentDefinitionEntity::getCreateDept, entity.getCreateDept()) .eq(Func.isNotEmpty(entity.getCreateUser()), ContentDefinitionEntity::getCreateUser, entity.getCreateUser()) - .eq(Func.isNotEmpty(entity.getStatus()), ContentDefinitionEntity::getStatus, entity.getStatus()).orderByDesc(ContentDefinitionEntity::getCreateTime); + .eq(Func.isNotEmpty(entity.getStatus()), ContentDefinitionEntity::getStatus, entity.getStatus()).orderByDesc(ContentDefinitionEntity::getCreateTime) + .eq(Func.isNotEmpty(entity.getCheckType()),ContentDefinitionEntity::getCheckType,entity.getCheckType()) + .like(Func.isNotEmpty(entity.getName()),ContentDefinitionEntity::getName,entity.getName()); return queryWrapper; } diff --git a/hzims-service/message/pom.xml b/hzims-service/message/pom.xml index 56dd88f..b3856f8 100644 --- a/hzims-service/message/pom.xml +++ b/hzims-service/message/pom.xml @@ -88,6 +88,7 @@ org.springblade blade-system-api + 5.0.2-SNAPSHOT diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java index c718ab3..c7a93ff 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java @@ -90,7 +90,7 @@ public class MessageClient extends BladeController implements IMessageClient{ entity.setDeptName(Func.isNotEmpty(entity.getDeptName()) ? entity.getDeptName() : this.getDeptNameById(entity.getDeptId())); entity.setMessageId(IdWorker.getId()); entity.setPusher(userId.toString()); - entity.setPusherName(Optional.ofNullable(UserCache.getUser(userId)).map(User::getName).orElse(null)); + //entity.setPusherName(Optional.ofNullable(UserCache.getUser(userId)).map(User::getName).orElse(null)); entity.setPushType(MessageConstants.IMMEDIATELY); entity.setAccount(userId.toString()); entity.setPlanTime(LocalDateTime.now()); @@ -98,11 +98,11 @@ public class MessageClient extends BladeController implements IMessageClient{ entity.setCreateDept(entity.getDeptId()); return entity; }).collect(Collectors.toList()); - boolean isSave = recordService.saveBatch(messages); + /*boolean isSave = recordService.saveBatch(messages); if(isSave){ return R.data(recordService.sendWxMessageByUser(request,messages)); - } - return R.data(false); + }*/ + return R.data(recordService.sendWxMessageByUser(request,messages)); } @PostMapping(PLAN_SEND_MESSAGE) diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java index bf9b069..6ab12eb 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java @@ -394,19 +394,15 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl records) { - Map param = new HashMap(); - param.put("templateId",message.getTemplateId()); - param.put("skip",message.getSkipUrl()); - param.put("map",message.getMap()); - param.put("userIds", Arrays.stream(message.getUserIds().split(",")).collect(Collectors.toList())); + WxMessageServiceImpl service = SpringUtil.getBean(WxMessageServiceImpl.class); - boolean isSend = service.send(param); - if (isSend) { + boolean isSend = service.send(message); + /*if (isSend) { this.update(Wrappers.lambdaUpdate() .set(MessagePushRecordEntity::getPushTime, LocalDateTime.now()) .set(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_SUCCESS) .in(MessagePushRecordEntity::getId, records.stream().map(MessagePushRecordEntity::getId).collect(Collectors.toList()))); - } + }*/ return isSend; } diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WxMessageServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WxMessageServiceImpl.java index 337983d..aea5845 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WxMessageServiceImpl.java +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WxMessageServiceImpl.java @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; import com.hnac.hzims.message.MessageConstants; import com.hnac.hzims.message.dto.AppPushDto; import com.hnac.hzims.message.dto.PushDto; +import com.hnac.hzims.message.dto.WxMessageDTO; import com.hnac.hzims.message.entity.MessagePushRecordEntity; import com.hnac.hzims.message.log.aspect.SaveLog; import com.hnac.hzims.message.service.IMessageService; @@ -16,6 +17,7 @@ import com.hnac.hzinfo.core.push.model.PushPlatform; import com.hnac.hzinfo.core.push.model.PushResponse; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.formula.functions.T; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.logger.BladeLogger; import org.springblade.core.secure.utils.AuthUtil; @@ -24,6 +26,9 @@ import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.resource.feign.IPushClient; import org.springblade.resource.vo.PushInfoVO; +import org.springblade.system.entity.PushTemplate; +import org.springblade.system.feign.IWxPushClient; +import org.springblade.system.vo.WxPushFeignVO; import org.springframework.stereotype.Service; import java.io.*; @@ -38,6 +43,7 @@ import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.FutureTask; import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; /** * @author hx @@ -48,6 +54,7 @@ import java.util.concurrent.atomic.AtomicReference; public class WxMessageServiceImpl implements IMessageService { private final IPushClient pushClient; + private final IWxPushClient wxPushClient; private final BladeLogger logger; private final ExecutorService appMessagePushExecutor; @@ -75,50 +82,13 @@ public class WxMessageServiceImpl implements IMessageService { return false; } - public boolean send(Map param) { - OutputStream out = null; - try{ - URL serverUrl = new URL("https://3d.hnaccloud.com/api/blade-system/wxPush/sendPush"); - HttpURLConnection conn = (HttpURLConnection) serverUrl.openConnection(); - conn.setRequestMethod("GET"); - conn.setRequestProperty("Content-type", "application/json"); - //必须设置false,否则会自动redirect到重定向后的地址 - conn.setInstanceFollowRedirects(false); - conn.connect(); - String result = responseFormat(conn); - //获取输出流 - out = conn.getOutputStream(); - log.error("send_wx_message_param: {}",param.toString()); - //输出流里写入POST参数 - out.write(param.toString().getBytes()); - out.flush(); - out.close(); - }catch (Exception ex){ - log.error("send_wx_message_error: {} ", ex.getMessage()); - } - return false; - } - - /*** - * 获取返回的内容 - * @param connection - * @return - */ - private String responseFormat(HttpURLConnection connection) { - StringBuilder stringBuilder = new StringBuilder(); - //将返回的输入流转换成字符串 - try ( - InputStream inputStream = connection.getInputStream(); - InputStreamReader inputStreamReader = new InputStreamReader(inputStream, StandardCharsets.UTF_8); - BufferedReader bufferedReader = new BufferedReader(inputStreamReader) - ) { - String str; - while ((str = bufferedReader.readLine()) != null) { - stringBuilder.append(str); - } - } catch (IOException e) { - return null; - } - return stringBuilder.toString(); - } + public boolean send(WxMessageDTO message) { + PushTemplate template = new PushTemplate(); + template.setTemplateId(message.getTemplateId()); + template.setSkipUrl(message.getSkipUrl()); + template.setMap(message.getMap()); + template.setUserIds(Arrays.stream(message.getUserIds().split(",")).collect(Collectors.toList())); + R result = wxPushClient.sendPushTemplateByUserId(template); + return result.isSuccess(); + } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/DeviceDataController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/DeviceDataController.java index a448691..89e98c5 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/DeviceDataController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/DeviceDataController.java @@ -42,4 +42,11 @@ public class DeviceDataController { public R> history(AnalyzeDataCondition analyzeDataCondition) { return service.history(analyzeDataCondition); } + + @ApiOperation("微信消息推送测试") + @PostMapping("/sendWxMessage") + @ApiOperationSupport(order = 1) + public R sendWxMessage() { + return service.sendWxMessage(); + } } \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/DeviceDataService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/DeviceDataService.java index 6726c14..c69fe0a 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/DeviceDataService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/DeviceDataService.java @@ -19,4 +19,6 @@ public interface DeviceDataService { R> real(RealDataSearchPO search); R> history(AnalyzeDataCondition analyzeDataCondition); + + R sendWxMessage(); } \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/DeviceDataServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/DeviceDataServiceImpl.java index cc96c56..91c2a11 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/DeviceDataServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/DeviceDataServiceImpl.java @@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; import com.esotericsoftware.minlog.Log; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; +import com.hnac.hzims.message.dto.WxMessageDTO; +import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.operational.census.service.DeviceDataService; import com.hnac.hzims.operational.census.vo.RealVo; import com.hnac.hzinfo.datasearch.PointData; @@ -15,10 +17,13 @@ import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO; import com.hnac.hzinfo.sdk.analyse.AnalyseDataSearchClient; import com.hnac.hzinfo.sdk.core.response.HzPage; import com.hnac.hzinfo.sdk.core.response.Result; +import io.swagger.annotations.ApiModelProperty; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.MapUtils; import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.mp.support.QueryField; +import org.springblade.core.mp.support.SqlCondition; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.StringUtil; @@ -26,6 +31,8 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; +import javax.validation.constraints.NotNull; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -42,6 +49,8 @@ public class DeviceDataServiceImpl implements DeviceDataService { private final AnalyseDataSearchClient analyseDataSearchClient; + private final IMessageClient messageClient; + /** * 实时数据 * @param search @@ -67,4 +76,44 @@ public class DeviceDataServiceImpl implements DeviceDataService { Result> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCode(analyzeDataCondition); return R.data(result.getData()); } + + /** + * 微信消息推送测试 + * @return + */ + @Override + public R sendWxMessage() { + WxMessageDTO message = new WxMessageDTO(); + // 模板Id + message.setTemplateId("hIgINCsjpG-gyCKh8wzwBWjR-hkbjkNLFTXQEsnR_Z8"); + // 微信消息跳转地址 + message.setSkipUrl("http://baidu.com"); + // 机构Id + message.setDeptId(200000010709L); + // 业务关键字 + message.setBusinessKey("wx_message_test"); + // 业务分类关键字 + message.setBusinessClassify("wx_message_test"); + // 任务Id + message.setTaskId(1686044105416650753L); + // 微信参数键值对 + HashMap map = new HashMap<>(); + map.put("thing18","云南维西拉波洛水电站"); + map.put("thing5","1号机组"); + map.put("thing11","拉波洛电站数据_1号机组PLC.(D182)机组故障_分"); + map.put("thing14","故障"); + map.put("time2","2023-08-28 16:08:19"); + message.setMap(map); + // 消息内容 + message.setContent("杨胜军在测试微信消息推送"); + // 消息主题 + message.setSubject("微信公众号推送消息测试"); + // 推送用户 + message.setUserIds("1678930425282785281,1696056255481344002,1696073993931157505"); + // 创建用户 + message.setCreateUser(1394936547620040706L); + // 租户Id + message.setTenantId("200000"); + return messageClient.sendWxMessage(message); + } } \ No newline at end of file