Commit f10d050d authored by lisong's avatar lisong

更新

parent 260c1dd7
...@@ -18,14 +18,17 @@ import org.apache.commons.lang3.StringUtils; ...@@ -18,14 +18,17 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
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;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.text.DateFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -483,10 +486,14 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -483,10 +486,14 @@ public class SupervisionConfigureController extends AbstractBaseController {
} }
// 稳压泵信息 // 稳压泵信息
List<Map<String, Object>> pressurePumps = fireFightingSystemMapper.selectAllPressurePumpInfo(bizOrgCode); List<Map<String, Object>> pressurePumps = fireFightingSystemMapper.selectAllPressurePumpInfo(bizOrgCode);
ArrayList<Map<String, Object>> names = new ArrayList<>();
// x轴数据 // x轴数据
List<Map<String, Object>> data = fireFightingSystemMapper.selectAllDays(); List<Map<String, Object>> data = fireFightingSystemMapper.selectAllDays();
for (Map<String, Object> pressurePump : pressurePumps) { for (Map<String, Object> pressurePump : pressurePumps) {
HashMap<String, Object> bar = new HashMap<>();
bar.put("name", pressurePump.get("name"));
bar.put("id", pressurePump.get("id"));
names.add(bar);
String prefix = null; String prefix = null;
String suffix = null; String suffix = null;
String iotCode = pressurePump.get("iot_code").toString(); String iotCode = pressurePump.get("iot_code").toString();
...@@ -510,6 +517,7 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -510,6 +517,7 @@ public class SupervisionConfigureController extends AbstractBaseController {
List<Map<String, String>> list = (List<Map<String, String>>) JSONArray.parse(json1); List<Map<String, String>> list = (List<Map<String, String>>) JSONArray.parse(json1);
List<Map<String, String>> collect = list.stream().filter(t -> (t.containsKey("time") && t.get("time").substring(0, 10).equals(item.get("date")))).collect(Collectors.toList()); List<Map<String, String>> collect = list.stream().filter(t -> (t.containsKey("time") && t.get("time").substring(0, 10).equals(item.get("date")))).collect(Collectors.toList());
map.put("value", collect.size()); map.put("value", collect.size());
map.put("id", pressurePump.get("id"));
if (item.containsKey("yData")) { if (item.containsKey("yData")) {
List<Map<String, Object>> yData1 = (List<Map<String, Object>>) item.get("yData"); List<Map<String, Object>> yData1 = (List<Map<String, Object>>) item.get("yData");
yData1.add(map); yData1.add(map);
...@@ -521,7 +529,10 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -521,7 +529,10 @@ public class SupervisionConfigureController extends AbstractBaseController {
} }
} }
} }
return CommonResponseUtil.success(data); HashMap<String, Object> result = new HashMap<>();
result.put("names", names);
result.put("data", data);
return CommonResponseUtil.success(result);
} }
@PersonIdentify @PersonIdentify
...@@ -540,4 +551,82 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -540,4 +551,82 @@ public class SupervisionConfigureController extends AbstractBaseController {
List<Map<String, Object>> pressurePumps = fireFightingSystemMapper.selectPressureDetails(bizOrgCode); List<Map<String, Object>> pressurePumps = fireFightingSystemMapper.selectPressureDetails(bizOrgCode);
return CommonResponseUtil.success(pressurePumps); return CommonResponseUtil.success(pressurePumps);
} }
@PersonIdentify
@RequestMapping(value = "/selectPipePressureDetail", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "管网压力详情", produces = "application/json;charset=UTF-8", notes = "管网压力详情")
public ResponseModel selectPipePressureDetail(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode,
@RequestParam(value = "equipmentSpecificId") String equipmentSpecificId) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
if (bizOrgCode == null) {
return CommonResponseUtil.success(null);
}
}
Map<String, Object> map = fireFightingSystemMapper.selectEquipmentSpecificById(equipmentSpecificId);
if (ObjectUtils.isEmpty(map) || ObjectUtils.isEmpty(map.get("iot_code"))) {
return CommonResponseUtil.success(null);
}
String iotCode = map.get("iot_code").toString();
String prefix = null;
String suffix = null;
if (iotCode.length() > 8) {
prefix = iotCode.substring(0, 8);
suffix = iotCode.substring(8);
} else {
throw new BadRequest("装备物联编码错误,请确认!");
}
String now = LocalDateTimeUtils.getNow();
ResponseModel mounthEntity = null;
try {
mounthEntity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), now.substring(0, 10) + " 00:00:00", now.substring(0, 10) + " 23:59:59", prefix, suffix, "FHS_PipePressureDetector_PipePressure");
} catch (Exception e) {
e.printStackTrace();
}
List<Map<String, String>> result = new ArrayList<>();
if (200 == mounthEntity.getStatus()) {
String json1 = JSON.toJSONString(mounthEntity.getResult());
List<Map<String, String>> list = (List<Map<String, String>>) JSONArray.parse(json1);
Collections.reverse(list);
if (!CollectionUtils.isEmpty(list) && list.size() > 30) {
for (int i = 0; i <= 29; i++) {
result.add(list.get(i));
}
} else {
result.addAll(list);
}
}
result.stream().map(item -> {
if (!ObjectUtils.isEmpty(item.get("time"))) {
item.put("time", change(String.valueOf(item.get("time"))));
}
return item;
}).collect(Collectors.toList());
return CommonResponseUtil.success(result);
}
private String change(String time) {
//进行转化时区
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.US);
Date myDate = null;
try {
myDate = dateFormat.parse(time.replace("Z", "+0000"));
} catch (ParseException e) {
e.printStackTrace();
}
//转换为年月日时分秒
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String format = df.format(myDate);
return format;
}
} }
...@@ -646,4 +646,6 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -646,4 +646,6 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
List<Map<String, Object>> selectPressureDetails(@Param("bizOrgCode") String bizOrgCode); List<Map<String, Object>> selectPressureDetails(@Param("bizOrgCode") String bizOrgCode);
Map<String, Object> selectEquipmentSpecificById(@Param("id") String id);
} }
...@@ -5630,7 +5630,7 @@ SELECT spe.id, ...@@ -5630,7 +5630,7 @@ SELECT spe.id,
es.id, es.id,
( (
SELECT SELECT
wesi.update_date DATE_FORMAT(wesi.update_date,'%Y-%m-%d %H:%i:%S')
FROM FROM
wl_equipment_specific_index wesi wl_equipment_specific_index wesi
WHERE WHERE
...@@ -5642,7 +5642,7 @@ SELECT spe.id, ...@@ -5642,7 +5642,7 @@ SELECT spe.id,
) AS stopTime, ) AS stopTime,
( (
SELECT SELECT
wesi.update_date DATE_FORMAT(wesi.update_date,'%Y-%m-%d %H:%i:%S')
FROM FROM
wl_equipment_specific_index wesi wl_equipment_specific_index wesi
WHERE WHERE
...@@ -5664,5 +5664,8 @@ SELECT spe.id, ...@@ -5664,5 +5664,8 @@ SELECT spe.id,
GROUP BY GROUP BY
es.id es.id
</select> </select>
<select id="selectEquipmentSpecificById" resultType="java.util.Map">
select * from wl_equipment_specific where id = #{id}
</select>
</mapper> </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