Sfoglia il codice sorgente

车辆设备状态统计

lamphua 7 mesi fa
parent
commit
8cbb04668d

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

5
 import java.util.List;
5
 import java.util.List;
6
 import javax.servlet.http.HttpServletResponse;
6
 import javax.servlet.http.HttpServletResponse;
7
 
7
 
8
+import com.alibaba.fastjson2.JSONArray;
9
+import com.alibaba.fastjson2.JSONObject;
8
 import com.ruoyi.common.utils.DateUtils;
10
 import com.ruoyi.common.utils.DateUtils;
9
 import com.ruoyi.system.service.ISysUserService;
11
 import com.ruoyi.system.service.ISysUserService;
10
 import org.springframework.beans.factory.annotation.Autowired;
12
 import org.springframework.beans.factory.annotation.Autowired;
73
         return success(cmcCarService.selectCmcCarByCarId(carId));
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
      * 新增cmc车辆信息
104
      * 新增cmc车辆信息
78
      */
105
      */

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

6
 import java.util.Map;
6
 import java.util.Map;
7
 import javax.servlet.http.HttpServletResponse;
7
 import javax.servlet.http.HttpServletResponse;
8
 
8
 
9
+import com.alibaba.fastjson2.JSONArray;
10
+import com.alibaba.fastjson2.JSONObject;
9
 import com.ruoyi.common.utils.DateUtils;
11
 import com.ruoyi.common.utils.DateUtils;
10
 import liquibase.pro.packaged.C;
12
 import liquibase.pro.packaged.C;
11
 import org.springframework.beans.factory.annotation.Autowired;
13
 import org.springframework.beans.factory.annotation.Autowired;
81
         return success(cmcDeviceService.selectCmcDeviceByDeviceId(deviceId));
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
      * 新增cmc设备信息
112
      * 新增cmc设备信息
86
      */
113
      */

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

2
 
2
 
3
 import java.util.List;
3
 import java.util.List;
4
 import javax.servlet.http.HttpServletResponse;
4
 import javax.servlet.http.HttpServletResponse;
5
+
6
+import com.ruoyi.oa.domain.CmcMaterial;
7
+import com.ruoyi.oa.service.ICmcMaterialService;
5
 import org.springframework.beans.factory.annotation.Autowired;
8
 import org.springframework.beans.factory.annotation.Autowired;
6
 import org.springframework.web.bind.annotation.GetMapping;
9
 import org.springframework.web.bind.annotation.GetMapping;
7
 import org.springframework.web.bind.annotation.PostMapping;
10
 import org.springframework.web.bind.annotation.PostMapping;
33
     @Autowired
36
     @Autowired
34
     private ICmcMaterialBuyService cmcMaterialBuyService;
37
     private ICmcMaterialBuyService cmcMaterialBuyService;
35
 
38
 
39
+    @Autowired
40
+    private ICmcMaterialService cmcMaterialService;
41
+
36
     /**
42
     /**
37
      * 查询cmc耗材购买列表
43
      * 查询cmc耗材购买列表
38
      */
44
      */
72
     @PostMapping
78
     @PostMapping
73
     public AjaxResult add(@RequestBody CmcMaterialBuy cmcMaterialBuy)
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
         return toAjax(cmcMaterialBuyService.insertCmcMaterialBuy(cmcMaterialBuy));
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 Vedi File

2
 
2
 
3
 import java.util.List;
3
 import java.util.List;
4
 import javax.servlet.http.HttpServletResponse;
4
 import javax.servlet.http.HttpServletResponse;
5
+
6
+import com.ruoyi.oa.domain.CmcMaterial;
7
+import com.ruoyi.oa.service.ICmcMaterialService;
5
 import org.springframework.beans.factory.annotation.Autowired;
8
 import org.springframework.beans.factory.annotation.Autowired;
6
 import org.springframework.web.bind.annotation.GetMapping;
9
 import org.springframework.web.bind.annotation.GetMapping;
7
 import org.springframework.web.bind.annotation.PostMapping;
10
 import org.springframework.web.bind.annotation.PostMapping;
33
     @Autowired
36
     @Autowired
34
     private ICmcMaterialGiveService cmcMaterialGiveService;
37
     private ICmcMaterialGiveService cmcMaterialGiveService;
35
 
38
 
39
+    @Autowired
40
+    private ICmcMaterialService cmcMaterialService;
41
+
36
     /**
42
     /**
37
      * 查询cmc耗材发放列表
43
      * 查询cmc耗材发放列表
38
      */
44
      */
72
     @PostMapping
78
     @PostMapping
73
     public AjaxResult add(@RequestBody CmcMaterialGive cmcMaterialGive)
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
         return toAjax(cmcMaterialGiveService.insertCmcMaterialGive(cmcMaterialGive));
84
         return toAjax(cmcMaterialGiveService.insertCmcMaterialGive(cmcMaterialGive));
76
     }
85
     }
77
 
86
 

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

79
     <select id="selectCmcArchiveList" parameterType="CmcArchive" resultMap="CmcArchiveResult">
79
     <select id="selectCmcArchiveList" parameterType="CmcArchive" resultMap="CmcArchiveResult">
80
         <include refid="selectCmcArchiveVo"/>
80
         <include refid="selectCmcArchiveVo"/>
81
         <where>
81
         <where>
82
-            (case YEAR(#{archiveTime}) when 2000 then a.archive_time is not null
83
-            end)
82
+
84
             <if test="projectId != null  and projectId != ''"> and a.project_id = #{projectId}</if>
83
             <if test="projectId != null  and projectId != ''"> and a.project_id = #{projectId}</if>
85
             <if test="projectNumber != null  and projectNumber != ''"> and p.project_number like concat('%', #{projectNumber}, '%')</if>
84
             <if test="projectNumber != null  and projectNumber != ''"> and p.project_number like concat('%', #{projectNumber}, '%')</if>
86
             <if test="projectLeader != null  and projectLeader != ''"> and a.project_leader = #{projectLeader}</if>
85
             <if test="projectLeader != null  and projectLeader != ''"> and a.project_leader = #{projectLeader}</if>
94
             <if test="qualityTime != null "> and a.quality_time = #{qualityTime}</if>
93
             <if test="qualityTime != null "> and a.quality_time = #{qualityTime}</if>
95
             <if test="produceTime != null "> and a.produce_time = #{produceTime}</if>
94
             <if test="produceTime != null "> and a.produce_time = #{produceTime}</if>
96
             <if test="deptTime != null "> and a.dept_time = #{deptTime}</if>
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
             <if test="produceComment != null  and produceComment != ''"> and a.produce_comment = #{produceComment}</if>
97
             <if test="produceComment != null  and produceComment != ''"> and a.produce_comment = #{produceComment}</if>
99
             <if test="qualityComment != null  and qualityComment != ''"> and a.quality_comment = #{qualityComment}</if>
98
             <if test="qualityComment != null  and qualityComment != ''"> and a.quality_comment = #{qualityComment}</if>
100
             <if test="deptComment != null  and deptComment != ''"> and a.dept_comment = #{deptComment}</if>
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 Vedi File

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

Loading…
Annulla
Salva