瀏覽代碼

Merge branch 'master' into energy-manage-chy

chenhongyan1989 7 月之前
父節點
當前提交
f49b360dea
共有 42 個文件被更改,包括 3290 次插入10 次删除
  1. 7 0
      energy-manage-common/src/main/java/com/energy/manage/common/constant/redis/ManagerRedisKeyConstant.java
  2. 7 1
      energy-manage-common/src/main/java/com/energy/manage/common/enums/IdPrefixEnum.java
  3. 56 0
      energy-manage-common/src/main/java/com/energy/manage/common/po/units/UnitBearingsPO.java
  4. 48 0
      energy-manage-common/src/main/java/com/energy/manage/common/po/units/UnitDictBrandModelPO.java
  5. 50 0
      energy-manage-common/src/main/java/com/energy/manage/common/po/units/UnitDictConstantsPO.java
  6. 65 0
      energy-manage-common/src/main/java/com/energy/manage/common/po/units/UnitDynamoPO.java
  7. 65 0
      energy-manage-common/src/main/java/com/energy/manage/common/po/units/UnitGearboxBearingsPO.java
  8. 39 0
      energy-manage-common/src/main/java/com/energy/manage/common/po/units/UnitGearboxPO.java
  9. 74 0
      energy-manage-common/src/main/java/com/energy/manage/common/po/units/UnitGearboxStructurePO.java
  10. 122 0
      energy-manage-service/src/main/java/com/energy/manage/service/controller/units/UnitController.java
  11. 197 0
      energy-manage-service/src/main/java/com/energy/manage/service/controller/units/UnitDictController.java
  12. 32 0
      energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDictBrandModelDto.java
  13. 19 0
      energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDictBrandModelIdDto.java
  14. 28 0
      energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDictBrandModelPageDto.java
  15. 36 0
      energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDictBrandModelUpdateDto.java
  16. 33 0
      energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDictConstantsDelDto.java
  17. 62 0
      energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDictConstantsDto.java
  18. 19 0
      energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDictConstantsListDto.java
  19. 26 0
      energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDictConstantsPDelDto.java
  20. 19 0
      energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDictConstantsPageDto.java
  21. 30 0
      energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDictConstantsUpdateDto.java
  22. 24 0
      energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDictRoutineDto.java
  23. 759 0
      energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDto.java
  24. 28 0
      energy-manage-service/src/main/java/com/energy/manage/service/domain/vo/units/UnitDictBrandModelVo.java
  25. 89 0
      energy-manage-service/src/main/java/com/energy/manage/service/domain/vo/units/UnitDictConstantsVo.java
  26. 24 0
      energy-manage-service/src/main/java/com/energy/manage/service/domain/vo/units/UnitDictRoutineListVo.java
  27. 354 0
      energy-manage-service/src/main/java/com/energy/manage/service/domain/vo/units/UnitVo.java
  28. 10 0
      energy-manage-service/src/main/java/com/energy/manage/service/mappers/units/UnitBearingsMapper.java
  29. 32 0
      energy-manage-service/src/main/java/com/energy/manage/service/mappers/units/UnitDictBrandModelMapper.java
  30. 16 0
      energy-manage-service/src/main/java/com/energy/manage/service/mappers/units/UnitDictConstantsMapper.java
  31. 10 0
      energy-manage-service/src/main/java/com/energy/manage/service/mappers/units/UnitDynamoMapper.java
  32. 10 0
      energy-manage-service/src/main/java/com/energy/manage/service/mappers/units/UnitGearboxBearingsMapper.java
  33. 10 0
      energy-manage-service/src/main/java/com/energy/manage/service/mappers/units/UnitGearboxMapper.java
  34. 10 0
      energy-manage-service/src/main/java/com/energy/manage/service/mappers/units/UnitGearboxStructureMapper.java
  35. 2 0
      energy-manage-service/src/main/java/com/energy/manage/service/service/cache/CacheService.java
  36. 8 0
      energy-manage-service/src/main/java/com/energy/manage/service/service/cache/impl/CacheServiceImpl.java
  37. 132 0
      energy-manage-service/src/main/java/com/energy/manage/service/service/units/UnitDictConstantsService.java
  38. 62 0
      energy-manage-service/src/main/java/com/energy/manage/service/service/units/UnitService.java
  39. 308 0
      energy-manage-service/src/main/java/com/energy/manage/service/service/units/impl/UnitDictConstantsServiceImpl.java
  40. 335 0
      energy-manage-service/src/main/java/com/energy/manage/service/service/units/impl/UnitServiceImpl.java
  41. 28 0
      energy-manage-service/src/main/resources/mybatis/units/UnitBrandModelMapper.xml
  42. 5 9
      energy-manage-service/src/test/java/client/SkfClientWebTest.java

+ 7 - 0
energy-manage-common/src/main/java/com/energy/manage/common/constant/redis/ManagerRedisKeyConstant.java

@@ -24,6 +24,13 @@ public class ManagerRedisKeyConstant {
      */
     public static final String IDGENERATOR_CONSTANTS_KEY = "energy:Idgenerator:{id}";
 
+    // 字典
+    public static final String IDGENERATOR_UDTC_KEY = "energy:Idgenerator:unit:udtc";
+    // 属性
+    public static final String IDGENERATOR_UDPC_KEY = "energy:Idgenerator:unit:{id}";
+
+    //品牌对应型号,数据集合
+    public static final String IDGENERATOR_UDPB_KEY = "energy:Idgenerator:unit:brandlist:{id}";
 
     private static final String PLACE_HOLDER = "{id}";
 

+ 7 - 1
energy-manage-common/src/main/java/com/energy/manage/common/enums/IdPrefixEnum.java

@@ -12,7 +12,13 @@ public enum IdPrefixEnum {
     WIND_EILL_NUMBER("WEM", "风机机型编号"),
     WIND_EILL_MF_NUMBER("WMF","风机机型厂商编号"),
     WIND_TOWER_NUMBER("WOT", "测风塔信息编号"),
-    WIND_ENGINE_BATCH_NUMBER("WOB","风机批次编号");
+    WIND_ENGINE_BATCH_NUMBER("WOB","风机批次编号"),
+
+    UNIT_DICT_TYPE_CODE("UDTC","部件字典编号"),
+
+    UNIT_BEARINGS_CODE("UTINTB","部件主轴"),
+    UNIT_GEAR_CODE("UTINTG","部件齿轮箱"),
+    UNIT_DYNAMO_CODE("UTINTD","部件发电机");
 
     IdPrefixEnum(String code, String name) {
         this.code = code;

+ 56 - 0
energy-manage-common/src/main/java/com/energy/manage/common/po/units/UnitBearingsPO.java

@@ -0,0 +1,56 @@
+package com.energy.manage.common.po.units;
+
+import com.energy.manage.common.base.NewBaseDomain;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import javax.persistence.Table;
+
+/**
+ * 主轴
+ */
+@Data
+@Table(name = "unit_bearings")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class UnitBearingsPO extends NewBaseDomain {
+
+    /**
+     * 主轴部件编号;主轴部件编号
+     */
+    private String code;
+    /**
+     * 机型编号
+     */
+    private String millTypeCode;
+    /**
+     * 润滑油品牌
+     */
+    private String lubricantBrand;
+    /**
+     * 润滑油型号
+     */
+    private String lubricantModel;
+    /**
+     * 前轴承品牌
+     */
+    private String frontBearingBrand;
+    /**
+     * 前轴承型号
+     */
+    private String frontBearingModel;
+    /**
+     * 后轴承品牌
+     */
+    private String rearBearingBrand;
+    /**
+     * 后轴承型号
+     */
+    private String rearBearingModel;
+    /**
+     * 删除状态;删除状态
+     */
+    private Integer delState;
+
+}

+ 48 - 0
energy-manage-common/src/main/java/com/energy/manage/common/po/units/UnitDictBrandModelPO.java

@@ -0,0 +1,48 @@
+package com.energy.manage.common.po.units;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.experimental.Accessors;
+
+import javax.persistence.Column;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.util.Date;
+
+/**
+ * 品牌模型
+ */
+@Data
+@Table(name = "unit_dict_brand_model")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class UnitDictBrandModelPO {
+
+
+    @Id
+    @GeneratedValue(generator = "JDBC")
+    @Column(name = "id")
+    private Integer id;
+
+    //1.轴承2.润滑油
+    private Integer unitType;
+
+    //品牌
+    private String manufacture;
+
+    //型号
+    private  String modelNumber;
+
+    //描述
+    private String description;
+
+
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+
+}

+ 50 - 0
energy-manage-common/src/main/java/com/energy/manage/common/po/units/UnitDictConstantsPO.java

@@ -0,0 +1,50 @@
+package com.energy.manage.common.po.units;
+
+import com.energy.manage.common.base.NewBaseDomain;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import javax.persistence.Table;
+
+/**
+ * 部件字典表
+ */
+@Data
+@Table(name = "unit_dict_constants")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class UnitDictConstantsPO extends NewBaseDomain {
+
+    // 父级ID
+    private Long parentId;
+
+    /**
+     * 部件类型(字典表):1..轴承2.润滑油3.冷却方式
+     */
+    private Integer contentsDictKey;
+    // 常量名称
+    private String contentsName;
+
+    // 常量值
+    private Integer contentsValue;
+
+    /**
+     * 部件模块编号1.主轴2.齿轮箱3.发电机
+     */
+    private Integer unitModule;
+    /**
+     * 关联功能(0.普通字典模式1.品牌型号)
+     */
+    private Integer associatedFunctionType;
+
+    // 常量类型编号
+    private String contentsType;
+
+    // 常量描述
+    private String contentsDescribe;
+
+    // 删除状态
+    private Integer delState;
+
+}

+ 65 - 0
energy-manage-common/src/main/java/com/energy/manage/common/po/units/UnitDynamoPO.java

@@ -0,0 +1,65 @@
+package com.energy.manage.common.po.units;
+
+
+import com.energy.manage.common.base.NewBaseDomain;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import javax.persistence.Table;
+
+/**
+ * 发电机
+ */
+@Data
+@Table(name = "unit_dynamo")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class UnitDynamoPO extends NewBaseDomain {
+
+    /**
+     * 发电机部件编号
+     */
+    private String code;
+    /**
+     * 机型编号
+     */
+    private String millTypeCode;
+    /**
+     * 极对数
+     */
+    private Integer polePairs;
+    /**
+     * 冷却方式
+     */
+    private Integer coolingMethod;
+    /**
+     * 润滑油品牌
+     */
+    private String lubricantBrand;
+    /**
+     * 润滑油型号
+     */
+    private String lubricantModel;
+    /**
+     * 驱动端轴承品牌
+     */
+    private String driveEndBearingBrand;
+    /**
+     * 驱动端轴承型号
+     */
+    private String driveEndBearingModel;
+    /**
+     * 非驱动端轴承品牌
+     */
+    private String nonDriveEndBearingBrand;
+    /**
+     * 非驱动端轴承型号
+     */
+    private String nonDriveEndBearingModel;
+    /**
+     * 删除状态
+     */
+    private Integer delState;
+
+}

+ 65 - 0
energy-manage-common/src/main/java/com/energy/manage/common/po/units/UnitGearboxBearingsPO.java

@@ -0,0 +1,65 @@
+package com.energy.manage.common.po.units;
+
+import com.energy.manage.common.base.NewBaseDomain;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import javax.persistence.Table;
+
+/**
+ * 齿轮箱轴承表
+ */
+@Data
+@Table(name = "unit_gearbox_bearings")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class UnitGearboxBearingsPO extends NewBaseDomain {
+
+    /**
+     * 齿轮箱编号
+     */
+    private String gearboxCode;
+    /**
+     * 齿轮箱轴承类型
+     */
+    private Integer parallelWheelGrade;
+    /**
+     * 齿轮箱轴承编号
+     */
+    private String gearboxBearingNumber;
+    /**
+     * 齿轮箱轴承级别
+     */
+    private String gearboxBearingLevel;
+    /**
+     * 轴承品牌
+     */
+    private String bearingBrand;
+    /**
+     * 轴承型号
+     */
+    private String bearingModel;
+    /**
+     * 齿圈齿数
+     */
+    private String gearRingTeethCount;
+    /**
+     * 轴承-RS品牌
+     */
+    private String bearingRsBrand;
+    /**
+     * 轴承-RS型号
+     */
+    private String bearingRsModel;
+    /**
+     * 轴承-GS品牌
+     */
+    private String bearingGsBrand;
+    /**
+     * 轴承-GS型号
+     */
+    private String bearingGsModel;
+
+
+}

+ 39 - 0
energy-manage-common/src/main/java/com/energy/manage/common/po/units/UnitGearboxPO.java

@@ -0,0 +1,39 @@
+package com.energy.manage.common.po.units;
+
+import com.energy.manage.common.base.NewBaseDomain;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import javax.persistence.Table;
+
+/**
+ * 齿轮箱总表
+ */
+@Data
+@Table(name = "unit_gearbox")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class UnitGearboxPO extends NewBaseDomain {
+
+    /**
+     * 部件编号
+     */
+    private String code;
+    /**
+     * 机型编号
+     */
+    private String millTypeCode;
+    /**
+     * 润滑油品牌
+     */
+    private String lubricantBrand;
+    /**
+     * 润滑油型号
+     */
+    private String lubricantModel;
+    /**
+     * 是否删除
+     */
+    private Integer delState;
+}

+ 74 - 0
energy-manage-common/src/main/java/com/energy/manage/common/po/units/UnitGearboxStructurePO.java

@@ -0,0 +1,74 @@
+package com.energy.manage.common.po.units;
+
+
+import com.energy.manage.common.base.NewBaseDomain;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import javax.persistence.Table;
+
+/**
+ * 齿轮箱结构表
+ */
+@Data
+@Table(name = "unit_gearbox_structure")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class UnitGearboxStructurePO extends NewBaseDomain {
+
+
+    /**
+     * 齿轮箱总表编号
+     */
+    private String gearboxCode;
+    /**
+     * 齿轮箱结构类型;1.行星轮2.平行轮
+     */
+    private Integer gearboxStructure;
+    /**
+     * 齿轮箱结构等级;sort_num1,2......
+     */
+    private Integer planetaryGearGrade;
+    /**
+     * 大齿轮齿数
+     */
+    private String largeGearTeethCount;
+    /**
+     * 小齿轮齿数
+     */
+    private String smallGearTeethCount;
+    /**
+     * 轴承品牌
+     */
+    private String bearingBrand;
+    /**
+     * 轴承型号
+     */
+    private String bearingModel;
+    /**
+     * 齿圈齿数
+     */
+    private String gearRingTeethCount;
+    /**
+     * 太阳轮齿数
+     */
+    private String sunWheelTeethCount;
+    /**
+     * 行星轮个数
+     */
+    private String planetWheelCount;
+    /**
+     * 行星轮齿数
+     */
+    private String planetWheelTeethCount;
+    /**
+     * 太阳轮轴承品牌
+     */
+    private String sunWheelBearingBrand;
+    /**
+     * 太阳轮轴承型号
+     */
+    private String sunWheelBearingModel;
+
+}

+ 122 - 0
energy-manage-service/src/main/java/com/energy/manage/service/controller/units/UnitController.java

@@ -0,0 +1,122 @@
+package com.energy.manage.service.controller.units;
+
+
+import com.dtflys.forest.annotation.Get;
+import com.energy.manage.common.po.units.UnitBearingsPO;
+import com.energy.manage.common.po.units.UnitDynamoPO;
+import com.energy.manage.common.reponse.ResultResp;
+import com.energy.manage.service.config.annotations.UserLoginToken;
+import com.energy.manage.service.controller.base.BaseServiceController;
+import com.energy.manage.service.domain.dto.units.UnitDictBrandModelDto;
+import com.energy.manage.service.domain.dto.units.UnitDictConstantsDelDto;
+import com.energy.manage.service.domain.dto.units.UnitDictRoutineDto;
+import com.energy.manage.service.domain.dto.units.UnitDto;
+import com.energy.manage.service.domain.vo.units.UnitDictRoutineListVo;
+import com.energy.manage.service.domain.vo.units.UnitVo;
+import com.energy.manage.service.service.units.UnitService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.List;
+
+@Slf4j
+@RestController
+@CrossOrigin
+@Api(value = "UnitController", tags = "风机部件管理接口")
+@RequestMapping(value = "/api/unit")
+public class UnitController extends BaseServiceController {
+
+
+    @Autowired
+    private UnitService unitService;
+
+
+    @UserLoginToken
+    @PostMapping(value = "/getBrandModelNameOrModelNumber")
+    @ApiOperation(value = "根据部件类型,查询部件类型对应品牌/型号")
+    public ResultResp<List<String>> getBrandModelNameOrModelNumber(@RequestBody @Valid UnitDictBrandModelDto unitDictBrandModelDto) {
+        if (unitDictBrandModelDto.getUnitType() == null) {
+            log.error("查询部件,部件类型unitType不能为空");
+            return ResultResp.NOTNULLPARAM();
+        }
+        List<String> list = unitService.getBrandModelNameOrModelNumber(unitDictBrandModelDto);
+        return ResultResp.SUCCESS(list);
+    }
+
+
+    @UserLoginToken
+    @PostMapping(value = "/getUnitDictRoutineList")
+    @ApiOperation(value = "根据部件类型,查询部件常用类型字典")
+    public ResultResp<List<UnitDictRoutineListVo>> getUnitDictRoutineList(@RequestBody @Valid UnitDictRoutineDto unitDictRoutineDto) {
+        List<UnitDictRoutineListVo> list = unitService.getUnitDictRoutineList(unitDictRoutineDto);
+        return ResultResp.SUCCESS(list);
+    }
+
+
+    @UserLoginToken
+    @PostMapping(value = "/modificationUnit")
+    @ApiOperation(value = "更新部件相关信息")
+    public ResultResp modificationUnit(@RequestBody @Valid UnitDto unitDto) {
+
+        if (StringUtils.isEmpty(unitDto.getMillTypeCode())) {
+            return ResultResp.NOTNULLPARAM();
+        }
+        // 验证主轴数据
+        UnitDto.validateAndSetEmptyToNull(unitDto.getUnitBearingsDto());
+        if (unitDto.getUnitBearingsDto().allPropertiesAreNull()) {
+            unitDto.setUnitBearingsDto(null);
+        }
+        // 验证齿轮箱数据
+        UnitDto.validateAndSetEmptyToNull(unitDto.getUnitGearDto());
+        if (!unitDto.getUnitGearDto().allPropertiesGearboxBearingsListNull()) {
+            unitDto.getUnitGearDto().setUnitGearboxBearingsDtoList(null);
+        }
+        if (!unitDto.getUnitGearDto().allPropertiesGearboxStructureListNull()) {
+            unitDto.getUnitGearDto().setUnitGearboxStructureDtoList(null);
+        }
+
+        if (unitDto.getUnitGearDto().allPropertiesAreNull()) {
+            unitDto.setUnitGearDto(null);
+        }
+        // 验证发电机数据
+        UnitDto.validateAndSetEmptyToNull(unitDto.getUnitDynamoDto());
+        if (unitDto.getUnitDynamoDto().allPropertiesAreNull()) {
+            unitDto.setUnitDynamoDto(null);
+        }
+
+        if (unitDto.getUnitBearingsDto() == null &&
+                unitDto.getUnitDynamoDto() == null &&
+                unitDto.getUnitGearDto() == null) {
+            return ResultResp.FAIL("所有数据均为空,不进行部件数据维护!");
+        }
+
+        UnitBearingsPO unitBearingsPO = unitService.verifyUnitBearingByMillTypeCode(unitDto.getMillTypeCode());
+        if (unitBearingsPO != null && unitBearingsPO.getId().intValue() != unitDto.getUnitBearingsDto().getId().intValue()) {
+            return ResultResp.FAIL("此机型编号已经绑定部件信息,不可重复绑定");
+        }
+
+        UnitDynamoPO unitDynamoPO = unitService.verifyUnitDynamoByMillTypeCode(unitDto.getMillTypeCode());
+        if (unitDynamoPO != null && unitDynamoPO.getId().intValue() != unitDto.getUnitDynamoDto().getId().intValue()) {
+            return ResultResp.FAIL("此机型编号已经绑定部件信息,不可重复绑定");
+        }
+
+        boolean flg = unitService.modificationUnit(unitDto, getUserId());
+        return flg ? ResultResp.SUCCESS() : ResultResp.FAIL();
+    }
+
+
+    @UserLoginToken
+    @GetMapping(value = "/getUnitVo")
+    @ApiOperation(value = "通过机型编号查询部件信息")
+    public ResultResp<UnitVo> getUnitVo(@RequestParam String millTypeCode) {
+        UnitVo vo = unitService.getUnitVo(millTypeCode);
+        return ResultResp.SUCCESS(vo);
+    }
+
+
+}

+ 197 - 0
energy-manage-service/src/main/java/com/energy/manage/service/controller/units/UnitDictController.java

@@ -0,0 +1,197 @@
+package com.energy.manage.service.controller.units;
+
+
+import cn.hutool.core.bean.BeanUtil;
+import com.energy.manage.common.base.Page;
+import com.energy.manage.common.enums.IdPrefixEnum;
+import com.energy.manage.common.reponse.ResultResp;
+import com.energy.manage.service.config.annotations.UserLoginToken;
+import com.energy.manage.service.controller.base.BaseServiceController;
+import com.energy.manage.service.domain.dto.units.*;
+import com.energy.manage.service.domain.dto.windenginegroup.WindEngineGroupCreateDto;
+import com.energy.manage.service.domain.vo.units.UnitDictBrandModelVo;
+import com.energy.manage.service.domain.vo.units.UnitDictConstantsVo;
+import com.energy.manage.service.service.units.UnitDictConstantsService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.checkerframework.checker.units.qual.A;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.List;
+
+@Slf4j
+@RestController
+@CrossOrigin
+@Api(value = "UnitDictController", tags = "风机部件字典管理")
+@RequestMapping(value = "/api/unit/dict")
+public class UnitDictController extends BaseServiceController {
+
+
+    @Autowired
+    private UnitDictConstantsService unitDictConstantsService;
+
+
+    @UserLoginToken
+    @PostMapping(value = "/createUnitDict")
+    @ApiOperation(value = "创建数据字典")
+    public ResultResp createUnitDict(@RequestBody @Valid UnitDictConstantsDto unitDictConstantsDto) {
+        if (unitDictConstantsDto.getParentId() != 0) {
+            return ResultResp.FAIL("数据字典级别不对");
+        }
+        unitDictConstantsDto.setCreateBy(getUserId());
+        unitDictConstantsDto.setUpdateBy(getUserId());
+        boolean flg = unitDictConstantsService.saveUnitDict(unitDictConstantsDto);
+        return flg ? ResultResp.SUCCESS() : ResultResp.FAIL();
+    }
+
+
+    @UserLoginToken
+    @PostMapping(value = "/updateUnitDict")
+    @ApiOperation(value = "更新数据字典")
+    public ResultResp updateUnitDict(@RequestBody @Valid UnitDictConstantsUpdateDto unitDictConstantsUpdateDto) {
+        unitDictConstantsUpdateDto.setUpdateBy(getUserId());
+        boolean flg = unitDictConstantsService.updateUnitDict(unitDictConstantsUpdateDto);
+        return flg ? ResultResp.SUCCESS() : ResultResp.FAIL();
+    }
+
+
+    @UserLoginToken
+    @PostMapping(value = "/delUnitDict")
+    @ApiOperation(value = "删除数据字典")
+    public ResultResp delUnitDict(@RequestBody @Valid UnitDictConstantsDelDto unitDictConstantsDelDto) {
+        unitDictConstantsDelDto.setUpdateBy(getUserId());
+        boolean flg = unitDictConstantsService.delUnitDict(unitDictConstantsDelDto);
+        return flg ? ResultResp.SUCCESS() : ResultResp.FAIL();
+    }
+
+
+    @UserLoginToken
+    @PostMapping(value = "/getUnitDictConstantsPage")
+    @ApiOperation(value = "部件字典分页列表,通过字典名称询")
+    public ResultResp<Page<UnitDictConstantsVo>> getUnitDictConstantsPage(@RequestBody @Valid UnitDictConstantsPageDto unitDictConstantsPageDto) {
+        Page<UnitDictConstantsVo> page = unitDictConstantsService.getUnitDictConstantsPage(unitDictConstantsPageDto);
+        return ResultResp.SUCCESS(page);
+    }
+
+
+    @UserLoginToken
+    @PostMapping(value = "/createUnitDictProperty")
+    @ApiOperation(value = "创建数据字典属性-常规类型")
+    public ResultResp createUnitDictProperty(@RequestBody @Valid UnitDictConstantsDto unitDictConstantsDto) {
+        if (unitDictConstantsDto.getParentId() <= 0) {
+            return ResultResp.FAIL("数据字典级别不对");
+        }
+        if (StringUtils.isEmpty(unitDictConstantsDto.getContentsType())) {
+            return ResultResp.FAIL("父级类型编号不能为空");
+        }
+        unitDictConstantsDto.setCreateBy(getUserId());
+        unitDictConstantsDto.setUpdateBy(getUserId());
+        unitDictConstantsDto.setContentsDictKey(0);
+        unitDictConstantsDto.setContentsDescribe("属性");
+        boolean flg = unitDictConstantsService.saveUnitDictProperty(unitDictConstantsDto);
+        return flg ? ResultResp.SUCCESS() : ResultResp.FAIL();
+    }
+
+
+    @UserLoginToken
+    @PostMapping(value = "/delUnitDictProperty")
+    @ApiOperation(value = "删除字典属性-常规类型")
+    public ResultResp delUnitDictProperty(@RequestBody @Valid UnitDictConstantsPDelDto unitDictConstantsPDelDto) {
+        unitDictConstantsPDelDto.setUpdateBy(getUserId());
+        boolean flg = unitDictConstantsService.delUnitDictProperty(unitDictConstantsPDelDto);
+        return flg ? ResultResp.SUCCESS() : ResultResp.FAIL();
+    }
+
+
+    @UserLoginToken
+    @PostMapping(value = "/updateUnitDictProperty")
+    @ApiOperation(value = "更新字典属性-常规类型")
+    public ResultResp updateUnitDictProperty(@RequestBody @Valid UnitDictConstantsUpdateDto unitDictConstantsUpdateDto) {
+        unitDictConstantsUpdateDto.setUpdateBy(getUserId());
+        boolean flg = unitDictConstantsService.updateUnitDictProperty(unitDictConstantsUpdateDto);
+        return flg ? ResultResp.SUCCESS() : ResultResp.FAIL();
+    }
+
+
+    @UserLoginToken
+    @PostMapping(value = "/getUnitDictConstantsList")
+    @ApiOperation(value = "查询字典属性集合-常规类型")
+    public ResultResp<List<UnitDictConstantsVo>> getUnitDictConstantsList(@RequestBody @Valid UnitDictConstantsListDto unitDictConstantsListDto) {
+        List<UnitDictConstantsVo> list = unitDictConstantsService.getUnitDictConstantsList(unitDictConstantsListDto.getContentsType());
+        return ResultResp.SUCCESS(list);
+    }
+
+
+    @UserLoginToken
+    @PostMapping(value = "/getUnitDictConstants")
+    @ApiOperation(value = "查询字典属性对象-品牌型号")
+    public ResultResp<UnitDictConstantsVo> getUnitDictConstants(@RequestBody @Valid UnitDictConstantsUpdateDto unitDictConstantsUpdateDto) {
+        UnitDictConstantsVo vo = unitDictConstantsService.getUnitDictConstants(unitDictConstantsUpdateDto.getId());
+        return ResultResp.SUCCESS(vo);
+    }
+
+
+    @UserLoginToken
+    @PostMapping(value = "/saveUnitDictBrandModel")
+    @ApiOperation(value = "创建部件品牌型号-品牌型号")
+    public ResultResp saveUnitDictBrandModel(@RequestBody @Valid UnitDictBrandModelDto unitDictBrandModelDto) {
+
+        if(StringUtils.isEmpty(unitDictBrandModelDto.getManufacture())
+                || StringUtils.isEmpty(unitDictBrandModelDto.getModelNumber())){
+            return ResultResp.NOTNULLPARAM();
+        }
+        if(unitDictConstantsService.verifyUnitDictBrandModel(unitDictBrandModelDto)){
+            return ResultResp.FAIL("品牌型号已经存在!");
+        }
+        boolean flg = unitDictConstantsService.saveUnitDictBrandModel(unitDictBrandModelDto);
+        return flg ? ResultResp.SUCCESS() : ResultResp.FAIL();
+    }
+
+
+    @UserLoginToken
+    @PostMapping(value = "/updateUnitDictBrandModel")
+    @ApiOperation(value = "更新部件品牌型号-品牌型号")
+    public ResultResp updateUnitDictBrandModel(@RequestBody @Valid UnitDictBrandModelUpdateDto unitDictBrandModelUpdateDto) {
+        if(StringUtils.isEmpty(unitDictBrandModelUpdateDto.getManufacture())
+                || StringUtils.isEmpty(unitDictBrandModelUpdateDto.getModelNumber())){
+            return ResultResp.NOTNULLPARAM();
+        }
+
+        UnitDictBrandModelDto dto = new UnitDictBrandModelDto();
+        BeanUtil.copyProperties(unitDictBrandModelUpdateDto,dto);
+
+        if(unitDictConstantsService.verifyUnitDictBrandModel(dto)){
+            return ResultResp.FAIL("品牌型号已经存在!");
+        }
+        boolean flg = unitDictConstantsService.updateUnitDictBrandModel(unitDictBrandModelUpdateDto);
+        return flg ? ResultResp.SUCCESS() : ResultResp.FAIL();
+    }
+
+    @UserLoginToken
+    @PostMapping(value = "/delUnitDictBrandModel")
+    @ApiOperation(value = "删除部件品牌型号-品牌型号")
+    public ResultResp delUnitDictBrandModel(@RequestBody @Valid UnitDictBrandModelIdDto unitDictBrandModelIdDto) {
+        boolean flg = unitDictConstantsService.delUnitDictBrandModel(unitDictBrandModelIdDto);
+        return flg ? ResultResp.SUCCESS() : ResultResp.FAIL();
+    }
+
+
+    @UserLoginToken
+    @PostMapping(value = "/getUnitDictBrandModelPage")
+    @ApiOperation(value = "查询品牌型号分页查询-品牌型号")
+    public ResultResp<Page<UnitDictBrandModelVo>> getUnitDictBrandModelPage(@RequestBody @Valid UnitDictBrandModelPageDto unitDictBrandModelPageDto) {
+        Page<UnitDictBrandModelVo> page = unitDictConstantsService.getUnitDictBrandModelPage(unitDictBrandModelPageDto);
+        return ResultResp.SUCCESS(page);
+    }
+
+
+
+
+
+
+
+}

+ 32 - 0
energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDictBrandModelDto.java

@@ -0,0 +1,32 @@
+package com.energy.manage.service.domain.dto.units;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+@Getter
+@Setter
+@ApiModel("创建部件品牌参数")
+public class UnitDictBrandModelDto {
+
+    // 部件类型
+    @ApiModelProperty("部件类型")
+    @NotNull(message = "部件类型不能为空")
+    private Integer unitType;
+
+    //  品牌
+    @ApiModelProperty("品牌")
+    private String manufacture;
+
+    //  型号
+    @ApiModelProperty("型号")
+    private  String modelNumber;
+
+    //  描述
+    @ApiModelProperty("描述")
+    private  String description;
+
+}

+ 19 - 0
energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDictBrandModelIdDto.java

@@ -0,0 +1,19 @@
+package com.energy.manage.service.domain.dto.units;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+@Getter
+@Setter
+@ApiModel("删除部件品牌参数")
+public class UnitDictBrandModelIdDto {
+
+    @ApiModelProperty("主键")
+    @NotNull(message = "主键不能为空")
+    private Integer id;
+
+}

+ 28 - 0
energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDictBrandModelPageDto.java

@@ -0,0 +1,28 @@
+package com.energy.manage.service.domain.dto.units;
+
+import com.energy.manage.service.domain.dto.BaseDto;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+@ApiModel("风机部件品牌分页参数")
+public class UnitDictBrandModelPageDto extends BaseDto {
+
+    /**
+     * 部件类型(字典表):1..轴承2.润滑油3.冷却方式
+     */
+    @ApiModelProperty("部件类型")
+    private Integer contentsDictKey;
+
+    //品牌
+    @ApiModelProperty("品牌")
+    private String manufacture;
+
+    //型号
+    @ApiModelProperty("型号")
+    private  String modelNumber;
+
+}

+ 36 - 0
energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDictBrandModelUpdateDto.java

@@ -0,0 +1,36 @@
+package com.energy.manage.service.domain.dto.units;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+@Getter
+@Setter
+@ApiModel("更新风机部件品牌参数")
+public class UnitDictBrandModelUpdateDto {
+
+
+    @ApiModelProperty("主键")
+    @NotNull(message = "主键不能为空")
+    private Integer id;
+
+    // 部件类型
+    @ApiModelProperty("部件类型")
+    @NotNull(message = "部件类型不能为空")
+    private String unitType;
+
+    //  品牌
+    @ApiModelProperty("品牌")
+    private String manufacture;
+
+    //  型号
+    @ApiModelProperty("型号")
+    private String modelNumber;
+
+    //  描述
+    @ApiModelProperty("描述")
+    private String description;
+}

+ 33 - 0
energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDictConstantsDelDto.java

@@ -0,0 +1,33 @@
+package com.energy.manage.service.domain.dto.units;
+
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+@Getter
+@Setter
+@ApiModel("风机部件字典删除参数")
+public class UnitDictConstantsDelDto {
+
+    /**
+     * 主键编号
+     */
+    @ApiModelProperty("主键id")
+    @NotNull(message = "主键id不能为空")
+    private Integer id;
+
+
+    // 字典/属性类型编号
+    @ApiModelProperty("字典/属性类型编号")
+    @NotNull(message = "字典/属性类型编号不能为空")
+    private String contentsType;
+
+
+    @ApiModelProperty(value = "修改人")
+    private Integer updateBy;
+
+}

+ 62 - 0
energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDictConstantsDto.java

@@ -0,0 +1,62 @@
+package com.energy.manage.service.domain.dto.units;
+
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+@Getter
+@Setter
+@ApiModel("风机部件字典创建参数")
+public class UnitDictConstantsDto {
+
+    // 父级ID,当创建字典时传0 , 当创建属性值时传对应父节点对应id
+    @ApiModelProperty("父级ID,当创建字典时传0 , 当创建属性值时传对应父节点对应id")
+    @NotNull(message = "部件字典层级不能为空")
+    private Long parentId;
+
+    /**
+     * 部件类型(字典表):1..轴承2.润滑油3.冷却方式
+     */
+    @ApiModelProperty(" 部件类型(字典表):1.轴承2.润滑油3.冷却方式")
+    @NotNull(message = "部件类型不能为空")
+    private Integer contentsDictKey;
+
+    // 字典名称/属性名称
+    @ApiModelProperty("字典名称/属性名称")
+    @NotNull(message = "字典名称/属性名称不能为空")
+    private String contentsName;
+
+    // 字典或属性对应值
+    private Integer contentsValue;
+
+    // 字典/属性类型编号
+    private String contentsType;
+
+    /**
+     * 部件模块编号1.主轴2.齿轮箱3.发电机
+     */
+    @ApiModelProperty("部件模块编号1.主轴2.齿轮箱3.发电机")
+    @NotNull(message = "部件模块不能为空")
+    private Integer unitModule;
+
+    /**
+     * 关联功能(0.普通字典模式1.品牌型号)
+     */
+    @ApiModelProperty("关联功能")
+    private Integer associatedFunctionType = 0;
+
+    // 描述
+    private String contentsDescribe;
+
+    @ApiModelProperty(value = "创建人")
+    private Integer createBy;
+
+    @ApiModelProperty(value = "修改人")
+    private Integer updateBy;
+
+
+}

+ 19 - 0
energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDictConstantsListDto.java

@@ -0,0 +1,19 @@
+package com.energy.manage.service.domain.dto.units;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+@Getter
+@Setter
+@ApiModel("风机部件字典(属性)集合参数")
+public class UnitDictConstantsListDto {
+
+    // 字典/属性类型编号
+    @ApiModelProperty("字典/属性类型编号")
+    @NotNull(message = "字典/属性类型编号不能为空")
+    private String contentsType;
+}

+ 26 - 0
energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDictConstantsPDelDto.java

@@ -0,0 +1,26 @@
+package com.energy.manage.service.domain.dto.units;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+@Getter
+@Setter
+@ApiModel("风机部件字典(属性)删除参数")
+public class UnitDictConstantsPDelDto {
+
+
+    /**
+     * 主键编号
+     */
+    @ApiModelProperty(value = "主键")
+    @NotNull(message = "字典名称/属性名称不能为空")
+    private Integer id;
+
+    @ApiModelProperty(value = "修改人")
+    private Integer updateBy;
+
+}

+ 19 - 0
energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDictConstantsPageDto.java

@@ -0,0 +1,19 @@
+package com.energy.manage.service.domain.dto.units;
+
+
+import com.energy.manage.service.domain.dto.BaseDto;
+import io.swagger.annotations.ApiModel;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+@ApiModel("风机部件字典分页参数")
+public class UnitDictConstantsPageDto  extends BaseDto {
+
+
+    // 字典名称/属性名称
+    private String contentsName;
+
+
+}

+ 30 - 0
energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDictConstantsUpdateDto.java

@@ -0,0 +1,30 @@
+package com.energy.manage.service.domain.dto.units;
+
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+@Getter
+@Setter
+@ApiModel("风机部件(字典/属性)更新参数")
+public class UnitDictConstantsUpdateDto {
+
+    // 主键id
+    @ApiModelProperty("主键id")
+    @NotNull(message = "主键id不能为空")
+    private Integer id;
+
+    // 字典名称/属性名称
+    @ApiModelProperty("字典名称/属性名称")
+    @NotNull(message = "字典名称/属性名称不能为空")
+    private String contentsName;
+
+    @ApiModelProperty(value = "修改人")
+    private Integer updateBy;
+
+
+}

+ 24 - 0
energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDictRoutineDto.java

@@ -0,0 +1,24 @@
+package com.energy.manage.service.domain.dto.units;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+@Getter
+@Setter
+@ApiModel("")
+public class UnitDictRoutineDto {
+
+    /**
+     * 字典/属性类型编号,查询部件常用字典集合参数,只需要传contentsType这一个参数
+     */
+    @ApiModelProperty("字典/属性类型编号,查询部件常用字典集合参数,只需要传contentsType这一个参数")
+    @NotNull(message = "部件字典类型编号不能为空")
+    private String contentsType;
+
+
+
+}

+ 759 - 0
energy-manage-service/src/main/java/com/energy/manage/service/domain/dto/units/UnitDto.java

@@ -0,0 +1,759 @@
+package com.energy.manage.service.domain.dto.units;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.util.CollectionUtils;
+
+import javax.validation.constraints.NotNull;
+import java.lang.reflect.Field;
+import java.util.List;
+
+/**
+ * 保存更新部件信息相关参数
+ */
+@Getter
+@Setter
+@ApiModel("保存更新部件信息相关参数")
+public class UnitDto {
+
+    /**
+     * 机型编号
+     */
+    @ApiModelProperty("机型编号")
+    @NotNull(message = "机型编号不能为空")
+    private String millTypeCode;
+
+    @ApiModelProperty("主轴相关参数")
+    UnitBearingsDto unitBearingsDto;
+
+
+    @ApiModelProperty("齿轮箱相关参数")
+    UnitGearDto unitGearDto;
+
+
+    @ApiModelProperty("发电机相关参数")
+    UnitDynamoDto unitDynamoDto;
+
+
+    /**
+     * 齿轮箱相关参数
+     */
+    @Setter
+    @Getter
+    @ApiModel
+    public static class UnitGearDto {
+
+        /**
+         * 主键
+         */
+        @ApiModelProperty("主键")
+        private Integer id;
+
+        /**
+         * 部件编号
+         */
+        @ApiModelProperty("部件编号")
+        private String code;
+
+        /**
+         * 润滑油品牌
+         */
+        @ApiModelProperty("润滑油品牌")
+        private String lubricantBrand;
+        /**
+         * 润滑油型号
+         */
+        @ApiModelProperty("润滑油型号")
+        private String lubricantModel;
+
+
+        /**
+         * 齿轮箱轴承集合
+         */
+        @ApiModelProperty("齿轮箱轴承集合")
+        List<UnitGearboxBearingsDto> unitGearboxBearingsDtoList;
+
+        /**
+         * 齿轮箱结构集合
+         */
+        @ApiModelProperty("齿轮箱结构集合")
+        List<UnitGearboxStructureDto> unitGearboxStructureDtoList;
+
+        // 判断所有属性是否都为空
+        public boolean allPropertiesAreNull() {
+            return (this.id == null || this.id == 0) &&
+                    (this.code == null || this.code.isEmpty()) &&
+                    (this.lubricantBrand == null || this.lubricantBrand.isEmpty()) &&
+                    (this.lubricantModel == null || this.lubricantModel.isEmpty()) &&
+                    (CollectionUtils.isEmpty(this.unitGearboxBearingsDtoList)) &&
+                    (CollectionUtils.isEmpty(this.unitGearboxStructureDtoList));
+        }
+
+        // 判断齿轮箱轴承集合所有属性是否都为空
+        public boolean allPropertiesGearboxBearingsListNull() {
+           List<UnitGearboxBearingsDto> list =  this.unitGearboxBearingsDtoList;
+           for(int i =0;i<list.size();i++){
+               UnitGearboxBearingsDto unitGearboxBearingsDto = list.get(i);
+               if(unitGearboxBearingsDto.allPropertiesAreNull()){
+                   list.remove(i);
+               }
+           }
+           if(list.size()<=0){
+               return false;
+           }
+           return true;
+        }
+
+        // 判断齿轮箱结构集合所有属性是否都为空
+        public boolean allPropertiesGearboxStructureListNull() {
+            List<UnitGearboxStructureDto> list =  this.unitGearboxStructureDtoList;
+            for(int i =0;i<list.size();i++){
+                UnitGearboxStructureDto unitGearboxStructureDto = list.get(i);
+                if(unitGearboxStructureDto.allPropertiesAreNull()){
+                    list.remove(i);
+                }
+            }
+            if(list.size()<=0){
+                return false;
+            }
+            return true;
+        }
+
+        /**
+         * 数据校验
+         *
+         * @param unitGearDto
+         * @return
+         */
+        public static boolean isValid(UnitGearDto unitGearDto) {
+            if (unitGearDto == null) {
+                return false;
+            }
+            if (unitGearDto.getId() == null) {
+                return false;
+            }
+
+            if (unitGearDto.getCode() == null || unitGearDto.getCode().isEmpty()) {
+                return false;
+            }
+
+            if (unitGearDto.getLubricantBrand() == null || unitGearDto.getLubricantBrand().isEmpty()) {
+                return false;
+            }
+
+            if (unitGearDto.getLubricantModel() == null || unitGearDto.getLubricantModel().isEmpty()) {
+                return false;
+            }
+
+            if (CollectionUtils.isEmpty(unitGearDto.getUnitGearboxStructureDtoList())) {
+                return false;
+            }
+
+            if (CollectionUtils.isEmpty(unitGearDto.getUnitGearboxBearingsDtoList())) {
+                return false;
+            }
+
+            return true;
+        }
+
+
+
+
+    }
+
+    /**
+     * 齿轮箱结构表
+     */
+    @Setter
+    @Getter
+    @ApiModel
+    public static class UnitGearboxStructureDto {
+
+        @ApiModelProperty("主键")
+        private Integer id;
+
+        /**
+         * 齿轮箱总表编号
+         */
+        @ApiModelProperty("齿轮箱总表编号")
+        private String gearboxCode;
+        /**
+         * 齿轮箱结构类型;1.行星轮2.平行轮
+         */
+        @ApiModelProperty("齿轮箱结构类型;1.行星轮2.平行轮")
+        private Integer gearboxStructure;
+        /**
+         * 齿轮箱结构等级;sort_num1,2......
+         */
+        @ApiModelProperty("齿轮箱结构等级;sort_num1,2......")
+        private Integer planetaryGearGrade;
+        /**
+         * 大齿轮齿数
+         */
+        @ApiModelProperty("大齿轮齿数")
+        private String largeGearTeethCount;
+        /**
+         * 小齿轮齿数
+         */
+        @ApiModelProperty("小齿轮齿数")
+        private String smallGearTeethCount;
+        /**
+         * 轴承品牌
+         */
+        @ApiModelProperty("轴承品牌")
+        private String bearingBrand;
+        /**
+         * 轴承型号
+         */
+        @ApiModelProperty("轴承型号")
+        private String bearingModel;
+        /**
+         * 齿圈齿数
+         */
+        @ApiModelProperty("齿圈齿数")
+        private String gearRingTeethCount;
+        /**
+         * 太阳轮齿数
+         */
+        @ApiModelProperty("太阳轮齿数")
+        private String sunWheelTeethCount;
+        /**
+         * 行星轮个数
+         */
+        @ApiModelProperty("行星轮个数")
+        private String planetWheelCount;
+        /**
+         * 行星轮齿数
+         */
+        @ApiModelProperty("行星轮齿数")
+        private String planetWheelTeethCount;
+        /**
+         * 太阳轮轴承品牌
+         */
+        @ApiModelProperty("太阳轮轴承品牌")
+        private String sunWheelBearingBrand;
+        /**
+         * 太阳轮轴承型号
+         */
+        @ApiModelProperty("太阳轮轴承型号")
+        private String sunWheelBearingModel;
+
+        /**
+         * 数据校验
+         *
+         * @param dto
+         * @return
+         */
+        public static boolean isValid(UnitGearboxStructureDto dto) {
+            if (dto == null) {
+                return false;
+            }
+            if (dto.getId() == null) {
+                return false;
+            }
+
+            if (dto.getGearboxCode() == null || dto.getGearboxCode().isEmpty()) {
+                return false;
+            }
+
+            if (dto.getGearboxStructure() == null) {
+                return false;
+            }
+
+            if (dto.getPlanetaryGearGrade() == null) {
+                return false;
+            }
+
+            if (dto.getLargeGearTeethCount() == null || dto.getLargeGearTeethCount().isEmpty()) {
+                return false;
+            }
+
+            if (dto.getSmallGearTeethCount() == null || dto.getSmallGearTeethCount().isEmpty()) {
+                return false;
+            }
+
+            if (dto.getBearingBrand() == null || dto.getBearingBrand().isEmpty()) {
+                return false;
+            }
+
+            if (dto.getBearingModel() == null || dto.getBearingModel().isEmpty()) {
+                return false;
+            }
+
+            if (dto.getGearRingTeethCount() == null || dto.getGearRingTeethCount().isEmpty()) {
+                return false;
+            }
+
+            if (dto.getSunWheelTeethCount() == null || dto.getSunWheelTeethCount().isEmpty()) {
+                return false;
+            }
+
+            if (dto.getPlanetWheelCount() == null || dto.getPlanetWheelCount().isEmpty()) {
+                return false;
+            }
+
+            if (dto.getPlanetWheelTeethCount() == null || dto.getPlanetWheelTeethCount().isEmpty()) {
+                return false;
+            }
+
+            if (dto.getSunWheelBearingBrand() == null || dto.getSunWheelBearingBrand().isEmpty()) {
+                return false;
+            }
+
+            if (dto.getSunWheelBearingModel() == null || dto.getSunWheelBearingModel().isEmpty()) {
+                return false;
+            }
+
+            return true;
+        }
+
+        // 判断所有属性是否都为空
+        public boolean allPropertiesAreNull() {
+            return (this.id == null || this.id == 0) &&
+                    (this.gearboxCode == null || this.gearboxCode.isEmpty()) &&
+                    (this.gearboxStructure == null || this.gearboxStructure == 0) &&
+                    (this.planetaryGearGrade == null || this.planetaryGearGrade == 0) &&
+                    (this.largeGearTeethCount == null || this.largeGearTeethCount.isEmpty()) &&
+                    (this.smallGearTeethCount == null || this.smallGearTeethCount.isEmpty()) &&
+                    (this.bearingBrand == null || this.bearingBrand.isEmpty()) &&
+                    (this.bearingModel == null || this.bearingModel.isEmpty()) &&
+                    (this.gearRingTeethCount == null || this.gearRingTeethCount.isEmpty()) &&
+                    (this.sunWheelTeethCount == null || this.sunWheelTeethCount.isEmpty()) &&
+                    (this.planetWheelCount == null || this.planetWheelCount.isEmpty()) &&
+                    (this.planetWheelTeethCount == null || this.planetWheelTeethCount.isEmpty()) &&
+                    (this.sunWheelBearingBrand == null || this.sunWheelBearingBrand.isEmpty()) &&
+                    (this.sunWheelBearingModel == null || this.sunWheelBearingModel.isEmpty());
+        }
+    }
+
+
+    /**
+     * 齿轮箱轴承
+     */
+    @Setter
+    @Getter
+    @ApiModel
+    public static class UnitGearboxBearingsDto {
+
+        @ApiModelProperty("主键")
+        private Integer id;
+
+        /**
+         * 齿轮箱编号
+         */
+        @ApiModelProperty("齿轮箱编号")
+        private String gearboxCode;
+
+        /**
+         * 齿轮箱轴承类型1.低速轴,2.低速中间轴3.高速轴
+         */
+        @ApiModelProperty("齿轮箱轴承类型1.低速轴,2.低速中间轴3.高速轴")
+        private Integer parallelWheelGrade;
+        /**
+         * 齿轮箱轴承编号
+         */
+        @ApiModelProperty("齿轮箱轴承编号")
+        private String gearboxBearingNumber;
+        /**
+         * 齿轮箱轴承级别1.2.3
+         */
+        @ApiModelProperty(" 齿轮箱轴承级别1.2.3")
+        private String gearboxBearingLevel;
+        /**
+         * 轴承品牌
+         */
+        @ApiModelProperty("轴承品牌")
+        private String bearingBrand;
+        /**
+         * 轴承型号
+         */
+        @ApiModelProperty("轴承型号")
+        private String bearingModel;
+        /**
+         * 齿圈齿数
+         */
+        @ApiModelProperty("齿圈齿数")
+        private String gearRingTeethCount;
+        /**
+         * 轴承-RS品牌
+         */
+        @ApiModelProperty("轴承-RS品牌")
+        private String bearingRsBrand;
+        /**
+         * 轴承-RS型号
+         */
+        @ApiModelProperty(" 轴承-RS型号")
+        private String bearingRsModel;
+        /**
+         * 轴承-GS品牌
+         */
+        @ApiModelProperty("轴承-GS品牌")
+        private String bearingGsBrand;
+        /**
+         * 轴承-GS型号
+         */
+        @ApiModelProperty("轴承-GS型号")
+        private String bearingGsModel;
+
+        /**
+         * 数据校验
+         *
+         * @param gearboxBearing
+         * @return
+         */
+        public static boolean isValid(UnitGearboxBearingsDto gearboxBearing) {
+            if (gearboxBearing == null) {
+                return false;
+            }
+            if (gearboxBearing.getId() == null) {
+                return false;
+            }
+
+            if (gearboxBearing.getGearboxCode() == null || gearboxBearing.getGearboxCode().isEmpty()) {
+                return false;
+            }
+
+            if (gearboxBearing.getParallelWheelGrade() == null) {
+                return false;
+            }
+
+            if (gearboxBearing.getGearboxBearingNumber() == null || gearboxBearing.getGearboxBearingNumber().isEmpty()) {
+                return false;
+            }
+
+            if (gearboxBearing.getGearboxBearingLevel() == null || gearboxBearing.getGearboxBearingLevel().isEmpty()) {
+                return false;
+            }
+
+            if (gearboxBearing.getBearingBrand() == null || gearboxBearing.getBearingBrand().isEmpty()) {
+                return false;
+            }
+
+            if (gearboxBearing.getBearingModel() == null || gearboxBearing.getBearingModel().isEmpty()) {
+                return false;
+            }
+
+            if (gearboxBearing.getGearRingTeethCount() == null || gearboxBearing.getGearRingTeethCount().isEmpty()) {
+                return false;
+            }
+
+            if (gearboxBearing.getBearingRsBrand() == null || gearboxBearing.getBearingRsBrand().isEmpty()) {
+                return false;
+            }
+
+            if (gearboxBearing.getBearingRsModel() == null || gearboxBearing.getBearingRsModel().isEmpty()) {
+                return false;
+            }
+
+            if (gearboxBearing.getBearingGsBrand() == null || gearboxBearing.getBearingGsBrand().isEmpty()) {
+                return false;
+            }
+
+            if (gearboxBearing.getBearingGsModel() == null || gearboxBearing.getBearingGsModel().isEmpty()) {
+                return false;
+            }
+
+            return true;
+        }
+
+
+        // 判断所有属性是否都为空
+        public boolean allPropertiesAreNull() {
+            return (this.id == null || this.id == 0) &&
+                    (this.gearboxCode == null || this.gearboxCode.isEmpty()) &&
+                    (this.parallelWheelGrade == null || this.parallelWheelGrade == 0) &&
+                    (this.gearboxBearingNumber == null || this.gearboxBearingNumber.isEmpty()) &&
+                    (this.gearboxBearingLevel == null || this.gearboxBearingLevel.isEmpty()) &&
+                    (this.bearingBrand == null || this.bearingBrand.isEmpty()) &&
+                    (this.bearingModel == null || this.bearingModel.isEmpty()) &&
+                    (this.gearRingTeethCount == null || this.gearRingTeethCount.isEmpty()) &&
+                    (this.bearingRsBrand == null || this.bearingRsBrand.isEmpty()) &&
+                    (this.bearingRsModel == null || this.bearingRsModel.isEmpty()) &&
+                    (this.bearingGsBrand == null || this.bearingGsBrand.isEmpty()) &&
+                    (this.bearingGsModel == null || this.bearingGsModel.isEmpty());
+        }
+
+
+    }
+
+
+    /**
+     * 主轴相关参数
+     */
+    @Setter
+    @Getter
+    @ApiModel
+    public static class UnitBearingsDto {
+
+        /**
+         * 主键
+         */
+        @ApiModelProperty("主键")
+        private Integer id;
+
+        /**
+         * 主轴部件编号;主轴部件编号
+         */
+        @ApiModelProperty("主轴部件编号")
+        private String code;
+
+        /**
+         * 润滑油品牌
+         */
+        @ApiModelProperty("润滑油品牌")
+        private String lubricantBrand;
+        /**
+         * 润滑油型号
+         */
+        @ApiModelProperty("润滑油型号")
+        private String lubricantModel;
+        /**
+         * 前轴承品牌
+         */
+        @ApiModelProperty("前轴承品牌")
+        private String frontBearingBrand;
+        /**
+         * 前轴承型号
+         */
+        @ApiModelProperty("前轴承型号")
+        private String frontBearingModel;
+        /**
+         * 后轴承品牌
+         */
+        @ApiModelProperty("后轴承品牌")
+        private String rearBearingBrand;
+        /**
+         * 后轴承型号
+         */
+        @ApiModelProperty("后轴承型号")
+        private String rearBearingModel;
+
+        /**
+         * 数据验证
+         *
+         * @param component
+         * @return
+         */
+        public static boolean isValid(UnitBearingsDto component) {
+
+            if (component == null) {
+                return false;
+            }
+            if (component.getId() == null) {
+                return false;
+            }
+
+            if (component.getCode() == null || component.getCode().isEmpty()) {
+                return false;
+            }
+
+            if (component.getLubricantBrand() == null || component.getLubricantBrand().isEmpty()) {
+                return false;
+            }
+
+            if (component.getLubricantModel() == null || component.getLubricantModel().isEmpty()) {
+                return false;
+            }
+
+            if (component.getFrontBearingBrand() == null || component.getFrontBearingBrand().isEmpty()) {
+                return false;
+            }
+
+            if (component.getFrontBearingModel() == null || component.getFrontBearingModel().isEmpty()) {
+                return false;
+            }
+
+            if (component.getRearBearingBrand() == null || component.getRearBearingBrand().isEmpty()) {
+                return false;
+            }
+
+            if (component.getRearBearingModel() == null || component.getRearBearingModel().isEmpty()) {
+                return false;
+            }
+
+            return true;
+        }
+
+        // 判断所有属性是否都为空
+        public boolean allPropertiesAreNull() {
+            return (this.id == null || this.id == 0) &&
+                    (this.code == null || this.code.isEmpty()) &&
+                    (this.lubricantBrand == null || this.lubricantBrand.isEmpty()) &&
+                    (this.lubricantModel == null || this.lubricantModel.isEmpty()) &&
+                    (this.frontBearingBrand == null || this.frontBearingBrand.isEmpty()) &&
+                    (this.frontBearingModel == null || this.frontBearingModel.isEmpty()) &&
+                    (this.rearBearingBrand == null || this.rearBearingBrand.isEmpty()) &&
+                    (this.rearBearingModel == null || this.rearBearingModel.isEmpty());
+        }
+
+    }
+
+
+    /**
+     * 发电机相关参数
+     */
+    @Setter
+    @Getter
+    @ApiModel
+    public static class UnitDynamoDto {
+
+        /**
+         * 主键
+         */
+        @ApiModelProperty("主键")
+        private Integer id;
+
+        /**
+         * 极对数
+         */
+        @ApiModelProperty("极对数")
+        private Integer polePairs;
+        /**
+         * 冷却方式
+         */
+        @ApiModelProperty("冷却方式")
+        private Integer coolingMethod;
+        /**
+         * 润滑油品牌
+         */
+        @ApiModelProperty("润滑油品牌")
+        private String lubricantBrand;
+        /**
+         * 润滑油型号
+         */
+        @ApiModelProperty("润滑油型号")
+        private String lubricantModel;
+        /**
+         * 驱动端轴承品牌
+         */
+        @ApiModelProperty("驱动端轴承品牌")
+        private String driveEndBearingBrand;
+        /**
+         * 驱动端轴承型号
+         */
+        @ApiModelProperty("驱动端轴承型号")
+        private String driveEndBearingModel;
+        /**
+         * 非驱动端轴承品牌
+         */
+        @ApiModelProperty("非驱动端轴承品牌")
+        private String nonDriveEndBearingBrand;
+        /**
+         * 非驱动端轴承型号
+         */
+        @ApiModelProperty("非驱动端轴承型号")
+        private String nonDriveEndBearingModel;
+
+        /**
+         * 数据校验
+         *
+         * @param motor
+         * @return
+         */
+        public static boolean isValid(UnitDynamoDto motor) {
+            if (motor == null) {
+                return false;
+            }
+            if (motor.getId() == null) {
+                return false;
+            }
+
+            if (motor.getPolePairs() == null) {
+                return false;
+            }
+
+            if (motor.getCoolingMethod() == null) {
+                return false;
+            }
+
+            if (motor.getLubricantBrand() == null || motor.getLubricantBrand().isEmpty()) {
+                return false;
+            }
+
+            if (motor.getLubricantModel() == null || motor.getLubricantModel().isEmpty()) {
+                return false;
+            }
+
+            if (motor.getDriveEndBearingBrand() == null || motor.getDriveEndBearingBrand().isEmpty()) {
+                return false;
+            }
+
+            if (motor.getDriveEndBearingModel() == null || motor.getDriveEndBearingModel().isEmpty()) {
+                return false;
+            }
+
+            if (motor.getNonDriveEndBearingBrand() == null || motor.getNonDriveEndBearingBrand().isEmpty()) {
+                return false;
+            }
+
+            if (motor.getNonDriveEndBearingModel() == null || motor.getNonDriveEndBearingModel().isEmpty()) {
+                return false;
+            }
+
+            return true;
+        }
+
+        // 判断所有属性是否都为空
+        public boolean allPropertiesAreNull() {
+            return (this.id == null || this.id == 0) &&
+                    (this.polePairs == null || this.polePairs == 0) &&
+                    (this.coolingMethod == null || this.coolingMethod == 0) &&
+                    (this.lubricantBrand == null || this.lubricantBrand.isEmpty()) &&
+                    (this.lubricantModel == null || this.lubricantModel.isEmpty()) &&
+                    (this.driveEndBearingBrand == null || this.driveEndBearingBrand.isEmpty()) &&
+                    (this.driveEndBearingModel == null || this.driveEndBearingModel.isEmpty()) &&
+                    (this.nonDriveEndBearingBrand == null || this.nonDriveEndBearingBrand.isEmpty()) &&
+                    (this.nonDriveEndBearingModel == null || this.nonDriveEndBearingModel.isEmpty());
+        }
+
+
+    }
+
+
+    // 通用方法:传入一个对象,当对象中的字符串属性为空时将其设置为null
+    public static <T> T validateAndSetEmptyToNull(T obj) {
+        if (obj == null) {
+            return null;
+        }
+        boolean allFieldsNull = true;
+        Field[] fields = obj.getClass().getDeclaredFields();
+        for (Field field : fields) {
+            try {
+                field.setAccessible(true);
+                Object value = field.get(obj);
+
+                if (value instanceof String) {
+                    String strValue = (String) value;
+                    if (strValue != null && !strValue.trim().isEmpty()) {
+                        allFieldsNull = false;
+                    }else{
+                        field.set(obj, null);
+                    }
+                }
+                if (value instanceof Integer) {
+                    Integer strValue = (Integer) value;
+                    if (strValue != null && strValue > 0) {
+                        allFieldsNull = false;
+                    }else{
+                        field.set(obj, null);
+                    }
+                }
+            } catch (IllegalAccessException e) {
+                e.printStackTrace();
+            }
+        }
+
+        if (allFieldsNull) {
+            try {
+                return (T) obj.getClass().newInstance();
+            } catch (InstantiationException | IllegalAccessException e) {
+                e.printStackTrace();
+            }
+        }
+        return obj;
+    }
+
+
+}

+ 28 - 0
energy-manage-service/src/main/java/com/energy/manage/service/domain/vo/units/UnitDictBrandModelVo.java

@@ -0,0 +1,28 @@
+package com.energy.manage.service.domain.vo.units;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+
+@Getter
+@Setter
+@ApiModel("风机部件品牌型号分页查询")
+public class UnitDictBrandModelVo {
+
+
+    @ApiModelProperty("主键id")
+    private Integer id;
+
+    //品牌
+    @ApiModelProperty("品牌")
+    private String manufacture;
+
+    //型号
+    @ApiModelProperty("型号")
+    private  String modelNumber;
+
+
+
+}

+ 89 - 0
energy-manage-service/src/main/java/com/energy/manage/service/domain/vo/units/UnitDictConstantsVo.java

@@ -0,0 +1,89 @@
+package com.energy.manage.service.domain.vo.units;
+
+import com.energy.manage.service.domain.dto.BaseDto;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+import java.util.Date;
+
+/**
+ * 分页查询
+ */
+@Getter
+@Setter
+@ApiModel("风机部件字典分页查询")
+public class UnitDictConstantsVo {
+
+    // 主键id
+    @ApiModelProperty("主键id")
+    private Integer id;
+
+    // 父级ID,当创建字典时传0 , 当创建属性值时传对应父节点对应id
+    @ApiModelProperty("父级ID,当创建字典时传0 , 当创建属性值时传对应父节点对应id")
+    private Long parentId;
+
+    /**
+     * 部件类型(字典表):1..轴承2.润滑油3.冷却方式
+     */
+    @ApiModelProperty(" 部件类型(字典表):1.轴承2.润滑油3.冷却方式")
+    @NotNull(message = "部件类型不能为空")
+    private Integer contentsDictKey;
+
+    // 字典名称/属性名称
+    @ApiModelProperty("字典名称/属性名称")
+    private String contentsName;
+
+    // 字典或属性对应值
+    @ApiModelProperty("字典或属性对应值")
+    private Integer contentsValue;
+
+    // 字典/属性类型编号
+    @ApiModelProperty("字典/属性类型编号")
+    private String contentsType;
+
+    /**
+     * 部件模块编号1.主轴2.齿轮箱3.发电机
+     */
+    @ApiModelProperty("部件模块编号")
+    private Integer unitModule;
+
+    @ApiModelProperty("部件模块名称")
+    private String unitModuleName;
+
+    /**
+     * 关联功能(0.普通字典模式1.品牌型号)
+     */
+    @ApiModelProperty("关联功能")
+    private Integer associatedFunctionType;
+
+    @ApiModelProperty("关联功能名称")
+    private String associatedFunctionTypeName;
+
+    // 描述
+    private String contentsDescribe;
+
+    /**
+     * 创建时间
+     */
+    @ApiModelProperty(value = "创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    private Date createTime;
+
+
+    /**
+     * 更新时间
+     */
+    @ApiModelProperty(value = "更新时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    private Date updateTime;
+
+
+
+
+
+
+}

+ 24 - 0
energy-manage-service/src/main/java/com/energy/manage/service/domain/vo/units/UnitDictRoutineListVo.java

@@ -0,0 +1,24 @@
+package com.energy.manage.service.domain.vo.units;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 部件常规字典属性
+ */
+@Getter
+@Setter
+public class UnitDictRoutineListVo {
+
+    /**
+     * 字典key
+     */
+    private Integer keyId;
+
+    /**
+     * 字典名字
+     */
+    private String valueName;
+
+
+}

+ 354 - 0
energy-manage-service/src/main/java/com/energy/manage/service/domain/vo/units/UnitVo.java

@@ -0,0 +1,354 @@
+package com.energy.manage.service.domain.vo.units;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * 显示部件相关信息
+ */
+@Getter
+@Setter
+@ApiModel("显示部件相关信息")
+public class UnitVo {
+
+    /**
+     * 机型编号
+     */
+    @ApiModelProperty("机型编号")
+    private String millTypeCode;
+
+    @ApiModelProperty("主轴相关参数")
+    UnitBearingsVo unitBearingsVo;
+
+
+    @ApiModelProperty("齿轮箱相关参数")
+    UnitGearVo unitGearVo;
+
+
+    @ApiModelProperty("发电机相关参数")
+    UnitDynamoVo unitDynamoVo;
+
+
+    /**
+     * 齿轮箱相关参数
+     */
+    @Setter
+    @Getter
+    @ApiModel("齿轮箱相关")
+    public static class UnitGearVo{
+
+        /**
+         * 主键
+         */
+        @ApiModelProperty("主键")
+        private Integer id;
+
+        /**
+         * 部件编号
+         */
+        @ApiModelProperty("部件编号")
+        private String code;
+
+        /**
+         * 润滑油品牌
+         */
+        @ApiModelProperty("润滑油品牌")
+        private String lubricantBrand;
+        /**
+         * 润滑油型号
+         */
+        @ApiModelProperty("润滑油型号")
+        private String lubricantModel;
+
+
+        /**
+         * 齿轮箱轴承集合
+         */
+        @ApiModelProperty("齿轮箱轴承集合")
+        List<UnitGearboxBearingsVo> unitGearboxBearingsList;
+
+        /**
+         * 齿轮箱结构集合
+         */
+        @ApiModelProperty("齿轮箱结构集合")
+        List<UnitGearboxStructureVo> unitGearboxStructureList;
+
+
+    }
+
+    /**
+     * 齿轮箱结构表
+     */
+    @Setter
+    @Getter
+    @ApiModel("齿轮箱结构表")
+    public static class UnitGearboxStructureVo{
+
+        @ApiModelProperty("主键")
+        private Integer id;
+
+        /**
+         * 齿轮箱总表编号
+         */
+        @ApiModelProperty("齿轮箱总表编号")
+        private String gearboxCode;
+        /**
+         * 齿轮箱结构类型;1.行星轮2.平行轮
+         */
+        @ApiModelProperty("齿轮箱结构类型;1.行星轮2.平行轮")
+        private Integer gearboxStructure;
+        /**
+         * 齿轮箱结构等级;sort_num1,2......
+         */
+        @ApiModelProperty("齿轮箱结构等级;sort_num1,2......")
+        private Integer planetaryGearGrade;
+        /**
+         * 大齿轮齿数
+         */
+        @ApiModelProperty("大齿轮齿数")
+        private String largeGearTeethCount;
+        /**
+         * 小齿轮齿数
+         */
+        @ApiModelProperty("小齿轮齿数")
+        private String smallGearTeethCount;
+        /**
+         * 轴承品牌
+         */
+        @ApiModelProperty("轴承品牌")
+        private String bearingBrand;
+        /**
+         * 轴承型号
+         */
+        @ApiModelProperty("轴承型号")
+        private String bearingModel;
+        /**
+         * 齿圈齿数
+         */
+        @ApiModelProperty("齿圈齿数")
+        private String gearRingTeethCount;
+        /**
+         * 太阳轮齿数
+         */
+        @ApiModelProperty("太阳轮齿数")
+        private String sunWheelTeethCount;
+        /**
+         * 行星轮个数
+         */
+        @ApiModelProperty("行星轮个数")
+        private String planetWheelCount;
+        /**
+         * 行星轮齿数
+         */
+        @ApiModelProperty("行星轮齿数")
+        private String planetWheelTeethCount;
+        /**
+         * 太阳轮轴承品牌
+         */
+        @ApiModelProperty("太阳轮轴承品牌")
+        private String sunWheelBearingBrand;
+        /**
+         * 太阳轮轴承型号
+         */
+        @ApiModelProperty("太阳轮轴承型号")
+        private String sunWheelBearingModel;
+
+
+    }
+
+
+    /**
+     * 齿轮箱轴承
+     */
+    @Setter
+    @Getter
+    @ApiModel
+    public static class UnitGearboxBearingsVo{
+
+        @ApiModelProperty("主键")
+        private Integer id;
+
+        /**
+         * 齿轮箱编号
+         */
+        @ApiModelProperty("齿轮箱编号")
+        private String gearboxCode;
+        /**
+         * 齿轮箱轴承类型1.低速轴,2.低速中间轴3.高速轴
+         */
+        @ApiModelProperty("齿轮箱轴承类型1.低速轴,2.低速中间轴3.高速轴")
+        private Integer parallelWheelGrade;
+        /**
+         * 齿轮箱轴承编号
+         */
+        @ApiModelProperty("齿轮箱轴承编号")
+        private String gearboxBearingNumber;
+        /**
+         * 齿轮箱轴承级别1.2.3
+         */
+        @ApiModelProperty("齿轮箱轴承级别1.2.3")
+        private String gearboxBearingLevel;
+        /**
+         * 轴承品牌
+         */
+        @ApiModelProperty("轴承品牌")
+        private String bearingBrand;
+        /**
+         * 轴承型号
+         */
+        @ApiModelProperty("轴承型号")
+        private String bearingModel;
+        /**
+         * 齿圈齿数
+         */
+        @ApiModelProperty("齿圈齿数")
+        private String gearRingTeethCount;
+        /**
+         * 轴承-RS品牌
+         */
+        @ApiModelProperty("轴承-RS品牌")
+        private String bearingRsBrand;
+        /**
+         * 轴承-RS型号
+         */
+        @ApiModelProperty("轴承-RS型号")
+        private String bearingRsModel;
+        /**
+         * 轴承-GS品牌
+         */
+        @ApiModelProperty("轴承-GS品牌")
+        private String bearingGsBrand;
+        /**
+         * 轴承-GS型号
+         */
+        @ApiModelProperty("轴承-GS型号")
+        private String bearingGsModel;
+
+
+    }
+
+
+
+    /**
+     * 主轴相关参数
+     */
+    @Setter
+    @Getter
+    @ApiModel
+    public static class UnitBearingsVo {
+
+        /**
+         * 主键
+         */
+        @ApiModelProperty("主键")
+        private Integer id;
+
+        /**
+         * 主轴部件编号
+         */
+        @ApiModelProperty("主轴部件编号")
+        private String code;
+
+        /**
+         * 润滑油品牌
+         */
+        @ApiModelProperty("润滑油品牌")
+        private String lubricantBrand;
+        /**
+         * 润滑油型号
+         */
+        @ApiModelProperty("润滑油型号")
+        private String lubricantModel;
+        /**
+         * 前轴承品牌
+         */
+        @ApiModelProperty("前轴承品牌")
+        private String frontBearingBrand;
+        /**
+         * 前轴承型号
+         */
+        @ApiModelProperty("前轴承型号")
+        private String frontBearingModel;
+        /**
+         * 后轴承品牌
+         */
+        @ApiModelProperty("后轴承品牌")
+        private String rearBearingBrand;
+        /**
+         * 后轴承型号
+         */
+        @ApiModelProperty("后轴承型号")
+        private String rearBearingModel;
+        /**
+         * 删除状态
+         */
+        @ApiModelProperty("删除状态")
+        private Integer delState;
+
+    }
+
+
+    /**
+     * 发电机相关参数
+     */
+    @Setter
+    @Getter
+    @ApiModel
+    public static class UnitDynamoVo {
+
+        /**
+         * 主键
+         */
+        @ApiModelProperty("主键")
+        private Integer id;
+
+        /**
+         * 极对数
+         */
+        @ApiModelProperty("极对数")
+        private Integer polePairs;
+        /**
+         * 冷却方式
+         */
+        @ApiModelProperty("冷却方式")
+        private Integer coolingMethod;
+        /**
+         * 润滑油品牌
+         */
+        @ApiModelProperty("润滑油品牌")
+        private String lubricantBrand;
+        /**
+         * 润滑油型号
+         */
+        @ApiModelProperty("润滑油型号")
+        private String lubricantModel;
+        /**
+         * 驱动端轴承品牌
+         */
+        @ApiModelProperty("驱动端轴承品牌")
+        private String driveEndBearingBrand;
+        /**
+         * 驱动端轴承型号
+         */
+        @ApiModelProperty("驱动端轴承型号")
+        private String driveEndBearingModel;
+        /**
+         * 非驱动端轴承品牌
+         */
+        @ApiModelProperty("非驱动端轴承品牌")
+        private String nonDriveEndBearingBrand;
+        /**
+         * 非驱动端轴承型号
+         */
+        @ApiModelProperty("非驱动端轴承型号")
+        private String nonDriveEndBearingModel;
+
+
+    }
+
+
+}

+ 10 - 0
energy-manage-service/src/main/java/com/energy/manage/service/mappers/units/UnitBearingsMapper.java

@@ -0,0 +1,10 @@
+package com.energy.manage.service.mappers.units;
+
+import com.energy.manage.common.mapper.MyMapper;
+import com.energy.manage.common.po.units.UnitBearingsPO;
+import com.energy.manage.common.po.units.UnitDictBrandModelPO;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface UnitBearingsMapper extends MyMapper<UnitBearingsPO> {
+}

+ 32 - 0
energy-manage-service/src/main/java/com/energy/manage/service/mappers/units/UnitDictBrandModelMapper.java

@@ -0,0 +1,32 @@
+package com.energy.manage.service.mappers.units;
+
+import com.energy.manage.common.mapper.MyMapper;
+import com.energy.manage.common.po.units.UnitDictBrandModelPO;
+import com.energy.manage.common.po.units.UnitDictConstantsPO;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface UnitDictBrandModelMapper extends MyMapper<UnitDictBrandModelPO> {
+
+    /**
+     * 查询品牌
+     * @param unitType
+     * @return
+     */
+    List<String> selectUnitManufactureByUnitType(@Param("unitType")Integer unitType);
+
+    /**
+     * 查询品牌对应型号
+     * @param unitType
+     * @param manufacture
+     * @return
+     */
+    List<String> selectUnitModelNumberByManufacture(@Param("unitType")Integer unitType,
+                                                    @Param("manufacture")String manufacture);
+
+
+
+}

+ 16 - 0
energy-manage-service/src/main/java/com/energy/manage/service/mappers/units/UnitDictConstantsMapper.java

@@ -0,0 +1,16 @@
+package com.energy.manage.service.mappers.units;
+
+import com.energy.manage.common.mapper.MyMapper;
+import com.energy.manage.common.po.units.UnitDictConstantsPO;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 部件带子集树结构的字典表
+ * 
+ * @author sy
+ * @date 2024-11-05 17:37:45
+ */
+@Repository
+public interface UnitDictConstantsMapper extends MyMapper<UnitDictConstantsPO> {
+
+}

+ 10 - 0
energy-manage-service/src/main/java/com/energy/manage/service/mappers/units/UnitDynamoMapper.java

@@ -0,0 +1,10 @@
+package com.energy.manage.service.mappers.units;
+
+import com.energy.manage.common.mapper.MyMapper;
+import com.energy.manage.common.po.units.UnitBearingsPO;
+import com.energy.manage.common.po.units.UnitDynamoPO;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface UnitDynamoMapper extends MyMapper<UnitDynamoPO> {
+}

+ 10 - 0
energy-manage-service/src/main/java/com/energy/manage/service/mappers/units/UnitGearboxBearingsMapper.java

@@ -0,0 +1,10 @@
+package com.energy.manage.service.mappers.units;
+
+import com.energy.manage.common.mapper.MyMapper;
+import com.energy.manage.common.po.units.UnitGearboxBearingsPO;
+import com.energy.manage.common.po.units.UnitGearboxPO;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface UnitGearboxBearingsMapper extends MyMapper<UnitGearboxBearingsPO> {
+}

+ 10 - 0
energy-manage-service/src/main/java/com/energy/manage/service/mappers/units/UnitGearboxMapper.java

@@ -0,0 +1,10 @@
+package com.energy.manage.service.mappers.units;
+
+import com.energy.manage.common.mapper.MyMapper;
+import com.energy.manage.common.po.units.UnitBearingsPO;
+import com.energy.manage.common.po.units.UnitGearboxPO;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface UnitGearboxMapper extends MyMapper<UnitGearboxPO> {
+}

+ 10 - 0
energy-manage-service/src/main/java/com/energy/manage/service/mappers/units/UnitGearboxStructureMapper.java

@@ -0,0 +1,10 @@
+package com.energy.manage.service.mappers.units;
+
+import com.energy.manage.common.mapper.MyMapper;
+import com.energy.manage.common.po.units.UnitGearboxPO;
+import com.energy.manage.common.po.units.UnitGearboxStructurePO;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface UnitGearboxStructureMapper extends MyMapper<UnitGearboxStructurePO> {
+}

+ 2 - 0
energy-manage-service/src/main/java/com/energy/manage/service/service/cache/CacheService.java

@@ -16,4 +16,6 @@ public interface CacheService {
     void delete(String key);
 
     Long incr(String key);
+
+    Long incrBy(String key,long value);
 }

+ 8 - 0
energy-manage-service/src/main/java/com/energy/manage/service/service/cache/impl/CacheServiceImpl.java

@@ -92,5 +92,13 @@ public class CacheServiceImpl implements CacheService {
 
     }
 
+    @Override
+    public Long incrBy(String key,long value) {
+
+        return redisTemplate.execute(
+                (RedisCallback<Long>) connection -> connection.incrBy(redisTemplate.getStringSerializer().serialize(key),value));
+
+    }
+
 
 }

+ 132 - 0
energy-manage-service/src/main/java/com/energy/manage/service/service/units/UnitDictConstantsService.java

@@ -0,0 +1,132 @@
+package com.energy.manage.service.service.units;
+
+
+import com.energy.manage.common.base.Page;
+import com.energy.manage.service.domain.dto.units.*;
+import com.energy.manage.service.domain.vo.units.UnitDictBrandModelVo;
+import com.energy.manage.service.domain.vo.units.UnitDictConstantsVo;
+
+import java.util.List;
+
+/**
+ * 部件字典表接口
+ */
+public interface UnitDictConstantsService  {
+
+
+    /**
+     * 创建数据字典
+     * @param unitDictConstantsDto
+     * @return
+     */
+    boolean saveUnitDict(UnitDictConstantsDto unitDictConstantsDto);
+
+    /**
+     * 更新数据字典
+     * @param unitDictConstantsUpdateDto
+     * @return
+     */
+    boolean updateUnitDict(UnitDictConstantsUpdateDto unitDictConstantsUpdateDto);
+
+
+    /**
+     * 删除数据字典
+     * @param unitDictConstantsDelDto
+     * @return
+     */
+    boolean delUnitDict(UnitDictConstantsDelDto unitDictConstantsDelDto);
+
+
+
+
+    /**
+     * 部件字典分页列表,通过名字查询
+     * @return
+     */
+    Page<UnitDictConstantsVo> getUnitDictConstantsPage(UnitDictConstantsPageDto unitDictConstantsPageDto);
+
+
+    /**
+     * 创建部件属性数据
+     * @return
+     */
+    boolean saveUnitDictProperty(UnitDictConstantsDto unitDictConstantsDto);
+
+
+    /**
+     * 删除字典属性
+     * @param unitDictConstantsPDelDto
+     * @return
+     */
+    boolean delUnitDictProperty(UnitDictConstantsPDelDto unitDictConstantsPDelDto);
+
+
+    /**
+     * 更新字典属性名字
+     * @param unitDictConstantsUpdateDto
+     * @return
+     */
+    boolean updateUnitDictProperty(UnitDictConstantsUpdateDto unitDictConstantsUpdateDto);
+
+
+    /**
+     * 字典属性集合
+     * @param contentsType
+     * @return
+     */
+    List<UnitDictConstantsVo> getUnitDictConstantsList(String contentsType);
+
+
+    /**
+     * 通过主键id查询字典对象
+     * @param id
+     * @return
+     */
+    UnitDictConstantsVo getUnitDictConstants(Integer id);
+
+
+    /**
+     * 查询品牌型号分页查询
+     * @param unitDictBrandModelPageDto
+     * @return
+     */
+    Page<UnitDictBrandModelVo>  getUnitDictBrandModelPage(UnitDictBrandModelPageDto unitDictBrandModelPageDto);
+
+    /**
+     * 创建部件品牌型号
+     * @param unitDictBrandModelDto
+     * @return
+     */
+    boolean saveUnitDictBrandModel(UnitDictBrandModelDto unitDictBrandModelDto);
+
+    /**
+     * 更新部件品牌型号
+     * @param unitDictBrandModelUpdateDto
+     * @return
+     */
+    boolean updateUnitDictBrandModel(UnitDictBrandModelUpdateDto unitDictBrandModelUpdateDto);
+
+    /**
+     * 删除部件品牌型号
+     * @param unitDictBrandModelIdDto
+     * @return
+     */
+    boolean delUnitDictBrandModel(UnitDictBrandModelIdDto unitDictBrandModelIdDto);
+
+
+    /**
+     * 通过部件类型/品牌名称查询集合
+     * @param unitDictBrandModelDto
+     * @return
+     */
+    List<String> getUnitDictBrandModelList(UnitDictBrandModelDto unitDictBrandModelDto);
+
+    /**
+     * 验证品牌型号在数据库中是否存在
+     * @param dto
+     * @return
+     */
+    boolean verifyUnitDictBrandModel(UnitDictBrandModelDto dto);
+
+
+}

+ 62 - 0
energy-manage-service/src/main/java/com/energy/manage/service/service/units/UnitService.java

@@ -0,0 +1,62 @@
+package com.energy.manage.service.service.units;
+
+import com.energy.manage.common.po.units.UnitBearingsPO;
+import com.energy.manage.common.po.units.UnitDynamoPO;
+import com.energy.manage.service.domain.dto.units.UnitDictBrandModelDto;
+import com.energy.manage.service.domain.dto.units.UnitDictRoutineDto;
+import com.energy.manage.service.domain.dto.units.UnitDto;
+import com.energy.manage.service.domain.vo.units.UnitDictRoutineListVo;
+import com.energy.manage.service.domain.vo.units.UnitVo;
+
+import java.util.List;
+
+/**
+ * 部件接口
+ */
+public interface UnitService {
+
+    /**
+     * 查询部件字典常用类型属性
+     * @param unitDictRoutineDto
+     * @return
+     */
+    List<UnitDictRoutineListVo> getUnitDictRoutineList(UnitDictRoutineDto unitDictRoutineDto);
+
+    /**
+     * 通过部件类型/品牌名称查询集合
+     * @param unitDictBrandModelDto
+     * @return
+     */
+    List<String> getBrandModelNameOrModelNumber (UnitDictBrandModelDto unitDictBrandModelDto);
+
+
+    /**
+     * 更新部件相关信息
+     * @param unitDto
+     * @return
+     */
+    boolean modificationUnit(UnitDto unitDto,Integer userId);
+
+    /**
+     * 通过机型编号查询部件信息
+     * @param millTypeCode
+     * @return
+     */
+    UnitVo getUnitVo(String millTypeCode);
+
+    /**
+     * 验证主轴是否绑定机型
+     * @param millTypeCode
+     * @return
+     */
+    UnitBearingsPO verifyUnitBearingByMillTypeCode(String millTypeCode);
+
+
+    /**
+     * 验证发电机是否绑定机型
+     * @param millTypeCode
+     * @return
+     */
+    UnitDynamoPO verifyUnitDynamoByMillTypeCode(String millTypeCode);
+
+}

+ 308 - 0
energy-manage-service/src/main/java/com/energy/manage/service/service/units/impl/UnitDictConstantsServiceImpl.java

@@ -0,0 +1,308 @@
+package com.energy.manage.service.service.units.impl;
+
+
+import cn.hutool.core.bean.BeanUtil;
+import com.energy.manage.common.base.BaseServiceImpl;
+import com.energy.manage.common.base.Page;
+import com.energy.manage.common.constant.redis.ManagerRedisKeyConstant;
+import com.energy.manage.common.enums.DeleteStatusEnum;
+import com.energy.manage.common.enums.IdPrefixEnum;
+import com.energy.manage.common.po.units.UnitDictBrandModelPO;
+import com.energy.manage.common.po.units.UnitDictConstantsPO;
+import com.energy.manage.common.util.IdGeneratorUtil;
+import com.energy.manage.service.domain.dto.units.*;
+import com.energy.manage.service.domain.vo.units.UnitDictBrandModelVo;
+import com.energy.manage.service.domain.vo.units.UnitDictConstantsVo;
+import com.energy.manage.service.mappers.units.UnitDictBrandModelMapper;
+import com.energy.manage.service.mappers.units.UnitDictConstantsMapper;
+import com.energy.manage.service.service.cache.CacheService;
+import com.energy.manage.service.service.dict.DictConstantsService;
+import com.energy.manage.service.service.units.UnitDictConstantsService;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.google.common.collect.Lists;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import tk.mybatis.mapper.entity.Example;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 部件字典表接口
+ */
+@Slf4j
+@Service
+public class UnitDictConstantsServiceImpl extends BaseServiceImpl<UnitDictConstantsPO> implements UnitDictConstantsService {
+
+    @Autowired
+    private UnitDictConstantsMapper dictConstantsMapper;
+
+    @Autowired
+    private CacheService cacheService;
+
+    @Autowired
+    private DictConstantsService dictConstantsService;
+
+    @Autowired
+    private UnitDictBrandModelMapper unitDictBrandModelMapper;
+
+    // 定义字典中部件模块类型
+    private final int unit_module_number = 3;
+
+    // 定义字典中部件类型
+    private final int associated_function_type_number = 5;
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean saveUnitDict(UnitDictConstantsDto unitDictConstantsDto) {
+
+        UnitDictConstantsPO unitDictConstantsPO = new UnitDictConstantsPO();
+        BeanUtil.copyProperties(unitDictConstantsDto, unitDictConstantsPO);
+        unitDictConstantsPO.setDelState(DeleteStatusEnum.NODELETE.getCode());
+        String contentsTypeCode = IdPrefixEnum.UNIT_DICT_TYPE_CODE.getCode().concat(IdGeneratorUtil.zeroFillUtil(cacheService.incr(ManagerRedisKeyConstant.build(ManagerRedisKeyConstant.IDGENERATOR_CONSTANTS_KEY, IdPrefixEnum.UNIT_DICT_TYPE_CODE.getCode()))));
+
+        // 初始化字典值
+        long contentsValue = 0;
+        UnitDictConstantsPO po = new UnitDictConstantsPO();
+        po.setParentId(0L);
+        int count = dictConstantsMapper.selectCount(po);
+        if (count == 0) {
+            contentsValue = cacheService.incrBy(ManagerRedisKeyConstant.IDGENERATOR_UDTC_KEY, 1000L);
+        }
+        contentsValue = cacheService.incr(ManagerRedisKeyConstant.IDGENERATOR_UDTC_KEY);
+
+        unitDictConstantsPO.setContentsValue(Integer.valueOf(String.valueOf(contentsValue)));
+        unitDictConstantsPO.setContentsType(contentsTypeCode);
+        unitDictConstantsPO.setCreateTime(new Date());
+        unitDictConstantsPO.setUpdateTime(new Date());
+
+        return dictConstantsMapper.insertUseGeneratedKeys(unitDictConstantsPO) > 0;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean updateUnitDict(UnitDictConstantsUpdateDto unitDictConstantsUpdateDto) {
+
+        UnitDictConstantsPO po = new UnitDictConstantsPO();
+        po.setContentsName(unitDictConstantsUpdateDto.getContentsName());
+        po.setUpdateTime(new Date());
+        po.setUpdateBy(unitDictConstantsUpdateDto.getUpdateBy());
+        Example queryExample = new Example(UnitDictConstantsPO.class);
+        Example.Criteria criteria = queryExample.createCriteria();
+        criteria.andEqualTo("id", unitDictConstantsUpdateDto.getId());
+        return dictConstantsMapper.updateByExampleSelective(po, queryExample) > 0;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean delUnitDict(UnitDictConstantsDelDto unitDictConstantsDelDto) {
+        UnitDictConstantsPO po = new UnitDictConstantsPO();
+        po.setDelState(DeleteStatusEnum.DELETE.getCode());
+        po.setUpdateTime(new Date());
+        po.setUpdateBy(unitDictConstantsDelDto.getUpdateBy());
+        Example queryExample = new Example(UnitDictConstantsPO.class);
+        Example.Criteria criteria = queryExample.createCriteria();
+        // 当删除字典时同类型属性也删除
+        criteria.andEqualTo("contentsType", unitDictConstantsDelDto.getContentsType());
+        return dictConstantsMapper.updateByExampleSelective(po, queryExample) > 0;
+    }
+
+    @Override
+    public Page<UnitDictConstantsVo> getUnitDictConstantsPage(UnitDictConstantsPageDto unitDictConstantsPageDto) {
+
+        PageHelper.startPage(unitDictConstantsPageDto.getPageNum(), unitDictConstantsPageDto.getPageSize());
+        Example queryExample = new Example(UnitDictConstantsPO.class);
+        Example.Criteria criteria = queryExample.createCriteria();
+        if (!StringUtils.isEmpty(unitDictConstantsPageDto.getContentsName())) {
+            criteria.andLike("contentsName", "%" + unitDictConstantsPageDto.getContentsName() + "%");
+        }
+
+        criteria.andEqualTo("delState", DeleteStatusEnum.NODELETE.getCode());
+        criteria.andEqualTo("parentId", 0);
+        List<UnitDictConstantsPO> list = dictConstantsMapper.selectByExample(queryExample);
+
+        UnitDictConstantsVo vo = null;
+        List<UnitDictConstantsVo> unitDictConstantsVoArrayList = Lists.newArrayList();
+        for (UnitDictConstantsPO po : list) {
+            vo = new UnitDictConstantsVo();
+            BeanUtil.copyProperties(po, vo);
+            vo.setUnitModuleName(dictConstantsService.getDictConstantsMap(this.unit_module_number).get(po.getUnitModule()));
+            vo.setAssociatedFunctionTypeName(dictConstantsService.getDictConstantsMap(this.associated_function_type_number).get(po.getAssociatedFunctionType()));
+            unitDictConstantsVoArrayList.add(vo);
+        }
+
+        Long total = org.apache.commons.collections.CollectionUtils.isEmpty(list) ? 0L : new PageInfo<>(list).getTotal();
+        return Page.build(unitDictConstantsPageDto.getPageNum(), unitDictConstantsPageDto.getPageSize(), total, unitDictConstantsVoArrayList);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean saveUnitDictProperty(UnitDictConstantsDto unitDictConstantsDto) {
+
+        UnitDictConstantsPO unitDictConstantsPO = new UnitDictConstantsPO();
+        BeanUtil.copyProperties(unitDictConstantsDto, unitDictConstantsPO);
+        unitDictConstantsPO.setDelState(DeleteStatusEnum.NODELETE.getCode());
+
+        // 初始化字典值
+        long contentsValue = cacheService.incr(ManagerRedisKeyConstant.build(ManagerRedisKeyConstant.IDGENERATOR_UDPC_KEY, unitDictConstantsDto.getContentsType()));
+
+        unitDictConstantsPO.setContentsValue(Integer.valueOf(String.valueOf(contentsValue)));
+        unitDictConstantsPO.setCreateTime(new Date());
+        unitDictConstantsPO.setUpdateTime(new Date());
+
+        return dictConstantsMapper.insertUseGeneratedKeys(unitDictConstantsPO) > 0;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean delUnitDictProperty(UnitDictConstantsPDelDto unitDictConstantsPDelDto) {
+
+        UnitDictConstantsPO po = new UnitDictConstantsPO();
+        po.setDelState(DeleteStatusEnum.DELETE.getCode());
+        po.setUpdateTime(new Date());
+        po.setUpdateBy(unitDictConstantsPDelDto.getUpdateBy());
+        Example queryExample = new Example(UnitDictConstantsPO.class);
+        Example.Criteria criteria = queryExample.createCriteria();
+        criteria.andEqualTo("id", unitDictConstantsPDelDto.getId());
+        return dictConstantsMapper.updateByExampleSelective(po, queryExample) > 0;
+
+    }
+
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean updateUnitDictProperty(UnitDictConstantsUpdateDto unitDictConstantsUpdateDto) {
+
+        UnitDictConstantsPO po = new UnitDictConstantsPO();
+        po.setContentsName(unitDictConstantsUpdateDto.getContentsName());
+        po.setUpdateTime(new Date());
+        po.setUpdateBy(unitDictConstantsUpdateDto.getUpdateBy());
+        Example queryExample = new Example(UnitDictConstantsPO.class);
+        Example.Criteria criteria = queryExample.createCriteria();
+        criteria.andEqualTo("id", unitDictConstantsUpdateDto.getId());
+        return dictConstantsMapper.updateByExampleSelective(po, queryExample) > 0;
+    }
+
+
+    @Override
+    public List<UnitDictConstantsVo> getUnitDictConstantsList(String contentsType) {
+        Example queryExample = new Example(UnitDictConstantsPO.class);
+        Example.Criteria criteria = queryExample.createCriteria();
+        criteria.andEqualTo("delState", DeleteStatusEnum.NODELETE.getCode());
+        criteria.andEqualTo("contentsType", contentsType);
+        criteria.andGreaterThan("parentId", 0);
+        List<UnitDictConstantsPO> list = dictConstantsMapper.selectByExample(queryExample);
+        UnitDictConstantsVo vo = null;
+        List<UnitDictConstantsVo> unitDictConstantsVoArrayList = Lists.newArrayList();
+        for (UnitDictConstantsPO po : list) {
+            vo = new UnitDictConstantsVo();
+            BeanUtil.copyProperties(po, vo);
+            unitDictConstantsVoArrayList.add(vo);
+        }
+        return unitDictConstantsVoArrayList;
+    }
+
+    @Override
+    public UnitDictConstantsVo getUnitDictConstants(Integer id) {
+        UnitDictConstantsVo vo = new UnitDictConstantsVo();
+        UnitDictConstantsPO po = dictConstantsMapper.selectByPrimaryKey(id);
+        BeanUtil.copyProperties(po, vo);
+        return vo;
+    }
+
+    @Override
+    public Page<UnitDictBrandModelVo> getUnitDictBrandModelPage(UnitDictBrandModelPageDto unitDictBrandModelPageDto) {
+
+        PageHelper.startPage(unitDictBrandModelPageDto.getPageNum(), unitDictBrandModelPageDto.getPageSize());
+        Example queryExample = new Example(UnitDictBrandModelPO.class);
+        Example.Criteria criteria = queryExample.createCriteria();
+        if (!StringUtils.isEmpty(unitDictBrandModelPageDto.getManufacture())) {
+            criteria.andLike("manufacture", "%" + unitDictBrandModelPageDto.getManufacture() + "%");
+        }
+        if (!StringUtils.isEmpty(unitDictBrandModelPageDto.getModelNumber())) {
+            criteria.andLike("modelNumber", "%" + unitDictBrandModelPageDto.getModelNumber() + "%");
+        }
+        // 部件类型
+        criteria.andEqualTo("unitType", unitDictBrandModelPageDto.getContentsDictKey());
+        List<UnitDictBrandModelPO> list = unitDictBrandModelMapper.selectByExample(queryExample);
+
+        UnitDictBrandModelVo vo = null;
+        List<UnitDictBrandModelVo> unitDictBrandModelVos = Lists.newArrayList();
+        for (UnitDictBrandModelPO po : list) {
+            vo = new UnitDictBrandModelVo();
+            BeanUtil.copyProperties(po, vo);
+            unitDictBrandModelVos.add(vo);
+        }
+
+        Long total = org.apache.commons.collections.CollectionUtils.isEmpty(list) ? 0L : new PageInfo<>(list).getTotal();
+        return Page.build(unitDictBrandModelPageDto.getPageNum(), unitDictBrandModelPageDto.getPageSize(), total, unitDictBrandModelVos);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean saveUnitDictBrandModel(UnitDictBrandModelDto unitDictBrandModelDto) {
+        UnitDictBrandModelPO po = new UnitDictBrandModelPO();
+        BeanUtil.copyProperties(unitDictBrandModelDto, po);
+        po.setCreateTime(new Date());
+
+        // redis删除
+        delBrandRedisKey(unitDictBrandModelDto.getManufacture());
+        return unitDictBrandModelMapper.insertUseGeneratedKeys(po) > 0;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean updateUnitDictBrandModel(UnitDictBrandModelUpdateDto unitDictBrandModelUpdateDto) {
+        UnitDictBrandModelPO po = new UnitDictBrandModelPO();
+        po.setManufacture(unitDictBrandModelUpdateDto.getManufacture());
+        po.setModelNumber(unitDictBrandModelUpdateDto.getModelNumber());
+        Example queryExample = new Example(UnitDictBrandModelPO.class);
+        Example.Criteria criteria = queryExample.createCriteria();
+        criteria.andEqualTo("id", unitDictBrandModelUpdateDto.getId());
+
+        // redis删除
+        delBrandRedisKey(unitDictBrandModelUpdateDto.getManufacture());
+        return unitDictBrandModelMapper.updateByExampleSelective(po, queryExample) > 0;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean delUnitDictBrandModel(UnitDictBrandModelIdDto unitDictBrandModelIdDto) {
+        return unitDictBrandModelMapper.deleteByPrimaryKey(unitDictBrandModelIdDto.getId()) > 0;
+    }
+
+    @Override
+    public List<String> getUnitDictBrandModelList(UnitDictBrandModelDto unitDictBrandModelDto) {
+        if (StringUtils.isEmpty(unitDictBrandModelDto.getManufacture())) {
+            return unitDictBrandModelMapper.selectUnitManufactureByUnitType(unitDictBrandModelDto.getUnitType());
+        }
+        return unitDictBrandModelMapper.selectUnitModelNumberByManufacture(unitDictBrandModelDto.getUnitType(),
+                unitDictBrandModelDto.getManufacture());
+    }
+
+    @Override
+    public boolean verifyUnitDictBrandModel(UnitDictBrandModelDto dto) {
+        Example queryExample = new Example(UnitDictBrandModelPO.class);
+        Example.Criteria criteria = queryExample.createCriteria();
+        criteria.andEqualTo("unitType", dto.getUnitType());
+        criteria.andEqualTo("manufacture", dto.getManufacture());
+        criteria.andEqualTo("modelNumber", dto.getModelNumber());
+        int count = unitDictBrandModelMapper.selectCountByExample(queryExample);
+        return count > 0 ? true : false;
+    }
+
+    /**
+     * 删除品牌对应型号
+     * @param brandKey
+     * @return
+     */
+    private void delBrandRedisKey(String brandKey){
+        String brandlistKey = ManagerRedisKeyConstant.build(ManagerRedisKeyConstant.IDGENERATOR_UDPB_KEY, brandKey);
+        cacheService.delete(brandlistKey);
+    }
+
+}

+ 335 - 0
energy-manage-service/src/main/java/com/energy/manage/service/service/units/impl/UnitServiceImpl.java

@@ -0,0 +1,335 @@
+package com.energy.manage.service.service.units.impl;
+
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.energy.manage.common.base.BaseServiceImpl;
+import com.energy.manage.common.base.Page;
+import com.energy.manage.common.constant.redis.ManagerRedisKeyConstant;
+import com.energy.manage.common.enums.DeleteStatusEnum;
+import com.energy.manage.common.enums.IdPrefixEnum;
+import com.energy.manage.common.po.units.*;
+import com.energy.manage.common.util.IdGeneratorUtil;
+import com.energy.manage.service.domain.dto.units.*;
+import com.energy.manage.service.domain.vo.units.UnitDictBrandModelVo;
+import com.energy.manage.service.domain.vo.units.UnitDictConstantsVo;
+import com.energy.manage.service.domain.vo.units.UnitDictRoutineListVo;
+import com.energy.manage.service.domain.vo.units.UnitVo;
+import com.energy.manage.service.mappers.units.*;
+import com.energy.manage.service.service.cache.CacheService;
+import com.energy.manage.service.service.dict.DictConstantsService;
+import com.energy.manage.service.service.units.UnitDictConstantsService;
+import com.energy.manage.service.service.units.UnitService;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.google.common.collect.Lists;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+import springfox.documentation.schema.Collections;
+import tk.mybatis.mapper.entity.Example;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 部件字典表接口
+ */
+@Slf4j
+@Service
+public class UnitServiceImpl implements UnitService {
+
+    @Autowired
+    private UnitDictConstantsService unitDictConstantsService;
+
+    @Autowired
+    private UnitBearingsMapper unitBearingsMapper;
+
+    @Autowired
+    private UnitDynamoMapper unitDynamoMapper;
+
+    @Autowired
+    private UnitGearboxMapper unitGearboxMapper;
+
+    @Autowired
+    private UnitGearboxStructureMapper unitGearboxStructureMapper;
+
+    @Autowired
+    private UnitGearboxBearingsMapper unitGearboxBearingsMapper;
+
+    @Autowired
+    private CacheService cacheService;
+
+
+    @Override
+    public List<UnitDictRoutineListVo> getUnitDictRoutineList(UnitDictRoutineDto unitDictRoutineDto) {
+        List<UnitDictConstantsVo> unitDictConstantsVos = unitDictConstantsService.getUnitDictConstantsList(unitDictRoutineDto.getContentsType());
+        UnitDictRoutineListVo vo = null;
+        List<UnitDictRoutineListVo> listVos = Lists.newArrayList();
+        for (UnitDictConstantsVo dictConstantsVo : unitDictConstantsVos) {
+            vo = new UnitDictRoutineListVo();
+            vo.setKeyId(dictConstantsVo.getContentsValue());
+            vo.setValueName(dictConstantsVo.getContentsName());
+            listVos.add(vo);
+        }
+        return listVos;
+    }
+
+
+    @Override
+    public List<String> getBrandModelNameOrModelNumber(UnitDictBrandModelDto unitDictBrandModelDto) {
+        if (StringUtils.isEmpty(unitDictBrandModelDto.getManufacture())) {
+            return unitDictConstantsService.getUnitDictBrandModelList(unitDictBrandModelDto);
+        }
+        String brandlistKey = ManagerRedisKeyConstant.build(ManagerRedisKeyConstant.IDGENERATOR_UDPB_KEY, unitDictBrandModelDto.getManufacture());
+        String val = cacheService.get(brandlistKey);
+        if (StringUtils.isEmpty(val)) {
+            List<String> valueString = unitDictConstantsService.getUnitDictBrandModelList(unitDictBrandModelDto);
+            log.info("品牌对应型号 ===> " + JSON.toJSONString(valueString));
+            cacheService.add(brandlistKey, JSON.toJSONString(valueString));
+            return valueString;
+        }
+        List<String> modelList = JSONArray.parseArray(val, String.class);
+        return modelList;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean modificationUnit(UnitDto unitDto, Integer userId) {
+
+        boolean flg = false;
+        // 处理主轴
+        outBearings:
+        if (unitDto.getUnitBearingsDto() != null) {
+            UnitBearingsPO unitBearingsPO = new UnitBearingsPO();
+            BeanUtil.copyProperties(unitDto.getUnitBearingsDto(), unitBearingsPO);
+
+            //更新
+            if (unitBearingsPO.getId() != null && unitBearingsPO.getId() > 0) {
+                unitBearingsPO.setUpdateBy(userId);
+                Example queryExample = new Example(UnitBearingsPO.class);
+                Example.Criteria criteria = queryExample.createCriteria();
+                criteria.andEqualTo("id", unitBearingsPO.getId());
+                flg = unitBearingsMapper.updateByExampleSelective(unitBearingsPO, queryExample) > 0;
+                break outBearings;
+            }
+            // 创建
+            String unitBearingsCode = IdPrefixEnum.UNIT_BEARINGS_CODE.getCode().concat(IdGeneratorUtil.zeroFillUtil(cacheService.incr(ManagerRedisKeyConstant.build(ManagerRedisKeyConstant.IDGENERATOR_CONSTANTS_KEY, IdPrefixEnum.UNIT_BEARINGS_CODE.getCode()))));
+            unitBearingsPO.setMillTypeCode(unitDto.getMillTypeCode());
+            unitBearingsPO.setCode(unitBearingsCode);
+            unitBearingsPO.setCreateBy(userId);
+            unitBearingsPO.setUpdateBy(userId);
+            unitBearingsPO.setCreateTime(new Date());
+            unitBearingsPO.setUpdateTime(new Date());
+            unitBearingsPO.setDelState(DeleteStatusEnum.NODELETE.getCode());
+            flg = unitBearingsMapper.insertUseGeneratedKeys(unitBearingsPO) > 0;
+        }
+
+        // 处理发电机数据
+        outDynamo:
+        if (unitDto.getUnitDynamoDto() != null) {
+            UnitDynamoPO unitDynamoPO = new UnitDynamoPO();
+            BeanUtil.copyProperties(unitDto.getUnitDynamoDto(), unitDynamoPO);
+
+            //更新
+            if (unitDynamoPO.getId() != null && unitDynamoPO.getId() > 0) {
+                unitDynamoPO.setUpdateBy(userId);
+                Example queryExample = new Example(UnitDynamoPO.class);
+                Example.Criteria criteria = queryExample.createCriteria();
+                criteria.andEqualTo("id", unitDynamoPO.getId());
+                flg = unitDynamoMapper.updateByExampleSelective(unitDynamoPO, queryExample) > 0;
+                break outDynamo;
+            }
+            // 创建
+            String unitDynamoCode = IdPrefixEnum.UNIT_DYNAMO_CODE.getCode().concat(IdGeneratorUtil.zeroFillUtil(cacheService.incr(ManagerRedisKeyConstant.build(ManagerRedisKeyConstant.IDGENERATOR_CONSTANTS_KEY, IdPrefixEnum.UNIT_DYNAMO_CODE.getCode()))));
+            unitDynamoPO.setMillTypeCode(unitDto.getMillTypeCode());
+            unitDynamoPO.setCode(unitDynamoCode);
+            unitDynamoPO.setCreateTime(new Date());
+            unitDynamoPO.setUpdateTime(new Date());
+            unitDynamoPO.setCreateBy(userId);
+            unitDynamoPO.setUpdateBy(userId);
+            unitDynamoPO.setDelState(DeleteStatusEnum.NODELETE.getCode());
+            flg = unitDynamoMapper.insertUseGeneratedKeys(unitDynamoPO) > 0;
+        }
+
+        // 处理齿轮箱总表数据
+        UnitGearboxPO unitGearboxPO = null;
+        outunitGearbox:
+        if (unitDto.getUnitGearDto() != null) {
+            unitGearboxPO = new UnitGearboxPO();
+            unitGearboxPO.setLubricantBrand(unitDto.getUnitGearDto().getLubricantBrand());
+            unitGearboxPO.setLubricantModel(unitDto.getUnitGearDto().getLubricantModel());
+            unitGearboxPO.setUpdateTime(new Date());
+            unitGearboxPO.setUpdateBy(userId);
+            //更新齿轮箱总表
+            if (unitDto.getUnitGearDto().getId() != null && unitDto.getUnitGearDto().getId() > 0) {
+                unitGearboxPO.setId(unitDto.getUnitGearDto().getId());
+                unitGearboxPO.setCode(unitDto.getUnitGearDto().getCode());
+                Example queryExample = new Example(UnitDynamoPO.class);
+                Example.Criteria criteria = queryExample.createCriteria();
+                criteria.andEqualTo("id", unitGearboxPO.getId());
+                flg = unitGearboxMapper.updateByExampleSelective(unitGearboxPO, queryExample) > 0;
+                break outunitGearbox;
+            }
+            unitGearboxPO.setMillTypeCode(unitDto.getMillTypeCode());
+            String unitGearboxCode = IdPrefixEnum.UNIT_GEAR_CODE.getCode().concat(IdGeneratorUtil.zeroFillUtil(cacheService.incr(ManagerRedisKeyConstant.build(ManagerRedisKeyConstant.IDGENERATOR_CONSTANTS_KEY, IdPrefixEnum.UNIT_GEAR_CODE.getCode()))));
+            unitGearboxPO.setCode(unitGearboxCode);
+            unitGearboxPO.setCreateTime(new Date());
+            unitGearboxPO.setCreateBy(userId);
+            unitGearboxPO.setDelState(DeleteStatusEnum.NODELETE.getCode());
+            flg = unitGearboxMapper.insertUseGeneratedKeys(unitGearboxPO) > 0;
+
+        }
+
+        if (unitGearboxPO != null) {
+            // 处理齿轮箱轴承处理
+            if (!CollectionUtils.isEmpty(unitDto.getUnitGearDto().getUnitGearboxBearingsDtoList())) {
+                UnitGearboxBearingsPO unitGearboxBearingsPO = null;
+                List<UnitGearboxBearingsPO> unitGearboxBearingsPOList = Lists.newArrayList();
+                for (UnitDto.UnitGearboxBearingsDto dto : unitDto.getUnitGearDto().getUnitGearboxBearingsDtoList()) {
+                    unitGearboxBearingsPO = new UnitGearboxBearingsPO();
+                    BeanUtil.copyProperties(dto, unitGearboxBearingsPO);
+                    unitGearboxBearingsPO.setGearboxCode(unitGearboxPO.getCode());
+                    unitGearboxBearingsPO.setCreateBy(userId);
+                    unitGearboxBearingsPO.setUpdateBy(userId);
+                    unitGearboxBearingsPO.setCreateTime(new Date());
+                    unitGearboxBearingsPO.setUpdateTime(new Date());
+                    unitGearboxBearingsPOList.add(unitGearboxBearingsPO);
+                }
+                UnitGearboxBearingsPO po = new UnitGearboxBearingsPO();
+                po.setGearboxCode(unitGearboxPO.getCode());
+                unitGearboxBearingsMapper.delete(po);
+
+                flg = unitGearboxBearingsMapper.insertList(unitGearboxBearingsPOList) > 0;
+            }
+
+            // 处理齿轮箱结构
+            if (!CollectionUtils.isEmpty(unitDto.getUnitGearDto().getUnitGearboxStructureDtoList())) {
+                UnitGearboxStructurePO unitGearboxStructurePO = null;
+                List<UnitGearboxStructurePO> unitGearboxStructurePOList = Lists.newArrayList();
+                for (UnitDto.UnitGearboxStructureDto dto : unitDto.getUnitGearDto().getUnitGearboxStructureDtoList()) {
+                    unitGearboxStructurePO = new UnitGearboxStructurePO();
+                    BeanUtil.copyProperties(dto, unitGearboxStructurePO);
+                    unitGearboxStructurePO.setGearboxCode(unitGearboxPO.getCode());
+                    unitGearboxStructurePO.setCreateTime(new Date());
+                    unitGearboxStructurePO.setUpdateTime(new Date());
+                    unitGearboxStructurePO.setCreateBy(userId);
+                    unitGearboxStructurePO.setUpdateBy(userId);
+                    unitGearboxStructurePOList.add(unitGearboxStructurePO);
+                }
+                UnitGearboxStructurePO po = new UnitGearboxStructurePO();
+                po.setGearboxCode(unitGearboxPO.getCode());
+                unitGearboxStructureMapper.delete(po);
+
+                flg = unitGearboxStructureMapper.insertList(unitGearboxStructurePOList) > 0;
+            }
+        }
+        return flg;
+    }
+
+    @Override
+    public UnitVo getUnitVo(String millTypeCode) {
+
+        UnitVo unitVo = new UnitVo();
+        unitVo.setMillTypeCode(millTypeCode);
+
+        if (StringUtils.isEmpty(millTypeCode)) {
+            return null;
+        }
+
+        // 主轴
+        Example queryExample = new Example(UnitBearingsPO.class);
+        Example.Criteria criteria = queryExample.createCriteria();
+        criteria.andEqualTo("millTypeCode", millTypeCode);
+        UnitBearingsPO unitBearingsPO = unitBearingsMapper.selectOneByExample(queryExample);
+
+        if (!ObjectUtil.isEmpty(unitBearingsPO)) {
+            UnitVo.UnitBearingsVo unitBearingsVo = new UnitVo.UnitBearingsVo();
+            BeanUtil.copyProperties(unitBearingsPO, unitBearingsVo);
+            unitVo.setUnitBearingsVo(unitBearingsVo);
+        }
+
+        // 发电机
+        Example queryUdExample = new Example(UnitDynamoPO.class);
+        Example.Criteria criteriaUd = queryUdExample.createCriteria();
+        criteriaUd.andEqualTo("millTypeCode", millTypeCode);
+        UnitDynamoPO unitDynamoPO = unitDynamoMapper.selectOneByExample(queryUdExample);
+
+        if (!ObjectUtil.isEmpty(unitDynamoPO)) {
+            UnitVo.UnitDynamoVo unitDynamoVo = new UnitVo.UnitDynamoVo();
+            BeanUtil.copyProperties(unitDynamoPO, unitDynamoVo);
+            unitVo.setUnitDynamoVo(unitDynamoVo);
+        }
+
+        // 齿轮箱
+        UnitVo.UnitGearVo unitGearVo = new UnitVo.UnitGearVo();
+        Example queryUgExample = new Example(UnitGearboxPO.class);
+        Example.Criteria criteriaUg = queryUgExample.createCriteria();
+        criteriaUg.andEqualTo("millTypeCode", millTypeCode);
+
+        UnitGearboxPO unitGearboxPO = unitGearboxMapper.selectOneByExample(queryUgExample);
+        BeanUtil.copyProperties(unitGearboxPO, unitGearVo);
+
+        // 齿轮箱轴承
+        if (!ObjectUtil.isEmpty(unitGearboxPO)) {
+            Example queryUgbExample = new Example(UnitGearboxBearingsPO.class);
+            Example.Criteria criteriaUgb = queryUgbExample.createCriteria();
+            criteriaUgb.andEqualTo("gearboxCode", unitGearboxPO.getCode());
+            List<UnitGearboxBearingsPO> unitGearboxBearingsPOList = unitGearboxBearingsMapper.selectByExample(queryUgbExample);
+
+            UnitVo.UnitGearboxBearingsVo unitGearboxBearingsVo = null;
+            List<UnitVo.UnitGearboxBearingsVo> unitGearboxBearingsVos = Lists.newArrayList();
+            for (UnitGearboxBearingsPO unitGearboxBearingsPO : unitGearboxBearingsPOList) {
+                unitGearboxBearingsVo = new UnitVo.UnitGearboxBearingsVo();
+                BeanUtil.copyProperties(unitGearboxBearingsPO, unitGearboxBearingsVo);
+                unitGearboxBearingsVos.add(unitGearboxBearingsVo);
+            }
+            unitGearVo.setUnitGearboxBearingsList(unitGearboxBearingsVos);
+
+            // 齿轮箱结构
+            Example queryUgsExample = new Example(UnitGearboxStructurePO.class);
+            Example.Criteria criteriaUgs = queryUgbExample.createCriteria();
+            criteriaUgs.andEqualTo("gearboxCode", unitGearboxPO.getCode());
+            List<UnitGearboxStructurePO> unitGearboxStructurePOList = unitGearboxStructureMapper.selectByExample(queryUgbExample);
+
+            UnitVo.UnitGearboxStructureVo unitGearboxStructureVo = null;
+            List<UnitVo.UnitGearboxStructureVo> unitGearboxStructureVos = Lists.newArrayList();
+            for (UnitGearboxStructurePO unitGearboxStructurePO : unitGearboxStructurePOList) {
+                unitGearboxStructureVo = new UnitVo.UnitGearboxStructureVo();
+                BeanUtil.copyProperties(unitGearboxStructurePO, unitGearboxStructureVo);
+                unitGearboxStructureVos.add(unitGearboxStructureVo);
+            }
+
+            unitGearVo.setUnitGearboxStructureList(unitGearboxStructureVos);
+            unitVo.setUnitGearVo(unitGearVo);
+        }
+        return unitVo;
+    }
+
+    @Override
+    public UnitBearingsPO verifyUnitBearingByMillTypeCode(String millTypeCode) {
+
+        Example queryExample = new Example(UnitBearingsPO.class);
+        Example.Criteria criteria = queryExample.createCriteria();
+        criteria.andEqualTo("millTypeCode", millTypeCode);
+
+        return unitBearingsMapper.selectOneByExample(queryExample);
+    }
+
+    @Override
+    public UnitDynamoPO verifyUnitDynamoByMillTypeCode(String millTypeCode) {
+
+        Example queryExample = new Example(UnitDynamoPO.class);
+        Example.Criteria criteria = queryExample.createCriteria();
+        criteria.andEqualTo("millTypeCode", millTypeCode);
+
+        return unitDynamoMapper.selectOneByExample(queryExample) ;
+    }
+
+
+}

+ 28 - 0
energy-manage-service/src/main/resources/mybatis/units/UnitBrandModelMapper.xml

@@ -0,0 +1,28 @@
+<?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.energy.manage.service.mappers.units.UnitDictBrandModelMapper">
+
+
+    <select id="selectUnitManufactureByUnitType" resultType="java.lang.String">
+        select manufacture from unit_dict_brand_model where unit_type = #{unitType}  group by manufacture
+    </select>
+
+    <select id="selectUnitModelNumberByManufacture" resultType="java.lang.String">
+
+         select
+            model_number as modelNumber
+         from
+            unit_dict_brand_model
+         where
+            unit_type = #{unitType}
+         and
+            manufacture = #{manufacture}
+         group by model_number
+
+    </select>
+
+
+
+
+
+</mapper>

+ 5 - 9
energy-manage-service/src/test/java/client/SkfClientWebTest.java

@@ -71,11 +71,12 @@ public class SkfClientWebTest {
             }
         }
 
-        Integer pointId = 138;
+        Integer pointId = 86;
+
         List<String> xlist = Lists.newArrayList();
-        xlist.add("7");
-        xlist.add("8");
-        xlist.add("9");
+//        xlist.add("7");
+//        xlist.add("8");
+        xlist.add("11");
 
         for(String x : xlist){
             String fromDateUTC = "2024-0"+x+"-01";
@@ -108,12 +109,7 @@ public class SkfClientWebTest {
                     createCsvFile(doubleList, "/Users/shiyue/Downloads/sdk_data/"+x+"month","/Users/shiyue/Downloads/sdk_data/"+x+"month/"+"SKF_F004_4#风机_" + utctolocal(dynamicMeasurementsVo.getReadingTimeUTC()) + "_" + name + "_" + dynamicMeasurementsVo.getSpeed() + "_cms.csv");
                 }
             }
-
         }
-
-
-
-
     }