Commit 0efbaf08 authored by xixinzhao's avatar xixinzhao

接口返回装备code

parent c1dd64b4
...@@ -24,6 +24,7 @@ import org.springframework.util.CollectionUtils; ...@@ -24,6 +24,7 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.DateTimeUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
...@@ -35,6 +36,8 @@ import java.text.SimpleDateFormat; ...@@ -35,6 +36,8 @@ import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static org.typroject.tyboot.core.foundation.utils.DateTimeUtil.ISO8601_DATE_HOUR_MIN_SEC;
@RestController @RestController
@Api(tags = "监盘总览组态需求 -- API") @Api(tags = "监盘总览组态需求 -- API")
@RequestMapping(value = "/supervisionConfigure", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/supervisionConfigure", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
...@@ -456,7 +459,7 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -456,7 +459,7 @@ public class SupervisionConfigureController extends AbstractBaseController {
public ResponseModel selectPipePressureDetail(@RequestParam(value = "equipmentSpecificId") String equipmentSpecificId, public ResponseModel selectPipePressureDetail(@RequestParam(value = "equipmentSpecificId") String equipmentSpecificId,
@RequestParam(value = "startTime", required = false) String startTime, @RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime @RequestParam(value = "endTime", required = false) String endTime
) { ) throws ParseException {
if (!StringUtil.isNotEmpty(equipmentSpecificId)) { if (!StringUtil.isNotEmpty(equipmentSpecificId)) {
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} }
...@@ -493,14 +496,16 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -493,14 +496,16 @@ public class SupervisionConfigureController extends AbstractBaseController {
String json1 = JSON.toJSONString(mounthEntity.getResult()); String json1 = JSON.toJSONString(mounthEntity.getResult());
List<Map<String, String>> list = (List<Map<String, String>>) JSONArray.parse(json1); List<Map<String, String>> list = (List<Map<String, String>>) JSONArray.parse(json1);
Collections.reverse(list); Collections.reverse(list);
if (!CollectionUtils.isEmpty(list) && list.size() > 30) { // if (!CollectionUtils.isEmpty(list) && list.size() > 30) {
for (int i = 0; i <= 29; i++) { // for (int i = 0; i <= 29; i++) {
result.add(list.get(i)); // result.add(list.get(i));
} // }
} else { // } else {
// result.addAll(list);
// }
if (!CollectionUtils.isEmpty(list)) {
result.addAll(list); result.addAll(list);
} }
} }
List<Map<String, String>> res = new ArrayList<>(); List<Map<String, String>> res = new ArrayList<>();
for (Map<String, String> m : result) { for (Map<String, String> m : result) {
...@@ -531,19 +536,32 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -531,19 +536,32 @@ public class SupervisionConfigureController extends AbstractBaseController {
return CommonResponseUtil.success(resMap); return CommonResponseUtil.success(resMap);
} }
private String change(String time) { private String change(String time) throws ParseException {
//进行转化时区 //进行转化时区
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.US); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.US);
Date myDate = null; Date date1 = null;
// if(time.contains("Z")) {
// try {
// myDate = dateFormat.parse(time.replace("Z", "+0000"));
// } catch (ParseException e) {
// e.printStackTrace();
// }
// }
try { try {
myDate = dateFormat.parse(time.replace("Z", "+0000")); String strDate = time.substring(0, 19);
SimpleDateFormat sdf = new SimpleDateFormat(ISO8601_DATE_HOUR_MIN_SEC);
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
date1 = sdf.parse(strDate);
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
return DateTimeUtil.format(date1, DateTimeUtil.ISO_DATE_HOUR24_MIN_SEC);
// return times;
//转换为年月日时分秒 //转换为年月日时分秒
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String format = df.format(myDate); // return df.format(time);
return format; // return format;
} }
} }
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
wel.warehouse_structure_id ,wel.equipment_code wel.warehouse_structure_id ,wel.equipment_code
</select> </select>
<select id="selectFireMonitor" resultType="java.util.Map"> <select id="selectFireMonitor" resultType="java.util.Map">
SELECT temp.name, temp.alarm ,temp.id, SELECT temp.name, temp.alarm ,temp.id, temp.code,
IFNULL((SELECT wesi.value FROM wl_equipment_specific_index wesi WHERE wesi.equipment_specific_id = temp.id AND wesi.equipment_index_key = 'CAFS_CAFSFireGun_FireGunPressure' IFNULL((SELECT wesi.value FROM wl_equipment_specific_index wesi WHERE wesi.equipment_specific_id = temp.id AND wesi.equipment_index_key = 'CAFS_CAFSFireGun_FireGunPressure'
ORDER BY wesi.update_date desc LIMIT 1),0) AS value, ORDER BY wesi.update_date desc LIMIT 1),0) AS value,
IFNULL((SELECT CASE WHEN wesi.value_label IS NULL OR trim( wesi.value_label ) = '' THEN (CASE IFNULL((SELECT CASE WHEN wesi.value_label IS NULL OR trim( wesi.value_label ) = '' THEN (CASE
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
ORDER BY wesi.update_date desc LIMIT 1),'--') AS status, ORDER BY wesi.update_date desc LIMIT 1),'--') AS status,
'0' AS flow '0' AS flow
FROM( FROM(
SELECT wes.id,wes.name, SELECT wes.id,wes.name,wes.code,
CASE CASE
WHEN ( SELECT is_alarm FROM wl_equipment_specific_index wesi WHERE wesi.equipment_specific_id = wes.id AND wesi.equipment_index_key = wes.realtime_iot_index_key ) = 1 WHEN ( SELECT is_alarm FROM wl_equipment_specific_index wesi WHERE wesi.equipment_specific_id = wes.id AND wesi.equipment_index_key = wes.realtime_iot_index_key ) = 1
AND wes.realtime_iot_index_value = 'true' THEN AND wes.realtime_iot_index_value = 'true' THEN
...@@ -145,6 +145,7 @@ ...@@ -145,6 +145,7 @@
SELECT SELECT
temp.id, temp.id,
temp.name, temp.name,
temp.code,
temp.nowLevel, temp.nowLevel,
temp.volume, temp.volume,
temp.unit, temp.unit,
...@@ -179,6 +180,7 @@ ...@@ -179,6 +180,7 @@
SELECT SELECT
wes.id, wes.id,
wes.name, wes.name,
wes.code,
IFNULL( ( SELECT value FROM wl_equipment_specific_index wesi WHERE wesi.equipment_specific_id = wes.id AND equipment_index_key = 'CAFS_FoamTank_FoamTankLevel' ), '--' ) AS nowLevel, IFNULL( ( SELECT value FROM wl_equipment_specific_index wesi WHERE wesi.equipment_specific_id = wes.id AND equipment_index_key = 'CAFS_FoamTank_FoamTankLevel' ), '--' ) AS nowLevel,
IFNULL( ( SELECT unit FROM wl_equipment_specific_index wesi WHERE wesi.equipment_specific_id = wes.id AND equipment_index_key = 'CAFS_FoamTank_FoamTankLevel' ), '--' ) AS unit, IFNULL( ( SELECT unit FROM wl_equipment_specific_index wesi WHERE wesi.equipment_specific_id = wes.id AND equipment_index_key = 'CAFS_FoamTank_FoamTankLevel' ), '--' ) AS unit,
IFNULL(( SELECT field_value FROM wl_form_instance_equip WHERE instance_id = wes.id AND field_name = 'maxLevel' ) , 0 )AS maxLevel, IFNULL(( SELECT field_value FROM wl_form_instance_equip WHERE instance_id = wes.id AND field_name = 'maxLevel' ) , 0 )AS maxLevel,
...@@ -198,7 +200,7 @@ ...@@ -198,7 +200,7 @@
'1' as type, '1' as type,
(SELECT wei.emergency_level FROM wl_equipment_index wei LEFT JOIN wl_equipment_specific_index wesi on wei.id = wesi.equipment_index_id (SELECT wei.emergency_level FROM wl_equipment_index wei LEFT JOIN wl_equipment_specific_index wesi on wei.id = wesi.equipment_index_id
WHERE wesi.equipment_specific_id = wes.id AND wesi.equipment_index_key = wes.realtime_iot_index_key) as level, WHERE wesi.equipment_specific_id = wes.id AND wesi.equipment_index_key = wes.realtime_iot_index_key) as level,
wes.equipment_code as code , wes.code as code ,
wes.name, wes.name,
IFNULL(wes.realtime_iot_index_name, IFNULL(wes.realtime_iot_index_name,
'暂无信号' '暂无信号'
...@@ -222,7 +224,7 @@ ...@@ -222,7 +224,7 @@
'2' as type, '2' as type,
(SELECT wei.emergency_level FROM wl_equipment_index wei LEFT JOIN wl_equipment_specific_index wesi on wei.id = wesi.equipment_index_id (SELECT wei.emergency_level FROM wl_equipment_index wei LEFT JOIN wl_equipment_specific_index wesi on wei.id = wesi.equipment_index_id
WHERE wesi.equipment_specific_id = wes.id AND wesi.equipment_index_key = wes.realtime_iot_index_key) as level, WHERE wesi.equipment_specific_id = wes.id AND wesi.equipment_index_key = wes.realtime_iot_index_key) as level,
wes.equipment_code as code , wes.code as code ,
wes.name, wes.name,
IFNULL(wes.realtime_iot_index_name, IFNULL(wes.realtime_iot_index_name,
'暂无信号' '暂无信号'
...@@ -247,7 +249,7 @@ ...@@ -247,7 +249,7 @@
'3' as type, '3' as type,
(SELECT wei.emergency_level FROM wl_equipment_index wei LEFT JOIN wl_equipment_specific_index wesi on wei.id = wesi.equipment_index_id (SELECT wei.emergency_level FROM wl_equipment_index wei LEFT JOIN wl_equipment_specific_index wesi on wei.id = wesi.equipment_index_id
WHERE wesi.equipment_specific_id = wes.id AND wesi.equipment_index_key = wes.realtime_iot_index_key) as level, WHERE wesi.equipment_specific_id = wes.id AND wesi.equipment_index_key = wes.realtime_iot_index_key) as level,
wes.equipment_code as code , wes.code as code ,
wes.name, wes.name,
IFNULL(wes.realtime_iot_index_name, IFNULL(wes.realtime_iot_index_name,
'暂无信号' '暂无信号'
...@@ -272,7 +274,7 @@ ...@@ -272,7 +274,7 @@
'4' as type, '4' as type,
(SELECT wei.emergency_level FROM wl_equipment_index wei LEFT JOIN wl_equipment_specific_index wesi on wei.id = wesi.equipment_index_id (SELECT wei.emergency_level FROM wl_equipment_index wei LEFT JOIN wl_equipment_specific_index wesi on wei.id = wesi.equipment_index_id
WHERE wesi.equipment_specific_id = wes.id AND wesi.equipment_index_key = wes.realtime_iot_index_key) as level, WHERE wesi.equipment_specific_id = wes.id AND wesi.equipment_index_key = wes.realtime_iot_index_key) as level,
wes.equipment_code as code , wes.code as code ,
wes.name, wes.name,
IFNULL(wes.realtime_iot_index_name, IFNULL(wes.realtime_iot_index_name,
'暂无信号' '暂无信号'
...@@ -1170,6 +1172,7 @@ ...@@ -1170,6 +1172,7 @@
'未消除' '未消除'
) cleanStatus, ) cleanStatus,
wlesal.equipment_index_id AS fireEquipmentIndexId, wlesal.equipment_index_id AS fireEquipmentIndexId,
wlesal.equipment_specific_code AS code,
wlesal.equipment_specific_index_key AS fireEquipmentSpecificIndexKey, wlesal.equipment_specific_index_key AS fireEquipmentSpecificIndexKey,
wlesal.equipment_specific_index_name AS fireEquipmentSpecificIndexName, wlesal.equipment_specific_index_name AS fireEquipmentSpecificIndexName,
CASE wlesal.equipment_specific_index_value CASE wlesal.equipment_specific_index_value
......
...@@ -2825,6 +2825,7 @@ ...@@ -2825,6 +2825,7 @@
concat_ws( '-', ws.full_name, ed.area ) area, concat_ws( '-', ws.full_name, ed.area ) area,
es.iot_code, es.iot_code,
es.id, es.id,
es.code,
IFNULL( sum( `status` ), 0 ) AS isAlarm IFNULL( sum( `status` ), 0 ) AS isAlarm
FROM FROM
wl_equipment_specific es wl_equipment_specific es
...@@ -4681,13 +4682,15 @@ ...@@ -4681,13 +4682,15 @@
IFNULL( rp.volume, 0 ) AS volume, IFNULL( rp.volume, 0 ) AS volume,
ec.image, ec.image,
r.resource_type, r.resource_type,
r.sequence_nbr r.sequence_nbr,
wes.code
FROM FROM
cb_water_resource r cb_water_resource r
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
LEFT JOIN wl_equipment_specific_index ei ON ei.equipment_specific_id = rp.level_device_id LEFT JOIN wl_equipment_specific_index ei ON ei.equipment_specific_id = rp.level_device_id
LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id
LEFT JOIN f_fire_fighting_system fs ON fs.id = r.belong_fighting_system_id LEFT JOIN f_fire_fighting_system fs ON fs.id = r.belong_fighting_system_id
LEFT JOIN wl_equipment_specific wes ON wes.id = rp.level_device_id
WHERE WHERE
r.resource_type = 'industryPool' r.resource_type = 'industryPool'
AND r.is_delete = 1 AND r.is_delete = 1
...@@ -4707,7 +4710,8 @@ ...@@ -4707,7 +4710,8 @@
a.volume, a.volume,
a.image, a.image,
a.resource_type, a.resource_type,
a.sequence_nbr a.sequence_nbr,
a.code
FROM FROM
( (
SELECT SELECT
...@@ -4733,12 +4737,14 @@ ...@@ -4733,12 +4737,14 @@
ec.image, ec.image,
r.resource_type, r.resource_type,
r.sequence_nbr, r.sequence_nbr,
rp.level_device_id rp.level_device_id,
wes.code
FROM FROM
cb_water_resource r cb_water_resource r
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id
LEFT JOIN f_fire_fighting_system fs ON fs.id = r.belong_fighting_system_id LEFT JOIN f_fire_fighting_system fs ON fs.id = r.belong_fighting_system_id
LEFT JOIN wl_equipment_specific wes ON wes.id = rp.level_device_id
WHERE WHERE
r.resource_type = 'pool' r.resource_type = 'pool'
AND r.is_delete = 1 AND r.is_delete = 1
......
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