Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 1 year ago
parent
commit
050c65ee2b
  1. 4
      hzims-service-api/common-api/pom.xml
  2. 39
      hzims-service-api/common-api/src/main/java/com/hnac/hzims/vo/VoteChartVo.java
  3. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java
  4. 11
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperDefectStatisticsVO.java
  5. 8
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/dto/OperMaintenanceTaskDTO.java
  6. 45
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/CheckVoteChartVo.java
  7. 6
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java
  8. 7
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/dto/TaskDTO.java
  9. 2
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/WxMessageDTO.java
  10. 2
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpReceivesMapper.xml
  11. 3
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.java
  12. 11
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpAllocationServiceImpl.java
  13. 6
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java
  14. 1
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java
  15. 4
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskServiceImpl.java
  16. 1
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/DefectService.java
  17. 3
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/PhenomenonService.java
  18. 24
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/DefectServiceImpl.java
  19. 6
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/MaintenanceServiceImpl.java
  20. 35
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/PhenomenonServiceImpl.java
  21. 3
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java
  22. 1
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/impl/TicketServiceImpl.java
  23. 55
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/impl/WorkTicketServiceImpl.java
  24. 4
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/IContentDefinitionService.java
  25. 26
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java
  26. 2
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/service/IPlanService.java
  27. 15
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/service/impl/PlanServiceImpl.java
  28. 61
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java
  29. 2
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/feign/InspectTaskReportClient.java
  30. 7
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/ITaskService.java
  31. 74
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java
  32. 6
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskListQuery.java
  33. 1
      hzims-service/message/pom.xml
  34. 8
      hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java
  35. 12
      hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java
  36. 62
      hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WxMessageServiceImpl.java
  37. 1
      hzims-service/operational/pom.xml
  38. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessStatisticsController.java
  39. 69
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessTaskController.java
  40. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessStatisticsDTO.java
  41. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessTaskDTO.java
  42. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.java
  43. 44
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml
  44. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessTaskService.java
  45. 72
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java
  46. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.java
  47. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.xml
  48. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java
  49. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/DeviceDataController.java
  50. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/DeviceDataService.java
  51. 49
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/DeviceDataServiceImpl.java
  52. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java
  53. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java
  54. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/vo/FaultVo.java
  55. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectStatisticsController.java
  56. 50
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperPhenomenonController.java
  57. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperPhenomenonService.java
  58. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java
  59. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectStatisticsServiceImpl.java
  60. 75
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperPhenomenonServiceImpl.java
  61. 31
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/wrapper/OperDefectStatisticsWrapper.java
  62. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyMainController.java
  63. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsAnalyseExampleServiceImpl.java
  64. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java
  65. 27
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/utils/ExcelTool.java
  66. 16
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/MainReportController.java
  67. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/MainWorkBenchController.java
  68. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/MainWorkBenchMapper.java
  69. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/MainWorkBenchMapper.xml
  70. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IMainWorkBenchService.java
  71. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AppHomeServiceImpl.java
  72. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java
  73. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java
  74. 78
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java
  75. 67
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceTaskController.java
  76. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java
  77. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceTaskService.java
  78. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/MaintenanceService.java
  79. 47
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java
  80. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenancePlanServiceImpl.java
  81. 73
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java
  82. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java
  83. 6
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java
  84. 9
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java

4
hzims-service-api/common-api/pom.xml

@ -22,6 +22,10 @@
<dependencies>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
</dependency>
</dependencies>
</project>

39
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<Long> sumIds;
@ApiModelProperty(value = "未完成数量")
@ExcelProperty(value = "未完成数量", index = 2)
private int undoneNum;
@ApiModelProperty(value = "未完成id")
@ExcelIgnore
private List<Long> undoneIds;
@ApiModelProperty(value = "完成数量")
@ExcelProperty(value = "完成数量", index = 3)
private int finishNum;
@ApiModelProperty(value = "完成id")
@ExcelIgnore
private List<Long> finishIds;
}

2
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java

@ -23,7 +23,7 @@ public interface AbnormalAlarmConstant {
/**故障**/
String FAULT = "3";
/**预警**/
Long EARLY_WARNING = 20L;

11
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<String> 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;
}

8
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<Long> taskList;
@ApiModelProperty("任务Id 多个按逗号分隔")
private List<Long> deptIds;
@ -33,4 +34,9 @@ public class OperMaintenanceTaskDTO extends OperMaintenanceTaskEntity {
@ApiModelProperty("结束时间")
private String endTime;
@ApiModelProperty("当前页")
private Integer current;
@ApiModelProperty("每页的数量")
private Integer size;
}

45
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<String> phenomenonIds;
@ApiModelProperty(value = "缺陷数量")
@ExcelProperty(value = "缺陷数量", index = 2)
private int defectNum;
@ApiModelProperty(value = "缺陷code")
@ExcelIgnore
private List<String> defectIds;
@ApiModelProperty(value = "处理数量")
@ExcelProperty(value = "处理数量", index = 3)
private int handleNum;
@ApiModelProperty(value = "处理code")
@ExcelIgnore
private List<String> handleIds;
@ApiModelProperty(value = "定论数量")
@ExcelProperty(value = "定论数量", index = 4)
private int conclusionNum;
@ApiModelProperty(value = "定论code")
@ExcelIgnore
private List<String> conclusionIds;
}

6
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java

@ -162,6 +162,7 @@ public class StationEntity extends TenantEntity implements Serializable {
private Integer sort;
@ApiModelProperty("实时画面绑定账号秘钥")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String secretKey;
@ -173,4 +174,9 @@ public class StationEntity extends TenantEntity implements Serializable {
@QueryField(condition = SqlCondition.EQUAL)
@TableField(updateStrategy = FieldStrategy.IGNORED)
private Boolean isAbroad;
@ApiModelProperty("所属国家")
@QueryField(condition = SqlCondition.EQUAL)
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String refCountry;
}

7
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<Long> ids;
@ApiModelProperty("当前页")
private Integer current;
@ApiModelProperty("每页的数量")
private Integer size;
}

2
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<String,String> map;
private Map<String,Object> map;
@NotNull
@ApiModelProperty(value = "内容")

2
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
<if test="params.code!=null and params.code!=''">
and wr.code = #{params.code}
and wr.code like concat('%',#{params.code},'%')
</if>
<if test="params.createUser!=null">
and wr.CREATE_USER = #{params.createUser}

3
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<WtSpBasicEntity> {
public interface WtSpBasicMapper extends UserDataScopeBaseMapper<WtSpBasicEntity> {
/**
* 备品备件基础信息列表
* @param params

11
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<SpAllocationMapper,
}
}
WtSpWarehouseEntity inWarehouseEntity = warehouseMapper.selectById(entity.getInWarehouseId());
entity.setInWarehouseName(inWarehouseEntity.getName());
if(ObjectUtil.isNotEmpty(inWarehouseEntity)&&StringUtil.isNotBlank(inWarehouseEntity.getName())){
entity.setInWarehouseName(inWarehouseEntity.getName());
}else {
entity.setInWarehouseName("");
}
result.add(entity);
}
return page.setRecords(result);

6
hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java

@ -552,9 +552,9 @@ public class WtSpBasicServiceImpl extends BaseServiceImpl<WtSpBasicMapper, WtSpB
List<WtSpBasicEntity> data = new ArrayList<>();
List<WtSpBasicEntity> 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("填入工器具编码不能为空");
});
@ -567,7 +567,7 @@ public class WtSpBasicServiceImpl extends BaseServiceImpl<WtSpBasicMapper, WtSpB
Integer counter = 2;
//数据校验
R<String> r = this.validExcel(libraryExcel, codeList, counter);
if (r.getMsg()!=null|| !r.isSuccess()) {
if ( !r.isSuccess()) {
return r;
}
}

1
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java

@ -523,6 +523,7 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl<FdpMonitorMapper, Fdp
if (ObjectUtil.isEmpty(fdpFaultEntity)) {
throw new ServiceException("获取对应故障对象失败");
}
taskDTO.setFdpDeviceName(fdpFaultEntity.getFdpDeviceName());
// /**获取实时、历史数据**/
// FdpRealTimeAndHisDataVo pushResp = this.dataPushByPartition(fdpFaultEntity.getFdpPartition(), fdpFaultEntity.getCreateDept());
// String key = UUID.randomUUID().toString();

4
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskServiceImpl.java

@ -758,13 +758,13 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
task.setInspectTaskIds(tasks.stream().map(TaskEntity::getId).map(Object::toString).collect(Collectors.joining(",")));
task.setInspectTaskSum(tasks.size());
// 所有处理完成巡检任务
List<TaskEntity> finshList = tasks.stream().filter(o-> null != o.getStatus() && o.getStatus().equals(3)).collect(Collectors.toList());
List<TaskEntity> finshList = tasks.stream().filter(o-> null != o.getStatus() && o.getStatus().equals(4)).collect(Collectors.toList());
if(CollectionUtil.isEmpty(finshList)){
return task;
}
task.setInspectTaskFinish(finshList.size());
// 未执行任务数
List<TaskEntity> notExecuteList = tasks.stream().filter(o-> null != o.getStatus() && o.getStatus().equals(0)).collect(Collectors.toList());
List<TaskEntity> notExecuteList = tasks.stream().filter(o-> !finshList.stream().map(TaskEntity::getId).collect(Collectors.toList()).contains(o.getId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(notExecuteList)){
return task;
}

1
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/DefectService.java

@ -11,5 +11,4 @@ import java.util.List;
*/
public interface DefectService extends BaseService<OperDefectEntity> {
SolveHomeVO solve_count(List<Long> deptIds, String start, String end);
}

3
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/PhenomenonService.java

@ -1,6 +1,7 @@
package com.hnac.hzims.scheduled.service.operation.business;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.vo.SolveHomeVO;
import com.hnac.hzims.operational.main.vo.ShortagesVo;
import com.hnac.hzims.operational.report.vo.DutyDefectVO;
import org.springblade.core.mp.base.BaseService;
@ -12,6 +13,8 @@ import java.util.List;
*/
public interface PhenomenonService extends BaseService<OperPhenomenonEntity> {
SolveHomeVO solve_count(List<Long> deptIds, String start, String end);
DutyDefectVO defect(String start, String end, List<Long> areas);
ShortagesVo defectMonth(String start, String end, List<Long> list);

24
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/DefectServiceImpl.java

@ -26,28 +26,4 @@ import java.util.stream.Collectors;
@AllArgsConstructor
public class DefectServiceImpl extends BaseServiceImpl<DefectMapper, OperDefectEntity> implements DefectService {
/**
* 消缺数量统计
* @param deptIds
* @param start
* @param end
* @return
*/
@Override
public SolveHomeVO solve_count(List<Long> deptIds, String start, String end) {
SolveHomeVO solve = new SolveHomeVO();
List<OperDefectEntity> defects = this.list(Wrappers.<OperDefectEntity>lambdaQuery()
.in(OperDefectEntity::getCreateDept,deptIds)
.gt(OperDefectEntity::getCreateTime,start)
.lt(OperDefectEntity::getCreateTime,end)
);
if(cn.hutool.core.collection.CollectionUtil.isEmpty(defects)){
solve.setDefectCount(0);
solve.setSolveCount(0);
}else{
solve.setDefectCount(defects.size());
solve.setSolveCount((int) defects.stream().filter(defect-> ObjectUtil.isNotEmpty(defect.getHandleTaskId())).count());
}
return solve;
}
}

6
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/MaintenanceServiceImpl.java

@ -156,7 +156,7 @@ public class MaintenanceServiceImpl extends BaseServiceImpl<MaintenanceMapper, O
e.printStackTrace();
}
}
/**
* 开启一个流程实例
**/
@ -247,7 +247,7 @@ public class MaintenanceServiceImpl extends BaseServiceImpl<MaintenanceMapper, O
}
// 日常维护完成数
maintainVo.setMaintain(maintainList.size());
List<Long> maintainFinish = maintainList.stream().filter(o-> Func.isNotEmpty(o.getStatus()) && MaintenanceConstant.TASK_STATUS_5 == o.getStatus())
List<Long> maintainFinish = maintainList.stream().filter(o-> "结束".equals(o.getFlowTaskName()))
.map(OperMaintenanceTaskEntity::getId).collect(Collectors.toList());
if(CollectionUtil.isEmpty(maintainFinish)){
maintainVo.setMaintainFinish(0);
@ -281,7 +281,7 @@ public class MaintenanceServiceImpl extends BaseServiceImpl<MaintenanceMapper, O
regularWorkVO.setMainTaskIds(regularWorkList.stream().map(OperMaintenanceTaskEntity::getId).map(Object::toString).collect(Collectors.joining(",")));
regularWorkVO.setRegularWorkSum(regularWorkList.size());
// 定期工作任务完成数量
List<OperMaintenanceTaskEntity> regularWorkFinishList = regularWorkList.stream().filter(o -> MaintenanceConstant.TASK_STATUS_5 == o.getStatus()).collect(Collectors.toList());
List<OperMaintenanceTaskEntity> regularWorkFinishList = regularWorkList.stream().filter(o -> "结束".equals(o.getFlowTaskName())).collect(Collectors.toList());
if (CollectionUtil.isEmpty(regularWorkFinishList)) {
regularWorkVO.setRegularWork(0);
return regularWorkVO;

35
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/PhenomenonServiceImpl.java

@ -1,7 +1,10 @@
package com.hnac.hzims.scheduled.service.operation.business.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.operational.defect.entity.OperDefectEntity;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.vo.SolveHomeVO;
import com.hnac.hzims.operational.main.vo.ShortagesVo;
import com.hnac.hzims.operational.report.vo.DutyDefectVO;
import com.hnac.hzims.scheduled.mapper.operation.PhenomenonMapper;
@ -11,6 +14,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
@ -28,6 +32,32 @@ import java.util.stream.Collectors;
public class PhenomenonServiceImpl extends BaseServiceImpl<PhenomenonMapper, OperPhenomenonEntity> implements PhenomenonService {
/**
* 消缺数量统计
* @param deptIds
* @param start
* @param end
* @return
*/
@Override
public SolveHomeVO solve_count(List<Long> deptIds, String start, String end) {
SolveHomeVO solve = new SolveHomeVO();
List<OperPhenomenonEntity> defects = this.list(Wrappers.<OperPhenomenonEntity>lambdaQuery()
.in(OperPhenomenonEntity::getCreateDept,deptIds)
.gt(OperPhenomenonEntity::getCreateTime,start)
.lt(OperPhenomenonEntity::getCreateTime,end)
);
if(cn.hutool.core.collection.CollectionUtil.isEmpty(defects)){
solve.setDefectCount(0);
solve.setSolveCount(0);
}else{
solve.setDefectCount(defects.size());
solve.setSolveCount((int) defects.stream().filter(defect-> !ObjectUtil.isEmpty(defect.getHandleTaskId())).count());
}
return solve;
}
/**
* 时间范围内机构缺陷数据查询
* @param start
* @param end
@ -51,7 +81,7 @@ public class PhenomenonServiceImpl extends BaseServiceImpl<PhenomenonMapper, Ope
defectVO.setTotalIds(operPhenomenonList.stream().map(o->String.valueOf(o.getId())).collect(Collectors.joining(",")));
defectVO.setDefectSum(operPhenomenonList.size());
// 消缺数
List<Long> defectList = operPhenomenonList.stream().filter(o -> (Func.isNotEmpty(o.getIsDefect()) && o.getIsDefect() == 0) || "1".equals(o.getConclusionStatus())).
List<Long> defectList = operPhenomenonList.stream().filter(defect-> !ObjectUtil.isEmpty(defect.getHandleTaskId())).
map(OperPhenomenonEntity::getId).collect(Collectors.toList());
if(CollectionUtil.isEmpty(defectList)){
defectVO.setDefect(0);
@ -88,8 +118,7 @@ public class PhenomenonServiceImpl extends BaseServiceImpl<PhenomenonMapper, Ope
}
// 消缺数
shortagesVo.setShortagesSum(defects.size());
List<Long> shortagesList = defects.stream().filter(o -> (Func.isNotEmpty(o.getIsDefect()) && o.getIsDefect() == 0) || "1".equals(o.getConclusionStatus())).
map(OperPhenomenonEntity::getId).collect(Collectors.toList());
List<Long> shortagesList = defects.stream().filter(defect-> !ObjectUtil.isEmpty(defect.getHandleTaskId())).map(OperPhenomenonEntity::getId).collect(Collectors.toList());
if(CollectionUtil.isEmpty(shortagesList)){
shortagesVo.setShortages(0);
}

3
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java

@ -80,7 +80,6 @@ public class ShowServiceImpl implements ShowService {
private final OtherService otherService;
private final AccessService accessService;
private final TicketService ticketService;
private final DefectService defectService;
private final DutyService dutyService;
private final StationService stationService;
private final OverDetailsService detailsService;
@ -397,7 +396,7 @@ public class ShowServiceImpl implements ShowService {
});
// 消缺率
exe.execute(() -> {
SolveHomeVO solve = defectService.solve_count(areas,DateUtil.format(DateUtil.toDate(firstDateTime.toLocalDate()),DateUtil.PATTERN_DATETIME),DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME));
SolveHomeVO solve = phenomenonService.solve_count(areas,DateUtil.format(DateUtil.toDate(firstDateTime.toLocalDate()),DateUtil.PATTERN_DATETIME),DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME));
if(Math.abs(solve.getSolveCount()) > 0 && Math.abs(solve.getDefectCount()) > 0){
target.setTaget_three(BigDecimal.valueOf((double)solve.getSolveCount() / solve.getDefectCount() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
}else{

1
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/impl/TicketServiceImpl.java

@ -15,7 +15,6 @@ import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springframework.stereotype.Service;

55
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/impl/WorkTicketServiceImpl.java

@ -2,26 +2,19 @@ package com.hnac.hzims.scheduled.service.ticket.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.scheduled.mapper.ticket.WorkTicketMapper;
import com.hnac.hzims.scheduled.service.ticket.WorkDelayService;
import com.hnac.hzims.scheduled.service.ticket.WorkPrincipalService;
import com.hnac.hzims.scheduled.service.ticket.WorkTicketService;
import com.hnac.hzims.ticket.constants.TicketConstants;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketDelayEntity;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketPrincipalChangeEntity;
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketStatisticVO;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.stream.Collectors;
@ -46,32 +39,40 @@ public class WorkTicketServiceImpl extends BaseServiceImpl<WorkTicketMapper, Wor
in(WorkTicketInfoEntity::getCreateDept, areas);
}});
if (CollectionUtil.isNotEmpty(infoList)) {
List<Long> infoIdList = infoList.stream().map(WorkTicketInfoEntity::getId).collect(Collectors.toList());
// List<Long> infoIdList = infoList.stream().map(WorkTicketInfoEntity::getId).collect(Collectors.toList());
work.setTotal(infoList.size());
//工作票作废
List<WorkTicketInfoEntity> invalidList = infoList.stream().filter(w -> TicketConstants.FirstWorkTicketFlowStatusEnum.INVALID.getStatus().equals(w.getStatus()))
List<WorkTicketInfoEntity> invalidList = infoList.stream().filter(item -> "废票".equals(item.getFlowTaskName()))
.collect(Collectors.toList());
work.setInvalid(CollectionUtil.isNotEmpty(invalidList) ? invalidList.size() : 0);
// 工作票完成
List<WorkTicketInfoEntity> completeList = infoList.stream().filter(w -> TicketConstants.FirstWorkTicketFlowStatusEnum.FINISH.getStatus().equals(w.getStatus()))
// 工作票结束
List<WorkTicketInfoEntity> completeList = infoList.stream().filter(item -> "结束".equals(item.getFlowTaskName()))
.collect(Collectors.toList());
work.setComplete(CollectionUtil.isNotEmpty(completeList) ? completeList.size() : 0);
int transferTask = 0;
int delayTask = 0;
List<WorkTicketPrincipalChangeEntity> moveList = workPrincipalService.list(new LambdaQueryWrapper<WorkTicketPrincipalChangeEntity>() {{
in(WorkTicketPrincipalChangeEntity::getTicketId, infoIdList);
}});
if(CollectionUtil.isNotEmpty(moveList)){
transferTask = moveList.size();
}
List<WorkTicketDelayEntity> delayEntityList = workDelayService.list(Wrappers.<WorkTicketDelayEntity>lambdaQuery()
.in(WorkTicketDelayEntity::getTicketId, infoIdList)
);
if(CollectionUtil.isNotEmpty(delayEntityList)){
delayTask = delayEntityList.size();
}
work.setDelay(delayTask);
work.setTransfer(transferTask);
// 工作票延期总数数
List<WorkTicketInfoEntity> delayList = infoList.stream().filter(item -> "延期".equals(item.getInput()))
.collect(Collectors.toList());
work.setDelay(CollectionUtil.isNotEmpty(delayList) ? delayList.size() : 0);
// 工作票移交数
List<WorkTicketInfoEntity> changeList = infoList.stream().filter(item -> "转移".equals(item.getInput()))
.collect(Collectors.toList());
work.setTransfer(CollectionUtil.isNotEmpty(changeList) ? changeList.size() : 0);
// int transferTask = 0;
// int delayTask = 0;
// List<WorkTicketPrincipalChangeEntity> moveList = workPrincipalService.list(new LambdaQueryWrapper<WorkTicketPrincipalChangeEntity>() {{
// in(WorkTicketPrincipalChangeEntity::getTicketId, infoIdList);
// }});
// if(CollectionUtil.isNotEmpty(moveList)){
// transferTask = moveList.size();
// }
// List<WorkTicketDelayEntity> delayEntityList = workDelayService.list(Wrappers.<WorkTicketDelayEntity>lambdaQuery()
// .in(WorkTicketDelayEntity::getTicketId, infoIdList)
// );
// if(CollectionUtil.isNotEmpty(delayEntityList)){
// delayTask = delayEntityList.size();
// }
// work.setDelay(delayTask);
// work.setTransfer(transferTask);
}
return work;
}

4
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/IContentDefinitionService.java

@ -29,7 +29,9 @@ public interface IContentDefinitionService extends BaseService<ContentDefinition
LambdaQueryWrapper<ContentDefinitionEntity> 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;
}

26
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java

@ -1,17 +1,12 @@
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;
import com.hnac.hzinfo.inspect.plan.service.IPlanObjectTemplateService;
import com.hnac.hzinfo.inspect.plan.service.IPlanService;
@ -24,7 +19,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 +26,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;
@ -83,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());
}
@ -113,7 +103,15 @@ public class PlanController extends BladeController {
public R<List<Long>> addAndChecked(@Valid @RequestBody PlanVO plan) {
return R.data(planService.addAndChecked(plan));
}
/**
* 撤销
*/
@GetMapping("/revoke")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "撤销", notes = "传入plan")
public R<Boolean> revoke(@RequestParam Long planId) {
return R.data(planService.revoke(planId));
}
/**
* 删除

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/service/IPlanService.java

@ -59,4 +59,6 @@ public interface IPlanService extends BaseService<PlanEntity> {
Boolean deletePlanAndRelatives(Long id);
List<PlanOfflineVO> getPlans(List<Long> planIds);
Boolean revoke(Long planId);
}

15
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/service/impl/PlanServiceImpl.java

@ -109,6 +109,21 @@ public class PlanServiceImpl extends BaseServiceImpl<PlanMapper, PlanEntity> imp
}
/**
*巡检计划撤销
* @param planId
* @return
*/
@Override
public Boolean revoke(Long planId) {
boolean re;
LambdaUpdateWrapper<PlanEntity> uw = new UpdateWrapper<PlanEntity>().lambda();
uw.set(PlanEntity::getStatus, PlanContants.PlanStatusEnum.PLAN_SUBMIT.getStatus());
uw.eq(PlanEntity::getId, planId);
re = update(uw);
return re;
}
/**
* 保存巡检计划
*/
@Transactional(rollbackFor = Exception.class)

61
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,11 +109,11 @@ public class TaskController extends BladeController {
return R.data(detail);
}
@GetMapping("/listPage")
@PostMapping("/listPage")
@ApiOperation(value = "巡检任务分页查询-站长级", notes = "传入task")
@ApiOperationSupport(order = 1)
public R<IPage<TaskVo>> listPage(TaskDTO taskDTO, Query query) {
return R.data(taskService.page(taskDTO,query));
public R<IPage<TaskVo>> listPage(@RequestBody TaskDTO taskDTO) {
return R.data(taskService.page(taskDTO));
}
/**
@ -370,5 +375,43 @@ public class TaskController extends BladeController {
return R.data(pageList);
}
/**
* 巡检计划统计
*/
@GetMapping("/getTaskListStatistics")
@ApiOperation(value = "巡检计划统计", notes = "传入计划id")
public R<List<VoteChartVo>> getTaskListStatistics(String startTime,String endTime,Long deptId) {
if(ObjectUtil.isEmpty(AuthUtil.getUser())||ObjectUtil.isEmpty(AuthUtil.getUser().getUserId())){
return R.fail("暂无权限查看,请稍后重试");
}
List<VoteChartVo> 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<VoteChartVo> 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();
}
}
}

2
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<TaskEntity> finshList = taskList.stream().filter(o-> null != o.getStatus() && o.getStatus().equals(3)).collect(Collectors.toList());

7
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<TaskEntity> {
*/
List<TaskObjectVO> getTaskById(Long id);
IPage<TaskVo> page(TaskDTO taskDTO, Query query);
IPage<TaskVo> page(TaskDTO taskDTO);
/**
* PC端任务列表
@ -189,4 +188,6 @@ public interface ITaskService extends BaseService<TaskEntity> {
* @return
*/
BladePage<TaskVo> selectPage(Page<TaskEntity> pageInfo, TaskListQuery task);
List<VoteChartVo> getTaskListStatistics(String startTime, String endTime,Long deptId);
}

74
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<TaskMapper, TaskEntity> imp
}
@Override
public IPage<TaskVo> page(TaskDTO taskDTO, Query query) {
public IPage<TaskVo> page(TaskDTO taskDTO) {
Query query = new Query();
query.setSize(taskDTO.getSize());
query.setCurrent(taskDTO.getCurrent());
TaskEntity request = BeanUtil.copy(taskDTO,TaskEntity.class);
LambdaQueryWrapper<TaskEntity> 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<TaskEntity> records = page.getRecords();
@ -539,8 +545,13 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
.filter(Func::isNotEmpty).map(String::valueOf).collect(Collectors.joining(","));
// 获取巡检任务人员名称
String userNames = taskUserList.stream().filter(Func::isNotEmpty).map(TaskUserEntity::getUserId).filter(Func::isNotEmpty)
.map(UserCache::getUser).map(user -> Optional.ofNullable(user).map(User::getName).orElse(""))
.collect(Collectors.joining(","));
.map(userId -> {
User user = UserCache.getUser(userId);
if(ObjectUtil.isEmpty(user)){
return "";
}
return user.getName();
}).collect(Collectors.joining(","));
taskVo.setUserIds(userIds);
taskVo.setUserNames(userNames);
// 获取机器人信息
@ -954,6 +965,49 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
}
@Override
public List<VoteChartVo> getTaskListStatistics(String startTime, String endTime,Long deptId) {
List<TaskEntity> taskEntities=new ArrayList<>();
R<List<Dept>> deptByCurrentUser = sysClient.getDeptByCurrentUser();
List<Long> deptIds;
if (deptByCurrentUser.isSuccess() && CollectionUtil.isNotEmpty(deptByCurrentUser.getData())) {
deptIds = deptByCurrentUser.getData().stream().map(s -> s.getId()).collect(Collectors.toList());
} else {
throw new ServiceException("暂无机构权限");
}
QueryWrapper<TaskEntity> 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<VoteChartVo> res=new ArrayList<>();
if (CollectionUtil.isNotEmpty(taskEntities)) {
VoteChartVo all = getVoteChartVo(taskEntities);
all.setName("总计");
res.add(all);
Map<Long, List<TaskEntity>> collect = Optional.ofNullable(taskEntities).orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(TaskEntity::getCreateDept));
for (Map.Entry<Long, List<TaskEntity>> longListEntry : collect.entrySet()) {
VoteChartVo voteChartVo = getVoteChartVo(longListEntry.getValue());
R<String> deptName = sysClient.getDeptName(longListEntry.getKey());
voteChartVo.setName(deptName.isSuccess() ? deptName.getData() : "");
res.add(voteChartVo);
}
}else {
VoteChartVo all = new VoteChartVo();
all.setName("总计");
res.add(all);
}
return res;
}
/**
* 巡检任务分页
*
@ -1018,4 +1072,18 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
}
return null;
}
private VoteChartVo getVoteChartVo(List<TaskEntity> list) {
VoteChartVo voteChartVo = new VoteChartVo();
List<Long> finishIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getStatus() == 3).map(s -> s.getId()).collect(Collectors.toList());
List<Long> 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;
}
}

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

1
hzims-service/message/pom.xml

@ -88,6 +88,7 @@
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-system-api</artifactId>
<version>5.0.2-SNAPSHOT</version>
</dependency>
<!-- blade-api end -->

8
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)

12
hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java

@ -394,19 +394,15 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
@Override
public Boolean sendWxMessageByUser(WxMessageDTO message,List<MessagePushRecordEntity> records) {
Map<String,Object> 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.<MessagePushRecordEntity>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;
}

62
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<String, Object> 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<WxPushFeignVO> result = wxPushClient.sendPushTemplateByUserId(template);
return result.isSuccess();
}
}

1
hzims-service/operational/pom.xml

@ -139,7 +139,6 @@
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-user-api</artifactId>
<version>5.0.1.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-collections4 -->
<dependency>

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

69
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;
/**
@ -79,6 +87,7 @@ public class OperAccessTaskController extends BladeController {
return service.detail(id);
}
/**
* 分页
*/
@ -92,7 +101,22 @@ public class OperAccessTaskController extends BladeController {
public R<IPage<OperAccessTaskVO>> 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<IPage<OperAccessTaskVO>> list(@RequestBody OperAccessTaskDTO req) {
Query query=new Query();
query.setCurrent(req.getCurrent());
query.setSize(req.getSize());
return service.listByStatus(req, query);
}
/**
* 获取检修台账
@ -104,4 +128,47 @@ public class OperAccessTaskController extends BladeController {
public R<List<RepairBillVO>> getAccessTaskByEmCode(String emCode, String startTime, String endTime) {
return R.data(service.getRepairBill(emCode, startTime, endTime));
}
/**
* 检修计划统计
*/
@GetMapping("/getAccessListStatistics")
@ApiOperation(value = "检修计划统计", notes = "传入时间")
public R<List<VoteChartVo>> getAccessListStatistics(String startTime, String endTime,Long deptId) {
if(ObjectUtil.isEmpty(AuthUtil.getUser())||ObjectUtil.isEmpty(AuthUtil.getUser().getUserId())){
return R.fail("暂无权限查看,请稍后重试");
}
List<VoteChartVo> 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<VoteChartVo> 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();
}
}
}

3
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<Long> deptIds;
@ApiModelProperty(value = "id集合")
private List<Long> ids;
/**
* 月份
*/

7
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<Long> deptIds;
@ApiModelProperty(value = "ids")
private List<Long> 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;
}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.java

@ -28,6 +28,9 @@ public interface OperAccessTaskMapper extends UserDataScopeBaseMapper<OperAccess
@UserDataAuth
List<OperAccessTaskVO> pageCondition(IPage page, @Param("req") OperAccessTaskDTO req);
List<OperAccessTaskVO> pageConditionByStatus(IPage page, @Param("req") OperAccessTaskDTO req);
List<OperAccessTaskEntity> selectByEmCode(String emCode,List<String> list);
@SqlParser(filter = true)

44
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml

@ -65,6 +65,7 @@
<if test="req.code != null and req.code != ''">
AND t.`CODE` LIKE CONCAT('%',#{req.code},'%')
</if>
<if test="req.handler != null">
AND t.`HANDLER`=#{req.handler}
</if>
@ -91,7 +92,48 @@
</if>
ORDER BY t.create_time DESC
</select>
<select id="pageConditionByStatus" resultType="com.hnac.hzims.operational.access.vo.OperAccessTaskVO">
SELECT t.*,p.name as planName
FROM hzims_oper_access_task t
left join hzims_oper_access_plan p
on t.plan_id = p.id
WHERE
t.IS_DELETED =0
<if test="req.code != null and req.code != ''">
AND t.`CODE` LIKE CONCAT('%',#{req.code},'%')
</if>
<if test="req.ids != null">
AND t.id in
<foreach collection="req.ids" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="req.handler != null">
AND t.`HANDLER`=#{req.handler}
</if>
<if test="req.planId != null">
AND p.ID =#{req.planId}
</if>
<if test="req.name != null and req.name != ''">
AND t.`NAME` LIKE CONCAT('%',#{req.name},'%')
</if>
<if test="req.excludeNullTicket != null and req.excludeNullTicket == 1">
and t.`TICKET_ID` is null
</if>
<if test="req.startTime != null and req.startTime != ''">
and t.`PLAN_START_TIME` &gt; #{req.startTime}
</if>
<if test="req.endTime != null and req.startTime != '' ">
and t.`PLAN_START_TIME` &lt; #{req.endTime}
</if>
<if test="req.deptIds != null">
and t.create_dept in
<foreach collection="req.deptIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
ORDER BY t.create_time DESC
</select>
<select id="selectByEmCode" resultType="com.hnac.hzims.operational.access.entity.OperAccessTaskEntity" parameterType="list">
select * from hzims_oper_access_task
where IS_DELETED = 0

6
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;
@ -34,6 +33,7 @@ public interface IOperAccessTaskService extends BaseService<OperAccessTaskEntity
R<OperAccessTaskVO> detail(Long id);
R<IPage<OperAccessTaskVO>> list(OperAccessTaskDTO req, Query query);
R<IPage<OperAccessTaskVO>> listByStatus(OperAccessTaskDTO req, Query query);
List<OperAccessTaskEntity> getByEmCode(String emCode,List<String> list);
@ -76,4 +76,6 @@ public interface IOperAccessTaskService extends BaseService<OperAccessTaskEntity
IPage<OperAccessTaskEntity> selectPage(Page<OperAccessTaskEntity> dbPage, OperAccessTaskEntity result);
List<RepairBillVO> getRepairBill(String emCode, String startTime, String endTime);
List<VoteChartVo> getAccessListStatistics(String startTime, String endTime,Long deptId);
}

72
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<OperAccessTaskMap
private final IMessagePushClient messagePushClient;
private final OperPhenomenonMapper operPhenomenonMapper;
private final IUserClient userClient;
private final ISysClient sysClient;
private final ISpareClient assetsClient;
private final IOperAccessMaterialService materialService;
private final IOperDefectService defectService;
@ -222,6 +228,14 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
}
@Override
public R<IPage<OperAccessTaskVO>> listByStatus(OperAccessTaskDTO req, Query query) {
IPage<OperAccessTaskVO> page = Condition.getPage(query);
List<OperAccessTaskVO> data = mapper.pageConditionByStatus(page, req);
page.setRecords(OperAccessTaskWrapper.build().listVOExtras(data));
return R.data(page);
}
@Override
public List<OperAccessTaskEntity> getByEmCode(String emCode, List<String> list) {
return this.baseMapper.selectByEmCode(emCode, list);
}
@ -419,6 +433,64 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
return repairBillList;
}
@Override
public List<VoteChartVo> getAccessListStatistics(String startTime, String endTime,Long deptId) {
List<OperAccessTaskEntity> operAccessTaskEntityList;
R<List<Dept>> deptByCurrentUser = sysClient.getDeptByCurrentUser();
List<Long> deptIds;
if (deptByCurrentUser.isSuccess()&&CollectionUtil.isNotEmpty(deptByCurrentUser.getData())) {
deptIds = deptByCurrentUser.getData().stream().map(s -> s.getId()).collect(Collectors.toList());
}else {
throw new ServiceException("暂无机构权限");
}
QueryWrapper<OperAccessTaskEntity> 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<VoteChartVo> res=new ArrayList<>();
if (CollectionUtil.isNotEmpty(operAccessTaskEntityList)) {
VoteChartVo all = getVoteChartVo(operAccessTaskEntityList);
all.setName("总计");
res.add(all);
Map<Long, List<OperAccessTaskEntity>> collect = Optional.ofNullable(operAccessTaskEntityList).orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(OperAccessTaskEntity::getCreateDept));
for (Map.Entry<Long, List<OperAccessTaskEntity>> longListEntry : collect.entrySet()) {
VoteChartVo voteChartVo = getVoteChartVo(longListEntry.getValue());
R<String> deptName = sysClient.getDeptName(longListEntry.getKey());
voteChartVo.setName(deptName.isSuccess() ? deptName.getData() : "");
res.add(voteChartVo);
}
}else {
VoteChartVo all = new VoteChartVo();
all.setName("总计");
res.add(all);
}
return res;
}
private VoteChartVo getVoteChartVo(List<OperAccessTaskEntity> list) {
VoteChartVo voteChartVo = new VoteChartVo();
List<Long> finishIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getStatus() == 4).map(s -> s.getId()).collect(Collectors.toList());
List<Long> 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

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.java

@ -20,5 +20,5 @@ public interface AlarmHandleMapper extends UserDataScopeBaseMapper<AlarmHandleEn
@UserDataAuth
IPage<AlarmHandleVo> selectHandlePage(IPage<Object> page,@Param("param") HandleQueryVo param);
List<AlarmHandleEntity> handles(@Param("types") List<Long> types,@Param("alarm") Integer alarm,@Param("start") String start,@Param("end") String end);
List<AlarmHandleEntity> handles(@Param("types") List<Long> types,@Param("start") String start,@Param("end") String end);
}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.xml

@ -51,9 +51,6 @@
<if test="start != null and end != null">
and handler.create_time between #{start} and #{end}
</if>
<if test="alarm != null">
and type = #{alarm}
</if>
and (detail.DELAY_TIME &gt; #{end} or detail.DELAY_TIME is null)
</where>
</select>

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java

@ -151,9 +151,13 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl<AlarmHandleMapper, A
* @return
*/
@Override
public List<AlarmHandleEntity> handles(List<Long> types,Integer alarm) {
public List<AlarmHandleEntity> handles(List<Long> 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);
}
}

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/DeviceDataController.java

@ -42,4 +42,11 @@ public class DeviceDataController {
public R<HzPage<AnalyzeDataList>> history(AnalyzeDataCondition analyzeDataCondition) {
return service.history(analyzeDataCondition);
}
@ApiOperation("微信消息推送测试")
@PostMapping("/sendWxMessage")
@ApiOperationSupport(order = 1)
public R sendWxMessage() {
return service.sendWxMessage();
}
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/DeviceDataService.java

@ -19,4 +19,6 @@ public interface DeviceDataService {
R<List<FieldsData>> real(RealDataSearchPO search);
R<HzPage<AnalyzeDataList>> history(AnalyzeDataCondition analyzeDataCondition);
R sendWxMessage();
}

49
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<HzPage<AnalyzeDataList>> 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<String,Object> 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);
}
}

4
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);
}
/**

15
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;
@ -24,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;
@ -739,10 +741,17 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl<StAlarmRecordMapper
if(CollectionUtil.isEmpty(list)){
return null;
}
log.error("fault_list_stations: {}",stations);
log.error("fault_list_list: {}",list);
// 过滤已处理预警信息
List<AlarmHandleEntity> handles = handleService.handles(Collections.singletonList(AbnormalAlarmConstant.EARLY_WARNING),AbnormalAlarmConstant.INTELLIGENCE_ALARM);
Map<String,String> 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())));
}
}).sorted(Comparator.comparing((FaultVo::getIsHandle)).reversed().thenComparing(FaultVo::getCreateTime).reversed()).collect(Collectors.toList());
}

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

12
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<IPage<OperDefectStatisticsVO>> list( OperDefectStatisticsVO entity, Query query) {
public R<IPage<OperDefectStatisticsVO>> list(@RequestBody OperDefectStatisticsVO entity) {
Query query=new Query();
query.setCurrent(entity.getCurrent());
query.setSize(entity.getSize());
LambdaQueryWrapper<OperDefectStatisticsEntity> queryWrapper = statisticsService.getQueryWrapper(entity);
IPage<OperDefectStatisticsEntity> pages = statisticsService.page(Condition.getPage(query), queryWrapper);
IPage<OperDefectStatisticsVO> vos = OperDefectStatisticsWrapper.build().pageVO(pages);

50
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<FdpTaskEntity> getFdpTaskByDefectCode(@RequestParam("defectCode") String defectCode) {
return R.data(phenomenonService.getFdpTaskByDefectCode(defectCode));
}
/**
* 缺陷记录统计
*/
@GetMapping("/getDefectListStatistics")
@ApiOperation(value = "缺陷记录统计", notes = "传入时间")
public R<List<CheckVoteChartVo>> getDefectListStatistics(String startTime, String endTime, Long deptId) {
if(ObjectUtil.isEmpty(AuthUtil.getUser())||ObjectUtil.isEmpty(AuthUtil.getUser().getUserId())){
return R.fail("暂无权限查看,请稍后重试");
}
List<CheckVoteChartVo> 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<CheckVoteChartVo> 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();
}
}
}

6
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<OperPhenomenonEntity
* @return
*/
boolean updatePhenomenonHandleStatus(OperPhenomenonEntity phenomenon);
List<CheckVoteChartVo> getDefectListStatistics(String startTime, String endTime, Long deptId);
}

7
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<OperPhenomenonMapper
private final IOperDefectStatisticsService statisticsService;
private final ISysClient sysClient;
private final IUserClient userClient;
private final IFlowClient processClient;
@ -147,7 +144,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
operAppearanceService.save(operAppearanceEntity);
// 现象发起人名字
String userName = Optional.ofNullable(UserCache.getUser(entity.getFinder()).getName()).orElse("");
String userName = Optional.ofNullable(AuthUtil.getUserName()).orElse("");
// 现象发起来源
String sourceName = DictCache.getValue(TreatMethodConstant.SOURCE_CODE_PREFIX, entity.getSourceCode());
// 流程名称

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectStatisticsServiceImpl.java

@ -41,6 +41,9 @@ public class OperDefectStatisticsServiceImpl extends BaseServiceImpl<OperDefectS
public LambdaQueryWrapper<OperDefectStatisticsEntity> getQueryWrapper(OperDefectStatisticsVO statistics) {
LambdaQueryWrapper<OperDefectStatisticsEntity> 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());
}

75
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<OperPhenomenonMapper, OperPhenomenonEntity> implements IOperPhenomenonService,GenerateCode{
@Autowired
private ISysClient sysClient;
@Autowired
private IFlowClient flowClient;
@Autowired
@ -546,8 +547,7 @@ public class OperPhenomenonServiceImpl extends BaseServiceImpl<OperPhenomenonMap
defectVO.setTotalIds(operPhenomenonList.stream().map(o->String.valueOf(o.getId())).collect(Collectors.joining(",")));
defectVO.setDefectSum(operPhenomenonList.size());
// 消缺数
List<Long> defectList = operPhenomenonList.stream().filter(o -> (Func.isNotEmpty(o.getIsDefect()) && o.getIsDefect() == 0) || "1".equals(o.getConclusionStatus())).
map(OperPhenomenonEntity::getId).collect(Collectors.toList());
List<Long> defectList = operPhenomenonList.stream().filter(defect -> !ObjectUtil.isEmpty(defect.getHandleTaskId())).map(OperPhenomenonEntity::getId).collect(Collectors.toList());
if(CollectionUtil.isEmpty(defectList)){
defectVO.setDefect(0);
return defectVO;
@ -582,4 +582,65 @@ public class OperPhenomenonServiceImpl extends BaseServiceImpl<OperPhenomenonMap
.eq(OperPhenomenonEntity::getId,phenomenon.getId())
);
}
@Override
public List<CheckVoteChartVo> getDefectListStatistics(String startTime, String endTime, Long deptId) {
List<OperPhenomenonEntity> operPhenomenonEntities;
R<List<Dept>> deptByCurrentUser = sysClient.getDeptByCurrentUser();
List<Long> deptIds;
if (deptByCurrentUser.isSuccess() && CollectionUtil.isNotEmpty(deptByCurrentUser.getData())) {
deptIds = deptByCurrentUser.getData().stream().map(s -> s.getId()).collect(Collectors.toList());
} else {
throw new ServiceException("暂无机构权限");
}
QueryWrapper<OperPhenomenonEntity> 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<CheckVoteChartVo> res = new ArrayList<>();
if (CollectionUtil.isNotEmpty(operPhenomenonEntities)) {
CheckVoteChartVo all = getCheckVoteChartVo(operPhenomenonEntities);
all.setName("总计");
res.add(all);
Map<Long, List<OperPhenomenonEntity>> collect = Optional.ofNullable(operPhenomenonEntities).orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(OperPhenomenonEntity::getCreateDept));
for (Map.Entry<Long, List<OperPhenomenonEntity>> longListEntry : collect.entrySet()) {
CheckVoteChartVo chartVo= getCheckVoteChartVo(longListEntry.getValue());
R<String> 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<OperPhenomenonEntity> list) {
CheckVoteChartVo voteChartVo = new CheckVoteChartVo();
List<String> 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<String> 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<String> 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.getDefectCode()).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;
}
}

31
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<OperDefectSta
User updateUser = UserCache.getUser(entity.getUpdateUser());
vo.setCreateUserName(createUser == null ? "" : createUser.getName());
vo.setUpdateUserName(updateUser == null ? "" : updateUser.getName());
User userC = UserCache.getUser(entity.getConclusionPeople());
vo.setConclusionPeopleName(userC == null ? "" : userC.getName());
User userF = UserCache.getUser(entity.getFinder());
vo.setFinderName(userF == null ? "" : userF.getName());
User userD = UserCache.getUser(entity.getDiscriminator());
vo.setDiscriminatorName(userD == null ? "" : userD.getName());
User userHn = UserCache.getUser(entity.getHandler());
vo.setHandlerName(userHn == null ? "" : userHn.getName());
if (Func.isNotEmpty(entity.getConclusionPeople())) {
User userC = UserCache.getUser(entity.getConclusionPeople());
vo.setConclusionPeopleName(userC == null ? "" : userC.getName());
}
if (Func.isNotEmpty(entity.getFinder())) {
User userF = UserCache.getUser(entity.getFinder());
vo.setFinderName(userF == null ? "" : userF.getName());
}
if (Func.isNotEmpty(entity.getDiscriminator())) {
User userD = UserCache.getUser(entity.getDiscriminator());
vo.setDiscriminatorName(userD == null ? "" : userD.getName());
}
if (Func.isNotEmpty(entity.getHandler())) {
User userHn = UserCache.getUser(entity.getHandler());
vo.setHandlerName(userHn == null ? "" : userHn.getName());
}
// 赋值消缺处理人名称
vo.setPlanHandlerName(Optional.ofNullable(entity.getPlanHandler()).map(Long::parseLong).map(UserCache::getUser).map(User::getName).orElse(entity.getPlanHandler()));
// 赋值两票工作负责人名称

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

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsAnalyseExampleServiceImpl.java

@ -65,6 +65,9 @@ public class ImsAnalyseExampleServiceImpl extends BaseServiceImpl<ImsAnalyseExam
public R queryAnalyseExampleData(AnalyzeDataCondition analyzeDataCondition) {
//设备ID:分析实例编码
R<HzPage<AnalyzeDataList>> analyzeDataByAnalyzeCode = searchClient.getAnalyzeDataByAnalyzeCode(analyzeDataCondition);
if(!analyzeDataByAnalyzeCode.isSuccess()) {
throw new ServiceException("设备数据查询异常,请检查好配置后重试!");
}
return analyzeDataByAnalyzeCode;
}
@ -131,6 +134,9 @@ public class ImsAnalyseExampleServiceImpl extends BaseServiceImpl<ImsAnalyseExam
public void outPutAnalyseExampleData(HttpServletResponse response, AnalyzeDataCondition analyzeDataCondition) {
try {
R analyseExampleData =queryAnalyseExampleData(analyzeDataCondition);
if(!analyseExampleData.isSuccess()) {
throw new ServiceException("设备数据查询异常,请检查好配置后重试!");
}
String name="值班日志";
if(ObjectUtils.isEmpty(analyzeDataCondition.getBeginTime())){
String format = DateUtil.format(analyzeDataCondition.getBeginTime(), DateUtil.PATTERN_DATE);

9
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java

@ -1409,6 +1409,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
// 获取部门所有没有分组的组员
LambdaQueryWrapper<ImsDutyMainPersonEntity> personWrapper = new LambdaQueryWrapper();
personWrapper.eq(ImsDutyMainPersonEntity::getCreateDept, deptId);
personWrapper.like(ImsDutyMainPersonEntity::getDutyDate, yearAndMonth);
List<ImsDutyMainPersonEntity> deptPersonList = imsDutyMainPersonMapper.selectList(personWrapper);
// 获取本月天数
@ -1438,13 +1439,15 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
List<ImsDutyGroupPEntity> 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<ImsDutyMainPersonEntity> 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 = "";

27
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();
}
}
}
}

16
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<OperDefectEntity> list = defectService.list(new LambdaQueryWrapper<OperDefectEntity>() {{
gt(OperDefectEntity::getCreateTime, startTime);
le(OperDefectEntity::getCreateTime, endTime);
List<OperPhenomenonEntity> list = operPhenomenonService.list(new LambdaQueryWrapper<OperPhenomenonEntity>() {{
ge(OperPhenomenonEntity::getCreateTime, startTime);
le(OperPhenomenonEntity::getCreateTime, endTime);
}});
if (CollectionUtil.isEmpty(list)) {
return R.data(new HashMap<>());
}
//按照日期将查询结果分类
Map<String, List<OperDefectEntity>> map = list.stream().collect(Collectors.groupingBy(o -> DateUtil.formatDate(o.getCreateTime())));
Map<String, List<OperPhenomenonEntity>> map = list.stream().collect(Collectors.groupingBy(o -> DateUtil.formatDate(o.getCreateTime())));
Map<String, DefectReportVO> data = new TreeMap<>();
Date date = DateUtil.plusDays(startTime, 0);
do {

9
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/MainWorkBenchController.java

@ -87,12 +87,19 @@ public class MainWorkBenchController extends BladeController {
* 根据用户权限获取路由
*
* @return
*/
@ApiLog
@ApiOperationSupport(order = 50)
@ApiOperation("获取路由")
@PostMapping("/getHomePageWorkBench")
public R<InDustryVo> getHomePageWorkBench(@Valid @RequestBody RoutingParamVo vo) {
return R.data(workBenchService.getHomePageWorkBench(vo));
}*/
@ApiLog
@ApiOperationSupport(order = 60)
@ApiOperation("首页工作台路由")
@PostMapping("/getHomePageWorkBench")
public R<InDustryVo> homeStagingRoute(@Valid @RequestBody RoutingParamVo vo) {
return R.data(workBenchService.route(vo));
}
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/MainWorkBenchMapper.java

@ -26,4 +26,6 @@ public interface MainWorkBenchMapper extends UserDataScopeBaseMapper<MainWorkBen
@Param("stationTypes") List<Integer> stationTypes,List<Long> deptList,@Param("excludeDept") Long excludeDept,@Param("ascriptionUser") Long ascriptionUser);
List<MainWorkBenchEntity> selectMainWorkBenchByTypes(@Param(value = "type") String type,@Param(value = "refDomains") List<Integer> refDomains,@Param("refTerminal") String refTerminal,@Param("stationTypes") List<Integer> stationTypes);
List<MainWorkBenchEntity> stagingRoute(@Param("terminal") String terminal,@Param("types") List<Integer> types,@Param("category") int category);
}

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/MainWorkBenchMapper.xml

@ -94,5 +94,15 @@
order by ord
</select>
<select id="stagingRoute" resultType="com.hnac.hzims.operational.main.entity.MainWorkBenchEntity">
SELECT * FROM HZIMS_MAIN_WORK_BENCH
WHERE IS_DELETED = 0
AND REF_TERMINAL = #{terminal}
AND TYPE = #{category}
AND ENABLE_FLAG = 1
AND STATION_TYPE IN
<foreach collection="types" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
</mapper>

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IMainWorkBenchService.java

@ -38,4 +38,5 @@ public interface IMainWorkBenchService extends BaseService<MainWorkBenchEntity>
InDustryVo getHomePageWorkBench(RoutingParamVo vo);
InDustryVo route(RoutingParamVo vo);
}

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

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java

@ -491,10 +491,12 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
ticketChartCell.setTicketName(value.getFileName());
if (value.getTicketType() == 2) {
List<WorkTicketInfoEntity> yearTicketCollect = Optional.ofNullable(yearTicket.getData()).orElse(new ArrayList<>()).stream()
.filter(s -> s.getSignageCode() != null)
.filter(s -> stationId.equals(s.getSignageCode()))
.filter(s -> s.getType().equals(value.getType())).collect(Collectors.toList());
List<WorkTicketInfoEntity> monthTicketCollect = Optional.ofNullable(monthTicket.getData()).orElse(new ArrayList<>()).stream()
.filter(s -> s.getSignageCode().equals(stationId))
.filter(s -> s.getSignageCode() != null)
.filter(s -> stationId.equals(s.getSignageCode()))
.filter(s -> s.getType().equals(value.getType())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(yearTicketCollect)) {
//年合格率和数量
@ -521,10 +523,12 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
}
if (value.getTicketType() == 1) {
List<StandardTicketInfoEntity> yearOperateCollect = Optional.ofNullable(yearOperateTicket.getData()).orElse(new ArrayList<>()).stream()
.filter(s -> s.getSignageCode() != null)
.filter(s -> stationId.equals(s.getSignageCode()))
.filter(s -> s.getTicketType().equals(value.getType())).collect(Collectors.toList());
List<StandardTicketInfoEntity> monthOperateCollect = Optional.ofNullable(monthOperateTicket.getData()).orElse(new ArrayList<>()).stream()
.filter(s -> s.getSignageCode().equals(stationId))
.filter(s -> s.getSignageCode() != null)
.filter(s -> stationId.equals(s.getSignageCode()))
.filter(s -> s.getTicketType().equals(value.getType())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(yearOperateCollect)) {
//年合格率和数量
@ -590,8 +594,8 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
ticketMap2.put("info", "合格率");
ticketMap.put("ticketMon" + ticketType, String.valueOf(chartCell.getTicketMon()));
ticketMap.put("ticketYear" + ticketType, String.valueOf(chartCell.getTicketYear()));
ticketMap2.put("ticketMon" + ticketType, chartCell.getTicketMonPerc()* 100 + "%");
ticketMap2.put("ticketYear" + ticketType, chartCell.getTicketYeaPercr()* 100 + "%");
ticketMap2.put("ticketMon" + ticketType, new BigDecimal(chartCell.getTicketMonPerc()).multiply(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue() + "%");
ticketMap2.put("ticketYear" + ticketType,new BigDecimal(chartCell.getTicketYeaPercr()).multiply(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue()+ "%");
}
ticketListRes.add(ticketMap);
ticketListRes.add(ticketMap2);

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java

@ -474,6 +474,7 @@ public class HomeServiceImpl implements HomeService {
e.printStackTrace();
Thread.currentThread().interrupt();
}
exe.shutdown();
return target;
}

78
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;
@ -64,6 +65,9 @@ public class MainWorkBenchServiceImpl extends BaseServiceImpl<MainWorkBenchMappe
if (StringUtils.isNotEmpty(req.getRefTerminal())) {
eq(MainWorkBenchEntity::getRefTerminal, req.getRefTerminal());
}
if (StringUtils.isNotEmpty(req.getRefDept())) {
like(MainWorkBenchEntity::getRefDept, "%".concat(req.getRefDept()).concat("%"));
}
}}.orderByAsc(MainWorkBenchEntity::getType).orderByAsc(MainWorkBenchEntity::getOrd);
IPage<MainWorkBenchEntity> pages = super.page(Condition.getPage(query), lambdaQueryWrapper);
IPage<MainWorkBenchVO> vos = MainWorkBenchWrapper.builder().pageVO(pages);
@ -173,7 +177,7 @@ public class MainWorkBenchServiceImpl extends BaseServiceImpl<MainWorkBenchMappe
// 当前用户
BladeUser user = AuthUtil.getUser();
// 查询路由列表
List<MainWorkBenchEntity> list = this.baseMapper.selectMainWorkBenchByType(deptCategory.toString(), null, vo.getRefTerminal(), stations.stream().map(StationEntity::getType).collect(Collectors.toList()), deptList,dept.getId(),user.getUserId());
List<MainWorkBenchEntity> 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){
@ -184,4 +188,76 @@ public class MainWorkBenchServiceImpl extends BaseServiceImpl<MainWorkBenchMappe
inDustryVo.setMainWorkBenchExtendVo(mainWorkBenchExtendVo);
return inDustryVo;
}
/**
* 首页工作台
* 过滤台条件 : 终端: WEB/APP 站点类型首页分类: 集团/区域/站点 所属机构指定用户
* 后续考虑 : 排除机构
* @param param
* @return InDustryVo
*/
@Override
public InDustryVo route(RoutingParamVo param) {
// 终端
String terminal = param.getRefTerminal();
// 站点分类
List<StationEntity> stations = stationService.list();
if(CollectionUtil.isEmpty(stations)){
return new InDustryVo();
}
List<Integer> types = stations.stream().map(StationEntity::getType).distinct().collect(Collectors.toList());
// 用户权限机构
R<List<Dept>> result = sysClient.getDeptByCurrentUser();
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return new InDustryVo();
}
// 首页分类
int category = this.userCategory(result.getData());
List<MainWorkBenchEntity> routes = this.baseMapper.stagingRoute(terminal,types,category);
if(CollectionUtil.isEmpty(routes)){
return new InDustryVo();
}
// 所属机构
List<String> 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<Dept> depts) {
Dept dept = depts.stream().min(Comparator.comparing(Dept::getDeptCategory)).get();
if(ObjectUtil.isEmpty(dept)){
return HomePageConstant.STATION;
}
return dept.getDeptCategory();
}
}

67
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<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req, Query query) {
return taskService.list(req, query);
public R<IPage<OperMaintenanceTaskVO>> 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<List<VoteChartVo>> getMaintenanceListStatistics(String startTime, String endTime,Long deptId) {
if(ObjectUtil.isEmpty(AuthUtil.getUser())||ObjectUtil.isEmpty(AuthUtil.getUser().getUserId())){
return R.fail("暂无权限查看,请稍后重试");
}
List<VoteChartVo> 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<VoteChartVo> 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();
}
}
}

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java

@ -94,7 +94,7 @@ public class MaintenanceTaskCreateTask {
//生成日常巡检任务并插入数据库
for (int i = startIndex; i < endIndex; i++) {
this.generateTaskByPlan(planEntities.get(i));
this.generateTaskByPlan(planEntities.get(i),true);
}
Thread.sleep(1000);
@ -110,18 +110,18 @@ public class MaintenanceTaskCreateTask {
* @param planEntity
* @return
*/
public void generateTaskByPlan(OperMaintenancePlanEntity planEntity) {
public void generateTaskByPlan(OperMaintenancePlanEntity planEntity,Boolean flag) {
OperMaintenanceTaskEntity taskEntity = BeanUtil.copy(planEntity,OperMaintenanceTaskEntity.class);
//拆分设备 每个设备生成一条任务
if(StringUtil.isNotBlank(planEntity.getEmCode())){
List<String> 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);
}
}

7
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<OperMaintenance
R<OperMaintenanceTaskEntity> detail(@RequestParam Long id);
R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req, Query query);
R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req);
String genTaskCode(Integer num);
@ -96,4 +96,5 @@ public interface IOperMaintenanceTaskService extends BaseService<OperMaintenance
IPage<MaintenanceTaskVo> queryLogMaintenancePageList(Page<OperMaintenanceTaskEntity> pageParam, MaintenanceTaskWithAreaVo areaMonthlyVo);
List<VoteChartVo> getMaintenanceListStatistics(String startTime, String endTime,Long deptId);
}

2
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);
}

47
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,13 +268,13 @@ public class MaintenanceServiceImpl implements MaintenanceService {
//拆分设备 每个设备生成一条任务
if (StringUtil.isNotBlank(finalPlanEntity.getEmCode())) {
log.info("finalPlanEntity.getEmCode() : {}", finalPlanEntity.getEmCode());
List<String> emCodeList = Arrays.asList(finalPlanEntity.getEmCode().split(","));
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);
}
}
@ -291,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);
@ -327,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<Void> operMaintenanceTaskEntityCompletableFuture =
CompletableFuture.runAsync(() -> {
@ -354,28 +349,36 @@ 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<String, Object> params = new HashMap<>();
params.put("taskId", taskEntity.getId());
List<String> 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);
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(userArr[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<MessageTemplateEntity> templateR = messageClient.getMsgTemplateById(taskEntity.getMessageTemplateId());

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenancePlanServiceImpl.java

@ -108,7 +108,7 @@ public class OperMaintenancePlanServiceImpl extends BaseServiceImpl<OperMaintena
MaintenanceTaskCreateTask schedule = SpringUtil.getBean(MaintenanceTaskCreateTask.class);
finalPlanEntities.forEach(planEntity -> {
try{
schedule.generateTaskByPlan(planEntity);
schedule.generateTaskByPlan(planEntity,false);
//更新任务派发时间
this.update(new LambdaUpdateWrapper<OperMaintenancePlanEntity>().set(OperMaintenancePlanEntity::getCreateTaskTime,new Date())
.eq(OperMaintenancePlanEntity::getId,planEntity.getId()));

73
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<OperMaintena
private final IFlowClient flowClient;
private final IUserClient userClient;
private final ISysClient sysClient;
@Override
public R doSave(OperMaintenanceTaskDTO req) {
req.setTaskCode(this.genTaskCode(RandomUtils.nextInt(0, 999)));
@ -85,12 +91,18 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
}
@Override
public R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req, Query query) {
public R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req) {
Query query=new Query();
query.setSize(req.getSize());
query.setCurrent(req.getCurrent());
Wrapper<OperMaintenanceTaskEntity> queryWrapper = new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{
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<OperMaintena
}
if (StringUtil.isNoneBlank(req.getFlowTaskName())) {
eq(OperMaintenanceTaskEntity::getFlowTaskName,req.getFlowTaskName());
eq(OperMaintenanceTaskEntity::getFlowTaskName, req.getFlowTaskName());
}
}};
@ -389,4 +401,61 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
}
return null;
}
@Override
public List<VoteChartVo> getMaintenanceListStatistics(String startTime, String endTime,Long deptId) {
List<OperMaintenanceTaskEntity> maintenanceTaskEntities = new ArrayList<>();
R<List<Dept>> deptByCurrentUser = sysClient.getDeptByCurrentUser();
List<Long> deptIds;
if (deptByCurrentUser.isSuccess() && CollectionUtil.isNotEmpty(deptByCurrentUser.getData())) {
deptIds = deptByCurrentUser.getData().stream().map(s -> s.getId()).collect(Collectors.toList());
} else {
throw new ServiceException("暂无机构权限");
}
QueryWrapper<OperMaintenanceTaskEntity> 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<VoteChartVo> res = new ArrayList<>();
if (CollectionUtil.isNotEmpty(maintenanceTaskEntities)) {
VoteChartVo all = getVoteChartVo(maintenanceTaskEntities);
all.setName("总计");
res.add(all);
Map<Long, List<OperMaintenanceTaskEntity>> collect = Optional.ofNullable(maintenanceTaskEntities).orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getCreateDept));
for (Map.Entry<Long, List<OperMaintenanceTaskEntity>> longListEntry : collect.entrySet()) {
VoteChartVo voteChartVo = getVoteChartVo(longListEntry.getValue());
R<String> deptName = sysClient.getDeptName(longListEntry.getKey());
voteChartVo.setName(deptName.isSuccess() ? deptName.getData() : "");
res.add(voteChartVo);
}
} else {
VoteChartVo all = new VoteChartVo();
all.setName("总计");
res.add(all);
}
return res;
}
private VoteChartVo getVoteChartVo(List<OperMaintenanceTaskEntity> list) {
VoteChartVo voteChartVo = new VoteChartVo();
List<Long> finishIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getStatus() == 3).map(s -> s.getId()).collect(Collectors.toList());
List<Long> 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;
}
}

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

@ -450,7 +450,6 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
@Override
public List<StationEntity> getStationType(Integer serveType, List<Integer> typeList, List<Long> departIdList,boolean make) {
return this.list(new LambdaQueryWrapper<StationEntity>() {{
eq(StationEntity::getIsDeleted, 0);
if (ObjectUtil.isNotEmpty(serveType)) {
eq(StationEntity::getServeType, serveType);
}

6
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java

@ -28,16 +28,14 @@ import com.hnac.hzims.ticket.standardTicket.vo.OperateTicketStatisticVO;
import com.hnac.hzims.ticket.standardTicket.vo.StandardTicketInfoVO;
import com.hnac.hzims.ticket.standardTicket.vo.StandardTicketMeasureVO;
import com.hnac.hzims.ticket.standardTicket.wrapper.StandardTicketInfoWrapper;
import com.hnac.hzims.ticket.twoTicket.vo.ticket.StandardTicketCountQueryVo;
import com.hnac.hzims.ticket.twoTicket.vo.ticket.TicketCountQueryVo;
import com.hnac.hzims.ticket.twoTicket.vo.operation.StandardTicketInfoVo;
import com.hnac.hzims.ticket.twoTicket.vo.operation.StandardTicketMeasureVo;
import com.hnac.hzims.ticket.twoTicket.vo.ticket.StandardTicketCountQueryVo;
import com.hnac.hzims.ticket.utils.ExcelUtil;
import com.hnac.hzims.ticket.utils.PdfUtils;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService;
import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO;
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketInfoVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@ -680,7 +678,7 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
List<OperateTicketStatisticVO> operateTicketReportStatistic = this.baseMapper.getOperateTicketReportStatistic(startDate, endDate, deptIdList);
if (CollectionUtil.isNotEmpty(operateTicketReportStatistic)) {
//已完成数量
int ticketInfoCompleteNum = operateTicketReportStatistic.stream().filter(ticket -> TicketConstants.StandardTicketStatusEnum.END.getStatus().equals(ticket.getStatus())).collect(Collectors.toList()).size();
int ticketInfoCompleteNum = operateTicketReportStatistic.stream().filter(item -> "结束".equals(item.getFlowTaskName())).collect(Collectors.toList()).size();
//合格数量
int ticketInfoQualifiedNum = operateTicketReportStatistic.stream().filter(ticket -> Func.isNotEmpty(ticket.getEvaluation()) && 1 == ticket.getEvaluation().intValue()).collect(Collectors.toList()).size();
//计算合格率

9
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java

@ -47,7 +47,6 @@ import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
@ -58,7 +57,6 @@ import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
@ -885,13 +883,12 @@ public class FirstWorkTicketServiceImpl extends BaseServiceImpl<WorkTicketInfoMa
List<WorkTicketReportStatisticVO> workTicketReportStatistic = this.baseMapper.getWorkTicketReportStatistic(startDate, endDate, deptIdList);
if(CollectionUtil.isNotEmpty(workTicketReportStatistic)) {
// 工作票完成数量
int ticketInfoCompleteNum = workTicketReportStatistic.stream().filter(
ticket-> WorkTicketConstants.FirstWorkTicketStatusEnum.FINISH.getStatus().equals(ticket.getStatus())
).collect(Collectors.toList()).size();
int ticketInfoCompleteNum = workTicketReportStatistic.stream().filter(item -> "结束".equals(item.getFlowTaskName()))
.collect(Collectors.toList()).size();
// 工作票未完成数量
int ticketInfoStartNum = workTicketReportStatistic.size() - ticketInfoCompleteNum;
// 延期数量统计
int ticketInfoDelayNum = workTicketReportStatistic.stream().filter(ticket -> Func.isNotEmpty(ticket.getDelayId()))
int ticketInfoDelayNum = workTicketReportStatistic.stream().filter(item -> "延期".equals(item.getInput()))
.collect(Collectors.toList()).size();
// 合格数量统计
int ticketInfoQualifiedNum = workTicketReportStatistic.stream().filter(ticket -> Func.isNotEmpty(ticket.getEvaluation()) && ticket.getEvaluation().intValue() == 1)

Loading…
Cancel
Save