c5f469fe 康伟

kangwei:修改bug,优化代码

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