Commit 54cf415a authored by KeYong's avatar KeYong

Merge branch 'develop_dl' of http://36.40.66.175:5000/moa/amos-boot-biz into develop_dl

parents bf96601d de0c8893
...@@ -17,6 +17,8 @@ public class EquipmentAlarmLogDto { ...@@ -17,6 +17,8 @@ public class EquipmentAlarmLogDto {
private String time; private String time;
@ApiModelProperty(value = "名称") @ApiModelProperty(value = "名称")
private String name; private String name;
@ApiModelProperty(value = "设备位置")
private String location;
@ApiModelProperty(value = "事件内容") @ApiModelProperty(value = "事件内容")
private String content; private String content;
......
...@@ -155,8 +155,12 @@ public class BigScreenController extends AbstractBaseController { ...@@ -155,8 +155,12 @@ public class BigScreenController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "卡片BigSystem报警处理情况统计") @ApiOperation(value = "卡片BigSystem报警处理情况统计")
@GetMapping("/statistic/alarm") @GetMapping("/statistic/alarm")
public ResponseModel getSystemAlarmStatistic(@RequestParam(value = "systemCode", required = false)String systemCode) { public ResponseModel getSystemAlarmStatistic(
return CommonResponseUtil.success(iFireFightingSystemService.getSystemAlarmStatistic(systemCode)); @RequestParam(value = "systemCode", required = false) String systemCode,
@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate
) {
return CommonResponseUtil.success(iFireFightingSystemService.getSystemAlarmStatistic(systemCode, startDate, endDate));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
......
...@@ -708,7 +708,7 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -708,7 +708,7 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
Page<Map<String, Object>> getWaterInfoPage(Page page, @Param("bizOrgCode") String bizOrgCode, @Param("type") String type, @Param("status") String status); Page<Map<String, Object>> getWaterInfoPage(Page page, @Param("bizOrgCode") String bizOrgCode, @Param("type") String type, @Param("status") String status);
Map<String, String> getSystemAlarmStatistic(@Param("systemCode") String systemCode); Map<String, String> getSystemAlarmStatistic(@Param("systemCode") String systemCode, @Param("startDate") String startDate, @Param("endDate") String endDate);
List<Map<String, Object>> getSystemAlarmTrend(@Param("systemCode") String systemCode, @Param("updateTime") String updateTime); List<Map<String, Object>> getSystemAlarmTrend(@Param("systemCode") String systemCode, @Param("updateTime") String updateTime);
......
...@@ -10,5 +10,5 @@ import com.yeejoin.equipmanage.common.entity.WarehouseStructure; ...@@ -10,5 +10,5 @@ import com.yeejoin.equipmanage.common.entity.WarehouseStructure;
* @date 2020-07-07 * @date 2020-07-07
*/ */
public interface WarehouseStructureMapper extends BaseMapper<WarehouseStructure> { public interface WarehouseStructureMapper extends BaseMapper<WarehouseStructure> {
WarehouseStructure selectByEquipmentId(Long equipmentId);
} }
...@@ -338,7 +338,7 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE ...@@ -338,7 +338,7 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
Page<Map<String, Object>> getWaterInfoPage(Page<Map<String, Object>> page, String bizOrgCode, String type, String status); Page<Map<String, Object>> getWaterInfoPage(Page<Map<String, Object>> page, String bizOrgCode, String type, String status);
List<Map<String, String>> getSystemAlarmStatistic(String systemCode); List<Map<String, String>> getSystemAlarmStatistic(String systemCode, String startDate, String endDate);
Map<String, Object> getSystemAlarmTrend(String systemCode, String updateTime); Map<String, Object> getSystemAlarmTrend(String systemCode, String updateTime);
......
...@@ -7,10 +7,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -7,10 +7,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.dto.EquiplistSpecificBySystemESVO; import com.yeejoin.equipmanage.common.dto.EquiplistSpecificBySystemESVO;
import com.yeejoin.equipmanage.common.entity.EquipmentIndex; import com.yeejoin.equipmanage.common.entity.EquipmentIndex;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex; import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex;
import com.yeejoin.equipmanage.common.entity.WarehouseStructure;
import com.yeejoin.equipmanage.common.entity.dto.EquipmentAlarmLogDto; import com.yeejoin.equipmanage.common.entity.dto.EquipmentAlarmLogDto;
import com.yeejoin.equipmanage.common.exception.BaseException; import com.yeejoin.equipmanage.common.exception.BaseException;
import com.yeejoin.equipmanage.dao.ESequiplistSpecificBySystemRepository; import com.yeejoin.equipmanage.dao.ESequiplistSpecificBySystemRepository;
import com.yeejoin.equipmanage.mapper.EquipmentIndexMapper; import com.yeejoin.equipmanage.mapper.EquipmentIndexMapper;
import com.yeejoin.equipmanage.mapper.WarehouseStructureMapper;
import com.yeejoin.equipmanage.service.IESeqService; import com.yeejoin.equipmanage.service.IESeqService;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
...@@ -30,6 +32,7 @@ import org.springframework.data.elasticsearch.core.query.Query; ...@@ -30,6 +32,7 @@ import org.springframework.data.elasticsearch.core.query.Query;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -51,6 +54,8 @@ public class ESeqServiceImpl implements IESeqService { ...@@ -51,6 +54,8 @@ public class ESeqServiceImpl implements IESeqService {
@Autowired @Autowired
private EquipmentIndexMapper equipmentIndexMapper; private EquipmentIndexMapper equipmentIndexMapper;
@Autowired
private WarehouseStructureMapper warehouseStructureMapper;
@Value("${es.ESEquiplistSpecific.flag}") @Value("${es.ESEquiplistSpecific.flag}")
private Boolean flag; private Boolean flag;
...@@ -89,38 +94,36 @@ public class ESeqServiceImpl implements IESeqService { ...@@ -89,38 +94,36 @@ public class ESeqServiceImpl implements IESeqService {
) )
.withPageable(PageRequest.of(current-1, pageSize)) .withPageable(PageRequest.of(current-1, pageSize))
.withSort(SortBuilders.fieldSort("time").order(SortOrder.DESC)); .withSort(SortBuilders.fieldSort("time").order(SortOrder.DESC));
List<EquipmentAlarmLogDto> list = new LinkedList<EquipmentAlarmLogDto>(); List<EquipmentAlarmLogDto> list = new LinkedList<>();
try try {
{ SearchHits<EquiplistSpecificBySystemESVO> searchHits = elasticsearchTemplate.search(queryBuilder.build(), EquiplistSpecificBySystemESVO.class);
SearchHits<EquiplistSpecificBySystemESVO> searchHits =elasticsearchTemplate.search(queryBuilder.build(), EquiplistSpecificBySystemESVO.class);
for (SearchHit<EquiplistSpecificBySystemESVO> searchHit : searchHits.getSearchHits()) for (SearchHit<EquiplistSpecificBySystemESVO> searchHit : searchHits.getSearchHits()) {
{
JSONObject jsonObject = (JSONObject) JSON.toJSON(searchHit.getContent()); JSONObject jsonObject = (JSONObject) JSON.toJSON(searchHit.getContent());
EquiplistSpecificBySystemESVO equiplistSpecificBySystemESVO = JSON.toJavaObject(jsonObject, EquiplistSpecificBySystemESVO.class); EquiplistSpecificBySystemESVO equiplistSpecificBySystemESVO = JSON.toJavaObject(jsonObject, EquiplistSpecificBySystemESVO.class);
EquipmentAlarmLogDto da=new EquipmentAlarmLogDto(); EquipmentAlarmLogDto da = new EquipmentAlarmLogDto();
da.setId(UUID.randomUUID().toString()); da.setId(String.valueOf(equiplistSpecificBySystemESVO.getEquipmentSpecificId()));
da.setName(equiplistSpecificBySystemESVO.getEquipmentSpecificName()); da.setName(equiplistSpecificBySystemESVO.getEquipmentSpecificName());
SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date daf =new Date(equiplistSpecificBySystemESVO.getTime()); Date daf = new Date(equiplistSpecificBySystemESVO.getTime());
String time=ft.format(daf); String time = ft.format(daf);
da.setTime(time); da.setTime(time);
// String value=equiplistSpecificBySystemESVO.getValue(); QueryWrapper<EquipmentIndex> wrapper = new QueryWrapper<>();
// value= getReadableStatus(value ); wrapper.eq("name_key", equiplistSpecificBySystemESVO.getEquipmentIndexKey());
// da.setContent(equiplistSpecificBySystemESVO.getEquipmentIndexName()+":"+value); wrapper.last("limit 1");
QueryWrapper<EquipmentIndex> wrapper = new QueryWrapper<>(); EquipmentIndex index = equipmentIndexMapper.selectOne(wrapper);
wrapper.eq("name_key", equiplistSpecificBySystemESVO.getEquipmentIndexKey()); da.setContent(index.getTypeName());
wrapper.last("limit 1"); WarehouseStructure warehouseStructure = warehouseStructureMapper.selectByEquipmentId(equiplistSpecificBySystemESVO.getEquipmentSpecificId());
EquipmentIndex index = equipmentIndexMapper.selectOne(wrapper); if (warehouseStructure != null) {
da.setContent(index.getTypeName()); da.setLocation(StringUtils.hasText(warehouseStructure.getFullName()) ? warehouseStructure.getFullName() : "");
list.add(da); }
list.add(da);
} }
pageBean.setRecords(list); pageBean.setRecords(list);
pageBean.setTotal(searchHits.getTotalHits()); pageBean.setTotal(searchHits.getTotalHits());
} catch (Exception e) {
}catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new BadRequest("系统异常"); throw new BadRequest("系统异常");
} }
return pageBean; return pageBean;
} }
......
...@@ -2533,8 +2533,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2533,8 +2533,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
return fireFightingSystemMapper.getWaterInfoPage(page, bizOrgCode, type, status); return fireFightingSystemMapper.getWaterInfoPage(page, bizOrgCode, type, status);
} }
@Override @Override
public List<Map<String, String>> getSystemAlarmStatistic(String systemCode) { public List<Map<String, String>> getSystemAlarmStatistic(String systemCode, String startDate, String endDate) {
Map<String, String> map = fireFightingSystemMapper.getSystemAlarmStatistic(systemCode); Map<String, String> map = fireFightingSystemMapper.getSystemAlarmStatistic(systemCode, startDate, endDate);
List<Map<String, String>> list = new ArrayList<>(); List<Map<String, String>> list = new ArrayList<>();
Map<String, String> entryMap = new HashMap<>(); Map<String, String> entryMap = new HashMap<>();
entryMap.put("key", "1"); entryMap.put("key", "1");
...@@ -2546,7 +2546,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2546,7 +2546,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
Map<String, String> entryMap1 = new HashMap<>(); Map<String, String> entryMap1 = new HashMap<>();
entryMap1.put("key", "2"); entryMap1.put("key", "2");
entryMap1.put("type", "handled"); entryMap1.put("type", "handled");
entryMap1.put("name", "已处理"); entryMap1.put("name", "已消除");
entryMap1.put("value", map.get("handledNum")); entryMap1.put("value", map.get("handledNum"));
entryMap1.put("unit", ""); entryMap1.put("unit", "");
list.add(entryMap1); list.add(entryMap1);
...@@ -2561,7 +2561,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2561,7 +2561,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
entryMap3.put("key", "4"); entryMap3.put("key", "4");
entryMap3.put("type", "faultEquip"); entryMap3.put("type", "faultEquip");
entryMap3.put("name", "故障设备"); entryMap3.put("name", "故障设备");
entryMap3.put("value", map.get("alarmEquipNum")); entryMap3.put("value", map.get("faultEquipNum"));
entryMap3.put("unit", ""); entryMap3.put("unit", "");
list.add(entryMap3); list.add(entryMap3);
return list; return list;
......
...@@ -6179,8 +6179,26 @@ ...@@ -6179,8 +6179,26 @@
<select id="getSystemAlarmStatistic" resultType="Map"> <select id="getSystemAlarmStatistic" resultType="Map">
SELECT SELECT
COUNT(wlesal.id) AS totalNum, COUNT(wlesal.id) AS totalNum,
IFNULL((select COUNT(DISTINCT wl.equipment_specific_id) from wl_equipment_specific_alarm_log wl where IFNULL(
wl.`status` = 1 AND system_codes LIKE CONCAT('%', #{systemCode}, '%')), 0) AS alarmEquipNum, (
SELECT
COUNT(DISTINCT wl.equipment_specific_id)
FROM
wl_equipment_specific_alarm_log wl
<where>
wl.type = 'BREAKDOWN'
<if test="systemCode != null and systemCode != ''">
AND wl.system_codes LIKE CONCAT('%', #{systemCode}, '%')
</if>
<if test="startDate != null and startDate != ''">
AND wl.create_date &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
AND wl.create_date &lt;= #{endDate}
</if>
</where>
)
, 0) AS faultEquipNum,
IFNULL(SUM(IF(wlesal.clean_time IS NULL,1,0)), 0) AS unClearNum, IFNULL(SUM(IF(wlesal.clean_time IS NULL,1,0)), 0) AS unClearNum,
IFNULL(SUM(IF(wlesal.confirm_type IS NOT NULL,1,0)), 0) AS handledNum IFNULL(SUM(IF(wlesal.confirm_type IS NOT NULL,1,0)), 0) AS handledNum
FROM FROM
...@@ -6188,7 +6206,13 @@ ...@@ -6188,7 +6206,13 @@
LEFT JOIN f_fire_fighting_system fs ON FIND_IN_SET( fs.id, wlesal.system_ids ) LEFT JOIN f_fire_fighting_system fs ON FIND_IN_SET( fs.id, wlesal.system_ids )
<where> <where>
<if test="systemCode != null and systemCode != ''"> <if test="systemCode != null and systemCode != ''">
fs.code = #{systemCode} AND fs.code = #{systemCode}
</if>
<if test="startDate != null and startDate != ''">
AND wlesal.create_date &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
AND wlesal.create_date &lt;= #{endDate}
</if> </if>
</where> </where>
</select> </select>
......
...@@ -2,4 +2,14 @@ ...@@ -2,4 +2,14 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.equipmanage.mapper.WarehouseStructureMapper"> <mapper namespace="com.yeejoin.equipmanage.mapper.WarehouseStructureMapper">
<select id="selectByEquipmentId" resultType="com.yeejoin.equipmanage.common.entity.WarehouseStructure">
SELECT
ws.*
FROM
wl_equipment_specific es
LEFT JOIN wl_warehouse_structure ws ON es.warehouse_structure_id = ws.id
WHERE
es.id = #{equipmentSpecificId}
LIMIT 1
</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