c5f469fe 康伟

kangwei:修改bug,优化代码

1 个父辈 b2fd0881
...@@ -20,6 +20,8 @@ public interface EmergencyRiskEventMapper extends BaseMapper<EmergencyRiskEvent> ...@@ -20,6 +20,8 @@ public interface EmergencyRiskEventMapper extends BaseMapper<EmergencyRiskEvent>
20 20
21 @Anonymous 21 @Anonymous
22 List<DangerDatabaseResult> getDangerList( @Param("departIds")String departIds , @Param("startDate") String startDate,@Param("endDate")String endDate); 22 List<DangerDatabaseResult> getDangerList( @Param("departIds")String departIds , @Param("startDate") String startDate,@Param("endDate")String endDate);
23 @Anonymous
24 List<DangerDatabaseResult> getDepartDangerList( @Param("startDate") String startDate,@Param("endDate")String endDate);
23 25
24 @Anonymous 26 @Anonymous
25 List<MapDatabaseResult> getMapData( @Param("departIds")String departIds ); 27 List<MapDatabaseResult> getMapData( @Param("departIds")String departIds );
......
...@@ -23,21 +23,22 @@ ...@@ -23,21 +23,22 @@
23 </select> 23 </select>
24 24
25 <select id="getDangerList" resultType="com.skua.modules.emergency.vo.DangerDatabaseResult"> 25 <select id="getDangerList" resultType="com.skua.modules.emergency.vo.DangerDatabaseResult">
26 SELECT 26 select d.depart_name, r.depart_id ,
27 d.id AS depart_id,
28 d.depart_name AS depart_name,
29 r.report_date AS danger_date, 27 r.report_date AS danger_date,
30 r.danger_name AS danger_location, 28 r.danger_name AS danger_location,
31 u.realname AS 'danger_user', 29 u.realname AS 'danger_user',
32 1 AS is_fault, 30 CASE
31 WHEN ifnull(t2.id,'0') >= 0 THEN '1'
32 ELSE '0'
33 END AS is_fault,
33 r.status 34 r.status
34 FROM
35 sys_depart d
36 LEFT JOIN danger_inspection_record r ON d.id = r.depart_id
37 LEFT JOIN sys_user u ON u.id = r.report_user
38 WHERE
39 d.depart_type = 1
40 35
36 from danger_inspection_record r
37 left join danger_inspection_info t1 on r.id= t1.inspection_record_id
38 left join danger_inspection_item t2 on t1.id = t2.inspection_info_id
39 LEFT JOIN sys_user u ON u.id = r.report_user
40 left join sys_depart d on d.id = r.depart_id
41 where t2.status = 0 and t2.item_value =1
41 <if test="startDate != null and startDate != ''"> 42 <if test="startDate != null and startDate != ''">
42 and DATE_FORMAT( r.report_date, '%Y-%m-%d' ) &gt;= #{startDate} 43 and DATE_FORMAT( r.report_date, '%Y-%m-%d' ) &gt;= #{startDate}
43 </if> 44 </if>
...@@ -45,11 +46,24 @@ ...@@ -45,11 +46,24 @@
45 and DATE_FORMAT( r.report_date, '%Y-%m-%d' ) &lt;= #{endDate} 46 and DATE_FORMAT( r.report_date, '%Y-%m-%d' ) &lt;= #{endDate}
46 </if> 47 </if>
47 <if test="departIds != null and departIds !='' "> 48 <if test="departIds != null and departIds !='' ">
48 and d.id in (${departIds}) 49 and r.depart_id in (${departIds})
49 </if> 50 </if>
51 group by r.depart_id
50 order by r.report_date desc 52 order by r.report_date desc
51 </select> 53 </select>
52 54
55 <select id="getDepartDangerList" resultType="com.skua.modules.emergency.vo.DangerDatabaseResult">
56 select r.*
57 from danger_inspection_record r
58 where 1=1
59 <if test="startDate != null and startDate != ''">
60 and DATE_FORMAT( r.report_date, '%Y-%m-%d' ) &gt;= #{startDate}
61 </if>
62 <if test="endDate != null and endDate != ''">
63 and DATE_FORMAT( r.report_date, '%Y-%m-%d' ) &lt;= #{endDate}
64 </if>
65 order by r.report_date desc
66 </select>
53 <select id="getMapData" resultType="com.skua.modules.emergency.vo.MapDatabaseResult"> 67 <select id="getMapData" resultType="com.skua.modules.emergency.vo.MapDatabaseResult">
54 SELECT 68 SELECT
55 d.id AS depart_id, 69 d.id AS depart_id,
......
...@@ -287,7 +287,7 @@ public class EmergencyRiskEventServiceImpl extends ServiceImpl<EmergencyRiskEven ...@@ -287,7 +287,7 @@ public class EmergencyRiskEventServiceImpl extends ServiceImpl<EmergencyRiskEven
287 /* if(StringUtils.isEmpty(year)){ 287 /* if(StringUtils.isEmpty(year)){
288 year = String.valueOf(DateUtils.getYear()); 288 year = String.valueOf(DateUtils.getYear());
289 }*/ 289 }*/
290 List<DangerDatabaseResult> dangerList = emergencyRiskEventMapper.getDangerList(JSUtils.quoteEach(departIds,","), startDate, endDate); 290 List<DangerDatabaseResult> dangerList = emergencyRiskEventMapper.getDepartDangerList( startDate, endDate);
291 List<MapDatabaseResult> list = emergencyRiskEventMapper.getMapData(JSUtils.quoteEach(departIds,",")); 291 List<MapDatabaseResult> list = emergencyRiskEventMapper.getMapData(JSUtils.quoteEach(departIds,","));
292 for (MapDatabaseResult mapDatabaseResult : list) { 292 for (MapDatabaseResult mapDatabaseResult : list) {
293 List<DangerDatabaseResult> daList = new ArrayList<>(); 293 List<DangerDatabaseResult> daList = new ArrayList<>();
......
...@@ -75,6 +75,8 @@ public class DangerInspectionRecordServiceImpl extends ServiceImpl<DangerInspect ...@@ -75,6 +75,8 @@ public class DangerInspectionRecordServiceImpl extends ServiceImpl<DangerInspect
75 dangerInspectionRecord.setDangerName(dangerLevelManage.getDangerName() );//风险等级名称 75 dangerInspectionRecord.setDangerName(dangerLevelManage.getDangerName() );//风险等级名称
76 dangerInspectionRecord.setDangerType( dangerLevelManage.getDangerType() );//风险类型 76 dangerInspectionRecord.setDangerType( dangerLevelManage.getDangerType() );//风险类型
77 dangerInspectionRecord.setDangerId( dangerId ); 77 dangerInspectionRecord.setDangerId( dangerId );
78 dangerInspectionRecord.setDangerPlace(dangerLevelManage.getDangerPlace());
79 dangerInspectionRecord.setDangerLevel(dangerLevelManage.getDangerLevel());
78 dangerInspectionRecord.setEquipInfoId( dangerLevelManage.getEquipInfoId()); 80 dangerInspectionRecord.setEquipInfoId( dangerLevelManage.getEquipInfoId());
79 dangerInspectionRecord.setStatus( status); 81 dangerInspectionRecord.setStatus( status);
80 dangerInspectionRecord.setReportUser( userId ); 82 dangerInspectionRecord.setReportUser( userId );
......
1 package com.skua.modules.statistics.job;
2
3 import com.skua.core.api.vo.Result;
4 import com.skua.core.context.BaseContextHandler;
5 import com.skua.core.util.DateUtils;
6 import com.skua.modules.edu.entity.Paper;
7 import com.skua.modules.edu.service.IPaperService;
8 import com.skua.modules.statistics.service.IEquipmentInfoDurationService;
9 import com.skua.modules.system.service.ISysUserService;
10 import com.skua.modules.system.service.SmsService;
11 import lombok.extern.slf4j.Slf4j;
12 import org.apache.commons.lang3.StringUtils;
13 import org.quartz.Job;
14 import org.quartz.JobExecutionContext;
15 import org.quartz.JobExecutionException;
16 import org.springframework.beans.factory.annotation.Autowired;
17 import org.springframework.stereotype.Component;
18
19 import java.time.LocalDate;
20 import java.time.format.DateTimeFormatter;
21 import java.util.Arrays;
22 import java.util.HashSet;
23 import java.util.List;
24 import java.util.Set;
25 import java.util.stream.Collectors;
26
27 /**
28 * 设备运行时长定时任务
29 */
30 @Slf4j
31 @Component
32 public class EquipmentInfoDurationJob implements Job {
33
34 @Autowired
35 private IEquipmentInfoDurationService equipmentInfoDurationService;
36 @Override
37 public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
38 log.info(String.format(" Jeecg-Boot 设备运行时长定时任务 EquipmentInfoDurationJob ! 时间:" + DateUtils.getTimestamp()));
39
40 // 获取当前日期
41 LocalDate today = LocalDate.now();
42 // 创建一个DateTimeFormatter对象,指定格式为yyyy-MM-dd
43 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
44 // 使用formatter格式化LocalDate对象
45 String todayDate = today.format(formatter);//今天
46
47 try {
48 String[] departIds = BaseContextHandler.getDeparts().split(",");
49 for(String departId : departIds){
50 equipmentInfoDurationService.fillOutEquipmentInfoDuration(departId, todayDate, todayDate);
51 }
52
53 } catch (Exception e) {
54 log.error("操作失败",e.getMessage());
55 }
56 }
57
58
59 }
...@@ -69,6 +69,8 @@ public class OperationReportServiceImpl implements IOperationReportService { ...@@ -69,6 +69,8 @@ public class OperationReportServiceImpl implements IOperationReportService {
69 String startMonth = DateUtils.formatDate(productDataVO.getStartTime(),"yyyy-MM");//开始月份 69 String startMonth = DateUtils.formatDate(productDataVO.getStartTime(),"yyyy-MM");//开始月份
70 String endMonth = DateUtils.formatDate(productDataVO.getEndTime(),"yyyy-MM");//结束月份 70 String endMonth = DateUtils.formatDate(productDataVO.getEndTime(),"yyyy-MM");//结束月份
71 71
72
73
72 //水务公司总数 74 //水务公司总数
73 String sql = "select count(1) from sys_depart where depart_type = 1 and id in ("+JSUtils.quoteEach(departId,",")+")"; 75 String sql = "select count(1) from sys_depart where depart_type = 1 and id in ("+JSUtils.quoteEach(departId,",")+")";
74 String deptartCount = getJdbcTemplate().queryForObject(sql,String.class); 76 String deptartCount = getJdbcTemplate().queryForObject(sql,String.class);
...@@ -78,7 +80,7 @@ public class OperationReportServiceImpl implements IOperationReportService { ...@@ -78,7 +80,7 @@ public class OperationReportServiceImpl implements IOperationReportService {
78 // String departId = BaseContextHandler.getDeparts(); 80 // String departId = BaseContextHandler.getDeparts();
79 productDataVO.setSequentialProgress("基本满足时序进度"); 81 productDataVO.setSequentialProgress("基本满足时序进度");
80 // ysfsl:月收费水量 ; yyf:月药费 ; ysjsl:月实际水量 82 // ysfsl:月收费水量 ; yyf:月药费 ; ysjsl:月实际水量
81 String dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ysfsl,ysjsl,yyf", departId, productDataVO.getStartTime(),productDataVO.getEndTime()); 83 String dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ysfsl,ysjsl,yyf", departId, startMonth,endMonth);
82 sql = "select round(sum(aaa.ysfsl),2) 'ysfsl' , round(sum(aaa.yyf),2) 'yyf' ,round(sum(aaa.ysjsl),2) 'ysjsl' from "+ dataViewName4411 + " aaa"; 84 sql = "select round(sum(aaa.ysfsl),2) 'ysfsl' , round(sum(aaa.yyf),2) 'yyf' ,round(sum(aaa.ysjsl),2) 'ysjsl' from "+ dataViewName4411 + " aaa";
83 String ysfsl = null;//月收费水量 ; 85 String ysfsl = null;//月收费水量 ;
84 String ysjsl = null;//月实际水量; 86 String ysjsl = null;//月实际水量;
...@@ -105,7 +107,7 @@ public class OperationReportServiceImpl implements IOperationReportService { ...@@ -105,7 +107,7 @@ public class OperationReportServiceImpl implements IOperationReportService {
105 productDataVO.setSequentialProgress("超额完成时序进度"); 107 productDataVO.setSequentialProgress("超额完成时序进度");
106 } 108 }
107 /****************去年同期数据处理************************/ 109 /****************去年同期数据处理************************/
108 dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ysfsl,ysjsl,yyf", departId, DateUtils.getTbDate(productDataVO.getStartTime()), DateUtils.getTbDate(productDataVO.getEndTime())); 110 dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ysfsl,ysjsl,yyf", departId, DateUtils.getTbMonth(startMonth), DateUtils.getTbMonth(endMonth));
109 sql = "select sum(aaa.ysfsl) 'ysfsl' , sum(aaa.yyf) 'yyf' ,sum(aaa.ysjsl) 'ysjsl' from "+ dataViewName4411 + " aaa"; 111 sql = "select sum(aaa.ysfsl) 'ysfsl' , sum(aaa.yyf) 'yyf' ,sum(aaa.ysjsl) 'ysjsl' from "+ dataViewName4411 + " aaa";
110 String ysfslTB = null;//月收费水量 ; 112 String ysfslTB = null;//月收费水量 ;
111 String ysjslTB = null;//月实际水量; 113 String ysjslTB = null;//月实际水量;
......
...@@ -130,6 +130,9 @@ public class ProductDataVO { ...@@ -130,6 +130,9 @@ public class ProductDataVO {
130 130
131 public ProductDataVO(Integer year, Integer season, String startTime, String endTime) { 131 public ProductDataVO(Integer year, Integer season, String startTime, String endTime) {
132 this.year = year; 132 this.year = year;
133 if(year != null){
134 this.lastYear = year -1;
135 }
133 this.season = season; 136 this.season = season;
134 this.startTime = startTime; 137 this.startTime = startTime;
135 this.endTime = endTime; 138 this.endTime = endTime;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!