Browse Source

绩效榜排序

xieshengjie 2 years atrás
parent
commit
a36097a2d1

+ 8 - 4
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/bmk/BenchmarkingController.java

@@ -85,8 +85,10 @@ public class BenchmarkingController {
                          @RequestParam(value = "endDate", required = true) String endDate,
                          @RequestParam(value = "wpids", required = true) String wpids,
                          @RequestParam(value = "projectids", required = true) String projectids,
-                         @RequestParam(value = "lineids", required = true) String lineids){
-        List<FjjxbVo> resultList = benchmarkingService.performance(companyid,getype,sttype,beginDate,endDate,wpids,projectids,lineids);
+                         @RequestParam(value = "lineids", required = true) String lineids,
+                         @RequestParam(value = "target",required = true) String target,
+                         @RequestParam(value = "sort",required = true) String sort){
+        List<FjjxbVo> resultList = benchmarkingService.performance(companyid,getype,sttype,beginDate,endDate,wpids,projectids,lineids,target,sort);
         if (StringUtils.isNotNull(resultList)) {
             return R.data(ResultMsg.ok(resultList));
         } else {
@@ -103,8 +105,10 @@ public class BenchmarkingController {
                            @RequestParam(value = "endDate", required = true) String endDate,
                            @RequestParam(value = "wpids", required = true) String wpids,
                            @RequestParam(value = "projectids", required = true) String projectids,
-                           @RequestParam(value = "lineids", required = true) String lineids){
-        List<FjjxbmxVo> resultList = benchmarkingService.performanceMX(companyid,getype,sttype,beginDate,endDate,wpids,projectids,lineids);
+                           @RequestParam(value = "lineids", required = true) String lineids,
+                           @RequestParam(value = "target",required = true) String target,
+                           @RequestParam(value = "sort",required = true) String sort){
+        List<FjjxbmxVo> resultList = benchmarkingService.performanceMX(companyid,getype,sttype,beginDate,endDate,wpids,projectids,lineids,target,sort);
         if (StringUtils.isNotNull(resultList)) {
             return R.data(ResultMsg.ok(resultList));
         } else {

+ 23 - 4
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/bmk/BenchmarkingService.java

@@ -77,7 +77,7 @@ public class BenchmarkingService {
     public List<ProBasicLine> lnByPjlist(String pjids) {
         return CacheContext.lnls.stream().filter(ln->pjids.contains(ln.getProjectId())).collect(Collectors.toList());
     }
-    public List<FjjxbVo> performance(String companyid, String getype, String sttype, String beginDate, String endDate, String wpids, String projectids, String lineids) {
+    public List<FjjxbVo> performance(String companyid, String getype, String sttype, String beginDate, String endDate, String wpids, String projectids, String lineids, String target, String sort) {
         List<FjjxbVo> resultList = new ArrayList<>();
         QueryWrapper<ProEconEquipmentInfoDay1> qw = new QueryWrapper<>();
         StringBuilder sb = new StringBuilder();
@@ -177,7 +177,16 @@ public class BenchmarkingService {
             sl.updateAndGet(v -> new Double((double) (v + vo.getSl())));
             resultList.add(vo);
         });
-        SortUtils.sort(resultList,"ordernum",SortUtils.ASC);
+        if (StringUtils.isNotEmpty(target) && StringUtils.isNotEmpty(sort)){
+            if (sort.equals("1")){
+                SortUtils.sort(resultList,target,SortUtils.ASC);
+            }else {
+                SortUtils.sort(resultList,target,SortUtils.DESC);
+            }
+        }else {
+            //SortUtils.sort(resultList,"fdl",SortUtils.DESC);
+            SortUtils.sort(resultList,"ordernum",SortUtils.ASC);
+        }
         FjjxbVo vo = new FjjxbVo();
         vo.setId("hj");
         vo.setName("合计");
@@ -195,7 +204,7 @@ public class BenchmarkingService {
         return resultList;
     }
 
-    public List<FjjxbmxVo> performanceMX(String companyid, String getype, String sttype, String beginDate, String endDate, String wpids, String projectids, String lineids) {
+    public List<FjjxbmxVo> performanceMX(String companyid, String getype, String sttype, String beginDate, String endDate, String wpids, String projectids, String lineids, String target, String sort) {
         List<FjjxbmxVo> resultList = new ArrayList<>();
         QueryWrapper<ProEconEquipmentInfoDay1> qw = new QueryWrapper<>();
         StringBuilder sb = new StringBuilder();
@@ -313,7 +322,17 @@ public class BenchmarkingService {
             sl2.updateAndGet(v -> new Double((double) (v + vo.getSl2())));
             resultList.add(vo);
         });
-        SortUtils.sort(resultList,"ordernum",SortUtils.ASC);
+        if (StringUtils.isNotEmpty(target) && StringUtils.isNotEmpty(sort)){
+            if (sort.equals("1")){
+                SortUtils.sort(resultList,target,SortUtils.ASC);
+            }else {
+                SortUtils.sort(resultList,target,SortUtils.DESC);
+            }
+        }else {
+            //SortUtils.sort(resultList,"fdl",SortUtils.DESC);
+            SortUtils.sort(resultList,"ordernum",SortUtils.ASC);
+        }
+//        SortUtils.sort(resultList,"ordernum",SortUtils.ASC);
         FjjxbmxVo vo = new FjjxbmxVo();
         vo.setId("hj");
         vo.setName("合计");