Browse Source

设备定义模块代码提交

设备信息模块代码提交
设备生命周期模块代码提交
zhongwei
tanghaihao 1 year ago
parent
commit
4f41e6e3f5
  1. 19
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/EquipmentConstants.java
  2. 43
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmDefinitionEntity.java
  3. 14
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmInfoEntity.java
  4. 7
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmParamEntity.java
  5. 26
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmTreeBasicEntity.java
  6. 63
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmTreeEntity.java
  7. 42
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmTreeInspectEntity.java
  8. 38
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmTreeParamEntity.java
  9. 4
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java
  10. 5
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java
  11. 4
      hzims-service/assets/pom.xml
  12. 1
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.java
  13. 1
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.xml
  14. 4
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java
  15. 6
      hzims-service/equipment/pom.xml
  16. 150
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmDefinitionController.java
  17. 143
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java
  18. 219
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmTreeController.java
  19. 21
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/LifeCycleController.java
  20. 26
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/dto/DeviceTreeDTO.java
  21. 37
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/dto/EmDefinitionDTO.java
  22. 66
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/dto/EmTreeDTO.java
  23. 21
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/dto/EmTreeIdsDTO.java
  24. 10
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java
  25. 7
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmDefinitionMapper.java
  26. 5
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmDefinitionMapper.xml
  27. 5
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.java
  28. 28
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.xml
  29. 11
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeBasicMapper.java
  30. 5
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeBasicMapper.xml
  31. 8
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeInspectMapper.java
  32. 5
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeInspectMapper.xml
  33. 7
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeMapper.java
  34. 5
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeMapper.xml
  35. 8
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeParamMapper.java
  36. 5
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeParamMapper.xml
  37. 7
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmDefinitionService.java
  38. 17
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmInfoService.java
  39. 7
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmTreeBasicService.java
  40. 7
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmTreeInspectService.java
  41. 7
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmTreeParamService.java
  42. 19
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmTreeService.java
  43. 19
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmAssociationDetailServiceImpl.java
  44. 17
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmDefinitionServiceImpl.java
  45. 290
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java
  46. 22
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmTreeBasicServiceImpl.java
  47. 17
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmTreeInspectServiceImpl.java
  48. 17
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmTreeParamServiceImpl.java
  49. 235
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmTreeServiceImpl.java
  50. 49
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/vo/EmInfoContentVO.java
  51. 25
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/vo/EmTreeVO.java
  52. 32
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/vo/SparePartVO.java
  53. 6
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/ModelController.java
  54. 1
      hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/IModelService.java
  55. 9
      hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/ModelServiceImpl.java
  56. 39
      hzims-service/equipment/src/main/java/com/hnac/hzims/util/MemoryPagination.java
  57. 13
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessTaskController.java
  58. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.java
  59. 24
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml
  60. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessTaskService.java
  61. 11
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java
  62. 33
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/vo/RepairBillVO.java
  63. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectStatisticsController.java
  64. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/mapper/OperDefectStatisticsMapper.java
  65. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/mapper/OperDefectStatisticsMapper.xml
  66. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperDefectStatisticsService.java
  67. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectStatisticsServiceImpl.java
  68. 11
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/controller/WorkTicketInfoController.java
  69. 3
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketInfoMapper.java
  70. 21
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketInfoMapper.xml
  71. 4
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketInfoService.java
  72. 14
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java
  73. 30
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/vo/WorkTicketBillVO.java

19
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/EquipmentConstants.java

@ -1,5 +1,6 @@
package com.hnac.hzims;
import io.swagger.models.auth.In;
import lombok.Getter;
public class EquipmentConstants {
@ -145,6 +146,24 @@ public class EquipmentConstants {
}
}
/**
* 运行状态
*/
public enum ActivateStatusEnum {
stop(0,"停用"),
start(1,"启用")
;
@Getter
private Integer status;
@Getter
private String des;
private ActivateStatusEnum(Integer status, String des) {
this.status = status;
this.des = des;
}
}
/**
* 装机容量

43
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmDefinitionEntity.java

@ -0,0 +1,43 @@
package com.hnac.hzims.equipment.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
/**
* 设备定义实体类
* @author tanghaihao
* @date 2023年06月14日 16:45
*/
@Data
@TableName("hzims_em_definition")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "设备定义实体类", description = "")
public class EmDefinitionEntity extends TenantEntity {
@ApiModelProperty(value = "站点类型")
private String stationType;
@ApiModelProperty(value = "类型")
private String type;
@ApiModelProperty(value = "设备定义名称")
private String name;
@ApiModelProperty(value = "模型标识")
private String modelSignage;
@ApiModelProperty(value = "模型名称")
private String modelName;
@ApiModelProperty(value = "创建用户")
private Long createUser;
@ApiModelProperty(value = "创建用户名称")
@TableField(exist = false)
private String createUserName;
}

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

@ -18,6 +18,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
@ -40,6 +41,11 @@ public class EmInfoEntity extends TenantEntity {
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long gpid;
/**
* 设备树ID
*/
@ApiModelProperty(value = "设备树ID")
private Long treeId;
/**
* 所属组织
*/
@ApiModelProperty(value = "所属组织")
@ -73,6 +79,10 @@ public class EmInfoEntity extends TenantEntity {
@ApiModelProperty(value = "设备编号")
@NotNull
private String number;
@ApiModelProperty(value = "设备编号路径")
private String path;
/**
* 设备名称
*/
@ -216,7 +226,6 @@ public class EmInfoEntity extends TenantEntity {
@ApiModelProperty("机组类型")
private String setType;
@TableField(exist = false)
@ApiModelProperty("站点编码")
private String stationCode;
@ -228,4 +237,7 @@ public class EmInfoEntity extends TenantEntity {
@ApiModelProperty("站点类型")
private Integer stationType;
@ApiModelProperty(value = "子设备")
@TableField(exist = false)
private List<EmInfoEntity> infoChildren;
}

7
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmParamEntity.java

@ -30,10 +30,15 @@ public class EmParamEntity extends TenantEntity {
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long infoId;
/**
* 参数标识
*/
@ApiModelProperty(value = "参数标识")
private String paramName;
/**
* 参数名称
*/
@ApiModelProperty(value = "参数名称")
private String paramName;
private String name;
/**
* 排序
*/

26
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmTreeBasicEntity.java

@ -0,0 +1,26 @@
package com.hnac.hzims.equipment.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
/**
* 设备树和物资台账关联表实体类
* @author tanghaihao
* @date 2023年07月14日 15:54
*/
@Data
@TableName("hzims_em_tree_basic")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "设备树和物资台账关联表实体类")
public class EmTreeBasicEntity extends TenantEntity {
@ApiModelProperty(value = "设备树id")
private Long treeId;
@ApiModelProperty(value = "物资台账id")
private Long basicId;
}

63
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmTreeEntity.java

@ -0,0 +1,63 @@
package com.hnac.hzims.equipment.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import java.util.List;
/**
* 设备树实体类
* @author tanghaihao
* @date 2023年06月14日 16:46
*/
@Data
@TableName("hzims_em_tree")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "设备树实体类")
public class EmTreeEntity extends TenantEntity {
@ApiModelProperty(value = "设备定义Id")
private Long definitionId;
@ApiModelProperty(value = "父Id")
private Long pid;
@ApiModelProperty(value = "设备树标识路径")
private String path;
@ApiModelProperty(value = "设备类别")
private String gradeCode;
@ApiModelProperty("设备类型")
private String emType;
@ApiModelProperty("机组类型")
private String setType;
@ApiModelProperty(value = "设备名称")
private String name;
@ApiModelProperty(value = "设备标识")
private String signage;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "所属组织")
private Long refOreanization;
@ApiModelProperty(value = "设备等级")
private Integer emGrade;
@ApiModelProperty(value = "巡检标准")
private String inspectStandard;
@ApiModelProperty(value = "子设备")
@TableField(exist = false)
private List<EmTreeEntity> children;
}

42
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmTreeInspectEntity.java

@ -0,0 +1,42 @@
package com.hnac.hzims.equipment.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
/**
* 设备树绑定巡检实体类
* @author tanghaihao
* @date 2023年06月14日 16:46
*/
@Data
@TableName("hzims_em_tree_inspect")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "设备树绑定巡检实体类", description = "")
public class EmTreeInspectEntity extends TenantEntity {
@ApiModelProperty(value = "设备树ID")
private Long treeId;
@ApiModelProperty(value = "巡检内容id")
private Long contentId;
@ApiModelProperty(value = "巡检内容名称")
private String contentName;
@ApiModelProperty(value = "模型标识")
private String modelSignage;
@ApiModelProperty(value = "模型名称")
private String modelName;
@ApiModelProperty(value = "模型属性标识")
private String modelAttrSignage;
@ApiModelProperty(value = "模型属性名称")
private String modelAttrName;
}

38
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmTreeParamEntity.java

@ -0,0 +1,38 @@
package com.hnac.hzims.equipment.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
/**
* 设备树绑定参数实体类
* @author tanghaihao
* @date 2023年06月14日 16:48
*/
@Data
@TableName("hzims_em_tree_param")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "设备树绑定参数实体类", description = "")
public class EmTreeParamEntity extends TenantEntity {
@ApiModelProperty(value = "设备树ID")
private Long treeId;
@ApiModelProperty(value = "参数标识")
private String paramName;
@ApiModelProperty(value = "参数名称")
private String name;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "单位")
private String unit;
@ApiModelProperty(value = "描述")
private String description;
}

4
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java

@ -76,6 +76,7 @@ public interface IEmInfoClient {
String GET_EM_INFO_BY_DEPT = API_PREFIX + "/getEmInfoByDept";
String GET_EM_INFO_BY_NAME = API_PREFIX + "/getEmInfoByName";
String GET_EM_INFO_BY_EM_CODE = API_PREFIX + "/getEmInfoByEmCode";
String GET_EM_INFO_TREE_BY_EM_CODE = API_PREFIX + "/getEmInfoTreeByEmCode";
String UPDATE_BY_EM_CODE = API_PREFIX + "/updateByEmCode";
String UPDATE_BATCH_EM_STATE = API_PREFIX + "/updateBachEmState";
@ -114,6 +115,9 @@ public interface IEmInfoClient {
@GetMapping(GET_EM_INFO_BY_EM_CODES)
R<List<EmInfoEntity>> getEmInfoByEmCodes(@RequestParam("emCodes") List<String> emCodes);
@GetMapping(GET_EM_INFO_TREE_BY_EM_CODE)
R<List<EmInfoEntity>> getEmInfoTreeByEmCode(@RequestParam("emCode") String emCode);
@PostMapping(GET_EM_INFO_UNIT_COUNT_BY_DEPT)
R<Integer> getEmInfoUnitCountByDept(@RequestParam("list") List<Long> list);

5
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java

@ -55,6 +55,11 @@ public class IEmInfoClientBack implements IEmInfoClient {
}
@Override
public R<List<EmInfoEntity>> getEmInfoTreeByEmCode(String emCode) {
return R.data(new ArrayList<>());
}
@Override
public R<Integer> getEmInfoUnitCountByDept(List<Long> depts) {
return R.data(null);
}

4
hzims-service/assets/pom.xml

@ -64,6 +64,10 @@
<artifactId>message-api</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>equipment-api</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>cn.afterturn</groupId>-->
<!-- <artifactId>easypoi-base</artifactId>-->

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

1
hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.xml

@ -93,4 +93,5 @@
AND b.SP_BASIC_ID = #{spBasicId}
AND b.type = 5
</select>
</mapper>

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

@ -15,6 +15,8 @@ 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;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.spare.entity.*;
import com.hnac.hzims.spare.enume.WarehouseInType;
import com.hnac.hzims.spare.enume.WarehouseOutType;
@ -97,6 +99,8 @@ public class WtSpBasicServiceImpl extends BaseServiceImpl<WtSpBasicMapper, WtSpB
private IUserClient userClient;
private final IEmInfoClient emInfoClient;
private final ITicketInfoAllClient ticketInfoAllClient;
@Override

6
hzims-service/equipment/pom.xml

@ -56,7 +56,7 @@
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>-->
<dependency>
<groupId>com.hnac.hzinfo.data</groupId>
@ -93,6 +93,10 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
</dependency>
<dependency>
<groupId>com.hnac.hzinfo</groupId>
<artifactId>inspect-api</artifactId>
</dependency>
</dependencies>

150
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmDefinitionController.java

@ -0,0 +1,150 @@
package com.hnac.hzims.equipment.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.equipment.dto.EmDefinitionDTO;
import com.hnac.hzims.equipment.entity.EmDefinitionEntity;
import com.hnac.hzims.equipment.entity.EmTreeEntity;
import com.hnac.hzims.equipment.service.IEmDefinitionService;
import com.hnac.hzims.equipment.service.IEmTreeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/**
* 设备定义控制层
* @author tanghaihao
* @date 2023年06月15日 9:52
*/
@RestController
@AllArgsConstructor
@RequestMapping("/em/definition")
@Api(value = "设备定义控制层", tags = "设备定义管理")
public class EmDefinitionController extends BladeController {
private final IEmDefinitionService emDefinitionService;
private final IEmTreeService emTreeService;
/**
* 设备定义列表分页
* @param emDefinition
* @param query
* @return
*/
@GetMapping("/page")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "分页")
@ApiImplicitParams({
})
public R<IPage<EmDefinitionEntity>> getEmDefinitionPage(EmDefinitionEntity emDefinition, Query query) {
LambdaQueryWrapper<EmDefinitionEntity> wrapper = new LambdaQueryWrapper<>();
if (Func.isNotEmpty(emDefinition.getStationType())) {
wrapper.eq(EmDefinitionEntity::getStationType, emDefinition.getStationType());
}
if (Func.isNotEmpty(emDefinition.getType())) {
wrapper.eq(EmDefinitionEntity::getType, emDefinition.getType());
}
if (Func.isNotEmpty(emDefinition.getName())) {
wrapper.like(EmDefinitionEntity::getName, emDefinition.getName());
}
if (Func.isNotEmpty(emDefinition.getStatus())) {
wrapper.eq(EmDefinitionEntity::getStatus, emDefinition.getStatus());
}
IPage<EmDefinitionEntity> pages = emDefinitionService.page(Condition.getPage(query), wrapper);
for (EmDefinitionEntity definition : pages.getRecords()) {
User createUser = UserCache.getUser(definition.getCreateUser());
definition.setCreateUserName(createUser.getName());
}
return R.data(pages);
}
/**
* 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "新增", notes = "传入EmDefinitionDTO")
public R save(@Valid @RequestBody EmDefinitionDTO emDefinitionDTO) {
EmDefinitionEntity emDefinition = new EmDefinitionEntity();
Func.copy(emDefinitionDTO, emDefinition);
return R.data(emDefinitionService.save(emDefinition));
}
/**
* 编辑
*/
@PostMapping("/update")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "编辑", notes = "传入EmDefinitionDTO")
public R update(@Valid @RequestBody EmDefinitionDTO emDefinitionDTO) {
EmDefinitionEntity emDefinition = new EmDefinitionEntity();
Func.copy(emDefinitionDTO, emDefinition);
return R.data(emDefinitionService.updateById(emDefinition));
}
/**
* 删除
*/
@GetMapping("/remove")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "逻辑删除", notes = "传入id")
public R remove(Long id) {
EmDefinitionEntity emDefinition = emDefinitionService.getById(id);
if (emDefinition.getStatus().equals(1)) {
return R.fail("已启用的设备定义不能删除");
}
LambdaQueryWrapper<EmTreeEntity> treeWrapper = new LambdaQueryWrapper();
treeWrapper.eq(EmTreeEntity::getDefinitionId, id);
List<EmTreeEntity> list = emTreeService.list(treeWrapper);
if (Func.isNotEmpty(list)) {
return R.fail("设备定义中存在设备树,不能删除");
}
return R.status(emDefinitionService.removeById(id));
}
/**
* 启用/停用
*/
@GetMapping("/startOrStop")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "启用/停用", notes = "传入id")
public R startOrStop(Long id, Integer status) {
EmDefinitionEntity emDefinition = emDefinitionService.getById(id);
emDefinition.setStatus(status);
return R.status(emDefinitionService.updateById(emDefinition));
}
/**
* 获取设备定义下拉列表
*/
@GetMapping("/getEmDefinitionList")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "获取设备定义(下拉列表)", notes = "传入定义名称和站点类型")
public R getEmDefinitionList(EmDefinitionEntity emDefinition) {
LambdaQueryWrapper<EmDefinitionEntity> wrapper = new LambdaQueryWrapper<>();
if (Func.isNotEmpty(emDefinition.getName())) {
wrapper.like(EmDefinitionEntity::getName, emDefinition.getName());
}
if (Func.isNotEmpty(emDefinition.getStationType())) {
wrapper.eq(EmDefinitionEntity::getStationType, emDefinition.getStationType());
}
wrapper.eq(EmDefinitionEntity::getStatus, 1);
return R.data(emDefinitionService.list(wrapper));
}
}

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

@ -1,18 +1,23 @@
package com.hnac.hzims.equipment.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.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.hzims.equipment.dto.DeviceTreeDTO;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.service.IEmInfoService;
import com.hnac.hzims.equipment.vo.EmInfoAddVo;
import com.hnac.hzims.equipment.vo.EmInfoContentVO;
import com.hnac.hzims.equipment.vo.EmInfoVO;
import com.hnac.hzims.equipment.vo.SparePartVO;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.util.MemoryPagination;
import com.hnac.hzinfo.inspect.obj.dto.ContentDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@ -20,23 +25,16 @@ 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.CollectionUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.util.Assert;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;
/**
* 设备控制器
@ -112,6 +110,72 @@ public class EmInfoController extends BladeController {
}
/**
* 查看子设备列表 分页(树结构)
*/
@ApiLog
@RequestMapping(value = "/treeList")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "查看子设备列表 分页(树结构)", notes = "传入设备id")
public R<Map<String, Object>> treeList(Long id, String name, Query query) {
Map<String, Object> result = new HashMap<>();
EmInfoEntity parentEmInfo = em_infoService.getById(id);
LambdaQueryWrapper<EmInfoEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.likeRight(EmInfoEntity::getPath, parentEmInfo.getPath());
queryWrapper.ne(EmInfoEntity::getId, id);
if (Func.isNotEmpty(name)) {
queryWrapper.like(EmInfoEntity::getName, name);
}
List<EmInfoEntity> list = em_infoService.list(queryWrapper);
// 获取站点列表 - 填充站点编码、站点类型、站点名称
R<List<StationEntity>> stationListR = stationClient.list(new StationEntity());
List<EmInfoEntity> resultList = new ArrayList<>();
// 把List结构数据转换成树结构
if (Func.isNotEmpty(name)) {
for (EmInfoEntity emInfo : list) {
LambdaQueryWrapper<EmInfoEntity> sonWrapper = new LambdaQueryWrapper<>();
sonWrapper.likeRight(EmInfoEntity::getPath, emInfo.getPath());
List<EmInfoEntity> sonList = em_infoService.list(sonWrapper);
if(stationListR.isSuccess() && CollectionUtil.isNotEmpty(stationListR.getData())) {
List<StationEntity> stationList = stationListR.getData();
sonList.forEach(emInfoEntity -> {
Optional<StationEntity> stationOptional = stationList.stream()
.filter(station -> Func.isNotEmpty(station.getRefDept()) && station.getRefDept().equals(emInfoEntity.getDepartment())).findAny();
if(stationOptional.isPresent()) {
StationEntity stationEntity = stationOptional.get();
emInfoEntity.setStationCode(stationEntity.getCode());
emInfoEntity.setStationType(stationEntity.getType());
emInfoEntity.setStationName(stationEntity.getName());
}
});
}
resultList.addAll(em_infoService.convertToTree(emInfo.getGpid(), sonList));
}
} else {
if(stationListR.isSuccess() && CollectionUtil.isNotEmpty(stationListR.getData())) {
List<StationEntity> stationList = stationListR.getData();
list.forEach(emInfoEntity -> {
Optional<StationEntity> stationOptional = stationList.stream()
.filter(station -> Func.isNotEmpty(station.getRefDept()) && station.getRefDept().equals(emInfoEntity.getDepartment())).findAny();
if(stationOptional.isPresent()) {
StationEntity stationEntity = stationOptional.get();
emInfoEntity.setStationCode(stationEntity.getCode());
emInfoEntity.setStationType(stationEntity.getType());
emInfoEntity.setStationName(stationEntity.getName());
}
});
}
resultList = em_infoService.convertToTree(id, list);
}
// 内存分页
resultList = MemoryPagination.pagination(resultList, query.getCurrent(), query.getSize());
result.put("data", resultList);
result.put("total", resultList.size());
return R.data(result);
}
/**
* 新增
*/
@PostMapping("/save")
@ -125,7 +189,7 @@ public class EmInfoController extends BladeController {
* 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 6)
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入em_info,isModel;其中isModel=0为非母版,=1时保存为母版,modelName,modelType")
public R update(@Valid @RequestBody EmInfoAddVo em_info) {
// List<EmInfoEntity> name = em_infoService.list(new QueryWrapper<EmInfoEntity>() {{
@ -156,7 +220,7 @@ public class EmInfoController extends BladeController {
* 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 9)
@ApiOperationSupport(order = 6)
@ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(em_infoService.remove(ids));
@ -167,7 +231,7 @@ public class EmInfoController extends BladeController {
* 查询所有
*/
@GetMapping("/list/all")
@ApiOperationSupport(order = 10)
@ApiOperationSupport(order = 7)
@ApiOperation(value = "查询所有")
public R listAll(EmInfoEntity fdpDeviceEntity) {
List<EmInfoEntity> list = em_infoService.list(Condition.getQueryWrapper(fdpDeviceEntity));
@ -178,7 +242,7 @@ public class EmInfoController extends BladeController {
* 查询设备树
*/
@GetMapping("/list/tree")
@ApiOperationSupport(order = 10)
@ApiOperationSupport(order = 8)
@ApiOperation(value = "查询设备树")
public R listTree() {
return em_infoService.listTree();
@ -188,7 +252,7 @@ public class EmInfoController extends BladeController {
* 根据站点及所属设备Code一起存放Redis
*/
@GetMapping("/StationCodeStoreRedis")
@ApiOperationSupport(order = 10)
@ApiOperationSupport(order = 9)
@ApiOperation(value = "根据站点及所属设备Code一起存放Redis")
public R StationCodeStoreRedis() {
em_infoService.getStationCodeStoreRedis();
@ -209,7 +273,7 @@ public class EmInfoController extends BladeController {
* 取Redis数据-根据自定义key取出站点及所属Code
*/
@GetMapping("/redisCode")
@ApiOperationSupport(order = 10)
@ApiOperationSupport(order = 11)
@ApiOperation(value = "根据站点及所属设备Code一起存放Redis")
public R redisCode() {
return R.data(em_infoService.redisCode());
@ -219,7 +283,7 @@ public class EmInfoController extends BladeController {
* 取Redis数据-根据自定义key取出站点及所属Code
*/
@GetMapping("/emInfoAndParamRedis")
@ApiOperationSupport(order = 10)
@ApiOperationSupport(order = 12)
@ApiOperation(value = "存设备数据")
public R emInfoAndParamRedis() {
em_infoService.loadEmInfo();
@ -230,14 +294,14 @@ public class EmInfoController extends BladeController {
* 取Redis数据-根据自定义key取出站点及所属Code
*/
@GetMapping("/getEmInfoAndParamRedis")
@ApiOperationSupport(order = 10)
@ApiOperationSupport(order = 13)
@ApiOperation(value = "取设备数据")
public R getEmInfoAndParamRedis() {
return R.data(em_infoService.getEmInfoAndParamRedis());
}
@GetMapping(value = "/getEmInfoByCode")
@ApiOperationSupport(order = 11)
@ApiOperationSupport(order = 14)
@ApiOperation(value = "获取所有设备数据")
public R<EmInfoEntity> getEmInfoByCode(@RequestParam(value = "emCode") String emCode){
return em_infoService.getEmInfoByCode(emCode);
@ -247,9 +311,50 @@ public class EmInfoController extends BladeController {
* 查询设备名称
*/
@GetMapping("/getDevices")
@ApiOperationSupport(order = 4)
@ApiOperationSupport(order = 15)
@ApiOperation(value = "获取设备", notes = "传入设备列表集合")
public R getDevices(@RequestParam(value ="codes") List<String> codes) {
return R.data(em_infoService.listByCodes(codes));
}
/**
* 导入设备树
*/
@PostMapping("/importDeviceTree")
@ApiOperationSupport(order = 16)
@ApiOperation(value = "导入设备树", notes = "传入设备树id集合")
public R importDeviceTree(@RequestBody DeviceTreeDTO deviceTreeDTO) {
return R.status(em_infoService.importDeviceTree(deviceTreeDTO));
}
/**
* 导入子设备树
*/
@PostMapping("/importSonDeviceTree")
@ApiOperationSupport(order = 17)
@ApiOperation(value = "导入子设备树", notes = "传入设备树id集合")
public R importSonDeviceTree(@RequestBody DeviceTreeDTO deviceTreeDTO) {
return R.status(em_infoService.importSonDeviceTree(deviceTreeDTO));
}
/**
* 获取设备的巡检内容
*/
@GetMapping("/getEmInfoContent")
@ApiOperationSupport(order = 18)
@ApiOperation(value = "获取设备的巡检内容", notes = "传入设备编码")
public R<List<EmInfoContentVO>> getEmInfoContent(String emCode, ContentDTO dto) {
return R.data(em_infoService.getEmInfoContent(emCode, dto));
}
/**
* 获取设备的备品备件
*/
@ApiLog
@GetMapping("/getSparePart")
@ApiOperationSupport(order = 10)
@ApiOperation(value = "获取设备的备品备件")
public R<List<SparePartVO>> getSparePart(String emCode, String startTime, String endTime) {
return R.data(em_infoService.getSparePart(emCode, startTime, endTime));
}
}

219
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmTreeController.java

@ -0,0 +1,219 @@
package com.hnac.hzims.equipment.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.equipment.dto.EmTreeDTO;
import com.hnac.hzims.equipment.entity.*;
import com.hnac.hzims.equipment.service.*;
import com.hnac.hzims.equipment.service.IEmTreeService;
import com.hnac.hzims.util.MemoryPagination;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 设备树控制层
* @author tanghaihao
* @date 2023年06月15日 15:23
*/
@RestController
@AllArgsConstructor
@RequestMapping("/em/tree")
@Api(value = "设备树控制层", tags = "设备树管理,包括巡检内容、设备参数")
public class EmTreeController extends BladeController {
private final IEmTreeService emTreeService;
private final IEmTreeInspectService emTreeInspectService;
private final IEmTreeParamService emTreeParamService;
private final IEmTreeBasicService emTreeBasicService;
private final IEmInfoService emInfoService;
/**
* 设备定义列表分页
* @param emTree
* @param query
* @return
*/
@GetMapping("/page")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "分页")
@ApiImplicitParams({
})
public R<Map<String, Object>> getEmTreePage(EmTreeEntity emTree, Query query) {
Map<String, Object> result = new HashMap<>();
LambdaQueryWrapper<EmTreeEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(EmTreeEntity::getDefinitionId, emTree.getDefinitionId());
if (Func.isNotEmpty(emTree.getPid())) {
wrapper.eq(EmTreeEntity::getPid, emTree.getPid());
}
if (Func.isNotEmpty(emTree.getSignage())) {
wrapper.like(EmTreeEntity::getSignage, emTree.getSignage());
}
if (Func.isNotEmpty(emTree.getName())) {
wrapper.like(EmTreeEntity::getName, emTree.getName());
}
wrapper.orderByAsc(EmTreeEntity::getSort);
List<EmTreeEntity> list = emTreeService.list(wrapper);
List<EmTreeEntity> resultList = new ArrayList<>();
if (Func.isNotEmpty(emTree.getPid()) || Func.isNotEmpty(emTree.getSignage()) || Func.isNotEmpty(emTree.getName())) {
// 把筛选过的数据子设备也查询出来,再拼成树结构
for (EmTreeEntity parentEmTree : list) {
LambdaQueryWrapper<EmTreeEntity> parentWrapper = new LambdaQueryWrapper<>();
parentWrapper.likeRight(EmTreeEntity::getPath, parentEmTree.getPath());
List<EmTreeEntity> emTreeList = emTreeService.list(parentWrapper);
Map<Long, List<EmTreeEntity>> emTreeMap = emTreeList.stream().collect(Collectors.groupingBy(EmTreeEntity::getPid));
emTreeList.forEach(tree -> {
tree.setChildren(emTreeMap.get(tree.getId()));
});
emTreeList = emTreeList.stream().filter(item -> item.getPid().equals(parentEmTree.getPid())).collect(Collectors.toList());
resultList.addAll(emTreeList);
}
} else {
// 把List结构数据转换成树结构
Map<Long, List<EmTreeEntity>> emTreeMap = list.stream().collect(Collectors.groupingBy(EmTreeEntity::getPid));
list.forEach(tree -> {
tree.setChildren(emTreeMap.get(tree.getId()));
});
resultList = list.stream().filter(item -> item.getPid().equals(0L)).collect(Collectors.toList());
}
// 内存分页
resultList = MemoryPagination.pagination(resultList, query.getCurrent(), query.getSize());
result.put("data", resultList);
result.put("total", resultList.size());
return R.data(result);
}
/**
* 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "新增", notes = "传入EmTreeDTO")
public R save(@Valid @RequestBody EmTreeDTO emTreeDTO) {
return R.data(emTreeService.saveEmTrree(emTreeDTO));
}
/**
* 编辑
*/
@PostMapping("/update")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "编辑", notes = "传入EmTreeDTO")
public R update(@Valid @RequestBody EmTreeDTO emTreeDTO) {
return R.data(emTreeService.updateEmTrree(emTreeDTO));
}
/**
* 删除
*/
@GetMapping("/remove")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "逻辑删除", notes = "传入id")
public R remove(Long id) {
LambdaQueryWrapper<EmTreeEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(EmTreeEntity::getPid, id);
List<EmTreeEntity> list = emTreeService.list(wrapper);
if (Func.isNotEmpty(list)) {
return R.fail("存在子设备不能删除");
}
LambdaQueryWrapper<EmInfoEntity> infoWrapper = new LambdaQueryWrapper<>();
infoWrapper.eq(EmInfoEntity::getTreeId, id);
List<EmInfoEntity> infoList = emInfoService.list(infoWrapper);
if (Func.isNotEmpty(infoList)) {
return R.fail("设备树已被设备信息使用,不能删除");
}
return R.status(emTreeService.removeById(id));
}
/**
* 通过设备定义id获取设备树(树结构)
*/
@GetMapping("/getEmTreeByDefinitionId")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "通过设备定义id获取设备树(树结构)", notes = "传入设备定义id")
public R getEmTreeByDefinitionId(Long definitionId) {
return R.data(emTreeService.getEmTreeByDefinitionId(definitionId));
}
/**
* 通过父设备树id获取子设备树(树结构)
*/
@GetMapping("/getSonEmTreeByPid")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "通过父设备树id获取子设备树(树结构)", notes = "传入父设备树id")
public R getSonEmTreeByPid(Long pid) {
return R.data(emTreeService.getSonEmTreeByPid(pid));
}
/**
* 获取定义的所有设备(下拉列表)
*/
@GetMapping("/getDefinitionAllEmTree")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "获取定义的所有设备(下拉列表)", notes = "传入设备定义id")
public R getDefinitionAllDevice(Long definitionId) {
LambdaQueryWrapper<EmTreeEntity> wrapper = new LambdaQueryWrapper();
wrapper.eq(EmTreeEntity::getDefinitionId, definitionId);
wrapper.ne(EmTreeEntity::getEmGrade, 5);
return R.data(emTreeService.list(wrapper));
}
/**
* 获取设备树绑定的巡检内容
*/
@GetMapping("/getEmTreeContent")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "获取设备树绑定的巡检内容", notes = "传入设备树id")
public R getEmTreeContent(Long treeId) {
LambdaQueryWrapper<EmTreeInspectEntity> wrapper = new LambdaQueryWrapper();
wrapper.eq(EmTreeInspectEntity::getTreeId, treeId);
return R.data(emTreeInspectService.list(wrapper));
}
/**
* 获取设备树绑定的参数
*/
@GetMapping("/getEmTreeParam")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "获取设备树绑定的参数", notes = "传入设备树id")
public R getEmTreeParam(Long treeId) {
LambdaQueryWrapper<EmTreeParamEntity> wrapper = new LambdaQueryWrapper();
wrapper.eq(EmTreeParamEntity::getTreeId, treeId);
return R.data(emTreeParamService.list(wrapper));
}
/**
* 获取设备树绑定的物资
*/
@GetMapping("/getEmTreeBasic")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "获取设备树绑定的物资", notes = "传入设备树id")
public R getEmTreeBasic(Long treeId) {
LambdaQueryWrapper<EmTreeBasicEntity> wrapper = new LambdaQueryWrapper();
wrapper.eq(EmTreeBasicEntity::getTreeId, treeId);
return R.data(emTreeBasicService.list(wrapper));
}
}

21
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/LifeCycleController.java

@ -0,0 +1,21 @@
package com.hnac.hzims.equipment.controller;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 设备生命周期控制层
* @author tanghaihao
* @date 2023年07月05日 17:04
*/
@RestController
@AllArgsConstructor
@RequestMapping("/lifecycle")
@Api(value = "设备生命周期控制层", tags = "设备生命周期")
public class LifeCycleController extends BladeController {
}

26
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/dto/DeviceTreeDTO.java

@ -0,0 +1,26 @@
package com.hnac.hzims.equipment.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author tanghaihao
* @date 2023年06月20日 10:46
*/
@Data
public class DeviceTreeDTO {
@ApiModelProperty(value = "站点ID")
private String stationId;
@ApiModelProperty(value = "设备信息ID")
private Long infoId;
@ApiModelProperty(value = "设备定义ID")
private Long definitionId;
@ApiModelProperty(value = "设备树ids")
private List<EmTreeIdsDTO> treeIds;
}

37
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/dto/EmDefinitionDTO.java

@ -0,0 +1,37 @@
package com.hnac.hzims.equipment.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @author tanghaihao
* @date 2023年06月15日 10:22
*/
@Data
public class EmDefinitionDTO {
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "站点类型")
@NotNull
private String stationType;
@ApiModelProperty(value = "类型")
@NotNull
private String type;
@ApiModelProperty(value = "设备定义名称")
@NotNull
private String name;
@ApiModelProperty(value = "模型标识")
@NotNull
private String modelSignage;
@ApiModelProperty(value = "模型标识")
private String modelName;
}

66
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/dto/EmTreeDTO.java

@ -0,0 +1,66 @@
package com.hnac.hzims.equipment.dto;
import com.hnac.hzims.equipment.entity.EmTreeInspectEntity;
import com.hnac.hzims.equipment.entity.EmTreeParamEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @author tanghaihao
* @date 2023年06月15日 15:44
*/
@Data
public class EmTreeDTO {
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "设备定义Id")
@NotNull
private Long definitionId;
@ApiModelProperty(value = "父Id")
private Long pid;
@ApiModelProperty(value = "设备类型")
@NotNull
private String emType;
@ApiModelProperty("机组类型")
private String setType;
@ApiModelProperty(value = "设备名称")
@NotNull
private String name;
@ApiModelProperty(value = "设备标识")
@NotNull
private String signage;
@ApiModelProperty(value = "排序")
@NotNull
private Integer sort;
@ApiModelProperty(value = "所属组织")
@NotNull
private Long refOreanization;
@ApiModelProperty(value = "设备类别")
private String gradeCode;
@ApiModelProperty(value = "巡检标准")
@NotNull
private String inspectStandard;
@ApiModelProperty(value = "巡检内容")
private List<EmTreeInspectEntity> emTreeInspectList;
@ApiModelProperty(value = "设备参数")
private List<EmTreeParamEntity> emTreeParamList;
@ApiModelProperty(value = "物资ids")
private List<Long> basicIds;
}

21
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/dto/EmTreeIdsDTO.java

@ -0,0 +1,21 @@
package com.hnac.hzims.equipment.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hnac.hzims.equipment.entity.EmTreeEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author tanghaihao
* @date 2023年07月10日 11:44
*/
@Data
public class EmTreeIdsDTO {
@ApiModelProperty(value = "设备树Id")
private Long treeId;
@ApiModelProperty(value = "子设备树")
private List<EmTreeIdsDTO> children;
}

10
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java

@ -133,4 +133,14 @@ public class EmInfoClient implements IEmInfoClient {
return service.getEmCreateTable(tableNames);
}
/**
*
* @param emCode
* @return
*/
@GetMapping(value = GET_EM_INFO_TREE_BY_EM_CODE)
@Override
public R<List<EmInfoEntity>> getEmInfoTreeByEmCode(String emCode) {
return R.data(service.getEmInfoTreeByEmCode(emCode));
}
}

7
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmDefinitionMapper.java

@ -0,0 +1,7 @@
package com.hnac.hzims.equipment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.equipment.entity.EmDefinitionEntity;
public interface EmDefinitionMapper extends BaseMapper<EmDefinitionEntity> {
}

5
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmDefinitionMapper.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.equipment.mapper.EmDefinitionMapper">
</mapper>

5
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.java

@ -4,6 +4,7 @@ import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.vo.EmInfoExtendVo;
import com.hnac.hzims.equipment.vo.DeviceVO;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.equipment.vo.SparePartVO;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.datascope.annotation.UserDataAuth;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
@ -48,4 +49,8 @@ public interface EmInfoMapper extends UserDataScopeBaseMapper<EmInfoEntity> {
String getCurDataBaseName();
List<DeviceVO> listByTenantId(@Param("tenantId") String tenantId);
Integer getMaxEmIndexByPid(@Param("pid") Long pid);
List<SparePartVO> getSparePart(@Param("path") String path, @Param("startTime") String startTime, @Param("endTime") String endTime);
}

28
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.xml

@ -115,4 +115,32 @@
where is_deleted = 0
and tenant_id = #{tenantId}
</select>
<select id="getMaxEmIndexByPid" resultType="java.lang.Integer">
select max(em_index) from hzims_em_info where GPID = #{pid}
</select>
<select id="getSparePart" resultType="com.hnac.hzims.equipment.vo.SparePartVO">
select info.`NAME` as emName,house.`NAME` as houseName,basic.`NAME` as basicName,
mat.number as expend,basic.UPPER_LIMIT,basic.LOWER_LIMIT,total.stock
from hzims_em_info info
LEFT JOIN hzims_em_tree tree ON info.tree_id = tree.id
LEFT JOIN hzims_em_tree_basic etb ON tree.id = etb.tree_id
LEFT JOIN dev_hzims_assets.wt_sp_basic basic ON etb.basic_id = basic.id
LEFT JOIN dev_hzims_assets.wt_sp_total total ON basic.id = total.SP_BASIC_ID
LEFT JOIN dev_hzims_assets.wt_sp_warehouse house ON total.WAREHOUSE_ID = house.id
LEFT JOIN dev_hzims_operation.hzims_oper_access_material mat ON basic.id = mat.SP_BASIC_ID
<where>
<if test="path != null">
info.path like CONCAT(#{path},'%')
</if>
<if test="startTime != null">
and mat.UPDATE_TIME &gt;= #{startTime}
</if>
<if test="endTime != null">
and mat.UPDATE_TIME &lt;= #{endTime}
</if>
</where>
GROUP BY info.id, basic.`CODE`
</select>
</mapper>

11
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeBasicMapper.java

@ -0,0 +1,11 @@
package com.hnac.hzims.equipment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.equipment.entity.EmTreeBasicEntity;
/**
* @author tanghaihao
* @date 2023年07月14日 16:38
*/
public interface EmTreeBasicMapper extends BaseMapper<EmTreeBasicEntity> {
}

5
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeBasicMapper.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.equipment.mapper.EmTreeBasicMapper">
</mapper>

8
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeInspectMapper.java

@ -0,0 +1,8 @@
package com.hnac.hzims.equipment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.equipment.entity.EmTreeInspectEntity;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
public interface EmTreeInspectMapper extends BaseMapper<EmTreeInspectEntity> {
}

5
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeInspectMapper.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.equipment.mapper.EmTreeInspectMapper">
</mapper>

7
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeMapper.java

@ -0,0 +1,7 @@
package com.hnac.hzims.equipment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.equipment.entity.EmTreeEntity;
public interface EmTreeMapper extends BaseMapper<EmTreeEntity> {
}

5
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeMapper.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.equipment.mapper.EmTreeMapper">
</mapper>

8
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeParamMapper.java

@ -0,0 +1,8 @@
package com.hnac.hzims.equipment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.equipment.entity.EmTreeParamEntity;
public interface EmTreeParamMapper extends BaseMapper<EmTreeParamEntity> {
}

5
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeParamMapper.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.equipment.mapper.EmTreeParamMapper">
</mapper>

7
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmDefinitionService.java

@ -0,0 +1,7 @@
package com.hnac.hzims.equipment.service;
import com.hnac.hzims.equipment.entity.EmDefinitionEntity;
import org.springblade.core.mp.base.BaseService;
public interface IEmDefinitionService extends BaseService<EmDefinitionEntity> {
}

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

@ -1,7 +1,9 @@
package com.hnac.hzims.equipment.service;
import com.hnac.hzims.equipment.dto.DeviceTreeDTO;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.vo.*;
import com.hnac.hzinfo.inspect.obj.dto.ContentDTO;
import io.swagger.annotations.ApiParam;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.api.R;
@ -19,6 +21,10 @@ import java.util.Map;
*/
public interface IEmInfoService extends BaseService<EmInfoEntity> {
String PUBLIC_TYPE = "1";
String SET_TYPE = "2";
String OTHERS_TYPE = "3";
/**
* 根据emCode获取设备
* @return
@ -53,6 +59,7 @@ public interface IEmInfoService extends BaseService<EmInfoEntity> {
EmInfoEntity getEmInfoByEmCode(String emCode);
List<EmInfoEntity> getEmInfoTreeByEmCode(String emCode);
void loadEmInfo();
@ -65,4 +72,14 @@ public interface IEmInfoService extends BaseService<EmInfoEntity> {
List<DeviceVO> listByTenantId(String tenantId);
Boolean remove(String ids);
Boolean importDeviceTree(DeviceTreeDTO deviceTreeDTO);
Boolean importSonDeviceTree(DeviceTreeDTO deviceTreeDTO);
List<EmInfoContentVO> getEmInfoContent(String code, ContentDTO dto);
List<SparePartVO> getSparePart(String emCode, String startTime, String endTime);
List<EmInfoEntity> convertToTree(Long pid, List<EmInfoEntity> list);
}

7
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmTreeBasicService.java

@ -0,0 +1,7 @@
package com.hnac.hzims.equipment.service;
import com.hnac.hzims.equipment.entity.EmTreeBasicEntity;
import org.springblade.core.mp.base.BaseService;
public interface IEmTreeBasicService extends BaseService<EmTreeBasicEntity> {
}

7
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmTreeInspectService.java

@ -0,0 +1,7 @@
package com.hnac.hzims.equipment.service;
import com.hnac.hzims.equipment.entity.EmTreeInspectEntity;
import org.springblade.core.mp.base.BaseService;
public interface IEmTreeInspectService extends BaseService<EmTreeInspectEntity> {
}

7
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmTreeParamService.java

@ -0,0 +1,7 @@
package com.hnac.hzims.equipment.service;
import com.hnac.hzims.equipment.entity.EmTreeParamEntity;
import org.springblade.core.mp.base.BaseService;
public interface IEmTreeParamService extends BaseService<EmTreeParamEntity> {
}

19
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmTreeService.java

@ -0,0 +1,19 @@
package com.hnac.hzims.equipment.service;
import com.hnac.hzims.equipment.dto.EmTreeDTO;
import com.hnac.hzims.equipment.entity.EmTreeEntity;
import com.hnac.hzims.equipment.vo.EmTreeVO;
import org.springblade.core.mp.base.BaseService;
import java.util.List;
public interface IEmTreeService extends BaseService<EmTreeEntity> {
Boolean saveEmTrree(EmTreeDTO emTreeDTO);
Boolean updateEmTrree(EmTreeDTO emTreeDTO);
List<EmTreeEntity> getEmTreeByDefinitionId(Long definitionId);
List<EmTreeEntity> getSonEmTreeByPid(Long pid);
}

19
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmAssociationDetailServiceImpl.java

@ -1,26 +1,11 @@
package com.hnac.hzims.equipment.service.impl;
import ReadData.ReadData;
import ReadData.ReadDataTypes;
import ReadData.YcRValue;
import com.alibaba.fastjson.JSON;
import com.hnac.hzims.equipment.entity.EmAssociationDetailEntity;
import com.hnac.hzims.equipment.mapper.EmAssociationDetailMapper;
import com.hnac.hzims.equipment.service.IEmAssociationDetailService;
import com.hnac.hzims.equipment.vo.EmAssociationDetailVo;
import com.hnac.hzims.fdp.util.HttpRequestUtil;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;
@Service
public class EmAssociationDetailServiceImpl extends BaseServiceImpl<EmAssociationDetailMapper, EmAssociationDetailEntity> implements IEmAssociationDetailService {
@ -29,7 +14,7 @@ public class EmAssociationDetailServiceImpl extends BaseServiceImpl<EmAssociatio
public String path;
public Map getRealValue(List<EmAssociationDetailVo> list, String tenantId) {
/*public Map getRealValue(List<EmAssociationDetailVo> list, String tenantId) {
Map<String, Object> resultMap = new HashMap<>();
List<Map> listMap = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
@ -78,5 +63,5 @@ public class EmAssociationDetailServiceImpl extends BaseServiceImpl<EmAssociatio
map.put("state", emAssociationDetailVo.getProType() == "yc");
maps.put("data", map);
return maps;
}
}*/
}

17
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmDefinitionServiceImpl.java

@ -0,0 +1,17 @@
package com.hnac.hzims.equipment.service.impl;
import com.hnac.hzims.equipment.entity.EmDefinitionEntity;
import com.hnac.hzims.equipment.mapper.EmDefinitionMapper;
import com.hnac.hzims.equipment.service.IEmDefinitionService;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* @author tanghaihao
* @date 2023年06月15日 9:08
*/
@Service
@Slf4j
public class EmDefinitionServiceImpl extends BaseServiceImpl<EmDefinitionMapper, EmDefinitionEntity> implements IEmDefinitionService {
}

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

@ -6,9 +6,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.api.client.util.Sleeper;
import com.google.common.collect.Lists;
import com.hnac.hzims.equipment.EquipmentContants;
import com.hnac.hzims.equipment.dto.DeviceTreeDTO;
import com.hnac.hzims.equipment.dto.EmTreeIdsDTO;
import com.hnac.hzims.equipment.entity.*;
import com.hnac.hzims.equipment.mapper.EmInfoMapper;
import com.hnac.hzims.equipment.mapper.EmInfoNoScopeMapper;
@ -21,17 +22,34 @@ import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.util.TableJsonUtils;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO;
import com.hnac.hzinfo.datasearch.device.IDeviceClient;
import com.hnac.hzinfo.inspect.obj.dto.ContentDTO;
import com.hnac.hzinfo.inspect.obj.dto.ContentDefinitionDTO;
import com.hnac.hzinfo.inspect.obj.dto.ProjectDTO;
import com.hnac.hzinfo.inspect.obj.feign.IContentDefinitionClient;
import com.hnac.hzinfo.inspect.obj.feign.IProjectClient;
import com.hnac.hzinfo.inspect.obj.request.ProjectContentRequest;
import com.hnac.hzinfo.inspect.obj.vo.ContentDefinitionVO;
import com.hnac.hzinfo.inspect.obj.vo.ContentVO;
import com.hnac.hzinfo.inspect.obj.vo.ProjectVO;
import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO;
import com.hnac.hzinfo.sdk.core.response.Result;
import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient;
import com.hnac.hzinfo.sdk.v5.device.dto.DeviceChildrenDTO;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceChildrenVO;
import com.hnac.hzinfo.sdk.v5.project.ProjectClient;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
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.*;
import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient;
import org.springblade.system.vo.CreateTableVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
@ -41,8 +59,10 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.*;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -63,6 +83,12 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
@Autowired
private IEmModelService modelService;
@Autowired
private IEmTreeService emTreeService;
@Autowired
private IEmTreeParamService emTreeParamService;
@Autowired
private IEmTreeInspectService emTreeInspectService;
@Autowired
private IStationClient stationClient;
@Autowired
private IAnalyseDataSearchClient searchClient;
@ -77,6 +103,12 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
private DeviceClient deviceClient;
@Autowired
private IProjectClient projectClient;
@Autowired
private IContentDefinitionClient contentDefinitionClient;
@Autowired
private ISysClient sysClient;
@Autowired
@ -130,6 +162,7 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
this.validEmInfo(em_info);
EmInfoEntity infoEntity = em_info.getInfo();
infoEntity.setNumber(emInfoCodePrefix + IdWorker.getId());
infoEntity.setPath("/" + infoEntity.getNumber());
if (this.save(infoEntity)) {
this.getStationCodeStoreRedis();
Long infoId = em_info.getInfo().getId();
@ -276,6 +309,12 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
return this.baseMapper.selectEmInfoByEmCode(emCode);
}
@Override
public List<EmInfoEntity> getEmInfoTreeByEmCode(String emCode) {
return null;
}
/**
* 把设备信息及装机容量ctpt从Redis 取出来
*/
@ -451,6 +490,98 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
return this.deleteLogic(Func.toLongList(",", ids));
}
@Override
@Transactional
public Boolean importDeviceTree(DeviceTreeDTO deviceTreeDTO) {
StationEntity station = stationClient.getStationByCode(deviceTreeDTO.getStationId()).getData();
if (Func.isEmpty(station)) {
throw new ServiceException("站点不存在");
}
copyDeviceTree(station, 0L,deviceTreeDTO.getDefinitionId() , deviceTreeDTO.getTreeIds());
return true;
}
@Override
public Boolean importSonDeviceTree(DeviceTreeDTO deviceTreeDTO) {
EmInfoEntity emInfo = this.getById(deviceTreeDTO.getInfoId());
StationEntity stationEntity = new StationEntity();
stationEntity.setRefDept(emInfo.getDepartment());
StationEntity station = stationClient.getStationByCodeOrRedDept(stationEntity).getData();
if (Func.isEmpty(station)) {
throw new ServiceException("设备负责部门未绑定站点");
}
EmTreeEntity emTree = emTreeService.getById(emInfo.getTreeId());
copyDeviceTree(station, deviceTreeDTO.getInfoId(), emTree.getDefinitionId(), deviceTreeDTO.getTreeIds());
return true;
}
@Override
public List<EmInfoContentVO> getEmInfoContent(String emCode, ContentDTO dto) {
List<EmInfoContentVO> emInfoContentList = new ArrayList<>();
ProjectContentRequest request = new ProjectContentRequest();
request.setCurrent(1);
request.setSize(-1);
request.setEmCode(emCode);
request.setContentDTO(dto);
R<ProjectVO> projectResult = projectClient.getProjectAndContentByEmCode(request);
if (projectResult.getCode() != 200) {
throw new ServiceException("获取项目信息失败");
}
ProjectVO projectVO = projectResult.getData();
if (Func.isEmpty(projectVO)) {
return emInfoContentList;
}
List<ContentVO> contentVOList = projectVO.getContentList();
if (Func.isEmpty(contentVOList)) {
return emInfoContentList;
}
List<String> attrSignages = contentVOList.stream().map(ContentVO::getAttrSignage).collect(Collectors.toList());
// 通过设备编号找到相同的设备实例获取设备绑定的采集点
DeviceChildrenDTO deviceChildrenDTO = new DeviceChildrenDTO();
deviceChildrenDTO.setDeviceCode(emCode);
deviceChildrenDTO.setType("attr");
deviceChildrenDTO.setSignages(attrSignages);
Result<List<DeviceChildrenVO>> deviceResult = deviceClient.getRealId(deviceChildrenDTO);
Map<String, DeviceChildrenVO> childrenMap = new HashMap<>();
if (deviceResult.getCode() == 200 && Func.isNotEmpty(deviceResult.getData())) {
List<DeviceChildrenVO> deviceChildrenList = deviceResult.getData();
childrenMap = deviceChildrenList.stream().collect(Collectors.toMap(DeviceChildrenVO::getSignage, Function.identity()));
}
// 拼接采集点到设备巡检内容
for (ContentVO content : contentVOList) {
EmInfoContentVO vo = new EmInfoContentVO();
BeanUtils.copyProperties(content, vo);
if (Func.isNotEmpty(childrenMap)) {
DeviceChildrenVO deviceChildrenVO = childrenMap.get(vo.getAttrSignage());
vo.setInstanceFacDeviceId(deviceChildrenVO.getRealId());
vo.setInstanceFacDeviceName(deviceChildrenVO.getFacName());
}
emInfoContentList.add(vo);
}
return emInfoContentList;
}
@Override
public List<SparePartVO> getSparePart(String emCode, String startTime, String endTime) {
EmInfoEntity emInfo = this.getEmInfoByEmCode(emCode);
return baseMapper.getSparePart(emInfo.getPath(), startTime, endTime);
}
@Override
public List<EmInfoEntity> convertToTree(Long pid, List<EmInfoEntity> list) {
// 把List结构数据转换成树结构
Map<Long, List<EmInfoEntity>> emTreeMap = list.stream().collect(Collectors.groupingBy(EmInfoEntity::getGpid));
list.forEach(tree -> {
tree.setInfoChildren(emTreeMap.get(tree.getId()));
});
return list.stream().filter(item -> item.getGpid().equals(pid)).collect(Collectors.toList());
}
/**
* 设备信息缓存(ctptinstalledCapacity监测点位)
@ -562,4 +693,161 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
// throw new ServiceException("设备编号已存在");
// });
}
private List<EmTreeEntity> getFatherAndSonDevice(EmInfoEntity emInfo, List<Long> treeIds){
List<EmTreeEntity> fatherAndSonList = new ArrayList<>();
List<String> parentSignages = new ArrayList<>();
List<EmTreeEntity> emTreeList = emTreeService.listByIds(treeIds);
for (EmTreeEntity emTree : emTreeList) {
LambdaQueryWrapper<EmTreeEntity> emTreeWrapper = new LambdaQueryWrapper();
emTreeWrapper.eq(EmTreeEntity::getDefinitionId, emTree.getDefinitionId());
emTreeWrapper.likeRight(EmTreeEntity::getPath, emTree.getPath());
if (Func.isNotEmpty(emInfo)) {
// 有设备信息说明是导入子设备,防止本级设备二次导入
emTreeWrapper.ne(EmTreeEntity::getId, emInfo.getTreeId());
}
// 获取所有子设备
List<EmTreeEntity> list = emTreeService.list(emTreeWrapper);
if (Func.isNotEmpty(list)) {
fatherAndSonList.addAll(list);
}
int index = 0;
if (Func.isNotEmpty(emInfo)) {
EmTreeEntity parentEmTree = emTreeService.getById(emInfo.getTreeId());
// 导入子设备根目录从父设备后面开始
index = emTree.getPath().indexOf(parentEmTree.getSignage()) + parentEmTree.getSignage().length();
}
// 通过path获取所有父设备标识,不包括自己
String parentPath = emTree.getPath().substring(index, emTree.getPath().lastIndexOf("/"));
if (parentPath.length() > 0) {
parentSignages.addAll(Arrays.asList(parentPath.split("/")));
}
}
if (Func.isNotEmpty(parentSignages)) {
LambdaQueryWrapper<EmTreeEntity> parentWrapper = new LambdaQueryWrapper();
parentWrapper.eq(EmTreeEntity::getDefinitionId, emTreeList.get(0).getDefinitionId());
parentWrapper.in(EmTreeEntity::getSignage, parentSignages);
// 通过标识获取父设备
List<EmTreeEntity> parentList = emTreeService.list(parentWrapper);
fatherAndSonList.addAll(parentList);
}
// 把List结构数据转换成树结构
Map<Long, List<EmTreeEntity>> fatherAndSonMap = fatherAndSonList.stream().collect(Collectors.groupingBy(EmTreeEntity::getPid));
fatherAndSonList.forEach(emTree -> {
emTree.setChildren(fatherAndSonMap.get(emTree.getId()));
});
List<EmTreeEntity> resultList = fatherAndSonList.stream().filter(item -> item.getPid() == 0).collect(Collectors.toList());
return resultList;
}
private void copyDeviceTree(StationEntity station, Long pid, Long definitionId, List<EmTreeIdsDTO> treeIds) {
List<ProjectDTO> projectDTOList = new ArrayList<>();
LambdaQueryWrapper<EmTreeEntity> wrapper = new LambdaQueryWrapper();
wrapper.eq(EmTreeEntity::getDefinitionId, definitionId);
List<EmTreeEntity> definitionEmTrees = emTreeService.list(wrapper);
Map<Long, EmTreeEntity> emTreeMap = definitionEmTrees.stream().collect(Collectors.toMap(EmTreeEntity::getId, Function.identity()));
for (EmTreeIdsDTO emTreeIdsDTO : treeIds) {
EmTreeEntity emTree = emTreeMap.get(emTreeIdsDTO.getTreeId());
EmInfoEntity emInfo = new EmInfoEntity();
// 把设备树复制成设备实例
BeanUtils.copyProperties(emTree, emInfo);
Long infoId = IdWorker.getId();
String number = emInfoCodePrefix + IdWorker.getId();
emInfo.setId(infoId);
emInfo.setGpid(pid);
emInfo.setTreeId(emTree.getId());
emInfo.setInsLocation(station.getAddress());
emInfo.setNumber(number);
emInfo.setStationCode(station.getCode());
EmInfoEntity parentEmInfo = this.getById(pid);
if (Func.isNotEmpty(parentEmInfo)) {
emInfo.setPath(parentEmInfo.getPath() + "/" + number);
} else {
emInfo.setPath("/" + number);
}
emInfo.setLgtd(new BigDecimal(station.getLgtd().toString()));
emInfo.setLttd(new BigDecimal(station.getLttd().toString()));
emInfo.setDepartment(station.getRefDept());
emInfo.setInstallTime(new Date());
emInfo.setRunStatus("1");
emInfo.setStatus(1);
emInfo.setRunDate(new Date());
emInfo.setCreateDept(station.getRefDept());
emInfo.setCreateTime(new Date());
emInfo.setCreateUser(AuthUtil.getUserId());
if (SET_TYPE.equals(emInfo.getEmType())) {
Integer maxIndex = baseMapper.getMaxEmIndexByPid(pid);
if (Func.isNotEmpty(maxIndex)) {
emInfo.setEmIndex(maxIndex + 1);
} else {
emInfo.setEmIndex(1);
}
emInfo.setName(emInfo.getEmIndex() + "号机组");
}
this.save(emInfo);
LambdaQueryWrapper<EmTreeParamEntity> treeParamWrapper = new LambdaQueryWrapper();
treeParamWrapper.eq(EmTreeParamEntity::getTreeId, emTree.getId());
List<EmTreeParamEntity> treeParamList = emTreeParamService.list(treeParamWrapper);
// 复制设备参数
if (Func.isNotEmpty(treeParamList)) {
List<EmParamEntity> paramList = new ArrayList<>();
for (EmTreeParamEntity emTreeParam : treeParamList) {
EmParamEntity param = new EmParamEntity();
BeanUtils.copyProperties(emTreeParam, param);
param.setInfoId(infoId);
param.setId(null);
paramList.add(param);
}
paramService.saveBatch(paramList);
}
// 新增巡检项目和巡检内容
ProjectDTO projectDTO = new ProjectDTO();
projectDTO.setEmCode(emInfo.getNumber());
projectDTO.setName(emInfo.getName());
// 获取设备树中绑定的巡检内容
LambdaQueryWrapper<EmTreeInspectEntity> inspectWrapper = new LambdaQueryWrapper();
inspectWrapper.eq(EmTreeInspectEntity::getTreeId, emTree.getId());
List<EmTreeInspectEntity> list = emTreeInspectService.list(inspectWrapper);
List<Long> contentIds = list.stream().map(EmTreeInspectEntity::getContentId).collect(Collectors.toList());
ContentDefinitionDTO contentDefinitionDTO = new ContentDefinitionDTO();
contentDefinitionDTO.setIds(contentIds);
R<List<ContentDefinitionVO>> result = contentDefinitionClient.list(contentDefinitionDTO);
if (result.getCode() != 200) {
throw new ServiceException("获取巡检内容失败");
}
List<ContentDefinitionVO> contentDefinitionList = result.getData();
if (Func.isNotEmpty(contentDefinitionList)) {
Map<Long, ContentDefinitionVO> contentDefinitionMap = contentDefinitionList.stream().collect(Collectors.toMap(ContentDefinitionVO::getId, Function.identity()));
// 把巡检内容拼装成projectDTO
List<ContentDTO> contentDTOList = new ArrayList<>();
for (EmTreeInspectEntity emTreeInspect : list) {
ContentDTO dto = new ContentDTO();
ContentDefinitionVO vo = contentDefinitionMap.get(emTreeInspect.getContentId());
BeanUtils.copyProperties(vo, dto);
dto.setModelSignage(emTreeInspect.getModelSignage());
dto.setAttrSignage(emTreeInspect.getModelAttrSignage());
dto.setAttrName(emTreeInspect.getModelAttrName());
dto.setId(null);
contentDTOList.add(dto);
}
projectDTO.setContentDTOList(contentDTOList);
}
projectDTOList.add(projectDTO);
if (Func.isNotEmpty(emTreeIdsDTO.getChildren())) {
copyDeviceTree(station, infoId, definitionId, emTreeIdsDTO.getChildren());
}
}
if (Func.isNotEmpty(projectDTOList)) {
projectClient.addProjectAndContent(projectDTOList);
}
}
}

22
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmTreeBasicServiceImpl.java

@ -0,0 +1,22 @@
package com.hnac.hzims.equipment.service.impl;
import com.hnac.hzims.equipment.entity.EmTreeBasicEntity;
import com.hnac.hzims.equipment.entity.EmTreeInspectEntity;
import com.hnac.hzims.equipment.mapper.EmTreeBasicMapper;
import com.hnac.hzims.equipment.mapper.EmTreeInspectMapper;
import com.hnac.hzims.equipment.service.IEmTreeBasicService;
import com.hnac.hzims.equipment.service.IEmTreeInspectService;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* @author tanghaihao
* @date 2023年07月14日 16:36
*/
@Service
@Slf4j
public class EmTreeBasicServiceImpl extends BaseServiceImpl<EmTreeBasicMapper, EmTreeBasicEntity> implements IEmTreeBasicService {
}

17
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmTreeInspectServiceImpl.java

@ -0,0 +1,17 @@
package com.hnac.hzims.equipment.service.impl;
import com.hnac.hzims.equipment.entity.EmTreeInspectEntity;
import com.hnac.hzims.equipment.mapper.EmTreeInspectMapper;
import com.hnac.hzims.equipment.service.IEmTreeInspectService;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* @author tanghaihao
* @date 2023年06月15日 9:08
*/
@Service
@Slf4j
public class EmTreeInspectServiceImpl extends BaseServiceImpl<EmTreeInspectMapper, EmTreeInspectEntity> implements IEmTreeInspectService {
}

17
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmTreeParamServiceImpl.java

@ -0,0 +1,17 @@
package com.hnac.hzims.equipment.service.impl;
import com.hnac.hzims.equipment.entity.EmTreeParamEntity;
import com.hnac.hzims.equipment.mapper.EmTreeParamMapper;
import com.hnac.hzims.equipment.service.IEmTreeParamService;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* @author tanghaihao
* @date 2023年06月15日 9:08
*/
@Service
@Slf4j
public class EmTreeParamServiceImpl extends BaseServiceImpl<EmTreeParamMapper, EmTreeParamEntity> implements IEmTreeParamService {
}

235
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmTreeServiceImpl.java

@ -0,0 +1,235 @@
package com.hnac.hzims.equipment.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.equipment.dto.EmTreeDTO;
import com.hnac.hzims.equipment.entity.EmTreeBasicEntity;
import com.hnac.hzims.equipment.entity.EmTreeEntity;
import com.hnac.hzims.equipment.entity.EmTreeInspectEntity;
import com.hnac.hzims.equipment.entity.EmTreeParamEntity;
import com.hnac.hzims.equipment.mapper.EmTreeMapper;
import com.hnac.hzims.equipment.service.IEmTreeBasicService;
import com.hnac.hzims.equipment.service.IEmTreeInspectService;
import com.hnac.hzims.equipment.service.IEmTreeParamService;
import com.hnac.hzims.equipment.service.IEmTreeService;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author tanghaihao
* @date 2023年06月15日 9:08
*/
@Service
@Slf4j
public class EmTreeServiceImpl extends BaseServiceImpl<EmTreeMapper, EmTreeEntity> implements IEmTreeService {
@Autowired
private IEmTreeInspectService emTreeInspectService;
@Autowired
private IEmTreeParamService emTreeParamService;
@Autowired
private IEmTreeBasicService emTreeBasicService;
@Override
@Transactional
public Boolean saveEmTrree(EmTreeDTO emTreeDTO) {
Long treeId = IdWorker.getId();
EmTreeEntity emTree = new EmTreeEntity();
Func.copy(emTreeDTO, emTree);
LambdaQueryWrapper<EmTreeEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(EmTreeEntity::getDefinitionId, emTree.getDefinitionId());
wrapper.eq(EmTreeEntity::getSignage, emTree.getSignage());
EmTreeEntity one = this.getOne(wrapper);
if (Func.isNotEmpty(one)) {
throw new ServiceException("在同一个定义中设备标识不能重复");
}
List<EmTreeInspectEntity> emTreeInspectList = emTreeDTO.getEmTreeInspectList();
for (EmTreeInspectEntity emTreeInspect: emTreeInspectList) {
emTreeInspect.setTreeId(treeId);
}
List<EmTreeParamEntity> emTreeParamList = emTreeDTO.getEmTreeParamList();
for (EmTreeParamEntity emTreeParam: emTreeParamList) {
emTreeParam.setTreeId(treeId);
}
List<EmTreeBasicEntity> emTreeBasicList = new ArrayList<>();
for (Long basicId : emTreeDTO.getBasicIds()) {
EmTreeBasicEntity emTreeBasic = new EmTreeBasicEntity();
emTreeBasic.setTreeId(treeId);
emTreeBasic.setBasicId(basicId);
emTreeBasicList.add(emTreeBasic);
}
emTreeInspectService.saveBatch(emTreeInspectList);
emTreeParamService.saveBatch(emTreeParamList);
emTreeBasicService.saveBatch(emTreeBasicList);
emTree.setId(treeId);
if (Func.isEmpty(emTree.getPid())) {
emTree.setEmGrade(0);
// 添加设备树标识路径,方便快速查询父子设备
emTree.setPath("/" + emTree.getSignage());
} else {
EmTreeEntity parentEmTree = this.getById(emTree.getPid());
if (parentEmTree.getEmGrade() >= 5) {
throw new ServiceException("设备等级最多五级");
}
emTree.setEmGrade(parentEmTree.getEmGrade() + 1);
EmTreeEntity parent = this.getById(emTree.getPid());
emTree.setPath(parent.getPath() + "/" + emTree.getSignage());
}
emTree.setCreateTime(new Date());
emTree.setCreateUser(AuthUtil.getUserId());
emTree.setStatus(1);
emTree.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
return this.save(emTree);
}
@Override
@Transactional
public Boolean updateEmTrree(EmTreeDTO emTreeDTO) {
EmTreeEntity emTree = new EmTreeEntity();
Func.copy(emTreeDTO, emTree);
LambdaQueryWrapper<EmTreeEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(EmTreeEntity::getSignage, emTree.getSignage());
wrapper.eq(EmTreeEntity::getDefinitionId, emTree.getDefinitionId());
wrapper.ne(EmTreeEntity::getId, emTree.getId());
EmTreeEntity one = this.getOne(wrapper);
if (Func.isNotEmpty(one)) {
throw new ServiceException("设备标识已存在");
}
// 更新设备巡检内容
List<EmTreeInspectEntity> emTreeInspectList = emTreeDTO.getEmTreeInspectList();
if (Func.isNotEmpty(emTreeInspectList)) {
for (EmTreeInspectEntity emTreeInspect: emTreeInspectList) {
emTreeInspect.setTreeId(emTree.getId());
}
emTreeInspectService.saveOrUpdateBatch(emTreeInspectList);
List<Long> updateInspectIds = emTreeInspectList.stream().map(EmTreeInspectEntity::getId).collect(Collectors.toList());
List<Long> removeInspectIds = new ArrayList<>();
LambdaQueryWrapper<EmTreeInspectEntity> inspectWrapper = new LambdaQueryWrapper();
inspectWrapper.eq(EmTreeInspectEntity::getTreeId, emTree.getId());
List<EmTreeInspectEntity> list = emTreeInspectService.list(inspectWrapper);
for (EmTreeInspectEntity inspect : list) {
if (!updateInspectIds.contains(inspect.getId())) {
removeInspectIds.add(inspect.getId());
}
}
// 删掉页面上删除的巡检内容
if (Func.isNotEmpty(removeInspectIds)) {
emTreeInspectService.removeByIds(removeInspectIds);
}
} else {
LambdaQueryWrapper<EmTreeInspectEntity> removeInspectWrapper = new LambdaQueryWrapper<>();
removeInspectWrapper.eq(EmTreeInspectEntity::getTreeId, emTreeDTO.getId());
emTreeInspectService.remove(removeInspectWrapper);
}
// 更新设备参数
List<EmTreeParamEntity> emTreeParamList = emTreeDTO.getEmTreeParamList();
if (Func.isNotEmpty(emTreeParamList)) {
for (EmTreeParamEntity emTreeParam : emTreeParamList) {
emTreeParam.setTreeId(emTree.getId());
}
emTreeParamService.saveOrUpdateBatch(emTreeParamList);
List<Long> updateParamIds = emTreeParamList.stream().map(EmTreeParamEntity::getId).collect(Collectors.toList());
List<Long> removeParamIds = new ArrayList<>();
LambdaQueryWrapper<EmTreeParamEntity> paramWrapper = new LambdaQueryWrapper();
paramWrapper.eq(EmTreeParamEntity::getTreeId, emTree.getId());
List<EmTreeParamEntity> list = emTreeParamService.list(paramWrapper);
for (EmTreeParamEntity param : list) {
if (!updateParamIds.contains(param.getId())) {
removeParamIds.add(param.getId());
}
}
// 删掉页面上删除的设备参数
if (Func.isNotEmpty(removeParamIds)) {
emTreeParamService.removeByIds(removeParamIds);
}
} else {
LambdaQueryWrapper<EmTreeParamEntity> removeParamWrapper = new LambdaQueryWrapper<>();
removeParamWrapper.eq(EmTreeParamEntity::getTreeId, emTreeDTO.getId());
emTreeParamService.remove(removeParamWrapper);
}
// 更新设备物资
List<Long> updateBasicIds = emTreeDTO.getBasicIds();
if (Func.isNotEmpty(updateBasicIds)) {
LambdaQueryWrapper<EmTreeBasicEntity> basicWrapper = new LambdaQueryWrapper();
basicWrapper.eq(EmTreeBasicEntity::getTreeId, emTree.getId());
List<EmTreeBasicEntity> list = emTreeBasicService.list(basicWrapper);
List<Long> oldBasicIds = list.stream().map(EmTreeBasicEntity::getBasicId).collect(Collectors.toList());
// 添加新增的设备物资
List<EmTreeBasicEntity> addBasicList = new ArrayList<>();
for (Long basicId : updateBasicIds) {
if (!oldBasicIds.contains(basicId)) {
EmTreeBasicEntity emTreeBasic = new EmTreeBasicEntity();
emTreeBasic.setTreeId(emTree.getId());
emTreeBasic.setBasicId(basicId);
addBasicList.add(emTreeBasic);
}
}
if (Func.isNotEmpty(addBasicList)) {
emTreeBasicService.saveBatch(addBasicList);
}
// 删掉页面上删除的设备参数
List<Long> removeBasicIds = new ArrayList<>();
for (EmTreeBasicEntity basic : list) {
if (!updateBasicIds.contains(basic.getBasicId())) {
removeBasicIds.add(basic.getId());
}
}
if (Func.isNotEmpty(removeBasicIds)) {
emTreeBasicService.removeByIds(removeBasicIds);
}
} else {
LambdaQueryWrapper<EmTreeBasicEntity> removeBasicWrapper = new LambdaQueryWrapper<>();
removeBasicWrapper.eq(EmTreeBasicEntity::getTreeId, emTree.getId());
emTreeBasicService.remove(removeBasicWrapper);
}
return this.updateById(emTree);
}
@Override
public List<EmTreeEntity> getEmTreeByDefinitionId(Long definitionId) {
List<EmTreeEntity> emTreeList = this.list(Wrappers.<EmTreeEntity>lambdaQuery().eq(EmTreeEntity::getDefinitionId, definitionId));
// 把List结构数据转换成树结构
Map<Long, List<EmTreeEntity>> emTreeMap = emTreeList.stream().collect(Collectors.groupingBy(EmTreeEntity::getPid));
emTreeList.forEach(emTree -> {
emTree.setChildren(emTreeMap.get(emTree.getId()));
});
List<EmTreeEntity> resultList = emTreeList.stream().filter(item -> item.getPid().equals(0L)).collect(Collectors.toList());
return resultList;
}
@Override
public List<EmTreeEntity> getSonEmTreeByPid(Long pid) {
EmTreeEntity parentEmTree = this.getById(pid);
List<EmTreeEntity> sonEmTreeList = this.list(Wrappers.<EmTreeEntity>lambdaQuery().likeRight(EmTreeEntity::getPath, parentEmTree.getPath()).ne(EmTreeEntity::getId, pid));
// 把List结构数据转换成树结构
Map<Long, List<EmTreeEntity>> emTreeMap = sonEmTreeList.stream().collect(Collectors.groupingBy(EmTreeEntity::getPid));
sonEmTreeList.forEach(emTree -> {
emTree.setChildren(emTreeMap.get(emTree.getId()));
});
List<EmTreeEntity> resultList = sonEmTreeList.stream().filter(item -> item.getPid().equals(pid)).collect(Collectors.toList());
return resultList;
}
}

49
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/vo/EmInfoContentVO.java

@ -0,0 +1,49 @@
package com.hnac.hzims.equipment.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 设备巡检内容VO
* @author tanghaihao
* @date 2023年07月07日 16:41
*/
@Data
public class EmInfoContentVO {
@ApiModelProperty(value = "内容编码")
private String code;
@ApiModelProperty(value = "内容名称,长度必须为1到128")
private String name;
@ApiModelProperty(value = "检测类型")
private String checkType;
@ApiModelProperty(value = "记录类型 0不记录 1仅选择 2仅记值 3选择并记值")
private String recordType;
@ApiModelProperty(value = "绑定物模型标识")
private String modelSignage;
@ApiModelProperty(value = "绑定物模型属性标识")
private String attrSignage;
@ApiModelProperty(value = "绑定物模型属性名称")
private String attrName;
@ApiModelProperty(value = "设备名称")
private String emName;
@ApiModelProperty(value = "绑定采集点ID")
private String facDeviceId;
@ApiModelProperty(value = "绑定采集点名称")
private String facDeviceName;
@ApiModelProperty(value = "实例采集点ID")
private String instanceFacDeviceId;
@ApiModelProperty(value = "实例采集点名称")
private String instanceFacDeviceName;
}

25
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/vo/EmTreeVO.java

@ -0,0 +1,25 @@
package com.hnac.hzims.equipment.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author tanghaihao
* @date 2023年06月16日 14:39
*/
@Data
public class EmTreeVO {
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "父Id")
private Long pid;
@ApiModelProperty(value = "设备名称")
private String name;
@ApiModelProperty(value = "子设备")
private List<EmTreeVO> children;
}

32
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/vo/SparePartVO.java

@ -0,0 +1,32 @@
package com.hnac.hzims.equipment.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author tanghaihao
* @date 2023年07月13日 17:23
*/
@Data
public class SparePartVO {
@ApiModelProperty(value = "设备名称")
private String emName;
@ApiModelProperty(value = "仓库")
private String houseName;
@ApiModelProperty(value = "物资种类")
private String basicName;
@ApiModelProperty(value = "物资消耗(件)")
private Integer expend;
@ApiModelProperty(value = "库存上限")
private Integer upperLimit;
@ApiModelProperty(value = "库存下限")
private Integer lowerLimit;
@ApiModelProperty(value = "物资库存(件)")
private Integer stock;
}

6
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/ModelController.java

@ -52,4 +52,10 @@ public class ModelController extends BladeController {
return R.data(modelService.getAttr(modelSignage));
}
@GetMapping("/getAllModel")
@ApiOperation("获取所有模型")
@ApiOperationSupport(order = 4)
public R<List<ModelVO>> getAllModel(String name) {
return R.data(modelService.getAllModel(name));
}
}

1
hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/IModelService.java

@ -34,5 +34,6 @@ public interface IModelService {
List<ModelAttrVO> getAttr(String modelSignage);
List<ModelVO> getAllModel(String name);
}

9
hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/ModelServiceImpl.java

@ -48,6 +48,15 @@ public class ModelServiceImpl implements IModelService {
}
@Override
public List<ModelVO> getAllModel(String name) {
R<List<ModelVO>> models = modelClient.getModelsLikeName(name);
Assert.isTrue(models.isSuccess(),() -> {
throw new ServiceException(models.getMsg());
});
return models.getData();
}
@Override
public List<ModelVO> mGroupByModel(Long modelGroupId) {
R<List<ModelVO>> listR = modelClient.mGroupByModel(modelGroupId);
Assert.isTrue(listR.isSuccess(),() -> {

39
hzims-service/equipment/src/main/java/com/hnac/hzims/util/MemoryPagination.java

@ -0,0 +1,39 @@
package com.hnac.hzims.util;
import org.springframework.util.CollectionUtils;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author tanghaihao
* @date 2023年07月12日 17:15
*/
public class MemoryPagination {
/**
* 内存分页
*
* @param records 待分页的数据
* @param pageNum 当前页码
* @param pageSize 每页显示的条数
* @return 分页之后的数据
*/
public static <T> List<T> pagination(List<T> records, int pageNum, int pageSize) {
if (CollectionUtils.isEmpty(records)) {
return Collections.emptyList();
}
int totalCount = records.size() ;
int remainder = totalCount % pageSize;
int pageCount = (remainder > 0) ? totalCount / pageSize + 1 : totalCount / pageSize;
if (remainder == 0) {
return records.stream().skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
} else {
if (pageNum == pageCount) {
return records.stream().skip((pageNum - 1) * pageSize).limit(totalCount).collect(Collectors.toList());
} else {
return records.stream().skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
}
}
}
}

13
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessTaskController.java

@ -9,6 +9,7 @@ import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO;
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 io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -21,6 +22,7 @@ import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/**
* 检修任务
@ -91,4 +93,15 @@ public class OperAccessTaskController extends BladeController {
return service.list(req, query);
}
/**
* 获取检修台账
*/
@ApiLog
@GetMapping("/getRepairBill")
@ApiOperationSupport(order = 60)
@ApiOperation(value = "获取检修台账")
public R<List<RepairBillVO>> getAccessTaskByEmCode(String emCode, String startTime, String endTime) {
return R.data(service.getRepairBill(emCode, startTime, endTime));
}
}

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

@ -1,6 +1,7 @@
package com.hnac.hzims.operational.access.mapper;
import com.baomidou.mybatisplus.annotation.SqlParser;
import com.hnac.hzims.operational.access.vo.RepairBillVO;
import org.springblade.core.datascope.annotation.UserDataAuth;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO;
@ -36,4 +37,6 @@ public interface OperAccessTaskMapper extends UserDataScopeBaseMapper<OperAccess
List<Map<String,Object>> getAccessConclusion(Map<String,Object> params);
List<OperAccessTaskEntity> selectAccessTask(@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("list")List<Long> list);
List<RepairBillVO> getRepairBill(@Param("path") String path, @Param("startTime") String startTime, @Param("endTime") String endTime);
}

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

@ -128,7 +128,8 @@
select count(hoat.`id`) ACCESS_TASK_COUNT
,count(case when hoat.`status` = 1 then 1 else null end) ACCESS_COMPLETE
from `hzims_oper_access_task` hoat
left join (select `EM_CODE`,count(`ID`) findProblemCount from `hzims_oper_phenomenon` where `IS_DELETED` = 0 group by `EM_CODE`) hop on hoat.`EM_CODE` = hop.`EM_CODE`
left join (select `EM_CODE`,count(`ID`) findProblemCount from `hzims_oper_phenomenon` where `IS_DELETED` = 0
group by `EM_CODE`) hop on hoat.`EM_CODE` = hop.`EM_CODE`
<where>
hoat.`IS_DELETED` =0
<if test="startDate != null">
@ -158,4 +159,25 @@
</foreach>
</if>
</select>
<select id="getRepairBill" resultType="com.hnac.hzims.operational.access.vo.RepairBillVO">
SELECT e.`NAME` AS emName,p.`GRADE_CODE`,count(t.ID) AS frequency,
sum(m.NUMBER) AS amount,t.ACT_HOURS,max(t.PLAN_START_TIME) AS recently
FROM hzims_oper_access_task t
LEFT JOIN hzims_oper_access_plan p ON t.PLAN_ID = p.ID
LEFT JOIN hzims_oper_access_material m ON t.ID = m.TASK_ID
LEFT JOIN dev_equipment.hzims_em_info e ON t.EM_CODE = e.NUMBER
<where>
<if test="path != null">
e.path like CONCAT(#{path},'%')
</if>
<if test="startTime != null">
and t.PLAN_START_TIME &gt;= #{startTime}
</if>
<if test="endTime != null">
and t.PLAN_START_TIME &lt;= #{endTime}
</if>
</where>
GROUP BY t.EM_CODE,p.`GRADE_CODE`
</select>
</mapper>

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessTaskService.java

@ -7,6 +7,7 @@ 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 org.springblade.core.mp.base.BaseService;
@ -74,4 +75,5 @@ public interface IOperAccessTaskService extends BaseService<OperAccessTaskEntity
*/
IPage<OperAccessTaskEntity> selectPage(Page<OperAccessTaskEntity> dbPage, OperAccessTaskEntity result);
List<RepairBillVO> getRepairBill(String emCode, String startTime, String endTime);
}

11
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java

@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.message.fegin.IMessagePushClient;
import com.hnac.hzims.message.req.PushExtrasReq;
import com.hnac.hzims.operational.OperationalConstants;
@ -21,6 +23,7 @@ import com.hnac.hzims.operational.access.entity.*;
import com.hnac.hzims.operational.access.mapper.OperAccessTaskMapper;
import com.hnac.hzims.operational.access.service.*;
import com.hnac.hzims.operational.access.vo.OperAccessTaskVO;
import com.hnac.hzims.operational.access.vo.RepairBillVO;
import com.hnac.hzims.operational.access.wrapper.OperAccessTaskDetailWrapper;
import com.hnac.hzims.operational.access.wrapper.OperAccessTaskWrapper;
import com.hnac.hzims.operational.defect.constants.DefectConstant;
@ -87,6 +90,7 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
private final IOperAccessMaterialService materialService;
private final IOperDefectService defectService;
private final IOperDefectStatisticsService defectStatisticsService;
private final IEmInfoClient emInfoClient;
@Transactional
@Override
@ -409,6 +413,13 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
return baseMapper.selectPage(dbPage, queryWrapper);
}
@Override
public List<RepairBillVO> getRepairBill(String emCode, String startTime, String endTime) {
EmInfoEntity emInfo = emInfoClient.getEmInfoByEmCode(emCode).getData();
List<RepairBillVO> repairBillList = baseMapper.getRepairBill(emInfo.getPath(), startTime, endTime);
return repairBillList;
}
/***
* 根据流程ID和处理人完成任务
* @param comleteTask

33
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/vo/RepairBillVO.java

@ -0,0 +1,33 @@
package com.hnac.hzims.operational.access.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 检修台账VO
* @author tanghaihao
* @date 2023年07月06日 15:58
*/
@Data
public class RepairBillVO {
@ApiModelProperty("设备名称")
private String emName;
@ApiModelProperty("检修等级")
private String gradeCode;
@ApiModelProperty("检修次数")
private Integer frequency;
@ApiModelProperty("耗材数量")
private Integer amount;
@ApiModelProperty("检修工时")
private Double actHours;
@ApiModelProperty("最近一次检修时间")
private String recently;
}

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectStatisticsController.java

@ -94,8 +94,10 @@ public class OperDefectStatisticsController extends BladeController {
@GetMapping("/getEMStaticstic")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "获取设备缺陷统计数据", notes = "传入statistics")
public R<List<OperDefectStatisticsDTO>> getEMStaticstic(@ApiParam(value = "设备编码", required = true) @RequestParam String emCode) {
return R.data(statisticsService.getEMStaticstic(emCode));
public R<List<OperDefectStatisticsDTO>> getEMStaticstic(@ApiParam(value = "设备编码", required = true) @RequestParam String emCode,
@ApiParam(value = "开始时间", required = true) @RequestParam String startTime,
@ApiParam(value = "结束时间", required = true) @RequestParam String endTime) {
return R.data(statisticsService.getEMStaticstic(emCode, startTime, endTime));
}
/**

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/mapper/OperDefectStatisticsMapper.java

@ -18,11 +18,12 @@ public interface OperDefectStatisticsMapper extends UserDataScopeBaseMapper<Oper
/**
* 获取设备缺陷统计数据
*
* @param emCode 设备编码
//* @param tenantId 租户id
* //* @param tenantId 租户id
* @return
*/
@UserDataAuth
List<OperDefectStatisticsDTO> getEMStaticstic(@Param("emCode")String emCode);
List<OperDefectStatisticsDTO> getEMStaticstic(@Param("emCode") String emCode, @Param("startTime") String startTime, @Param("endTime") String endTime);
}

9
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/mapper/OperDefectStatisticsMapper.xml

@ -7,9 +7,12 @@
SELECT SOURCE_CODE,COUNT(ID) NUM,SUM(CHECK_HOURS) CHECK_HOURS ,`NAME` ,EM_CODE,CREATE_USER,CREATE_DEPT
from HZIMS_OPER_DEFECT_STATISTICS
WHERE EM_CODE = #{emCode}
<!-- <if test="createDept != null and createDept != ''">
and CREATE_DEPT = #{createDept}
</if>-->
<if test="startTime != null">
and PLAN_START_TIME &gt;= #{startTime}
</if>
<if test="endTime != null">
and PLAN_START_TIME &lt;= #{endTime}
</if>
GROUP BY SOURCE_CODE
</select>
</mapper>

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperDefectStatisticsService.java

@ -21,7 +21,7 @@ public interface IOperDefectStatisticsService extends BaseService<OperDefectStat
* @param emCode
* @return
*/
List<OperDefectStatisticsDTO> getEMStaticstic(String emCode);
List<OperDefectStatisticsDTO> getEMStaticstic(String emCode, String startTime, String endTime);
LambdaQueryWrapper<OperDefectStatisticsEntity> getQueryWrapper(OperDefectStatisticsVO statistics);

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

@ -29,12 +29,12 @@ public class OperDefectStatisticsServiceImpl extends BaseServiceImpl<OperDefectS
* @return
*/
@Override
public List<OperDefectStatisticsDTO> getEMStaticstic(String emCode){
List<OperDefectStatisticsDTO> re = this.baseMapper.getEMStaticstic(emCode);
public List<OperDefectStatisticsDTO> getEMStaticstic(String emCode, String startTime, String endTime){
List<OperDefectStatisticsDTO> re = this.baseMapper.getEMStaticstic(emCode, startTime, endTime);
for (OperDefectStatisticsDTO dto : re) {
dto.setSourceCodeName(DictCache.getValue(dto.getSourceCode(), DefectConstant.SOURCE_CODE_DICT_KEY));
}
return this.baseMapper.getEMStaticstic(emCode);
return re;
}
@Override

11
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/controller/WorkTicketInfoController.java

@ -18,6 +18,7 @@ import com.hnac.hzims.ticket.workTicket.dto.WorkInfoFlowDto;
import com.hnac.hzims.ticket.workTicket.dto.WorkTicketInfoDto;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService;
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketBillVO;
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketInfoVO;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
@ -196,5 +197,15 @@ public class WorkTicketInfoController {
return R.data(standardWorkVoList);
}
/**
* 获取工作票台账
*/
@ApiLog
@GetMapping("/getWorkTicketBill")
@ApiOperation(value = "获取工作票台账")
public R<List<WorkTicketBillVO>> getWorkTicketBill(String emCode, String startTime, String endTime) {
return R.data(workTicketInfoService.getWorkTicketBill(emCode, startTime, endTime));
}
}

3
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketInfoMapper.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketBillVO;
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketReportStatisticVO;
import com.hnac.hzims.vo.SafeCheckStatisticVO;
import org.apache.ibatis.annotations.Mapper;
@ -64,4 +65,6 @@ public interface WorkTicketInfoMapper extends UserDataScopeBaseMapper<WorkTicket
*/
Page<WorkTicketInfoEntity> selectPages(Page<WorkTicketInfoEntity> pageEntity,
@Param(Constants.WRAPPER) QueryWrapper<WorkTicketInfoEntity> queryWrapper);
List<WorkTicketBillVO> getWorkTicketBill(@Param("path") String path, @Param("startTime") String startTime, @Param("endTime") String endTime);
}

21
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketInfoMapper.xml

@ -85,4 +85,25 @@
${ew.customSqlSegment}
</select>
<select id="getWorkTicketBill" resultType="com.hnac.hzims.ticket.workTicket.vo.WorkTicketBillVO">
select em.`NAME` as emName,info.`type`,count(*) as payment,
(select count(*) from hzims_work_ticket_info i where flow_description = '结束' and i.id = info.id) as finish,
(select count(*) from hzims_work_ticket_info i where flow_description = '作废' and i.id = info.id) as invalid,
(select count(*) from hzims_ticket_info_evaluate e where evaluate = '合格!' and e.id = eval.id) as qualified
from hzims_work_ticket_info info
LEFT JOIN hzims_ticket_info_evaluate eval ON info.id = eval.ticket_id
LEFT JOIN dev_equipment.hzims_em_info em ON info.em_code = em.NUMBER
<where>
<if test="path != null">
em.path like CONCAT(#{path},'%')
</if>
<if test="startTime != null">
and info.make_date_time &gt;= #{startTime}
</if>
<if test="endTime != null">
and info.make_date_time &lt;= #{endTime}
</if>
</where>
GROUP BY info.EM_CODE,info.`type`
</select>
</mapper>

4
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketInfoService.java

@ -2,12 +2,14 @@ package com.hnac.hzims.ticket.workTicket.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo;
import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketWithAreaVo;
import com.hnac.hzims.ticket.areamonthly.vo.StandardWorkVo;
import com.hnac.hzims.ticket.twoTicket.vo.process.WorkTicketVo;
import com.hnac.hzims.ticket.workTicket.dto.TicketAccessTaskDto;
import com.hnac.hzims.ticket.workTicket.dto.WorkTicketInfoDto;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketBillVO;
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketInfoVO;
import com.hnac.hzims.vo.SafeCheckStatisticVO;
import org.springblade.core.mp.base.BaseService;
@ -164,4 +166,6 @@ public interface IWorkTicketInfoService extends BaseService<WorkTicketInfoEntity
* @return
*/
List<WorkTicketInfoEntity> selectTicketByDeptIdWithTicketType(List<Long> createDept, String ticketType, String dateTime);
List<WorkTicketBillVO> getWorkTicketBill(String emCode, String startTime, String endTime);
}

14
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java

@ -13,6 +13,8 @@ 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.logs.utils.StringUtils;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.operational.access.constants.AccessConstants;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import com.hnac.hzims.operational.access.feign.IOperAccessTaskClient;
@ -106,6 +108,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
private final IWorkTicketContentService workTicketContentService;
private final WorkTicketFinishServiceImpl workTicketFinishService;
private final TicketInfoDangerService ticketInfoDangerService;
private final IEmInfoClient emInfoClient;
/** 生成两票编号锁 **/
private Lock lock = new ReentrantLock();
@ -1114,4 +1117,15 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
queryWrapper.apply("date_format(CREATE_TIME,'%Y-%m') = {0}" , dateTime);
return baseMapper.selectList(queryWrapper);
}
@Override
public List<WorkTicketBillVO> getWorkTicketBill(String emCode, String startTime, String endTime) {
R<EmInfoEntity> emInfoEntityR = emInfoClient.getEmInfoByEmCode(emCode);
if (emInfoEntityR.getCode() != 200 || Func.isEmpty(emInfoEntityR.getData())) {
throw new ServiceException("设备信息查询异常");
}
EmInfoEntity emInfo = emInfoEntityR.getData();
List<WorkTicketBillVO> workTicketBillList = baseMapper.getWorkTicketBill(emInfo.getPath(), startTime, endTime);
return workTicketBillList;
}
}

30
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/vo/WorkTicketBillVO.java

@ -0,0 +1,30 @@
package com.hnac.hzims.ticket.workTicket.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 工作票VO
* @author tanghaihao
* @date 2023年07月06日 19:08
*/
@Data
public class WorkTicketBillVO {
@ApiModelProperty("设备名称")
private String emName;
@ApiModelProperty("开票种类")
private String type;
@ApiModelProperty("开票数量")
private Integer payment;
@ApiModelProperty("完成数量")
private Integer finish;
@ApiModelProperty("作废数量")
private Double invalid;
@ApiModelProperty("合格数量")
private String qualified;
}
Loading…
Cancel
Save