Browse Source

车辆设备状态统计

lamphua 7 months ago
parent
commit
8cbb04668d

+ 27
- 0
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcCarController.java View File

@@ -5,6 +5,8 @@ import java.text.SimpleDateFormat;
5 5
 import java.util.List;
6 6
 import javax.servlet.http.HttpServletResponse;
7 7
 
8
+import com.alibaba.fastjson2.JSONArray;
9
+import com.alibaba.fastjson2.JSONObject;
8 10
 import com.ruoyi.common.utils.DateUtils;
9 11
 import com.ruoyi.system.service.ISysUserService;
10 12
 import org.springframework.beans.factory.annotation.Autowired;
@@ -73,6 +75,31 @@ public class CmcCarController extends BaseController
73 75
         return success(cmcCarService.selectCmcCarByCarId(carId));
74 76
     }
75 77
 
78
+    /**
79
+     * 获取设备统计信息
80
+     */
81
+    @GetMapping(value = "/statistic")
82
+    public AjaxResult getCarStatistic()
83
+    {
84
+        JSONObject jsonObject = new JSONObject();
85
+        JSONArray statusArray = new JSONArray();
86
+        JSONObject statusObject = new JSONObject();
87
+        CmcCar cmcCar = new CmcCar();
88
+        cmcCar.setStatus("0");
89
+        statusObject.put("被领用", cmcCarService.selectCmcCarList(cmcCar).size());
90
+        cmcCar.setStatus("1");
91
+        statusObject.put("可领用", cmcCarService.selectCmcCarList(cmcCar).size());
92
+        cmcCar.setStatus("2");
93
+        statusObject.put("维修中", cmcCarService.selectCmcCarList(cmcCar).size());
94
+        cmcCar.setStatus("3");
95
+        statusObject.put("已停用", cmcCarService.selectCmcCarList(cmcCar).size());
96
+        cmcCar.setStatus("4");
97
+        statusObject.put("已报废", cmcCarService.selectCmcCarList(cmcCar).size());
98
+        statusArray.add(statusObject);
99
+        jsonObject.put("",statusArray);
100
+        return success(jsonObject);
101
+    }
102
+
76 103
     /**
77 104
      * 新增cmc车辆信息
78 105
      */

+ 27
- 0
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcDeviceController.java View File

@@ -6,6 +6,8 @@ import java.util.List;
6 6
 import java.util.Map;
7 7
 import javax.servlet.http.HttpServletResponse;
8 8
 
9
+import com.alibaba.fastjson2.JSONArray;
10
+import com.alibaba.fastjson2.JSONObject;
9 11
 import com.ruoyi.common.utils.DateUtils;
10 12
 import liquibase.pro.packaged.C;
11 13
 import org.springframework.beans.factory.annotation.Autowired;
@@ -81,6 +83,31 @@ public class CmcDeviceController extends BaseController
81 83
         return success(cmcDeviceService.selectCmcDeviceByDeviceId(deviceId));
82 84
     }
83 85
 
86
+    /**
87
+     * 获取设备统计信息
88
+     */
89
+    @GetMapping(value = "/statistic")
90
+    public AjaxResult getDeviceStatistic()
91
+    {
92
+        JSONObject jsonObject = new JSONObject();
93
+        JSONArray statusArray = new JSONArray();
94
+        JSONObject statusObject = new JSONObject();
95
+        CmcDevice cmcDevice = new CmcDevice();
96
+        cmcDevice.setStatus("0");
97
+        statusObject.put("被领用", cmcDeviceService.selectCmcDeviceList(cmcDevice).size());
98
+        cmcDevice.setStatus("1");
99
+        statusObject.put("可领用", cmcDeviceService.selectCmcDeviceList(cmcDevice).size());
100
+        cmcDevice.setStatus("2");
101
+        statusObject.put("维修中", cmcDeviceService.selectCmcDeviceList(cmcDevice).size());
102
+        cmcDevice.setStatus("3");
103
+        statusObject.put("已停用", cmcDeviceService.selectCmcDeviceList(cmcDevice).size());
104
+        cmcDevice.setStatus("4");
105
+        statusObject.put("已报废", cmcDeviceService.selectCmcDeviceList(cmcDevice).size());
106
+        statusArray.add(statusObject);
107
+        jsonObject.put("",statusArray);
108
+        return success(jsonObject);
109
+    }
110
+
84 111
     /**
85 112
      * 新增cmc设备信息
86 113
      */

+ 9
- 0
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcMaterialBuyController.java View File

@@ -2,6 +2,9 @@ package com.ruoyi.web.controller.oa;
2 2
 
3 3
 import java.util.List;
4 4
 import javax.servlet.http.HttpServletResponse;
5
+
6
+import com.ruoyi.oa.domain.CmcMaterial;
7
+import com.ruoyi.oa.service.ICmcMaterialService;
5 8
 import org.springframework.beans.factory.annotation.Autowired;
6 9
 import org.springframework.web.bind.annotation.GetMapping;
7 10
 import org.springframework.web.bind.annotation.PostMapping;
@@ -33,6 +36,9 @@ public class CmcMaterialBuyController extends BaseController
33 36
     @Autowired
34 37
     private ICmcMaterialBuyService cmcMaterialBuyService;
35 38
 
39
+    @Autowired
40
+    private ICmcMaterialService cmcMaterialService;
41
+
36 42
     /**
37 43
      * 查询cmc耗材购买列表
38 44
      */
@@ -72,6 +78,9 @@ public class CmcMaterialBuyController extends BaseController
72 78
     @PostMapping
73 79
     public AjaxResult add(@RequestBody CmcMaterialBuy cmcMaterialBuy)
74 80
     {
81
+        CmcMaterial cmcMaterial = cmcMaterialService.selectCmcMaterialByMaterialId(cmcMaterialBuy.getMaterialId());
82
+        cmcMaterial.setRemain(cmcMaterial.getRemain() + cmcMaterialBuy.getTotalNum());
83
+        cmcMaterialService.updateCmcMaterial(cmcMaterial);
75 84
         return toAjax(cmcMaterialBuyService.insertCmcMaterialBuy(cmcMaterialBuy));
76 85
     }
77 86
 

+ 9
- 0
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcMaterialGiveController.java View File

@@ -2,6 +2,9 @@ package com.ruoyi.web.controller.oa;
2 2
 
3 3
 import java.util.List;
4 4
 import javax.servlet.http.HttpServletResponse;
5
+
6
+import com.ruoyi.oa.domain.CmcMaterial;
7
+import com.ruoyi.oa.service.ICmcMaterialService;
5 8
 import org.springframework.beans.factory.annotation.Autowired;
6 9
 import org.springframework.web.bind.annotation.GetMapping;
7 10
 import org.springframework.web.bind.annotation.PostMapping;
@@ -33,6 +36,9 @@ public class CmcMaterialGiveController extends BaseController
33 36
     @Autowired
34 37
     private ICmcMaterialGiveService cmcMaterialGiveService;
35 38
 
39
+    @Autowired
40
+    private ICmcMaterialService cmcMaterialService;
41
+
36 42
     /**
37 43
      * 查询cmc耗材发放列表
38 44
      */
@@ -72,6 +78,9 @@ public class CmcMaterialGiveController extends BaseController
72 78
     @PostMapping
73 79
     public AjaxResult add(@RequestBody CmcMaterialGive cmcMaterialGive)
74 80
     {
81
+        CmcMaterial cmcMaterial = cmcMaterialService.selectCmcMaterialByMaterialId(cmcMaterialGive.getMaterialId());
82
+        cmcMaterial.setRemain(cmcMaterial.getRemain() - cmcMaterialGive.getGiveNum());
83
+        cmcMaterialService.updateCmcMaterial(cmcMaterial);
75 84
         return toAjax(cmcMaterialGiveService.insertCmcMaterialGive(cmcMaterialGive));
76 85
     }
77 86
 

+ 2
- 3
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcArchiveMapper.xml View File

@@ -79,8 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
79 79
     <select id="selectCmcArchiveList" parameterType="CmcArchive" resultMap="CmcArchiveResult">
80 80
         <include refid="selectCmcArchiveVo"/>
81 81
         <where>
82
-            (case YEAR(#{archiveTime}) when 2000 then a.archive_time is not null
83
-            end)
82
+
84 83
             <if test="projectId != null  and projectId != ''"> and a.project_id = #{projectId}</if>
85 84
             <if test="projectNumber != null  and projectNumber != ''"> and p.project_number like concat('%', #{projectNumber}, '%')</if>
86 85
             <if test="projectLeader != null  and projectLeader != ''"> and a.project_leader = #{projectLeader}</if>
@@ -94,7 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
94 93
             <if test="qualityTime != null "> and a.quality_time = #{qualityTime}</if>
95 94
             <if test="produceTime != null "> and a.produce_time = #{produceTime}</if>
96 95
             <if test="deptTime != null "> and a.dept_time = #{deptTime}</if>
97
-<!--            <if test="archiveTime != null "> and YEAR(a.archive_time) = YEAR(#{archiveTime})</if>-->
96
+            <if test="archiveTime != null and @com.ruoyi.common.utils.DateUtils@parseDateToStr('yyyy', archiveTime) == '2000' "> and a.archive_time is not null</if>
98 97
             <if test="produceComment != null  and produceComment != ''"> and a.produce_comment = #{produceComment}</if>
99 98
             <if test="qualityComment != null  and qualityComment != ''"> and a.quality_comment = #{qualityComment}</if>
100 99
             <if test="deptComment != null  and deptComment != ''"> and a.dept_comment = #{deptComment}</if>

+ 2
- 3
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcSettleMapper.xml View File

@@ -113,8 +113,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
113 113
     <select id="selectCmcSettleList" parameterType="CmcSettle" resultMap="CmcSettleResult">
114 114
         <include refid="selectCmcSettleVo"/>
115 115
         <where>
116
-            (case YEAR(#{gmTime}) when 2000 then s.gm_time is not null
117
-            end)
116
+
118 117
             <if test="settleId != null  and settleId != ''"> and s.settle_id = #{settleId}</if>
119 118
             <if test="projectId != null"> and s.project_id = #{projectId}</if>
120 119
             <if test="projectNumber != null  and projectNumber != ''"> and p.project_number like concat('%', #{projectNumber}, '%')</if>
@@ -138,7 +137,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
138 137
             <if test="managerTime != null "> and s.manager_time = #{managerTime}</if>
139 138
             <if test="managerComment != null  and managerComment != ''"> and s.manager_comment = #{managerComment}</if>
140 139
             <if test="gmUserId != null "> and s.gm_user_id = #{gmUserId}</if>
141
-<!--            <if test="gmTime != null "> and YEAR(s.gm_time) = YEAR(#{gmTime})</if>-->
140
+            <if test="gmTime != null and @com.ruoyi.common.utils.DateUtils@parseDateToStr('yyyy', gmTime) == '2000' "> and s.gm_time is not null</if>
142 141
             <if test="gmComment != null  and gmComment != ''"> and s.gm_comment = #{gmComment}</if>
143 142
         </where>
144 143
         order by s.report_time desc

Loading…
Cancel
Save