Commit 9996b380 authored by zhangsen's avatar zhangsen

监盘概览部分API提交

parent 0d0084d9
......@@ -8,6 +8,7 @@ import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.config.PersonIdentify;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
......@@ -21,8 +22,11 @@ import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.HashMap;
@RestController
@Api(tags = "监盘总览组态需求 -- API")
@RequestMapping(value = "/supervisionConfigure", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
......@@ -31,6 +35,9 @@ public class SupervisionConfigureController extends AbstractBaseController {
@Autowired
private FireFightingSystemMapper fireFightingSystemMapper;
@Autowired
private IFireFightingSystemService iFireFightingSystemService;
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "监盘概览水源信息")
......@@ -113,4 +120,59 @@ public class SupervisionConfigureController extends AbstractBaseController {
}
return CommonResponseUtil.success(fireFightingSystemMapper.statisticsByStation(bizOrgCode));
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "【监盘总览-排油系统信息】获取系统设备状态(根据系统编码查询)")
@GetMapping("/getEquipmentStateBySuper")
public ResponseModel getEquipmentStateBySuper(@RequestParam(required = false) String systemCode, CommonPageable commonPageable) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
Page result = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
HashMap<String, Object> hashMap = new HashMap<>();
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
String bizOrgCode = personIdentity.getBizOrgCode();
if (StringUtils.isNotBlank(bizOrgCode)) {
hashMap.put("bizOrgCode", bizOrgCode);
}
if (bizOrgCode == null) {
return CommonResponseUtil.success(null);
}
}
if (StringUtils.isNotBlank(systemCode)) {
hashMap.put("systemCode", systemCode);
} else {
throw new BadRequest("系统编码不能为空");
}
return CommonResponseUtil.success(iFireFightingSystemService.equipmentStateBySuper(result, hashMap));
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "【监盘总览-排油系统信息】获取系统工作状态(根据系统编码查询)")
@GetMapping("/getSystemStatusBySuper")
public ResponseModel getSystemStatusBySuper(@RequestParam(required = false) String systemCode) {
HashMap<String, Object> hashMap = new HashMap<>();
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
String bizOrgCode = personIdentity.getBizOrgCode();
if (StringUtils.isNotBlank(bizOrgCode)) {
hashMap.put("bizOrgCode", bizOrgCode);
}
if (bizOrgCode == null) {
return CommonResponseUtil.success(null);
}
}
if (StringUtils.isNotBlank(systemCode)) {
hashMap.put("systemCode", systemCode);
} else {
throw new BadRequest("系统编码不能为空");
}
return CommonResponseUtil.success(iFireFightingSystemService.getSystemStatusBySuper(hashMap));
}
}
......@@ -356,6 +356,13 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
List<Map<String, Object>> getFireSystemInfo(HashMap<String, Object> hashMap);
/**
* 获取系统状态 大于0异常 小于0正常
* @param hashMap
* @return
*/
Integer getSystemStatus(HashMap<String, Object> hashMap);
/**
* 获取系统近一月告警设备top5
*
* @param hashMap
......@@ -372,6 +379,14 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
String equipmentId(HashMap<String, Object> hashMap);
/**
* 获取设备id
*
* @param hashMap
* @return
*/
String equipmentIdBySuper(HashMap<String, Object> hashMap);
/**
* 获取系统设备状态
*
* @param page
......@@ -381,6 +396,15 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
Page<Map<String, Object>> equipmentState(Page page, String id);
/**
* 获取系统设备状态
*
* @param page
* @param id
* @return
*/
Page<Map<String, Object>> equipmentStateBySuper(Page page, String id);
/**
* 稳压泵信息
*
* @param page
......
......@@ -242,12 +242,16 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
Map<String, Object> getSystemStatus(HashMap<String, Object> hashMap);
Integer getSystemStatusBySuper(HashMap<String, Object> hashMap);
Map<String, Object> equipAlarmTOP(HashMap<String, Object> hashMap);
Page<Map<String, Object>> getSmallWaterInfo(Page page, HashMap<String, Object> hashMap);
Page<Map<String, Object>> equipmentState(Page result, HashMap<String, Object> hashMap);
Page<Map<String, Object>> equipmentStateBySuper(Page result, HashMap<String, Object> hashMap);
Map<String, Object> statisticsByStation(String bizOrgCode);
Map<String, Object> todayAlarmEquipment(String bizOrgCode);
......
......@@ -1290,6 +1290,12 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
@Override
public Integer getSystemStatusBySuper(HashMap<String, Object> hashMap) {
Integer systemStatus = fireFightingSystemMapper.getSystemStatus(hashMap);
return systemStatus;
}
@Override
public Map<String, Object> getSystemName(HashMap<String, Object> hashMap) {
Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> map = fireFightingSystemMapper.getFireSystemInfo(hashMap);
......@@ -1332,6 +1338,17 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
@Override
public Page<Map<String, Object>> equipmentStateBySuper(Page res, HashMap<String, Object> hashMap) {
Page result = new Page<>(res.getCurrent(), res.getSize());
String id = fireFightingSystemMapper.equipmentIdBySuper(hashMap);
if (!StringUtil.isNotEmpty(id)) {
return null;
}
Page<Map<String, Object>> mapPage = fireFightingSystemMapper.equipmentStateBySuper(result, id);
return mapPage;
}
@Override
public Page<Map<String, Object>> getSmallWaterInfo(Page page, HashMap<String, Object> hashMap) {
String bizOrgCode = null;
String systemCode = null;
......
......@@ -2574,6 +2574,17 @@
code = #{systemCode}
</select>
<select id="equipmentIdBySuper" resultType="String">
select
id
from
f_fire_fighting_system
where
code = #{systemCode}
and
biz_org_code like concat(#{bizOrgCode}, '%')
</select>
<select id="equipmentState" resultType="java.util.Map">
<!-- SELECT-->
<!-- b.equipName,-->
......@@ -2640,6 +2651,44 @@
b.totalNum DESC
</select>
<select id="equipmentStateBySuper" resultType="java.util.Map">
SELECT
b.equipName,
( CASE WHEN b.totalAlarmNum > 0 THEN '异常' ELSE '正常' END ) `status`,
b.totalAlarmNum AS alarmNum,
b.`code` AS equipDetailCode,
b.totalNum
FROM
(
SELECT
a.equipName,
count( DISTINCT wesa.equipment_specific_id ) AS totalAlarmNum,
a.`code`,
count( a.id ) AS totalNum
FROM
(
SELECT
eq.`name` AS equipName,
eq.id AS equipmentId,
eq.`code` AS `code`,
wes.id
FROM
wl_equipment eq
LEFT JOIN wl_equipment_detail wed ON eq.id = wed.equipment_id
LEFT JOIN wl_equipment_specific wes ON wed.id = wes.equipment_detail_id
WHERE
FIND_IN_SET( #{id}, wes.system_id ) > 0
) a
LEFT JOIN wl_equipment_specific_alarm wesa ON wesa.equipment_id = a.equipmentId
AND wesa.`status` = 1
AND FIND_IN_SET( #{id}, wesa.system_ids ) > 0
GROUP BY
a.equipmentId
) b
ORDER BY
b.totalNum DESC
</select>
<select id="getPressurePumpInfo" resultType="java.util.Map">
SELECT
ed.`name`,
......@@ -4650,4 +4699,16 @@
GROUP BY
es.id
</select>
<select id="getSystemStatus" resultType="java.lang.Integer">
SELECT
IFNULL( sum( `status` ), 0 ) AS isAlarm
FROM
wl_equipment_specific_alarm
WHERE
equipment_specific_id IN
( SELECT id FROM wl_equipment_specific
WHERE FIND_IN_SET( #{id}, system_id ) > 0
AND biz_org_code LIKE concat(#{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