232e2ba4 康伟

Merge remote-tracking branch 'origin/master'

2 个父辈 01fff184 b16a2cdb
......@@ -33,7 +33,7 @@ import java.util.stream.Collectors;
*/
@Slf4j
@Api(tags="应急风险事件")
@RestController("webEmergencyRiskEventController")
@RestController
@RequestMapping("/web/emergency/emergencyRiskEvent")
public class EmergencyRiskEventController {
@Autowired
......
package com.skua.modules.emergency.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.modules.emergency.entity.EmergencyRiskEvent;
import com.skua.modules.emergency.service.IEmergencyRiskEventService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
/**
* 安全环保地图接口
*/
@Slf4j
@Api(tags="安全环保地图")
@RestController
@RequestMapping("/safetyEnviron/map")
public class EventMapController {
@Autowired
private IEmergencyRiskEventService emergencyRiskEventService;
/**
* 安全隐患事件数量
*/
@AutoLog(value = "安全隐患事件数量")
@ApiOperation(value="安全隐患事件数量", notes="安全隐患事件数量")
@GetMapping(value = "/getCount")
public Result<Map<String,Object>> getHandleCount(EmergencyRiskEvent emergencyRiskEvent){
Result<Map<String,Object>> result = new Result<>();
Map<String,Object> map = emergencyRiskEventService.getCount(emergencyRiskEvent);
result.setSuccess(true);
result.setResult(map);
return result;
}
}
......@@ -25,14 +25,9 @@ public interface IEmergencyRiskEventService extends IService<EmergencyRiskEvent>
void handle(EmergencyRiskEventHandleDto dto);
/**
* <pre>
* 运营总览,应急事件已/未处理数量
* </pre>
* @param startTime
* @param endTime
* @param handleType【1未处理/3已处理】
* @author Li Yuanyuan,2023/7/3 14:09
* @Description: TODO(这里描述这个方法的需求变更情况)
* 安全隐患事件数量统计
* @param emergencyRiskEvent
* @return
*/
Map<String,Object> getNoHandleWorkOrderInfo(String startTime, String endTime, String handleType);
Map<String, Object> getCount(EmergencyRiskEvent emergencyRiskEvent);
}
......
......@@ -29,6 +29,7 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -92,19 +93,12 @@ public class EmergencyRiskEventServiceImpl extends ServiceImpl<EmergencyRiskEven
}
@Override
public Map<String, Object> getNoHandleWorkOrderInfo(String startTime, String endTime, String handleType) {
QueryWrapper queryWrapper = new QueryWrapper();
if(StringUtils.isEmpty(startTime)){
//默认开始时间当年第一天
//结束时间未今天
endTime = DateUtils.getTodayOrMonthDate("day")+" 23:59:59";
startTime = endTime.substring(0,4)+"-01-01 00:00:00";
}
queryWrapper.select("count(*) AS num ");
queryWrapper.eq("handle_result",handleType);
queryWrapper.ge("report_date",startTime);
queryWrapper.le("report_date",endTime);
return getMap(queryWrapper);
public Map<String, Object> getCount(EmergencyRiskEvent emergencyRiskEvent) {
Map<String, Object> map = new HashMap<>();
map.put("total","9");
map.put("yes","5");
map.put("no","4");
return map;
}
@Override
......
package com.skua.modules.dataAnalysis.mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface FactoryCenterMapper {
List<Map<String, Object>> getWssltj(@Param("startDate") String startDate, @Param("endDate") String endDate,
@Param("startDateTb") String startDateTb, @Param("endDateTb") String endDateTb,
@Param("departId") String departId);
List<Map<String, Object>> getHdltj(@Param("startDate") String startDate, @Param("endDate") String endDate,
@Param("startDateTb") String startDateTb, @Param("endDateTb") String endDateTb,
@Param("departId") String departId);
List<Map<String, Object>> getCnltj(@Param("startDate") String startDate, @Param("endDate") String endDate,
@Param("startDateTb") String startDateTb, @Param("endDateTb") String endDateTb,
@Param("departId") String departId);
Map<String, Object> getData(@Param("month") String month, @Param("departId") String departId);
}
......
......@@ -2,4 +2,160 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.skua.modules.dataAnalysis.mapper.FactoryCenterMapper">
<select id="getWssltj" resultType="java.util.HashMap">
SELECT
LEFT ( v.time, 7 ) AS time,
round( sum( v.CSL ) / 10000, 2 ) AS clsl,
ifnull(v2.clsl,0) as clsl_tb
FROM
view_2119 v
left join (
SELECT
RIGHT( LEFT ( time, 7 ), 2 ) AS time,
round( sum( CSL ) / 10000, 2 ) AS clsl
FROM
view_2119
WHERE
depart_id = #{departId}
AND time &gt;= #{startDateTb}
AND time &lt;= #{endDateTb}
GROUP BY
LEFT ( time, 7 )
) v2 on RIGHT( LEFT ( v.time, 7 ), 2 ) = v2.time
WHERE v.depart_id = #{departId}
AND v.time &gt;= #{startDate}
AND v.time &lt;= #{endDate}
GROUP BY
LEFT ( v.time, 7 )
</select>
<select id="getHdltj" resultType="java.util.HashMap">
SELECT
ROUND(SUM(v3.DLHJ)/10000,2) as hdl,
ROUND(ifnull(v2.clsl,0),2) as clsl,
ROUND(SUM(v3.DLHJ)/ifnull(v2.clsl,0),2) as dsdh,
ROUND(pre.hdl/10000,2) as hdl_tb,
ROUND(pre.clsl,2) as clsl_tb,
ROUND(pre.dsdh,2) as dsdh_tb,
LEFT(v3.time,7) as time
FROM
view_3a24 v3
left join (
SELECT
SUM(CSL) as clsl,
LEFT(time,7) as time
FROM
view_2119
WHERE
depart_id = #{departId}
AND time &gt;= #{startDate}
AND time &lt;= #{endDate}
GROUP BY LEFT ( time, 7 )
) v2 on LEFT(v3.time,7) = v2.time
left join (
SELECT
SUM(v3.DLHJ) as hdl,
ifnull(v2.clsl,0) as clsl,
round(SUM(v3.DLHJ)/ifnull(v2.clsl,0),2) as dsdh,
LEFT(v3.time,7) as time
FROM
view_3a24 v3
left join (
SELECT
SUM(CSL) as clsl,
LEFT(time,7) as time
FROM
view_2119
WHERE
depart_id = #{departId}
AND time &gt;= #{startDateTb}
AND time &lt;= #{endDateTb}
GROUP BY LEFT ( time, 7 )
) v2 on LEFT(v3.time,7) = v2.time
WHERE
v3.depart_id = #{departId}
AND v3.time &gt;= #{startDateTb}
AND v3.time &lt;= #{endDateTb}
GROUP BY LEFT ( v3.time, 7 )
) pre on right(pre.time,2) = right(LEFT(v3.time,7),2)
WHERE
v3.depart_id = #{departId}
AND v3.time &gt;= #{startDate}
AND v3.time &lt;= #{endDate}
GROUP BY LEFT ( v3.time, 7 )
</select>
<select id="getCnltj" resultType="java.util.HashMap">
SELECT
SUM(v3.WNL) as cnl,
ifnull(v2.clsl,0) as clsl,
round(SUM(v3.WNL)/(ifnull(v2.clsl,0)/10000),2) as wdscnl,
pre.cnl as cnl_tb,
pre.clsl as clsl_tb,
pre.wdscnl as wdscnl_tb,
LEFT(v3.time,7) as time
FROM
view_3a24 v3
left join (
SELECT
SUM(CSL) as clsl,
LEFT(time,7) as time
FROM
view_2119
WHERE
depart_id = #{departId}
AND time &gt;= #{startDate}
AND time &lt;= #{endDate}
GROUP BY LEFT ( time, 7 )
) v2 on LEFT(v3.time,7) = v2.time
left join (
SELECT
SUM(v3.WNL) as cnl,
ifnull(v2.clsl,0) as clsl,
round(SUM(v3.WNL)/(ifnull(v2.clsl,0)/10000),2) as wdscnl,
LEFT(v3.time,7) as time
FROM
view_3a24 v3
left join (
SELECT
SUM(CSL) as clsl,
LEFT(time,7) as time
FROM
view_2119
WHERE
depart_id = #{departId}
AND time &gt;= #{startDateTb}
AND time &lt;= #{endDateTb}
GROUP BY LEFT ( time, 7 )
) v2 on LEFT(v3.time,7) = v2.time
WHERE
v3.depart_id = #{departId}
AND v3.time &gt;= #{startDateTb}
AND v3.time &lt;= #{endDateTb}
GROUP BY LEFT ( v3.time, 7 )
) pre on right(pre.time,2) = right(LEFT(v3.time,7),2)
WHERE
v3.depart_id = #{departId}
AND v3.time &gt;= #{startDate}
AND v3.time &lt;= #{endDate}
GROUP BY LEFT ( v3.time, 7 )
</select>
<select id="getData" resultType="java.util.HashMap">
SELECT
ROUND(SUM( v3.DLHJ )/10000,2) AS yzdl,
ROUND(AVG( v3.DLHJ )/10000,2) AS rjdl,
ROUND(SUM( v3.WNL ),2) AS yzcnl,
ROUND(SUM( v2.CSL )/10000,2) AS yclsl,
ROUND(SUM( v3.DLHJ )/SUM( v2.CSL ),2) as dsdh,
ROUND(AVG( v2.CSL )/10000,2) AS rjclsl,
ROUND(SUM( v3.WNL )/(SUM( v2.CSL )/10000),2) as wdscnl,
LEFT ( v3.time, 7 ) AS time
FROM
view_3a24 v3
LEFT JOIN (select CSL,time from view_2119 where LEFT ( time, 7 ) = #{month} and depart_id = #{departId}) v2 ON v2.time = v3.time
where LEFT ( v3.time, 7 ) = #{month}
and v3.depart_id = #{departId}
</select>
</mapper>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!