Browse Source

修复总存栏量等参数

zhuoning 4 years ago
parent
commit
d53b064824

+ 10 - 1
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/controller/IndexParameterController.java

@@ -43,7 +43,16 @@ public class IndexParameterController {
      }*/
     @RequestMapping("/findAll")
     public Result findAll() {
-        return parameterService.findAll();
+        Result parameterResult = parameterService.getDatasourceType();
+        String datasourceType = parameterResult.getData().toString();
+        System.out.println("datasourceType>>"+datasourceType);
+        if(datasourceType.trim().equalsIgnoreCase("true")){
+            // 从本地填报表获取数据
+            return parameterService.findAllFrom2();
+        }else{
+            // 从远程落地表获取数据
+            return parameterService.findAll();
+        }
     }
 
     /**

+ 2 - 0
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/service/IndexParameterService.java

@@ -26,4 +26,6 @@ public interface IndexParameterService {
     Result setDatasourceType(String datasourceType);
 
     Result getDatasourceType();
+
+    Result findAllFrom2();
 }

+ 32 - 0
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/service/impl/IndexParameterServiceImpl.java

@@ -3,6 +3,7 @@ package com.huimv.production.service.impl;
 import com.huimv.production.domain.ConfigEntity;
 import com.huimv.production.domain.IndexParameterEntity;
 import com.huimv.production.repo.ConfigEntityRepository;
+import com.huimv.production.repo.IndexParameter2Repository;
 import com.huimv.production.repo.IndexParameterEntityRepository;
 import com.huimv.production.result.Result;
 import com.huimv.production.result.ResultStatus;
@@ -25,6 +26,8 @@ public class IndexParameterServiceImpl implements IndexParameterService {
     @Autowired
     private IndexParameterEntityRepository parameterEntityRepository;
     @Autowired
+    private IndexParameter2Repository parameterEntityRepository2;
+    @Autowired
     private ConfigEntityRepository configRepo;
 
     @Override
@@ -74,6 +77,16 @@ public class IndexParameterServiceImpl implements IndexParameterService {
         }
     }
 
+    /**
+     * @Method      : findAll
+     * @Description : 
+     * @Params      : []
+     * @Return      : com.huimv.production.result.Result
+     * 
+     * @Author      : ZhuoNing
+     * @Date        : 2021/5/22       
+     * @Time        : 16:58
+     */
     @Override
     public Result findAll() {
         try {
@@ -84,6 +97,25 @@ public class IndexParameterServiceImpl implements IndexParameterService {
     }
 
     /**
+     * @Method      : findAllFrom2
+     * @Description : 
+     * @Params      : []
+     * @Return      : com.huimv.production.result.Result
+     * 
+     * @Author      : ZhuoNing
+     * @Date        : 2021/5/22       
+     * @Time        : 16:58
+     */
+    @Override
+    public Result findAllFrom2() {
+        try {
+            return new Result(10000, ResultStatus.findSuccess,parameterEntityRepository2.findAll());
+        }catch (Exception e){
+            return new Result(10001, ResultStatus.findFailed,null);
+        }
+    }
+    
+    /**
      * @Method      : setDatasourceType
      * @Description : 
      * @Params      : [datasourceType]