Commit 97e33c96 authored by zhangsen's avatar zhangsen

问题处理

parent 636aa187
...@@ -23,9 +23,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper; ...@@ -23,9 +23,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.*;
import java.util.List; import java.util.stream.Collectors;
import java.util.Map;
@RestController @RestController
@Api(tags = "人员人员赋码基本信息 评估大屏Api") @Api(tags = "人员人员赋码基本信息 评估大屏Api")
...@@ -67,12 +66,20 @@ public class PersonQrCodeController extends BaseController { ...@@ -67,12 +66,20 @@ public class PersonQrCodeController extends BaseController {
} else if (StringUtils.isNotEmpty(dataType) && dataType.equals("job")) { } else if (StringUtils.isNotEmpty(dataType) && dataType.equals("job")) {
resultList = sjglZsjZsbtzMapper.getJobYardStatistics(parentCode); resultList = sjglZsjZsbtzMapper.getJobYardStatistics(parentCode);
} }
Map<Object, Object> collect = resultList.stream().collect(Collectors.toMap(t -> t.get("qrCodeColor"), t -> t.get("value")));
resultList.forEach(item -> { resultList.forEach(item -> {
String name = QrcodeColorEnum.getName(String.valueOf(item.get("qrCodeColor"))); String name = QrcodeColorEnum.getName(String.valueOf(item.get("qrCodeColor")));
item.put("name", name); item.put("name", name);
item.put("value", Integer.parseInt(item.get("value").toString())); item.put("value", Integer.parseInt(item.get("value").toString()));
}); });
return ResponseHelper.buildResponse(resultList); List<Map<String, Object>> maps = new ArrayList<>();
Arrays.stream(QrcodeColorEnum.values()).forEach(item -> {
HashMap<String, Object> map = new HashMap<>();
map.put("name", item.getName());
map.put("value", collect.getOrDefault("qrCodeColor", 0));
maps.add(map);
});
return ResponseHelper.buildResponse(maps);
} }
/** /**
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.mapper2.AlarmEventMapper">
<select id="getAlarmEventList" resultType="com.yeejoin.amos.boot.module.jxiop.biz.dto.AlarmEventDto">
select
station_name as stationName,
event_desc as eventDesc,
alarm_group_name as alarmGroupName,
event_time as eventTime,
(case event_movement
WHEN 'true' then '告警'
WHEN 'false' then '恢复'
ELSE event_movement end ) as eventMovement
from
fault_alarm_event
<where>
<if test="gatewayId != null and gatewayId != ''">
gateway_id = #{gatewayId}
</if>
<if test="stationId != null and stationId != ''">
station_id = #{stationId}
</if>
</where>
order by sort desc limit #{current},#{size}
</select>
<select id="getLastDataBySort" resultType="java.lang.String">
select
sort
from
fault_alarm_event
<where>
<if test="gatewayId != null and gatewayId != ''">
gateway_id = #{gatewayId}
</if>
</where>
order by sort desc limit 1
</select>
<select id="getOldAlarmsBySort" resultType="java.lang.String">
select
event_desc
from
fault_alarm_event
where
gateway_id = #{gatewayId} and sort = #{sort}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.mapper2.SjglZsjZsbtzMapper">
<select id="getStationCapactityByStationWerks" resultType="Double">
select SUM(CAPACITYL) from sjgl_zsj_zsbtz where WERKS = #{WERKS}
</select>
<select id="getStationInfoMapByStationWerks" resultType="map">
SELECT LEFT
( SBMC, 4 ) AS NAME,
GROUP_CONCAT(REPLACE (REPLACE( substring( SBMC, 5 ),'风机系统', '' ) ,"#","" )) as equipNum
FROM
`sjgl_zsj_zsbtz`
WHERE
MACHGENRE = #{DATAID} and WERKS = #{WERKS}
GROUP BY
FSB
</select>
<select id="getStationInfoMapByStationGFWerks" resultType="map">
SELECT LEFT
( b.SBMC, 4 ) AS NAME,
GROUP_CONCAT( REPLACE ( SUBSTRING_INDEX( b.SBMC, "#",- 1 ), '光伏阵区系统', '' ) ) AS equipNum
FROM
(
SELECT
*
FROM
sjgl_zsj_zsbtz
WHERE
FSB IN ( SELECT DBID FROM `sjgl_zsj_zsbtz` WHERE MACHGENRE = ( SELECT DATAID FROM `tpri_dmp_databook` WHERE DATANAME = #{DATAID} ) AND WERKS = #{WERKS} )
) B
GROUP BY
B.FSB
</select>
<select id="getEquipQrcodeInfo" resultType="com.yeejoin.amos.boot.module.jxiop.api.entity.StationQrCodeStatistics">
SELECT
WERKS AS `code`,
count( QRCODE_COLOR = 'red' OR NULL ) AS redNum,
count( QRCODE_COLOR = 'yellow' OR NULL ) AS yellowNum,
count( QRCODE_COLOR = 'green' OR NULL ) AS greenNum,
'equip' AS type,
CURRENT_DATE AS recordDate
FROM
sjgl_zsj_zsbtz
GROUP BY
WERKS
</select>
<select id="getTaskQrcodeInfo" resultType="com.yeejoin.amos.boot.module.jxiop.api.entity.StationQrCodeStatistics">
SELECT
WERKS AS `code`,
count( QRCODE_COLOR = 'red' OR NULL ) AS redNum,
count( QRCODE_COLOR = 'yellow' OR NULL ) AS yellowNum,
count( QRCODE_COLOR = 'green' OR NULL ) AS greenNum,
'job' AS type,
CURRENT_DATE AS recordDate
FROM
fdgl_job_main
GROUP BY
WERKS
</select>
<select id="getEquipYardStatistics" resultType="java.util.Map">
SELECT
a.QRCODE_COLOR as qrCodeColor,
count( 1 ) as value
FROM
sjgl_zsj_zsbtz a
LEFT JOIN privilege_company b on a.WERKS = b.COMPANY_CODE
<where>
<if test="parentCode != null and parentCode != ''">
b.COMPANY_CODE like concat(#{parentCode},'%')
</if>
</where>
GROUP BY
QRCODE_COLOR
</select>
<select id="getJobYardStatistics" resultType="java.util.Map">
SELECT
a.QRCODE_COLOR as qrCodeColor,
count( 1 ) as value
FROM
fdgl_job_main a
LEFT JOIN privilege_company b on a.WERKS = b.COMPANY_CODE
<where>
<if test="parentCode != null and parentCode != ''">
b.COMPANY_CODE like concat(#{parentCode},'%')
</if>
</where>
GROUP BY
QRCODE_COLOR
</select>
<select id="getEquipYardByPage" resultType="java.util.Map">
SELECT
ifnull(a.SBMC, '') as objectName ,
ifnull(a.QRCODE_COLOR, '') AS qrCodeColor,
ifnull(b.COMPANY_NAME, '') AS stationName
FROM
sjgl_zsj_zsbtz a
LEFT JOIN privilege_company b ON a.WERKS = b.COMPANY_CODE
<where>
<if test="parentCode != null and parentCode != ''">
AND b.COMPANY_CODE like concat(#{parentCode},'%')
</if>
</where>
ORDER BY a.CREATE_TIME DESC
limit #{current},#{size}
</select>
<select id="getEquipYardByPageCount" resultType="java.lang.Integer">
SELECT
count(1)
FROM
sjgl_zsj_zsbtz a
LEFT JOIN privilege_company b ON a.WERKS = b.COMPANY_CODE
<where>
<if test="parentCode != null and parentCode != ''">
AND b.COMPANY_CODE like concat(#{parentCode},'%')
</if>
</where>
</select>
<select id="getJobYardByPage" resultType="java.util.Map">
SELECT
ifnull(a.JOB_DESCRIPTION, '') as objectName ,
ifnull(a.qrcode_color, '') AS qrCodeColor,
ifnull(b.COMPANY_NAME, '') AS stationName
FROM
fdgl_job_main a
LEFT JOIN privilege_company b ON a.WERKS = b.COMPANY_CODE
<where>
<if test="parentCode != null and parentCode != ''">
AND b.COMPANY_CODE like concat(#{parentCode},'%')
</if>
</where>
ORDER BY a.CREATE_TIME DESC
limit #{current},#{size}
</select>
<select id="getJobYardByPageCount" resultType="java.lang.Integer">
SELECT
count(1)
FROM
fdgl_job_main a
LEFT JOIN privilege_company b ON a.WERKS = b.COMPANY_CODE
<where>
<if test="parentCode != null and parentCode != ''">
AND b.COMPANY_CODE like concat(#{parentCode},'%')
</if>
</where>
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.mapper2.SwitchPictureMapper">
<select id="getSwitchUrl" resultType="com.yeejoin.amos.boot.module.jxiop.biz.entity.SwitchPicture">
select
*
from
switch_picture_url
where
station_id = #{stationId} and switch_num = #{switchNum}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.mapper2.SystemEnumMapper">
<select id="getStatusMonitoring" resultType="com.yeejoin.amos.boot.module.jxiop.biz.dto.SystemEnumDto">
SELECT * FROM `system_enum` WHERE type = #{type} and system_name = #{systemName}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.mapper2.TemporaryDataMapper">
<select id="timingTemporarysSorageData" resultType="map">
SELECT avg(value) as value ,
created_time as createdTime ,
equipmentIndexName
FROM
`temporary_data`
<where>
<if test="gatewayId != null and gatewayId != ''">
gatewayId = #{gatewayId}
</if>
<if test="gatewayId == null or gatewayId == ''">
equipmentNumber is not null and equipmentIndexName is not null
</if>
</where>
GROUP BY batch_no ,equipmentIndexName;
</select>
<select id="getStatisticsInfo" resultType="map">
SELECT
avg( VALUE ) AS mean,
( SELECT created_time FROM temporary_data WHERE
equipmentIndexName =#{equipmentIndexName}
<if test="gatewayId != null and gatewayId != ''">
and gatewayId = #{gatewayId}
</if>
ORDER BY `value` LIMIT 1 ) AS minTime,
max( `value` ) AS max,
( SELECT created_time FROM temporary_data WHERE
equipmentIndexName =#{equipmentIndexName}
<if test="gatewayId != null and gatewayId != ''">
and gatewayId = #{gatewayId}
</if> ORDER BY `value` DESC LIMIT 1 ) AS maxTime,
min( `value` ) AS min
FROM
`temporary_data`
<where>
<if test="gatewayId != null and gatewayId != ''">
gatewayId = #{gatewayId} and equipmentIndexName =#{equipmentIndexName}
</if>
<if test="gatewayId == null or gatewayId == ''">
equipmentNumber is not null and equipmentIndexName is not null and equipmentIndexName =#{equipmentIndexName}
</if>
</where>
</select>
<select id="getAllData" resultType="com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESWindSpeed">
SELECT
*
FROM
`temporary_data`
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.mapper2.TestMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.mapper2.TpriDmpDatabookMapper">
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment