Browse Source

值际对标功能修改

shilin 4 years ago
parent
commit
3ef810c280

+ 17 - 25
src/main/java/com/gyee/frame/controller/contrast/ContrastController.java

@@ -318,7 +318,7 @@ public class ContrastController {
     public AjaxResult addBenchmarkZj(HttpServletRequest request,Tablepar tablepar, String wpId, String year, String month, String zjs) {
 
         List<BenchMarkVo> vos=null;
-       // List<BenchMarkVo> vos =contrastWtService.benchmarkWtList(wpId,wtId,beginDate, endDate);
+        // List<BenchMarkVo> vos =contrastWtService.benchmarkWtList(wpId,wtId,beginDate, endDate);
 
         contrastZjService.addBenchmarkZj(request, wpId, year, month, zjs);
 
@@ -330,15 +330,6 @@ public class ContrastController {
 
         }
 
-        Map<String, ConditionVo> ctmap = null;
-        if (null != request.getSession().getAttribute("bmwtvos")) {
-            ctmap = (Map<String, ConditionVo>) request.getSession().getAttribute("bmwtvos");
-        }else
-        {
-            ctmap=new HashMap<>();
-        }
-
-        Map<String,Object> map=new HashMap<>();
         if (vos != null && !vos.isEmpty()) {
             BenchmarkUtil bu = new BenchmarkUtil();
             vos = bu.getBenchMarkOrder(vos);
@@ -347,8 +338,6 @@ public class ContrastController {
             {
                 vos = bu.getBenchMarkOrder(vos,tablepar);
             }
-            map.put("list",vos);//每次添加,前台需要把新返回的记录,追加到前台seesion对象中
-            map.put("key",ctmap);//每次添加,前台需要把新返回的记录,追加到前台seesion对象中
             return AjaxResult.successData(AjaxStatus.success.code, vos);
         } else {
             return AjaxResult.successData(AjaxStatus.emptyresultset.code, vos);
@@ -393,23 +382,26 @@ public class ContrastController {
      **/
     @PostMapping("/benchmarkZjWtList")
     @ResponseBody
-    public AjaxResult benchmarkZjWtList(HttpServletRequest request,Tablepar tablepar, ConditionVo ct) {
+    public AjaxResult benchmarkZjWtList(HttpServletRequest request,Tablepar tablepar, String cid) {
         List<BenchMarkVo> vos=new ArrayList<>();
-//        Map<String, List<ConditionVo>> ctmap = null;
-//        if (null != request.getSession().getAttribute("bmwtvos")) {
-//            ctmap = (Map<String, List<ConditionVo>>) request.getSession().getAttribute("bmwtvos");
-//        } else {
-//            ctmap = new HashMap<String, List<ConditionVo>>();
-//        }
-
-        if (StringUtils.notEmp(ct) ) {
+        Map<String, List<ConditionVo>> ctmap = null;
+        if (null != request.getSession().getAttribute("bmwtvos")) {
+            ctmap = (Map<String, List<ConditionVo>>) request.getSession().getAttribute("bmwtvos");
+        } else {
+            ctmap = new HashMap<String, List<ConditionVo>>();
+        }
 
+        if (StringUtils.notEmp(cid) && ctmap.containsKey(cid)) {
+            List<ConditionVo> ctvos = ctmap.get(cid);
             Map<String, BenchMarkVo> bmmap = new HashMap<String, BenchMarkVo>();
-            String wpId = ct.getWpId();
-            String beginDate = DateUtils.format(ct.getBeginDate());
-            String endDate =DateUtils.format(ct.getEndDate());
+            for (ConditionVo ct : ctvos) {
 
-            bmmap=contrastWtService.benchmarkZjInWtList(wpId,null,beginDate,endDate);
+                String wpId = ct.getWpId();
+                String beginDate = DateUtils.format(ct.getBeginDate());
+                String endDate =DateUtils.format(ct.getEndDate());
+
+                bmmap=contrastWtService.benchmarkZjInWtList(wpId,null,beginDate,endDate);
+            }
 
             Set<Map.Entry<String, BenchMarkVo>> set = bmmap.entrySet();
             for (Iterator<Map.Entry<String, BenchMarkVo>> it = set.iterator(); it.hasNext();) {

+ 2 - 0
src/main/java/com/gyee/frame/controller/powercompare/PowerCompareController.java

@@ -403,6 +403,8 @@ public class PowerCompareController {
             return	AjaxResult.successData(AjaxStatus.success.code,result);
         }else
         {
+            result.put("list",vos);
+            result.put("lyl",lylls);
             return	AjaxResult.successData(AjaxStatus.emptyresultset.code,result);
         }
     }

+ 42 - 37
src/main/java/com/gyee/frame/service/Windturbineinfoday3Service.java

@@ -289,44 +289,49 @@ public class Windturbineinfoday3Service implements BaseService<Windturbineinfoda
             double lyl = 0.0;
             double dayspeed = 0.0;
             long count = 0;
-            vos.addAll(vosapp);
-
-            for (Windturbineinfoday3 wi : vos) {
-                count++;
-                fdl = StringUtils.round(wi.getDaydl2(), 4) + StringUtils.round(fdl, 4);
-                gzss = StringUtils.round(wi.getDaynhgzssdl(), 4) + StringUtils.round(gzss, 4);
-                whss = StringUtils.round(wi.getDaynhwhssdl(), 4) + StringUtils.round(whss, 4);
-                xdss = StringUtils.round(wi.getDaynhxdssdl(), 4) + StringUtils.round(xdss, 4);
-                xnss = StringUtils.round(wi.getDaynhqfdl(), 4) + StringUtils.round(xnss, 4);
-                dayspeed = StringUtils.round(wi.getDayspeed(), 2) + StringUtils.round(dayspeed, 2);
-                slss = StringUtils.round(wi.getDaynhcfdl(), 4) + StringUtils.round(slss, 4);
-
-                // wi.setTotal(new BigDecimal(wi.getTotal()).divide(new
-                // BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue());
-            }
-            llfdl = StringUtils.round(fdl + whss + gzss + xnss + xdss + slss, 4);
-            if (llfdl != 0) {
-                // llfdl=StringUtils.round(llfdl, 2);
-                // fdl=StringUtils.round(fdl, 2);
-                lyl = StringUtils.round(fdl / llfdl * 100, 2);
-                // lyl = new BigDecimal(fdl).divide(new BigDecimal(llfdl), 2,
-                // RoundingMode.HALF_EVEN).multiply(new
-                // BigDecimal(100)).doubleValue();
+
+            if(!vosapp.isEmpty())
+            {
+                vos.addAll(vosapp);
+
+                for (Windturbineinfoday3 wi : vos) {
+                    count++;
+                    fdl = StringUtils.round(wi.getDaydl2(), 4) + StringUtils.round(fdl, 4);
+                    gzss = StringUtils.round(wi.getDaynhgzssdl(), 4) + StringUtils.round(gzss, 4);
+                    whss = StringUtils.round(wi.getDaynhwhssdl(), 4) + StringUtils.round(whss, 4);
+                    xdss = StringUtils.round(wi.getDaynhxdssdl(), 4) + StringUtils.round(xdss, 4);
+                    xnss = StringUtils.round(wi.getDaynhqfdl(), 4) + StringUtils.round(xnss, 4);
+                    dayspeed = StringUtils.round(wi.getDayspeed(), 2) + StringUtils.round(dayspeed, 2);
+                    slss = StringUtils.round(wi.getDaynhcfdl(), 4) + StringUtils.round(slss, 4);
+
+                    // wi.setTotal(new BigDecimal(wi.getTotal()).divide(new
+                    // BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue());
+                }
+                llfdl = StringUtils.round(fdl + whss + gzss + xnss + xdss + slss, 4);
+                if (llfdl != 0) {
+                    // llfdl=StringUtils.round(llfdl, 2);
+                    // fdl=StringUtils.round(fdl, 2);
+                    lyl = StringUtils.round(fdl / llfdl * 100, 2);
+                    // lyl = new BigDecimal(fdl).divide(new BigDecimal(llfdl), 2,
+                    // RoundingMode.HALF_EVEN).multiply(new
+                    // BigDecimal(100)).doubleValue();
+                }
+                getSortData(sortName, sortOrder, vos);
+
+                Windturbineinfoday3 wi = new Windturbineinfoday3();
+                wi.setWtName("合计");
+                wi.setDaydl2(StringUtils.round(fdl, 4));
+                wi.setDaynhgzssdl(StringUtils.round(gzss, 4));
+                wi.setDaynhwhssdl(StringUtils.round(whss, 4));
+                wi.setDaynhcfdl(StringUtils.round(slss, 4));
+                wi.setDaynhxdssdl(StringUtils.round(xdss, 4));
+                wi.setDaynhqfdl(StringUtils.round(xnss, 4));
+                wi.setTotal(StringUtils.round(llfdl, 4));
+                wi.setLyl(lyl > 100 ? 100.00 : lyl);
+                wi.setDayspeed(dayspeed / count);
+                vos.add(wi);
             }
-            getSortData(sortName, sortOrder, vos);
-
-            Windturbineinfoday3 wi = new Windturbineinfoday3();
-            wi.setWtName("合计");
-            wi.setDaydl2(StringUtils.round(fdl, 4));
-            wi.setDaynhgzssdl(StringUtils.round(gzss, 4));
-            wi.setDaynhwhssdl(StringUtils.round(whss, 4));
-            wi.setDaynhcfdl(StringUtils.round(slss, 4));
-            wi.setDaynhxdssdl(StringUtils.round(xdss, 4));
-            wi.setDaynhqfdl(StringUtils.round(xnss, 4));
-            wi.setTotal(StringUtils.round(llfdl, 4));
-            wi.setLyl(lyl > 100 ? 100.00 : lyl);
-            wi.setDayspeed(dayspeed / count);
-            vos.add(wi);
+
         }
 
 

+ 7 - 7
src/main/resources/application-dev.yml

@@ -7,14 +7,14 @@ spring:
     druid:
      #主库数据源
      master:
-        url: jdbc:mysql://localhost:3306/springbootv2?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&serverTimezone=UTC&zeroDateTimeBehavior=convertToNull
-        username: root
-        password: 123456
+#        url: jdbc:mysql://localhost:3306/springbootv2?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&serverTimezone=UTC&zeroDateTimeBehavior=convertToNull
+#        username: root
+#        password: 123456
 
-#        url: jdbc:oracle:thin:@192.168.1.105:1521:gdnxfd
-#        username: nxfdprod
-#        password: gdnxfd123
-#        driver-class-name: oracle.jdbc.driver.OracleDriver
+        url: jdbc:oracle:thin:@192.168.1.105:1521:gdnxfd
+        username: nxfdprod
+        password: gdnxfd123
+        driver-class-name: oracle.jdbc.driver.OracleDriver
 
      #备数据源 #关闭
      slave:

+ 1 - 1
src/main/resources/application.yml

@@ -109,7 +109,7 @@ spring :
 #    cache-enabled: false
 #pagehelper分页插件
 pagehelper:
-    helperDialect: mysql
+    helperDialect: oracle
     reasonable: true
     supportMethodsArguments: true
     params: count=countSql