소스 검색

物资使用情况排名;

zlq 8 달 전
부모
커밋
ae12ca6e18

+ 34 - 0
src/main/java/com/unis/vis/controller/InboundMaterialInfoController.java

@@ -0,0 +1,34 @@
1
+package com.unis.vis.controller;
2
+
3
+import com.unis.vis.model.InboundMaterialInfo;
4
+import com.unis.vis.service.InboundMaterialInfoService;
5
+import org.springframework.web.bind.annotation.GetMapping;
6
+import org.springframework.web.bind.annotation.RequestMapping;
7
+import org.springframework.web.bind.annotation.RestController;
8
+
9
+import javax.annotation.Resource;
10
+import java.util.HashMap;
11
+import java.util.List;
12
+
13
+/**
14
+ * ClassName: InboundMaterialInfoController
15
+ * Package: com.unis.vis.controller
16
+ * Description:
17
+ *
18
+ * @Author zlq
19
+ * @Create 2024/3/5 11:06
20
+ * @Version 1.0
21
+ */
22
+@RestController
23
+@RequestMapping("/Material")
24
+public class InboundMaterialInfoController {
25
+    @Resource
26
+    private InboundMaterialInfoService inboundMaterialInfoService;
27
+
28
+    /*应用物资大类*/
29
+    @GetMapping("/getWzsyqkpm")
30
+    public HashMap<String, List<InboundMaterialInfo>> getEmergencySuppliesCategory() {
31
+        HashMap<String, List<InboundMaterialInfo>> wzsyqkpmMap = inboundMaterialInfoService.getWzsyqkpm();
32
+        return wzsyqkpmMap;
33
+    }
34
+}

+ 2 - 0
src/main/java/com/unis/vis/mapper/InboundMaterialInfoMapper.java

@@ -13,4 +13,6 @@ public interface InboundMaterialInfoMapper extends BaseMapper<InboundMaterialInf
13 13
      List<InboundMaterialInfo> getEmergencySuppliesCategory();
14 14
 
15 15
      List<InboundMaterialInfo> getMaterialSituation();
16
+
17
+     List<InboundMaterialInfo> getWzsyqkpm();
16 18
 }

+ 2 - 1
src/main/java/com/unis/vis/service/InboundMaterialInfoService.java

@@ -3,6 +3,7 @@ package com.unis.vis.service;
3 3
 import com.baomidou.mybatisplus.extension.service.IService;
4 4
 import com.unis.vis.model.InboundMaterialInfo;
5 5
 
6
+import java.util.HashMap;
6 7
 import java.util.List;
7 8
 
8 9
 
@@ -12,5 +13,5 @@ public interface InboundMaterialInfoService extends IService<InboundMaterialInfo
12 13
 
13 14
     List<InboundMaterialInfo> getMaterialSituation();
14 15
 
15
-
16
+    HashMap<String, List<InboundMaterialInfo>> getWzsyqkpm();
16 17
 }

+ 23 - 0
src/main/java/com/unis/vis/service/impl/InboundMaterialInfoServiceImpl.java

@@ -8,7 +8,10 @@ import com.unis.vis.service.InboundMaterialInfoService;
8 8
 import org.springframework.stereotype.Service;
9 9
 
10 10
 import javax.annotation.Resource;
11
+import java.util.Comparator;
12
+import java.util.HashMap;
11 13
 import java.util.List;
14
+import java.util.stream.Collectors;
12 15
 
13 16
 @Service
14 17
 public class InboundMaterialInfoServiceImpl extends ServiceImpl<InboundMaterialInfoMapper, InboundMaterialInfo> implements InboundMaterialInfoService {
@@ -27,6 +30,26 @@ public class InboundMaterialInfoServiceImpl extends ServiceImpl<InboundMaterialI
27 30
         return inboundMaterialInfoMapper.getMaterialSituation();
28 31
     }
29 32
 
33
+    @Override
34
+    public HashMap<String, List<InboundMaterialInfo>> getWzsyqkpm() {
35
+        HashMap<String, List<InboundMaterialInfo>> wzsyqkpmMap = new HashMap<>();
36
+        List<InboundMaterialInfo> wzsyqkpm = inboundMaterialInfoMapper.getWzsyqkpm();
37
+        //按数量排序
38
+        List<InboundMaterialInfo> quantityList = wzsyqkpm.stream()
39
+                .sorted(Comparator.comparing(InboundMaterialInfo::getQuantity).reversed())
40
+                .collect(Collectors.toList());
41
+
42
+        wzsyqkpmMap.put("quantitySort",quantityList);
43
+        //按价值排序
44
+        List<InboundMaterialInfo> collect = wzsyqkpm.stream()
45
+                .sorted(Comparator.comparing(InboundMaterialInfo::getTotalPrice).reversed())
46
+                .collect(Collectors.toList());
47
+
48
+        wzsyqkpmMap.put("TotalPriceSort",collect);
49
+
50
+
51
+        return wzsyqkpmMap;
52
+    }
30 53
 
31 54
 
32 55
 }

+ 8 - 0
src/main/resources/mapper/vis/InboundMaterialInfoMapper.xml

@@ -23,5 +23,13 @@
23 23
         where b."status"=5
24 24
         GROUP BY dic.NAME_
25 25
     </select>
26
+    <select id="getWzsyqkpm" resultType="com.unis.vis.model.InboundMaterialInfo">
27
+        select dic.NAME_ as material_type,SUM(iif.quantity)as quantity,SUM(iif.total_price)as total_price
28
+        from outbound_material_info iif
29
+        left JOIN SYS_TREE_DICT dic on iif.material_type=dic.ID
30
+        left join outbound_info b ON iif."outbound_id"=B."outbound_id"
31
+        where b."status"=5 and dic.DIFFERENCE_=2
32
+        GROUP BY dic.NAME_
33
+    </select>
26 34
 
27 35
 </mapper>