88172627 张雷

actorref(模块名): 优化数据查询和统计功能

-优化了多个模块的数据查询和统计方法,提高了数据处理效率
- 重构了部分代码结构,增强了系统的可维护性
- 优化了数据库查询SQL,提高了查询性能
- 修复了一些潜在的逻辑错误,提升了数据准确性
1 个父辈 3aa0e6bb
...@@ -350,8 +350,10 @@ public class AjhRectificationInfoController { ...@@ -350,8 +350,10 @@ public class AjhRectificationInfoController {
350 350
351 @ApiOperation(value="安全态势总览数据统计:统计教育+题库", notes="安全态势总览数据统计:统计教育+题库") 351 @ApiOperation(value="安全态势总览数据统计:统计教育+题库", notes="安全态势总览数据统计:统计教育+题库")
352 @RequestMapping(value = "/jyCensus", method = RequestMethod.GET) 352 @RequestMapping(value = "/jyCensus", method = RequestMethod.GET)
353 public Map<String,Object> jyCensus(@RequestParam(name="now",required=true) String now) { 353 public Result<Map<String,Object>> jyCensus(@RequestParam(name="now",required=true) String now) {
354 Map<String, Object> result = ajhRectificationInfoService.jyCensus(now); 354 Result<Map<String,Object>> result = new Result<Map<String,Object>>();
355 Map<String, Object> map = ajhRectificationInfoService.jyCensus(now);
356 result.setResult(map);
355 return result; 357 return result;
356 } 358 }
357 } 359 }
......
...@@ -93,7 +93,7 @@ public class AjhWasteReportController { ...@@ -93,7 +93,7 @@ public class AjhWasteReportController {
93 if(reportYear==null){ 93 if(reportYear==null){
94 reportYear = String.valueOf(Year.now().getValue()); 94 reportYear = String.valueOf(Year.now().getValue());
95 } 95 }
96 IPage<AjhWasteYearReport> pageList = wasteReportService.queryPageListByYear(page, departId,reportYear); 96 IPage<AjhWasteYearReport> pageList = wasteReportService.queryPageListByYear(page, departId, reportYear);
97 result.setSuccess(true); 97 result.setSuccess(true);
98 result.setResult(pageList); 98 result.setResult(pageList);
99 return result; 99 return result;
......
...@@ -9,6 +9,8 @@ import lombok.Data; ...@@ -9,6 +9,8 @@ import lombok.Data;
9 import org.apache.commons.lang3.StringUtils; 9 import org.apache.commons.lang3.StringUtils;
10 import org.jeecgframework.poi.excel.annotation.Excel; 10 import org.jeecgframework.poi.excel.annotation.Excel;
11 11
12 import java.text.DecimalFormat;
13
12 /** 14 /**
13 * 危险废物台账月报报表 15 * 危险废物台账月报报表
14 */ 16 */
...@@ -57,11 +59,11 @@ public class AjhWasteMonthReport { ...@@ -57,11 +59,11 @@ public class AjhWasteMonthReport {
57 @ApiModelProperty(value = "贮存量") 59 @ApiModelProperty(value = "贮存量")
58 private String monthKeep; 60 private String monthKeep;
59 61
60
61 public String getStockOnHand() { 62 public String getStockOnHand() {
62 //数据之间应进行逻辑验算:期初量+入库量-出库量=在存量。 63 //数据之间应进行逻辑验算:期初量+入库量-出库量=在存量。
63 if(StringUtils.isEmpty(stockOnHand)){ 64 if(StringUtils.isEmpty(stockOnHand)){
64 stockOnHand = ConvertUtils.getDouble(monthProduce,0d) + ConvertUtils.getDouble(monthKeep,0d) - ConvertUtils.getDouble(monthOut,0d)+"" ; 65 DecimalFormat df = new DecimalFormat("#.##");
66 stockOnHand = df.format(ConvertUtils.getDouble(monthKeep,0d) - ConvertUtils.getDouble(monthOut,0d)) ;
65 } 67 }
66 return stockOnHand; 68 return stockOnHand;
67 } 69 }
......
1 package com.skua.modules.ajh.entity; 1 package com.skua.modules.ajh.entity;
2 2
3 import java.text.DecimalFormat;
3 import java.util.Date; 4 import java.util.Date;
4 import com.baomidou.mybatisplus.annotation.IdType; 5 import com.baomidou.mybatisplus.annotation.IdType;
5 import com.baomidou.mybatisplus.annotation.TableField; 6 import com.baomidou.mybatisplus.annotation.TableField;
6 import com.baomidou.mybatisplus.annotation.TableId; 7 import com.baomidou.mybatisplus.annotation.TableId;
7 import com.baomidou.mybatisplus.annotation.TableName; 8 import com.baomidou.mybatisplus.annotation.TableName;
8 import com.skua.core.aspect.annotation.Dict; 9 import com.skua.core.aspect.annotation.Dict;
10 import com.skua.core.util.ConvertUtils;
9 import io.swagger.annotations.ApiModel; 11 import io.swagger.annotations.ApiModel;
10 import io.swagger.annotations.ApiModelProperty; 12 import io.swagger.annotations.ApiModelProperty;
11 import lombok.Data; 13 import lombok.Data;
12 import lombok.EqualsAndHashCode; 14 import lombok.EqualsAndHashCode;
13 import lombok.experimental.Accessors; 15 import lombok.experimental.Accessors;
14 import com.fasterxml.jackson.annotation.JsonFormat; 16 import com.fasterxml.jackson.annotation.JsonFormat;
17 import org.apache.commons.lang3.StringUtils;
15 import org.springframework.format.annotation.DateTimeFormat; 18 import org.springframework.format.annotation.DateTimeFormat;
16 import org.jeecgframework.poi.excel.annotation.Excel; 19 import org.jeecgframework.poi.excel.annotation.Excel;
17 20
...@@ -56,11 +59,23 @@ public class AjhWasteYearReport { ...@@ -56,11 +59,23 @@ public class AjhWasteYearReport {
56 @ApiModelProperty(value = "年度贮存量") 59 @ApiModelProperty(value = "年度贮存量")
57 private String yearKeep; 60 private String yearKeep;
58 61
62 @TableField(exist=false)
63 @Excel(name = "在存量", width = 15)
64 @ApiModelProperty(value = "在存量")
65 private String stockOnHand;
66
59 /**出库量*/ 67 /**出库量*/
60 @TableField(exist=false) 68 @TableField(exist=false)
61 @Excel(name = "出库量", width = 15) 69 @Excel(name = "出库量", width = 15)
62 @ApiModelProperty(value = "出库量") 70 @ApiModelProperty(value = "出库量")
63 private String yearOut; 71 private String yearOut;
64 72
65 73 public String getStockOnHand() {
74 //数据之间应进行逻辑验算:期初量+入库量-出库量=在存量。
75 if(StringUtils.isEmpty(stockOnHand)){
76 DecimalFormat df = new DecimalFormat("#.##");
77 stockOnHand = df.format(ConvertUtils.getDouble(yearKeep,0d) - ConvertUtils.getDouble(yearOut,0d)) ;
78 }
79 return stockOnHand;
80 }
66 } 81 }
......
...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
6 import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7 import com.skua.modules.ajh.entity.AjhWasteMonthReport; 7 import com.skua.modules.ajh.entity.AjhWasteMonthReport;
8 import com.skua.modules.ajh.entity.AjhWasteYearReport; 8 import com.skua.modules.ajh.entity.AjhWasteYearReport;
9 import com.skua.tool.annotation.Anonymous;
9 import org.apache.ibatis.annotations.Param; 10 import org.apache.ibatis.annotations.Param;
10 import com.skua.modules.ajh.entity.AjhWasteProduce; 11 import com.skua.modules.ajh.entity.AjhWasteProduce;
11 import com.baomidou.mybatisplus.core.mapper.BaseMapper; 12 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -14,6 +15,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -14,6 +15,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
14 * 危废产生记录表 15 * 危废产生记录表
15 */ 16 */
16 public interface AjhWasteProduceMapper extends BaseMapper<AjhWasteProduce> { 17 public interface AjhWasteProduceMapper extends BaseMapper<AjhWasteProduce> {
18
17 /*** 19 /***
18 * 月报 20 * 月报
19 * @param page 21 * @param page
......
...@@ -46,20 +46,19 @@ ...@@ -46,20 +46,19 @@
46 46
47 <select id="queryPageListByYear" resultType="com.skua.modules.ajh.entity.AjhWasteYearReport"> 47 <select id="queryPageListByYear" resultType="com.skua.modules.ajh.entity.AjhWasteYearReport">
48 SELECT 48 SELECT
49 p.id, 49 p.id,
50 p.waste_code, 50 p.waste_code,
51 p.waste_name, 51 p.waste_name,
52 LEFT ( p.pro_out_date, 4 ) AS report_year, 52 LEFT ( p.pro_out_date, 4 ) AS report_year,
53 ROUND(ifnull(SUM( p.pro_come_count ),0) , 2) AS year_produce, 53 ROUND(ifnull(SUM( p.pro_come_count ),0) , 2) AS year_produce,
54 ROUND(ifnull(SUM( k.keep_out_count ),0) , 2) AS year_out, 54 ROUND(ifnull(SUM( k.keep_out_count ),0) , 2) AS year_out,
55 ROUND(ifnull(SUM( k.keep_in_count ),0) , 2) AS year_keep, 55 ROUND(ifnull(SUM( k.keep_in_count ),0) , 2) AS year_keep,
56 d.depart_name AS depart_name, 56 d.depart_name AS depart_name,
57 d.id as depart_id 57 d.id as depart_id
58 FROM 58 FROM
59 ajh_waste_produce p 59 ajh_waste_produce p
60 LEFT JOIN ( SELECT * FROM ajh_waste_keep WHERE LEFT ( keep_in_date, 4 ) = #{reportYear} ) k ON p.depart_id = k.depart_id 60 LEFT JOIN ( SELECT * FROM ajh_waste_keep WHERE LEFT ( keep_in_date, 4 ) = #{reportYear} ) k ON p.depart_id = k.depart_id
61 AND p.waste_code = k.waste_code 61 AND p.waste_code = k.waste_code AND p.waste_name = k.waste_name
62 AND p.waste_name = k.waste_name
63 LEFT JOIN sys_depart d ON p.depart_id = d.id 62 LEFT JOIN sys_depart d ON p.depart_id = d.id
64 WHERE 63 WHERE
65 LEFT ( p.pro_out_date, 4 ) = #{reportYear} 64 LEFT ( p.pro_out_date, 4 ) = #{reportYear}
...@@ -70,8 +69,8 @@ ...@@ -70,8 +69,8 @@
70 </foreach> 69 </foreach>
71 </if> 70 </if>
72 GROUP BY 71 GROUP BY
73 p.depart_id, 72 p.depart_id,
74 p.waste_code, 73 p.waste_code,
75 p.waste_name 74 p.waste_name
76 </select> 75 </select>
77 </mapper> 76 </mapper>
......
...@@ -5,9 +5,9 @@ import java.util.Map; ...@@ -5,9 +5,9 @@ import java.util.Map;
5 5
6 public interface IRealTimeDataService { 6 public interface IRealTimeDataService {
7 7
8 List<Map<String, Object>> queryRealTimeData(String factoryId, String type, String structId,String nmName); 8 List<Map<String, Object>> queryRealTimeData(String departId, String type, String structId,String nmName);
9 9
10 List<Map<String, Object>> queryStructData(String factoryId); 10 List<Map<String, Object>> queryStructData(String departId);
11 11
12 12
13 /** 13 /**
...@@ -17,7 +17,7 @@ public interface IRealTimeDataService { ...@@ -17,7 +17,7 @@ public interface IRealTimeDataService {
17 * @Param [factoryId] 17 * @Param [factoryId]
18 * @return java.util.Map<java.lang.String, java.lang.Object> 18 * @return java.util.Map<java.lang.String, java.lang.Object>
19 **/ 19 **/
20 Map<String, Object> getFacInfoByFactoryId(String factoryId); 20 Map<String, Object> getFacInfoByFactoryId(String departId);
21 21
22 22
23 23
...@@ -34,10 +34,10 @@ public interface IRealTimeDataService { ...@@ -34,10 +34,10 @@ public interface IRealTimeDataService {
34 * 34 *
35 * @Description web趋势 35 * @Description web趋势
36 * @Date 2022-03-24 10:12 36 * @Date 2022-03-24 10:12
37 * @Param [factoryId, timeType, startTime, endTime, id] 37 * @Param [departId, timeType, startTime, endTime, id]
38 * @return java.util.Map<java.lang.String, java.lang.Object> 38 * @return java.util.Map<java.lang.String, java.lang.Object>
39 **/ 39 **/
40 Map<String, Object> getSZTreadWeb(String factoryId, String timeType, String startTime, String endTime, String id); 40 Map<String, Object> getSZTreadWeb(String departId, String timeType, String startTime, String endTime, String id);
41 41
42 /** 42 /**
43 * <pre> 43 * <pre>
...@@ -71,7 +71,7 @@ public interface IRealTimeDataService { ...@@ -71,7 +71,7 @@ public interface IRealTimeDataService {
71 */ 71 */
72 Map<String, Object> getProjectInfo(); 72 Map<String, Object> getProjectInfo();
73 73
74 List<Map<String, Object>> queryStructDataApp(String factoryId); 74 List<Map<String, Object>> queryStructDataApp(String departId);
75 75
76 List<Map<String, Object>> queryRealTimeDataApp(String factoryId, String type, String structId, String sortType,String nmName); 76 List<Map<String, Object>> queryRealTimeDataApp(String departId, String type, String structId, String sortType,String nmName);
77 } 77 }
......
...@@ -196,20 +196,19 @@ public class ScreenDataServiceImpl implements IScreenDataService { ...@@ -196,20 +196,19 @@ public class ScreenDataServiceImpl implements IScreenDataService {
196 if (StringUtil.isNotBlank(sb.toString())) { 196 if (StringUtil.isNotBlank(sb.toString())) {
197 appendSql = "and a.id in (" + sb.substring(1) + ")"; 197 appendSql = "and a.id in (" + sb.substring(1) + ")";
198 } 198 }
199
200 } 199 }
201 return masterDB.queryForList("select t.*,\n" + 200 String dataViewName2119 = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, month);
202 "round(avg(t.indexValue/t.proScale),2) as fhl\n" + 201 String sql = "select t.*," +
203 ", round(sum(t.indexValue),2) totalCLSL\n" + 202 " round(avg(t.indexValue/t.proScale),2) as fhl," +
204 "from(\n" + 203 " round(sum(t.indexValue),2) totalCLSL " +
205 "SELECT a.id as departId,a.depart_name as departName,b.index_tag as indexTag,b.index_value as indexValue," + 204 " from( " +
206 "(select c.pro_scale*10000 from sys_factory_info c where a.id = c.depart_id) as proScale\n" + 205 " SELECT a.id as departId,a.depart_name as departName,'JSLJLL' as indexTag,b.CSL as indexValue," +
207 "FROM sys_depart a LEFT JOIN sys_data_calculation b ON a.id = b.depart_id \n" + 206 " (select c.pro_scale*10000 from sys_factory_info c where a.id = c.depart_id) as proScale " +
208 "where a.del_flag= 1 and a.depart_type = 1 and b.index_tag = 'JSLJLL'\n" + 207 " FROM sys_depart a " +
209 "\tand ts LIKE '" + month + "%' \n" + appendSql+ 208 " LEFT JOIN (select v2.time,v2.CSL,v2.depart_id from "+dataViewName2119+" v2 where v2.time like '"+month+"%') b ON a.id = b.depart_id" +
210 "\tGROUP BY a.id, b.ts)t GROUP BY t.departId"); 209 " where a.del_flag= 1 and a.depart_type = 1 " + appendSql +
211 210 " GROUP BY a.id, b.time)t GROUP BY t.departId";
212 211 return masterDB.queryForList(sql);
213 } 212 }
214 213
215 @Override 214 @Override
......
...@@ -162,11 +162,11 @@ skua: ...@@ -162,11 +162,11 @@ skua:
162 isRunTimeInterval: 3600 162 isRunTimeInterval: 3600
163 #视频对接相关配置,未使用,待完善 163 #视频对接相关配置,未使用,待完善
164 video: 164 video:
165 lan: 20.0.99.6 165 lan: 112.123.135.139
166 ip: 113.249.91.27 166 ip: 112.123.135.139
167 port: 8667 167 port: 8667
168 appkey: 21656155 168 appkey: 29461614
169 secretkey: llQvkzDIzmYnNiXNYxDN 169 secretkey: RkJhpwVKJyf0FbDwQpbP
170 #消息推送 170 #消息推送
171 push: 171 push:
172 #是否开启流程消息推送 172 #是否开启流程消息推送
......
...@@ -103,4 +103,7 @@ public class EquipmentMaintainTask { ...@@ -103,4 +103,7 @@ public class EquipmentMaintainTask {
103 @ApiModelProperty(value = "维保类型") 103 @ApiModelProperty(value = "维保类型")
104 @Dict(dicCode = "maintenance_type") 104 @Dict(dicCode = "maintenance_type")
105 private String maintenanceType; 105 private String maintenanceType;
106 @TableField(exist = false)
107 @ApiModelProperty(value = "预估费用")
108 private String planCost;
106 } 109 }
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
26 emt.picture_url AS pictureUrl, 26 emt.picture_url AS pictureUrl,
27 emt.equipment_id AS equipmentId, 27 emt.equipment_id AS equipmentId,
28 emt.results_enforcement AS resultsEnforcement, 28 emt.results_enforcement AS resultsEnforcement,
29 emp.plan_cost AS planCost,
29 emp.plan_accepter_id AS planAccepterId, 30 emp.plan_accepter_id AS planAccepterId,
30 emp.plan_arranger_id, 31 emp.plan_arranger_id,
31 emt.device_administrator_id AS deviceAdministratorId, 32 emt.device_administrator_id AS deviceAdministratorId,
......
...@@ -1121,20 +1121,21 @@ public class SysUserController { ...@@ -1121,20 +1121,21 @@ public class SysUserController {
1121 String newCid = loginUser.getCid(); 1121 String newCid = loginUser.getCid();
1122 if (StrUtil.isNotBlank(newCid)) { 1122 if (StrUtil.isNotBlank(newCid)) {
1123 //修改手机cid 1123 //修改手机cid
1124 String oldCid = oldUser.getCid(); 1124 oldUser.setCid(loginUser.getCid());
1125 if (StringUtils.isBlank(oldCid)) { 1125 // String oldCid = oldUser.getCid();
1126 oldUser.setCid(loginUser.getCid()); 1126 // if (StringUtils.isBlank(oldCid)) {
1127 } else { 1127 // oldUser.setCid(loginUser.getCid());
1128 String[] split = oldCid.split(","); 1128 // } else {
1129 Set<String> sets = new HashSet<>(Arrays.asList(split)); 1129 // String[] split = oldCid.split(",");
1130 sets.add(loginUser.getCid()); 1130 // Set<String> sets = new HashSet<>(Arrays.asList(split));
1131 StringBuilder stringBuilder = new StringBuilder(); 1131 // sets.add(loginUser.getCid());
1132 for (String set : sets) { 1132 // StringBuilder stringBuilder = new StringBuilder();
1133 stringBuilder.append(set + ","); 1133 // for (String set : sets) {
1134 } 1134 // stringBuilder.append(set + ",");
1135 stringBuilder.deleteCharAt(stringBuilder.length() - 1); 1135 // }
1136 oldUser.setCid(stringBuilder.toString()); 1136 // stringBuilder.deleteCharAt(stringBuilder.length() - 1);
1137 } 1137 // oldUser.setCid(stringBuilder.toString());
1138 // }
1138 sysBaseAPI.updateUser(oldUser); 1139 sysBaseAPI.updateUser(oldUser);
1139 result.success("cid修改成功"); 1140 result.success("cid修改成功");
1140 } 1141 }
......
...@@ -255,6 +255,11 @@ ...@@ -255,6 +255,11 @@
255 '${item}' 255 '${item}'
256 </foreach> 256 </foreach>
257 ) 257 )
258 OR parent_id IN ( SELECT id from sys_depart WHERE parent_id IN(SELECT id FROM sys_depart WHERE parent_id IN
259 <foreach item="item" index="index" collection="departIds.split(',')" open="(" separator="," close=")">
260 '${item}'
261 </foreach>
262 ))
258 ORDER BY 263 ORDER BY
259 depart_type, 264 depart_type,
260 depart_order 265 depart_order
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!