Commit 5eb88a34 authored by zhangsen's avatar zhangsen

三小消防给水信息

parent da8f1f80
......@@ -245,6 +245,67 @@ public class ConfigureController extends AbstractBaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "消防给水3小稳压泵信息")
@GetMapping("/getPressurePumpInfo3Small")
public ResponseModel getPressurePumpInfo3Small() {
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
List<Map<String, Object>> pressurePumpInfo = fireFightingSystemMapper.getPressurePumpInfo3Small(bizOrgCode, null);
Map<String, Integer> resultMap = new HashMap<>();
resultMap.put("total", pressurePumpInfo.size());
resultMap.put("normalNum", 0);
resultMap.put("unNormalNum", 0);
pressurePumpInfo.stream().map(item -> {
item.put("startAndStopNum", 0);
item.put("update_time", "未知");
item.put("equipment_index_name", "未知");
String prefix = null;
String suffix = null;
String iotCode = item.get("iot_code").toString();
if (iotCode.length() > 8) {
prefix = iotCode.substring(0, 8);
suffix = iotCode.substring(8);
} else {
throw new BadRequest("装备物联编码错误,请确认!");
}
String nowStrLong = DateUtils.getNowStrLong();
Date startDate = DateUtils.dateAddMinutes(null, -4);
String startDateStr = DateUtils.convertDateToString(startDate, DateUtils.DATE_TIME_PATTERN);
ResponseModel entity1 = null;
ResponseModel entity2 = null;
try {
entity1 = iotFeign.selectList(getAppKey(), getProduct(), getToken(), startDateStr, nowStrLong, prefix, suffix, "FHS_PressurePump_Start");
entity2 = iotFeign.selectList(getAppKey(), getProduct(), getToken(), startDateStr, nowStrLong, prefix, suffix, "FHS_PressurePump_Stop");
} catch (Exception e) {
e.printStackTrace();
}
if (200 == entity1.getStatus() && !ObjectUtils.isEmpty(entity1.getResult()) &&
200 == entity2.getStatus() && !ObjectUtils.isEmpty(entity2.getResult())) {
String json1 = JSON.toJSONString(entity1.getResult());
List<Map<String, String>> listObject1 = (List<Map<String, String>>) JSONArray.parse(json1);
String json2 = JSON.toJSONString(entity1.getResult());
List<Map<String, String>> listObject2 = (List<Map<String, String>>) JSONArray.parse(json2);
int num = listObject1.size() + listObject2.size();
item.put("startAndStopNum", num);
}
item.put("stateDesc", (Integer) item.get("startAndStopNum") <= 1 ? "正常" : "异常");
resultMap.put("normalNum", (Integer) item.get("startAndStopNum") <= 1 ? (resultMap.get("normalNum") + 1) : resultMap.get("normalNum"));
resultMap.put("unNormalNum", (Integer) item.get("startAndStopNum") > 1 ? (resultMap.get("unNormalNum") + 1) : resultMap.get("unNormalNum"));
item.put("normalNum", (Integer) item.get("startAndStopNum") <= 1 ? 1 : 0);
item.put("unNormalNum", (Integer) item.get("startAndStopNum") <= 1 ? 0 : 1);
Map<String, String> stateMap = fireFightingSystemMapper.queryPressureNowStateBySpecificId((Long) item.get("id"));
if (!ObjectUtils.isEmpty(stateMap) && stateMap.containsKey("update_date") && stateMap.containsKey("equipment_index_name")) {
item.put("update_time", stateMap.get("update"));
item.put("equipment_index_name", stateMap.get("equipment_index_name"));
}
return item;
}).collect(Collectors.toList());
return CommonResponseUtil.success(resultMap);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "3小水源信息")
@GetMapping("/getSmallWaterInfo")
public ResponseModel getSmallWaterInfo(@RequestParam(required = false) String systemCode, CommonPageable commonPageable) {
......
......@@ -342,4 +342,12 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
* @return
*/
Map<String, String> queryPressureNowStateBySpecificId(@Param("id") Long id);
/**
* 稳压泵信息-3小消防给水信息
* @param bizOrgCode
* @param systemCode
* @return
*/
List<Map<String, Object>> getPressurePumpInfo3Small(@Param("bizOrgCode") String bizOrgCode, @Param("systemCode") String systemCode);
}
......@@ -2731,4 +2731,18 @@
i.update_date DESC
LIMIT 1
</select>
<select id="getPressurePumpInfo3Small" resultType="java.util.Map">
SELECT
ed.`name`,
ed.area,
es.iot_code,
es.id
FROM
wl_equipment_detail ed
LEFT JOIN wl_equipment_specific es ON es.equipment_detail_id = ed.id
WHERE
ed.`code` LIKE '92010800%'
AND biz_org_code = #{bizOrgCode}
</select>
</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