Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
yang_shj 1 year ago
parent
commit
1dece6bb0d
  1. 3
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmInfoEntity.java
  2. 6
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IQuestionClient.java
  3. 4
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/TemplateEntity.java
  4. 25
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/feign/IProjectClient.java
  5. 16
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/plan/entity/RouteEntity.java
  6. 37
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/dto/TaskDTO.java
  7. 18
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskEntity.java
  8. 6
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskObjectProjectContentEntity.java
  9. 8
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java
  10. 9
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmInfoService.java
  11. 31
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java
  12. 1
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/vo/EmInfoVO.java
  13. 6
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/QuestionClient.java
  14. 8
      hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/EquipmentInstanceServiceImpl.java
  15. 17
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ProjectClient.java
  16. 27
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectServiceImpl.java
  17. 7
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/vo/TemplateAddVo.java
  18. 18
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ProjectController.java
  19. 10
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java
  20. 4
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/ITaskService.java
  21. 2
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskObjectProjectContentServiceImpl.java
  22. 39
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java
  23. 6
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskObjectProjectContentVO.java
  24. 7
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskVo.java
  25. 14
      hzims-service/inspect/src/main/resources/db/1.0.1.sql
  26. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

3
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmInfoEntity.java

@ -234,6 +234,9 @@ public class EmInfoEntity extends TenantEntity {
@ApiModelProperty("站点编码")
private String stationCode;
@ApiModelProperty(value = "模型标识")
private String modelSignage;
@TableField(exist = false)
@ApiModelProperty("站点名称")
private String stationName;

6
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IQuestionClient.java

@ -28,9 +28,9 @@ public interface IQuestionClient {
* @return
*/
@GetMapping(SUBMIT_STATION_INFO)
R<Boolean> submitStationInfo(@RequestParam("fdp站点类型") Integer fdpStationType,
@RequestParam("站点编码") String stationCode,
@RequestParam(value = "站点描述",required = false) String stationDesc);
R<Boolean> submitStationInfo(@RequestParam Integer fdpStationType,
@RequestParam String stationCode,
@RequestParam(required = false) String stationDesc);
@DeleteMapping(DELETE_STATION_INFO)
R<Boolean> deleteStationInfo(@RequestParam String stationId);

4
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/TemplateEntity.java

@ -59,6 +59,6 @@ public class TemplateEntity extends TenantEntity {
@ApiModelProperty(value = "inspectType 支持的巡检类型 0普通巡检,1视频自动巡检,2机器人巡检")
private String supportAutoVideo;
//private Boolean ;
@ApiModelProperty(value = "巡检对象ID")
private Long objectId;
}

25
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/feign/IProjectClient.java

@ -1,22 +1,17 @@
package com.hnac.hzinfo.inspect.obj.feign;
import com.hnac.hzinfo.inspect.Constants;
import com.hnac.hzinfo.inspect.obj.dto.ContentDTO;
import com.hnac.hzinfo.inspect.obj.dto.ProjectDTO;
import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity;
import com.hnac.hzinfo.inspect.obj.request.ProjectContentRequest;
import com.hnac.hzinfo.inspect.obj.vo.ProjectVO;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;
@FeignClient(value = Constants.APP_NAME)
@ -25,7 +20,7 @@ public interface IProjectClient {
String API_PREFIX = "/feign/project";
String ADD_PROJECT_AND_CONTENT = API_PREFIX + "/addProjectAndContent";
String GET_PROJECT_AND_CONTENT_BY_EM_CODE = API_PREFIX + "/getProjectAndContentByEmCode";
String GET_EM_CODES_BY_DEPT_ID = API_PREFIX + "/getEmCodesByDeptId";
/**
* 批量新增/更新项目
@ -36,13 +31,19 @@ public interface IProjectClient {
R<Boolean> addProjectAndContent(@RequestBody @Valid List<ProjectDTO> request);
/**
*
* @param emCode 设备编号
* @param content namerecordTypecheckType
* @param query 分页参数
* @return
* 根据设备Code获取巡检项目内容
* @param request 分页 - 内容筛选条件 - 设备编号
* @return 巡检项目内容
*/
@PostMapping(GET_PROJECT_AND_CONTENT_BY_EM_CODE)
R<ProjectVO> getProjectAndContentByEmCode(@RequestBody ProjectContentRequest request);
/**
* 根据机构ID获取设备编号列表
* @param deptId 机构ID
* @return 设备编号列表
*/
@GetMapping(GET_EM_CODES_BY_DEPT_ID)
R<List<String>> getEmCodesByDeptId(@RequestParam Long deptId);
}

16
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/plan/entity/RouteEntity.java

@ -1,13 +1,13 @@
package com.hnac.hzinfo.inspect.plan.entity;
import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.baomidou.mybatisplus.annotation.TableName;
import org.springblade.core.tenant.mp.TenantEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.hnac.hzinfo.inspect.utils.QueryField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
/**
@ -27,6 +27,7 @@ public class RouteEntity extends TenantEntity {
* 路线名称
*/
@ApiModelProperty(value = "路线名称")
@QueryField(condition = SqlCondition.LIKE)
private String routeName;
/**
* 路线数据
@ -41,6 +42,11 @@ public class RouteEntity extends TenantEntity {
* 巡检类型标识
*/
@ApiModelProperty(value = " 巡检类型标识 0普通巡检,1视频自动巡检,2机器人巡检")
@QueryField(condition = SqlCondition.EQUAL)
private String supportAutoVideo;
@ApiModelProperty(value = "巡检路线 字典:routeType 1-值班 2-计划")
@QueryField(condition = SqlCondition.EQUAL)
private String type;
}

37
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/dto/TaskDTO.java

@ -0,0 +1,37 @@
package com.hnac.hzinfo.inspect.task.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hnac.hzinfo.inspect.task.entity.TaskEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @ClassName TaskDTO
* @description: 巡检任务DTO对象
* @author: hx
* @create: 2023-07-27 14:37
* @Version 4.0
**/
@EqualsAndHashCode
@Data
@ApiModel("巡检任务DTO")
public class TaskDTO extends TaskEntity implements Serializable {
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
@ApiModelProperty(value = "任务计划开始时间-起")
private LocalDateTime planStartTime;
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
@ApiModelProperty(value = "任务计划开始时间-止")
private LocalDateTime planStartTimeEnd;
}

18
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskEntity.java

@ -1,10 +1,12 @@
package com.hnac.hzinfo.inspect.task.entity;
import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import org.springblade.core.mp.support.QueryField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -32,21 +34,25 @@ public class TaskEntity extends TenantEntity {
* 计划ID
*/
@ApiModelProperty(value = "计划ID")
@QueryField(condition = SqlCondition.EQUAL)
private Long planId;
/**
* 计划模式 0 人员 1岗位 2机构 3自由模式 4 自由人模式
*/
@ApiModelProperty(value = "计划模式 0 人员 1岗位 2机构 3自由模式 4 自由人模式")
@QueryField(condition = SqlCondition.EQUAL)
private String type;
/**
* 计划名称
*/
@ApiModelProperty(value = "计划名称")
@QueryField(condition = SqlCondition.LIKE)
private String planName;
/**
* 任务批次号
*/
@ApiModelProperty(value = "任务批次号")
@QueryField(condition = SqlCondition.EQUAL)
private String batchNumber;
/**
* 任务计划开始时间
@ -96,15 +102,18 @@ public class TaskEntity extends TenantEntity {
* 巡检备案 0 未备案 1已备案
*/
@ApiModelProperty(value = "任务报备 0 未报备 1已报备")
@QueryField(condition = SqlCondition.EQUAL)
private String keepOnRecord;
/**
* 计划周期 0: 从不 1:每天 2:每月 3:每季度 4:每年 5:每周
*/
@ApiModelProperty(value = "计划周期 0: 从不 1:每天 2:每月 3:每季度 4:每年 5:每周")
@QueryField(condition = SqlCondition.EQUAL)
private String cycle;
@ApiModelProperty(value = "任务模式:0抢占,1并发")
@QueryField(condition = SqlCondition.EQUAL)
private String method;
@TableField(exist=false)
@ -127,6 +136,7 @@ public class TaskEntity extends TenantEntity {
* 巡检类型标识 0普通巡检1视频自动巡检2机器人巡检
*/
@ApiModelProperty(value = "巡检类型标识: 0普通巡检,1视频自动巡检,2机器人巡检")
@QueryField(condition = SqlCondition.EQUAL)
private String autoVideo;
/**
@ -134,25 +144,30 @@ public class TaskEntity extends TenantEntity {
*/
@ApiModelProperty(value = "计划类型")
@QueryField(condition = SqlCondition.EQUAL)
private String planType;
/**
* 任务开始前 是否发送提醒短信 标识
*/
@ApiModelProperty(value = "任务开始前 是否发送提醒短信 标识")
@QueryField(condition = SqlCondition.EQUAL)
private Boolean startRemindFlag ;
/**
* 任务结束前 是否发送提醒短信 标识
*/
@ApiModelProperty(value = "任务结束前 是否发送提醒短信 标识")
@QueryField(condition = SqlCondition.EQUAL)
private Boolean endRemindFlag ;
@ApiModelProperty(value = "计划、任务增加开始前提醒时间")
@QueryField(condition = SqlCondition.EQUAL)
private LocalDateTime startRemindTime;
@ApiModelProperty(value = "计划、任务增加结束前提醒时间")
@QueryField(condition = SqlCondition.EQUAL)
private LocalDateTime endRemindTime;
/**
@ -165,14 +180,17 @@ public class TaskEntity extends TenantEntity {
* 值班id
*/
@ApiModelProperty(value = "值班id")
@QueryField(condition = SqlCondition.EQUAL)
private Long dutyId;
@ApiModelProperty(value = "消息模板ID")
@JsonSerialize(nullsUsing = NullSerializer.class)
@QueryField(condition = SqlCondition.EQUAL)
private Long messageTemplateId;
@ApiModelProperty(value = "消息推送状态")
@JsonSerialize(nullsUsing = NullSerializer.class)
@QueryField(condition = SqlCondition.EQUAL)
private Boolean pushStatus;
}

6
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskObjectProjectContentEntity.java

@ -120,4 +120,10 @@ public class TaskObjectProjectContentEntity extends TenantEntity {
@ApiModelProperty(value = "记值方式为选择时选择值")
private String dictType;
@ApiModelProperty(value = "绑定物模型属性标识")
private String attrSignage;
@ApiModelProperty(value = "绑定物模型属性名称")
private String attrName;
}

8
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java

@ -1,5 +1,6 @@
package com.hnac.hzims.equipment.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -404,4 +405,11 @@ public class EmInfoController extends BladeController {
public R<List<SparePartVO>> getSparePart(String emCode, String startTime, String endTime) {
return R.data(em_infoService.getSparePart(emCode, startTime, endTime));
}
@GetMapping("/getEmTreeByDeptAndParentCode")
@ApiOperationSupport(order = 11)
@ApiOperation(value = "根据所属机构、父级设备Code获取设备树下级设备列表")
public R<List<JSONObject>> getEmTreeByDeptAndParentCode(@ApiParam("机构ID") Long deptId, @ApiParam("父级设备编号") String parentCode) {
return R.data(em_infoService.getEmTreeByDeptAndParentCode(deptId,parentCode));
}
}

9
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmInfoService.java

@ -1,5 +1,6 @@
package com.hnac.hzims.equipment.service;
import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.equipment.dto.DeviceTreeDTO;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.vo.*;
@ -82,4 +83,12 @@ public interface IEmInfoService extends BaseService<EmInfoEntity> {
List<SparePartVO> getSparePart(String emCode, String startTime, String endTime);
List<EmInfoEntity> convertToTree(Long pid, List<EmInfoEntity> list);
/**
* 根据所属机构父级设备Code获取设备树下级设备列表
* @param deptId 设备所属机构
* @param parentCode 父级设备Code
* @return 设备信息列表
*/
List<JSONObject> getEmTreeByDeptAndParentCode(Long deptId, String parentCode);
}

31
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java

@ -1,5 +1,6 @@
package com.hnac.hzims.equipment.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -15,6 +16,7 @@ import com.hnac.hzims.equipment.mapper.EmInfoMapper;
import com.hnac.hzims.equipment.mapper.EmInfoNoScopeMapper;
import com.hnac.hzims.equipment.service.*;
import com.hnac.hzims.equipment.vo.*;
import com.hnac.hzims.equipment.wrapper.EmInfoWrapper;
import com.hnac.hzims.fdp.service.IFdpQuestionService;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity;
@ -583,6 +585,34 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
return list.stream().filter(item -> item.getGpid().equals(pid)).collect(Collectors.toList());
}
@Override
public List<JSONObject> getEmTreeByDeptAndParentCode(Long deptId, String parentCode) {
// 获取该机构下的巡检项目绑定的设备编号
List<String> emCodes = Lists.newArrayList();
List<String> projectEmCodes = projectClient.getEmCodesByDeptId(deptId).getData();
// 获取巡检项目绑定的设备的父设备集合
if(CollectionUtil.isNotEmpty(projectEmCodes)) {
emCodes.addAll(projectEmCodes);
LambdaQueryWrapper<EmInfoEntity> childrenEmInfoWrapper = Wrappers.<EmInfoEntity>lambdaQuery().in(EmInfoEntity::getNumber, projectEmCodes);
List<EmInfoEntity> projectEmInfos = this.list(childrenEmInfoWrapper);
List<String> childrenEmCode = projectEmInfos.stream().map(EmInfoEntity::getPath).filter(Func::isNotEmpty)
.flatMap(path -> Arrays.stream(path.split("/"))).distinct().collect(Collectors.toList());
emCodes.addAll(childrenEmCode);
}
// 获取parentCode下的子设备集合
LambdaQueryWrapper<EmInfoEntity> queryWrapper = Wrappers.<EmInfoEntity>lambdaQuery()
.eq(EmInfoEntity::getGpid, parentCode)
.eq(EmInfoEntity::getDepartment,deptId);
List<EmInfoEntity> emInfoList = this.list(queryWrapper);
List<JSONObject> result = emInfoList.stream().map(emInfoEntity -> {
JSONObject object = JSONObject.parseObject(JSON.toJSONString(emInfoEntity));
object.put("disabled", emCodes.contains(emInfoEntity.getNumber()) ? true : false);
return object;
}).collect(Collectors.toList());
return result;
}
/**
* 设备信息缓存(ctptinstalledCapacity监测点位)
@ -811,6 +841,7 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
ProjectDTO projectDTO = new ProjectDTO();
projectDTO.setEmCode(emInfo.getNumber());
projectDTO.setName(emInfo.getName());
projectDTO.setCreateDept(station.getRefDept());
// 获取设备树中绑定的巡检内容
LambdaQueryWrapper<EmTreeInspectEntity> inspectWrapper = new LambdaQueryWrapper();

1
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/vo/EmInfoVO.java

@ -20,4 +20,5 @@ public class EmInfoVO {
private List<EmInfoEntity> children;
private List<EmParamEntity> params;
private List<EmAttachEntity> attachs;
}

6
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/QuestionClient.java

@ -21,9 +21,9 @@ public class QuestionClient implements IQuestionClient {
@GetMapping(SUBMIT_STATION_INFO)
@Override
public R<Boolean> submitStationInfo(@RequestParam("fdp站点类型") Integer fdpStationType,
@RequestParam("站点编码") String stationCode,
@RequestParam(value = "站点描述",required = false) String stationDesc) {
public R<Boolean> submitStationInfo(@RequestParam Integer fdpStationType,
@RequestParam String stationCode,
@RequestParam(required = false) String stationDesc) {
return R.status(fdpQuestionService.submitStationInfo(fdpStationType,stationCode,stationDesc));
}

8
hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/EquipmentInstanceServiceImpl.java

@ -2,8 +2,12 @@ package com.hnac.hzims.monitor.server.impl;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.equipment.entity.EmDefinitionEntity;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.entity.EmTreeEntity;
import com.hnac.hzims.equipment.service.IEmDefinitionService;
import com.hnac.hzims.equipment.service.IEmInfoService;
import com.hnac.hzims.equipment.service.IEmTreeService;
import com.hnac.hzims.fdp.request.AnswerFormatReq;
import com.hnac.hzims.fdp.request.SubmitAnswerReq;
import com.hnac.hzims.fdp.service.IFdpQuestionService;
@ -78,6 +82,10 @@ public class EquipmentInstanceServiceImpl implements IEquipmentInstanceService {
}
private String getModelSignageByAnswer(SubmitAnswerReq submitAnswerReq) {
EmInfoEntity emInfoEntity = emInfoService.getEmInfoByEmCode(submitAnswerReq.getEmCode());
if (Func.isNotEmpty(emInfoEntity.getModelSignage())) {
return emInfoEntity.getModelSignage();
}
if(IFdpQuestionService.COMMON_TYPE.equals(submitAnswerReq.getDeviceType())) {
return commonSignage;
}

17
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ProjectClient.java

@ -1,8 +1,12 @@
package com.hnac.hzinfo.inspect.obj.feign;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzinfo.inspect.obj.dto.ContentDTO;
import com.hnac.hzinfo.inspect.obj.dto.ProjectDTO;
import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity;
import com.hnac.hzinfo.inspect.obj.request.ProjectContentRequest;
import com.hnac.hzinfo.inspect.obj.services.ProjectService;
import com.hnac.hzinfo.inspect.obj.vo.ProjectVO;
@ -12,10 +16,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
@ -50,4 +51,12 @@ public class ProjectClient extends BladeController implements IProjectClient {
return R.data(projectService.getProjectAndContentByEmCode(request.getEmCode(), request.getContentDTO(), query));
}
@Override
@GetMapping(GET_EM_CODES_BY_DEPT_ID)
public R<List<String>> getEmCodesByDeptId(@RequestParam Long deptId) {
QueryWrapper<ProjectEntity> queryWrapper = Wrappers.<ProjectEntity>query().eq("create_dept", deptId);
queryWrapper.select("distinct em_code emCode");
queryWrapper.ne("em_code","").isNotNull("em_code");
return R.data(projectService.listObjs(queryWrapper, String::valueOf));
}
}

27
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectServiceImpl.java

@ -1,5 +1,6 @@
package com.hnac.hzinfo.inspect.obj.services.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
@ -31,6 +32,7 @@ import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -243,24 +245,27 @@ public class ObjectServiceImpl extends BaseServiceImpl<InspectObjectMapper, Obje
private void generateTemplate(ObjectEntity object) {
// 若巡检对象设备编码存在,则生成巡检模板
if(Func.isNotEmpty(object.getEmCodes())) {
// 清空巡检对象与巡检模板的绑定关系
if(Func.isNotEmpty(object.getId())) {
objectTemplateService.remove(Wrappers.<ObjectTemplateEntity>lambdaQuery().eq(ObjectTemplateEntity::getObjectId,object.getId()));
}
TemplateEntity template = new TemplateEntity();
TemplateEntity template = Optional.ofNullable(templateService.getOne(Wrappers.<TemplateEntity>lambdaQuery().eq(TemplateEntity::getObjectId, object.getId()))).orElse(new TemplateEntity());
template.setObjectId(object.getId());
template.setCode(String.valueOf(LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().getEpochSecond()));
template.setName(object.getName());
template.setDuplicateRecord(ObjectConstants.TemplateRecordEnum.ALLOW.getRecordType());
template.setSupportAutoVideo(Constants.InspectTypeEnum.COMMON.getVal());
template.setStatus(ObjectConstants.TemplateEnableEnum.YES.getEnableType());
Assert.isTrue(templateService.save(template),() -> {
Assert.isTrue(templateService.saveOrUpdate(template),() -> {
throw new ServiceException("保存巡检模板失败!");
});
// 保存巡检对象与巡检模板的绑定关系
ObjectTemplateEntity banding = ObjectTemplateEntity.builder()
.templateId(template.getId()).objectId(object.getId()).code(template.getCode())
.name(template.getName()).supportAutoVideo(object.getSupportAutoVideo()).build();
objectTemplateService.save(banding);
// 查询对象与模板的绑定关系是否存在 若不在线则新建绑定关系
LambdaQueryWrapper<ObjectTemplateEntity> objTemBanding = Wrappers.<ObjectTemplateEntity>lambdaQuery().eq(ObjectTemplateEntity::getObjectId, object.getId()).eq(ObjectTemplateEntity::getTemplateId, template.getId());
if(Func.isEmpty(objectTemplateService.getOne(objTemBanding))) {
ObjectTemplateEntity banding = ObjectTemplateEntity.builder()
.templateId(template.getId()).objectId(object.getId()).code(template.getCode())
.name(template.getName()).supportAutoVideo(object.getSupportAutoVideo()).build();
objectTemplateService.save(banding);
}
// 解除该模板下与项目的绑定关系 新增编辑后的绑定关系
LambdaQueryWrapper<TemplateProjectEntity> queryWrapper = Wrappers.<TemplateProjectEntity>lambdaQuery().eq(TemplateProjectEntity::getTemplateId, template.getId());
templateProjectService.remove(queryWrapper);
// 保存巡检模板与巡检项目的绑定关系
List<String> emCodeList = Func.toStrList(",", object.getEmCodes());
Function<Integer,TemplateProjectEntity> getTemplateProjectByEmCode = index -> {

7
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/vo/TemplateAddVo.java

@ -17,13 +17,6 @@ import java.util.List;
public class TemplateAddVo extends TemplateEntity {
/**
* 对象Id
*/
@ApiModelProperty(value = "对象Id")
private Long objectId;
/**
* 模板项目绑定list
*/
@ApiModelProperty(value = "模板项目绑定list")

18
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ProjectController.java

@ -32,6 +32,8 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
@ -41,6 +43,7 @@ import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -59,6 +62,8 @@ public class ProjectController {
private TemplateProjectService templateProjectService;
@Autowired
private ProjectContentServiceImpl projectContentService;
@Autowired
private ISysClient sysClient;
/**
* 巡检项目列表
@ -178,4 +183,17 @@ public class ProjectController {
public R<List<ProjectVO>> getProjectAndContentByEmCodes(@RequestParam String emCodes) {
return R.data(projectService.getProjectAndContentByEmCodes(emCodes));
}
@GetMapping("/getProjectDept")
@ApiOperation(value = "获取巡检项目下的机构")
@ApiOperationSupport(order = 9)
public R<List> getProjectDept() {
QueryWrapper<ProjectEntity> queryWrapper = Wrappers.<ProjectEntity>query().select("distinct create_dept deptId");
List<Long> deptIdList = projectService.listObjs(queryWrapper, Func::toLong);
List<HashMap> result = deptIdList.stream().map(deptId -> new HashMap() {{
put("deptId", deptId);
put("deptName", Optional.ofNullable(sysClient.getDept(deptId).getData()).map(Dept::getDeptName).orElse(deptId.toString()));
}}).collect(Collectors.toList());
return R.data(result);
}
}

10
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java

@ -1,6 +1,7 @@
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.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -16,6 +17,7 @@ import com.hnac.hzinfo.core.push.model.PushInfo;
import com.hnac.hzinfo.core.push.model.PushPlatform;
import com.hnac.hzinfo.inspect.plan.PlanContants;
import com.hnac.hzinfo.inspect.task.TaskContants.ClaimStatusEnum;
import com.hnac.hzinfo.inspect.task.dto.TaskDTO;
import com.hnac.hzinfo.inspect.task.entity.EventEntity;
import com.hnac.hzinfo.inspect.task.entity.TaskEntity;
import com.hnac.hzinfo.inspect.task.entity.TaskUserEntity;
@ -35,6 +37,7 @@ 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.resource.feign.IPushClient;
import org.springblade.resource.vo.PushInfoVO;
@ -101,6 +104,13 @@ public class TaskController extends BladeController {
return R.data(detail);
}
@GetMapping("/listPage")
@ApiOperation(value = "巡检任务分页查询-站长级", notes = "传入task")
@ApiOperationSupport(order = 1)
public R<IPage<TaskVo>> listPage(TaskDTO taskDTO, Query query) {
return R.data(taskService.page(taskDTO,query));
}
/**
* PC端分页显示任务列表
*/

4
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/ITaskService.java

@ -3,11 +3,13 @@ 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.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;
@ -63,6 +65,8 @@ public interface ITaskService extends BaseService<TaskEntity> {
*/
List<TaskObjectVO> getTaskById(Long id);
IPage<TaskVo> page(TaskDTO taskDTO, Query query);
/**
* PC端任务列表
* @return

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskObjectProjectContentServiceImpl.java

@ -64,6 +64,8 @@ public class TaskObjectProjectContentServiceImpl extends BaseServiceImpl<TaskObj
if(ObjectUtil.isNotEmpty(realDataObject) && realDataObject.getIntValue("q") == 0) {
contentVO.setRealData(realDataObject.getDoubleValue("v"));
contentVO.setGatherTime(LocalDateTime.ofInstant(Instant.ofEpochMilli(realDataObject.getLongValue("ts")), ZoneId.systemDefault()));
contentVO.setAttrSignage(content.getAttrSignage());
contentVO.setAttrName(content.getAttrName());
}
}
}

39
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java

@ -1,6 +1,7 @@
package com.hnac.hzinfo.inspect.task.service.impl;
import com.alibaba.fastjson.JSONObject;
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;
@ -8,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.hnac.hzims.common.utils.Condition;
import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.safeproduct.entity.ImsMonCameraInfoEntity;
import com.hnac.hzims.safeproduct.feign.IImsMonCameraInfoClient;
@ -22,6 +24,7 @@ import com.hnac.hzinfo.inspect.plan.vo.RoutObject;
import com.hnac.hzinfo.inspect.task.TaskContants;
import com.hnac.hzinfo.inspect.task.TaskContants.ClaimStatusEnum;
import com.hnac.hzinfo.inspect.task.TaskContants.TaskStatusEnum;
import com.hnac.hzinfo.inspect.task.dto.TaskDTO;
import com.hnac.hzinfo.inspect.task.entity.*;
import com.hnac.hzinfo.inspect.task.mapper.TaskMapper;
import com.hnac.hzinfo.inspect.task.mapper.TaskNoUserDataScopeMapper;
@ -34,6 +37,7 @@ import org.apache.commons.collections4.CollectionUtils;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tenant.mp.TenantEntity;
import org.springblade.core.tool.api.R;
@ -517,6 +521,41 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
}
@Override
public IPage<TaskVo> page(TaskDTO taskDTO, Query query) {
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.orderByDesc(TaskEntity::getCreateTime);
IPage page = this.page(Condition.getPage(query), queryWrapper);
List<TaskEntity> records = page.getRecords();
List<TaskVo> taskVos = records.stream().map(task -> {
TaskVo taskVo = BeanUtil.copy(task, TaskVo.class);
// 补充巡检任务人员
List<TaskUserEntity> taskUserList = taskUserService.list(Wrappers.<TaskUserEntity>lambdaQuery().eq(TaskUserEntity::getTaskId, task.getId()));
String userIds = taskUserList.stream().filter(Func::isNotEmpty).map(TaskUserEntity::getUserId)
.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(","));
taskVo.setUserIds(userIds);
taskVo.setUserNames(userNames);
// 获取机器人信息
if (taskVo.getAutoVideo().equals(PlanContants.InspectTypeEnum.ROBOT.getVal()) && taskUserList.size() == 1) {
if (Func.isNotEmpty(taskUserList.get(0))) {
taskVo.setRobot(robotService.getDetailByUserId(taskUserList.get(0).getUserId()));
}
}
return taskVo;
}).collect(Collectors.toList());
page.setRecords(taskVos);
return page;
}
@Override
public List<TaskVo> getListPage(IPage<TaskVo> page, TaskListQuery task) {
List<TaskVo> re = this.baseMapper.getListPage(page, task);
setVoInfo(re);

6
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskObjectProjectContentVO.java

@ -127,4 +127,10 @@ public class TaskObjectProjectContentVO implements Serializable {
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
private LocalDateTime gatherTime;
@ApiModelProperty(value = "绑定物模型属性标识")
private String attrSignage;
@ApiModelProperty(value = "绑定物模型属性名称")
private String attrName;
}

7
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskVo.java

@ -3,6 +3,7 @@ package com.hnac.hzinfo.inspect.task.vo;
import com.hnac.hzinfo.inspect.ai.vo.RobotVO;
import com.hnac.hzinfo.inspect.task.entity.TaskEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
@ -22,4 +23,10 @@ public class TaskVo extends TaskEntity {
* 机器人信息
*/
private RobotVO robot;
@ApiModelProperty("执行人ID,按逗号分隔")
private String userIds;
@ApiModelProperty("执行名称,按逗号分隔")
private String userNames;
}

14
hzims-service/inspect/src/main/resources/db/1.0.1.sql

@ -56,3 +56,17 @@ alter table hz_st_re_project add COLUMN `em_code` VARCHAR(50) comment '设备编
-- 设备巡检对象添加设备字段
alter table hz_st_re_object add COLUMN `em_codes` VARCHAR(255) comment '设备编号,按逗号分隔';
-- 巡检模板添加巡检对象
alter table hz_st_re_template add COLUMN `object_id` BIGINT(20) comment '巡检对象ID';
-- 巡检任务中巡检内容执行情况添加模型属性标识、名称字段
alter table hz_st_ex_object_project_content add COLUMN `attr_signage` VARCHAR(50) comment '属性标识';
alter table hz_st_ex_object_project_content add COLUMN `attr_name` VARCHAR(64) comment '属性名称';
-- 巡检路径添加类型
alter table hz_st_re_route add COLUMN `type` VARCHAR(2) comment '巡检路线 字典:routeType 1-值班 2-通用';
-- 巡检路径类型字典
INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1684523371508834306, 0, 'routeType', '-1', '巡检路径类型', 23, '', 0, 0, 0, -1, 'inspect');
INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1684523447710949377, 1684523371508834306, 'routeType', '1', '值班', 1, '', 0, 0, 0, -1, 'inspect');
INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1684523498650771458, 1684523371508834306, 'routeType', '2', '计划', 2, '', 0, 0, 0, -1, 'inspect');

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

@ -114,7 +114,7 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
StationPushConfigVO configVO = stationPushConfigService.getOne(BeanUtil.copy(config, StationPushConfigDTO.class));
if(ObjectUtil.isNotEmpty(configVO) && configVO.getIsPush()) {
log.info("{}站点开始智能诊断站点推送",req.getCode());
new Thread(() -> questionClient.submitStationInfo(configVO.getFdpStationType(), req.getCode(), ""), "智能诊断站点推送").start();
new Thread(() -> questionClient.submitStationInfo(configVO.getFdpStationType(), req.getCode(), "运维平台推送"), "智能诊断站点推送").start();
}
// 如果设备数据来源未选定其他 则进行站点初始化操作
if (StationConstants.GATHER.equals(req.getDataOrigin()) && !StationConstants.HZ3000_OTHER.equals(req.getDataSource())) {

Loading…
Cancel
Save