Browse Source

数据录入接口逻辑修正

wangchenghong 4 years ago
parent
commit
4a2aae6e8a

+ 3 - 2
src/main/java/com/persagy/apm/energy/report/manualfilling/model/dto/SaveEnergyItemDataDTO.java

@@ -15,13 +15,14 @@ public class SaveEnergyItemDataDTO {
     @ApiModelProperty(value = "项目id", required = true)
     private String projectId;
 
-    @ApiModelProperty("能耗类型")
+    @NotNull(message = "energyType不能为空")
+    @ApiModelProperty(value = "能耗类型", required = true)
     private String energyType;
 
     @ApiModelProperty("建筑类型(业态)")
     private String buildingType;
 
-    @ApiModelProperty("信息点类型(0-能耗,1-费用 ,2-能耗预算,3-费用预算)")
+    @ApiModelProperty(value = "信息点类型(0-能耗,1-费用 ,2-能耗预算,3-费用预算)", required = true)
     private String functionType;
 
     @NotNull(message = "dataList不能为空")

+ 1 - 1
src/main/java/com/persagy/apm/energy/report/manualfilling/model/vo/EnergyItemDataVo.java

@@ -8,7 +8,7 @@ import lombok.Data;
 @ApiModel
 public class EnergyItemDataVo {
 
-    @ApiModelProperty(value = "能耗分项数据id", required = true)
+    @ApiModelProperty(value = "能耗分项数据id")
     private String id;
 
     @ApiModelProperty(value = "能耗分项数据", required = true)

+ 2 - 2
src/main/java/com/persagy/apm/energy/report/manualfilling/model/vo/EnergyItemInfoVo.java

@@ -13,10 +13,10 @@ public class EnergyItemInfoVo {
     @ApiModelProperty(value = "能耗分项id", required = true)
     private String itemId;
 
-    @ApiModelProperty(value = "能耗分项信息id", required = true)
+    @ApiModelProperty(value = "能耗分项信息id")
     private String functionId;
 
-    @ApiModelProperty(value = "能耗模型编码", required = true)
+    @ApiModelProperty(value = "能耗模型编码")
     private String modelCode;
 
     @ApiModelProperty(value = "能据耗分项数", required = true)

+ 7 - 2
src/main/java/com/persagy/apm/energy/report/manualfilling/service/impl/IEnergyItemDataServiceImpl.java

@@ -42,7 +42,7 @@ public class IEnergyItemDataServiceImpl implements IEnergyItemDataService {
     public List<EnergyItemInfoVo> queryEnergyItemDataList(QueryEnergyItemDataDTO queryEnergyItemDataDTO) {
         try {
             ReportProjectVO projectVO = iSaasWebService.getReportProjectInfo(queryEnergyItemDataDTO.getProjectId());
-            if (null == projectVO || StringUtils.isEmpty(projectVO.getFunctionType())) {
+            if (null == projectVO ) {
                 return new ArrayList<>();
             }
             QueryFunctionDTO queryFunctionDTO = new QueryFunctionDTO();
@@ -52,7 +52,7 @@ public class IEnergyItemDataServiceImpl implements IEnergyItemDataService {
             }
             queryFunctionDTO.setEnergyType(queryEnergyItemDataDTO.getEnergyType());
             queryFunctionDTO.setFunctionType(queryEnergyItemDataDTO.getFunctionType());
-            queryFunctionDTO.setBuildingType(projectVO.getFunctionType());
+            queryFunctionDTO.setBuildingType("300");
             // 查询配置的分项信息列表
             List<Function> functionList = functionService.queryFunctionList(queryFunctionDTO);
             if (CollectionUtils.isEmpty(functionList)) {
@@ -105,6 +105,11 @@ public class IEnergyItemDataServiceImpl implements IEnergyItemDataService {
     @Override
     public void saveEnergyItemData(SaveEnergyItemDataDTO saveEnergyItemDataDTO) {
         try {
+            ReportProjectVO projectVO = iSaasWebService.getReportProjectInfo(saveEnergyItemDataDTO.getProjectId());
+            if (null == projectVO || StringUtils.isEmpty(projectVO.getFunctionType())) {
+                throw new Exception("获取不到项目信息");
+            }
+            saveEnergyItemDataDTO.setFunctionType(projectVO.getFunctionType());
             List<EnergyItemInfoVo> energyItemInfoVoList = saveEnergyItemDataDTO.getDataList();
             Map<String, String> itemId_functionIdMap = getFunctionIdMap(saveEnergyItemDataDTO);
             for (EnergyItemInfoVo energyItemInfoVo : energyItemInfoVoList) {