Commit 8851cdda authored by chenzhao's avatar chenzhao

Merge branch 'develop_dl_plan6_temp' of…

Merge branch 'develop_dl_plan6_temp' of http://39.98.45.134:8090/moa/amos-boot-biz into develop_dl_plan6_temp
parents 99dfa155 ad35804c
...@@ -140,5 +140,6 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> { ...@@ -140,5 +140,6 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
List<OrgUsr> companyTreeByUserToPatrolRoute(Map<String, Object> param); List<OrgUsr> companyTreeByUserToPatrolRoute(Map<String, Object> param);
String getBizOrgCodeByOrgCode(String orgCode); OrgUsr queryByBizCode(@Param("code") String code);
} }
...@@ -1094,6 +1094,20 @@ LEFT JOIN ( ...@@ -1094,6 +1094,20 @@ LEFT JOIN (
AND code = #{companyCode} AND code = #{companyCode}
</if> </if>
</select> </select>
<select id="queryByBizCode" resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT *
FROM cb_org_usr
WHERE is_delete = 0
<if test="code != null and code != ''">
AND biz_org_code = #{code}
</if>
</select>
<select id="getOrgUsrSyncDataList" resultType="com.yeejoin.amos.boot.module.common.api.dto.OrgUsrSyncDto"> <select id="getOrgUsrSyncDataList" resultType="com.yeejoin.amos.boot.module.common.api.dto.OrgUsrSyncDto">
SELECT SELECT
u.*, u.*,
...@@ -1151,7 +1165,7 @@ LEFT JOIN ( ...@@ -1151,7 +1165,7 @@ LEFT JOIN (
FROM FROM
cb_org_usr u cb_org_usr u
LEFT JOIN cb_firefighters_post cfp ON cfp.org_usr_id = u.sequence_nbr LEFT JOIN cb_firefighters_post cfp ON cfp.org_usr_id = u.sequence_nbr
LEFT JOIN cb_firefighters cf ON cf.org_usr_id = u.sequence_nbr LEFT JOIN cb_firefighters cf ON CONCAT( u.sequence_nbr, '' ) = cf.org_usr_id
LEFT JOIN cb_fire_team cft ON cft.sequence_nbr = cf.fire_team_id LEFT JOIN cb_fire_team cft ON cft.sequence_nbr = cf.fire_team_id
WHERE WHERE
u.is_delete = 0 u.is_delete = 0
...@@ -1173,14 +1187,4 @@ LEFT JOIN ( ...@@ -1173,14 +1187,4 @@ LEFT JOIN (
and usr.is_delete = false and usr.is_delete = false
</select> </select>
<select id="getBizOrgCodeByOrgCode" resultType="java.lang.String">
SELECT
biz_org_code
FROM
cb_org_usr
where
is_delete = false
and amos_org_code = #{orgCode}
limit 1
</select>
</mapper> </mapper>
...@@ -465,6 +465,62 @@ public class DateUtils { ...@@ -465,6 +465,62 @@ public class DateUtils {
} }
/** /**
* 获取两个日期(不含时分秒)相差的小时
*
* @param startDate
* @param endDate
* @return
* @throws ParseException
*/
public static int dateBetweenNew(Date startDate, Date endDate) throws ParseException {
Date dateStart = dateParse(dateFormat(startDate, DATE_PATTERN), DATE_PATTERN);
Date dateEnd = dateParse(dateFormat(endDate, DATE_PATTERN), DATE_PATTERN);
return (int) ((dateEnd.getTime() - dateStart.getTime()) / 1000 / 60 / 60);
}
/**
* 获取两个日期(不含时分秒)相差的半小时
*
* @param startDate
* @param endDate
* @return
* @throws ParseException
*/
public static int dateBetweenNew1(Date startDate, Date endDate) throws ParseException {
Date dateStart = dateParse(dateFormat(startDate, DATE_PATTERN), DATE_PATTERN);
Date dateEnd = dateParse(dateFormat(endDate, DATE_PATTERN), DATE_PATTERN);
return (int) ((dateEnd.getTime() - dateStart.getTime()) / 1000 / 60 / 30);
}
/**
* 获取两个日期(不含时分秒)相差的二小时
*
* @param startDate
* @param endDate
* @return
* @throws ParseException
*/
public static int dateBetweenNew2(Date startDate, Date endDate) throws ParseException {
Date dateStart = dateParse(dateFormat(startDate, DATE_PATTERN), DATE_PATTERN);
Date dateEnd = dateParse(dateFormat(endDate, DATE_PATTERN), DATE_PATTERN);
return (int) ((dateEnd.getTime() - dateStart.getTime()) / 1000 / 60 / 120);
}
/**
* 获取两个日期(不含时分秒)相差的四小时
*
* @param startDate
* @param endDate
* @return
* @throws ParseException
*/
public static int dateBetweenNew3(Date startDate, Date endDate) throws ParseException {
Date dateStart = dateParse(dateFormat(startDate, DATE_PATTERN), DATE_PATTERN);
Date dateEnd = dateParse(dateFormat(endDate, DATE_PATTERN), DATE_PATTERN);
return (int) ((dateEnd.getTime() - dateStart.getTime()) / 1000 / 60 / 240);
}
/**
* 获取两个日期(不含时分秒)相差的天数,包含今天 * 获取两个日期(不含时分秒)相差的天数,包含今天
* *
* @param startDate * @param startDate
......
...@@ -32,4 +32,6 @@ public class IotIndexResVo { ...@@ -32,4 +32,6 @@ public class IotIndexResVo {
private List<IotDataVO> iotData; private List<IotDataVO> iotData;
private String equipId;
} }
...@@ -265,9 +265,9 @@ public class KeySiteController extends BaseController { ...@@ -265,9 +265,9 @@ public class KeySiteController extends BaseController {
if (dto.getFireEnduranceRateName() != null){ if (dto.getFireEnduranceRateName() != null){
dto.setFireEnduranceRate(dto.getFireEnduranceRateName()); dto.setFireEnduranceRate(dto.getFireEnduranceRateName());
} }
if (dto.getUseNatureName() != null){ // if (dto.getUseNatureName() != null){
dto.setUseNature(dto.getUseNatureName()); // dto.setUseNature(dto.getUseNatureName());
} // }
if(null != dto.getLongitude() && null != dto.getLatitude()) { if(null != dto.getLongitude() && null != dto.getLatitude()) {
dto.setAddressDesc(dto.getAddressDesc().concat("@address@").concat("{\"longitude\":"). dto.setAddressDesc(dto.getAddressDesc().concat("@address@").concat("{\"longitude\":").
concat(dto.getLongitude().toString().concat(",\"latitude\":").concat(dto.getLatitude().toString().concat("}")))); concat(dto.getLongitude().toString().concat(",\"latitude\":").concat(dto.getLatitude().toString().concat("}"))));
......
...@@ -246,7 +246,6 @@ public class OrgPersonController extends BaseController { ...@@ -246,7 +246,6 @@ public class OrgPersonController extends BaseController {
@PersonIdentify
@TycloudOperation( ApiLevel = UserType.AGENCY) @TycloudOperation( ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/listAllByCurrentUserALL", method = RequestMethod.GET) @RequestMapping(value = "/listAllByCurrentUserALL", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询(表单用)", notes = "列表分页查询(表单用)") @ApiOperation(httpMethod = "GET", value = "列表分页查询(表单用)", notes = "列表分页查询(表单用)")
......
...@@ -3536,7 +3536,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -3536,7 +3536,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
public List<OrgMenuDto> companyTreeByUserToPatrolRoute(ReginParams reginParams) { public List<OrgMenuDto> companyTreeByUserToPatrolRoute(ReginParams reginParams) {
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
String bizOrgCode = orgUsrMapper.getBizOrgCodeByOrgCode(reginParams.getCompany().getOrgCode()); String bizOrgCode = reginParams.getPersonIdentity().getCompanyBizOrgCode();
param.put("bizOrgCode", bizOrgCode); param.put("bizOrgCode", bizOrgCode);
List<OrgUsr> list = orgUsrMapper.companyTreeByUserToPatrolRoute(param); List<OrgUsr> list = orgUsrMapper.companyTreeByUserToPatrolRoute(param);
return buildTreeParallel(list); return buildTreeParallel(list);
......
...@@ -490,6 +490,16 @@ public class EquipmentAlarmController extends AbstractBaseController { ...@@ -490,6 +490,16 @@ public class EquipmentAlarmController extends AbstractBaseController {
return CommonResponseUtil.success(map); return CommonResponseUtil.success(map);
} }
@RequestMapping(value = "/pressureMessage", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "站端双月报稳压泵打压频次信息", produces = "application/json;charset=UTF-8", notes = "数字换流站根据id获取装备详情")
public ResponseModel pressureMessage(@RequestParam(value = "startTime") String startTime,
@RequestParam(value = "orgCode") String orgCode,
@RequestParam(value = "endTime") String endTime) {
Map<String, Object> map = iEquipmentSpecificAlarmService.pressureMessage(orgCode, startTime, endTime);
return CommonResponseUtil.success(map);
}
@RequestMapping(value = "/getAllEquipNum", method = RequestMethod.GET) @RequestMapping(value = "/getAllEquipNum", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查装备数量", produces = "application/json;charset=UTF-8", notes = "查装备数量") @ApiOperation(httpMethod = "GET", value = "查装备数量", produces = "application/json;charset=UTF-8", notes = "查装备数量")
......
...@@ -6,6 +6,7 @@ import java.util.stream.Collectors; ...@@ -6,6 +6,7 @@ import java.util.stream.Collectors;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.equipmanage.common.constant.Constant; import com.yeejoin.equipmanage.common.constant.Constant;
import com.yeejoin.equipmanage.common.entity.vo.EquiplistSpecificBySystemVO; import com.yeejoin.equipmanage.common.entity.vo.EquiplistSpecificBySystemVO;
import com.yeejoin.equipmanage.common.entity.vo.IotIndexInfoVo;
import com.yeejoin.equipmanage.common.utils.*; import com.yeejoin.equipmanage.common.utils.*;
import com.yeejoin.equipmanage.fegin.IotFeign; import com.yeejoin.equipmanage.fegin.IotFeign;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -430,35 +431,39 @@ public class EquipmentSpecificController extends AbstractBaseController { ...@@ -430,35 +431,39 @@ public class EquipmentSpecificController extends AbstractBaseController {
public ResponseModel getEquipmentIotIndexInfo(@PathVariable String equipSpeId, @RequestParam String beginDate, @RequestParam String endDate, public ResponseModel getEquipmentIotIndexInfo(@PathVariable String equipSpeId, @RequestParam String beginDate, @RequestParam String endDate,
@RequestParam(required = false) Integer isTrend, @RequestParam(required = false) String fieldKey) { @RequestParam(required = false) Integer isTrend, @RequestParam(required = false) String fieldKey) {
// 1.根据 equipSpeId 查询装备iotCode List<IotIndexInfoVo> indexInfoList = new ArrayList<>();
EquipmentSpecific equipmentSpecific = equipmentSpecificMapper.selectById(equipSpeId); List<String> split= Arrays.asList(equipSpeId.split(","));
if (ObjectUtils.isEmpty(equipmentSpecific)) { for (String s : split) {
return CommonResponseUtil.failure("未查询到装备信息!"); // 1.根据 equipSpeId 查询装备iotCode
EquipmentSpecific equipmentSpecific = equipmentSpecificMapper.selectById(equipSpeId);
if (ObjectUtils.isEmpty(equipmentSpecific)) {
return CommonResponseUtil.failure("未查询到装备信息!");
}
String iotCode = equipmentSpecific.getIotCode();
String prefix = null;
String suffix = null;
if (StringUtil.isNotEmpty(iotCode) && iotCode.length() > 8) {
prefix = iotCode.substring(0, 8);
suffix = iotCode.substring(8);
} else {
return CommonResponseUtil.failure("装备物联编码错误,请确认!");
}
ResponseModel entity = null;
try {
entity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), beginDate, endDate, prefix, suffix, null);
} catch (Exception e) {
e.printStackTrace();
log.error("调用iot服务出错");
return CommonResponseUtil.failure("请求失败");
}
if (RESULT_SUCCESS_CODE != entity.getStatus() && ObjectUtils.isEmpty(entity.getResult())) {
log.error("查询物联日志数据为空或iotCode为 (" + iotCode + ") 的装备不存在于物联系统中!");
return CommonResponseUtil.failure("物联日志数据为空");
}
indexInfoList.addAll(equipmentSpecificSerivce.getIndexInfoList(iotCode, entity, isTrend, fieldKey));
} }
String iotCode = equipmentSpecific.getIotCode(); return CommonResponseUtil.success(indexInfoList);
String prefix = null;
String suffix = null;
if (StringUtil.isNotEmpty(iotCode) && iotCode.length() > 8) {
prefix = iotCode.substring(0, 8);
suffix = iotCode.substring(8);
} else {
return CommonResponseUtil.failure("装备物联编码错误,请确认!");
}
ResponseModel entity = null;
try {
entity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), beginDate, endDate, prefix, suffix, null);
} catch (Exception e) {
e.printStackTrace();
log.error("调用iot服务出错");
return CommonResponseUtil.failure("请求失败");
}
if (RESULT_SUCCESS_CODE != entity.getStatus() && ObjectUtils.isEmpty(entity.getResult())) {
log.error("查询物联日志数据为空或iotCode为 (" + iotCode + ") 的装备不存在于物联系统中!");
return CommonResponseUtil.failure("物联日志数据为空");
}
return CommonResponseUtil.success(equipmentSpecificSerivce.getIndexInfoList(iotCode, entity, isTrend, fieldKey));
} }
......
...@@ -29,6 +29,7 @@ import org.apache.logging.log4j.Logger; ...@@ -29,6 +29,7 @@ import org.apache.logging.log4j.Logger;
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.data.domain.Page; import org.springframework.data.domain.Page;
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;
...@@ -101,6 +102,9 @@ public class TopographyController extends AbstractBaseController { ...@@ -101,6 +102,9 @@ public class TopographyController extends AbstractBaseController {
@Value("${iot.vehicle.track}") @Value("${iot.vehicle.track}")
private String iotServerName; private String iotServerName;
@Value("${water.level.indexKey}")
private String waterLevelIndexKey;
// /** // /**
// * 拓扑图-树 // * 拓扑图-树
// * // *
...@@ -840,136 +844,238 @@ public class TopographyController extends AbstractBaseController { ...@@ -840,136 +844,238 @@ public class TopographyController extends AbstractBaseController {
@RequestParam(required = false) String fieldKey, @RequestParam(required = false) String fieldKey,
@RequestParam(required = false) String isTrend, @RequestParam(required = false) String isTrend,
@RequestParam(required = false) String endDate) throws ParseException { @RequestParam(required = false) String endDate) throws ParseException {
String eqpId;
String iotCode = null; Map<String, List<IotIndexResVo>> resultMap = new HashMap<>();
if(null != fieldKey || null != isTrend) { List<String> split= Arrays.asList(equipSpeId.split(","));
EquipmentSpecific equipmentSpecific = equipmentSpecificService.getById(equipSpeId); List<IotIndexResVo> finalRes = new ArrayList<>();
iotCode = equipmentSpecific.getIotCode(); List<IotIndexResVo> finalResContainsWaterLevel = new ArrayList<>();
List<IotIndexResVo> resultResContainsWater = new ArrayList<>();
List<EquipmentIndex> equipmentSpecifics = equipmentIndexService.getPerfQutoaIotList(Long.valueOf(equipSpeId)); for (String specId : split) {
String eqpId;
if (equipmentSpecifics.size() == 0) { String iotCode = null;
return CommonResponseUtil.success(); if(null != fieldKey || null != isTrend) {
} EquipmentSpecific equipmentSpecific = equipmentSpecificService.getById(specId);
if ("true".equals(isTrend)) { iotCode = equipmentSpecific.getIotCode();
fieldKey = equipmentSpecifics.stream().filter(equipmentIndex -> equipmentIndex.getIsTrend()).map(EquipmentIndex::getPerfQuotaDefinitionId).collect(Collectors.joining(","));
}
} else {
if (StringUtil.isNotEmpty(equipSpeId)) {
eqpId = equipSpeId;
} else {
TopographyNodeDetailDTO detailDTO = topographyNodeDetailService.queryByNodeid(id);
if (null == detailDTO || !StringUtil.isNotEmpty(detailDTO.getEqpId())) {
throw new RuntimeException("节点信息错误或此节点下未绑定装备!");
}
eqpId = detailDTO.getEqpId();
}
EquipmentSpecific equipmentSpecific = equipmentSpecificService.getById(eqpId);
iotCode = equipmentSpecific.getIotCode();
}
List<EquipmentIndex> equipmentSpecifics = equipmentIndexService.getPerfQutoaIotList(Long.valueOf(specId));
if (equipmentSpecifics.size() == 0) {
return CommonResponseUtil.success();
}
if ("true".equals(isTrend)) {
fieldKey = equipmentSpecifics.stream().filter(equipmentIndex -> equipmentIndex.getIsTrend()).map(EquipmentIndex::getPerfQuotaDefinitionId).collect(Collectors.joining(","));
}
String prefix = null; } else {
String suffix = null; if (StringUtil.isNotEmpty(specId)) {
if (StringUtil.isNotEmpty(iotCode) && iotCode.length() > 8) { eqpId = specId;
prefix = iotCode.substring(0, 8); } else {
suffix = iotCode.substring(8); TopographyNodeDetailDTO detailDTO = topographyNodeDetailService.queryByNodeid(id);
} else { if (null == detailDTO || !StringUtil.isNotEmpty(detailDTO.getEqpId())) {
return CommonResponseUtil.failure("装备物联编码不存在或编码错误,请确认!"); throw new RuntimeException("节点信息错误或此节点下未绑定装备!");
}
ResponseModel entity = null;
try {
entity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), beginDate, endDate, prefix, suffix, fieldKey);
} catch (Exception e) {
throw new RuntimeException("调用AMOS-API-IOT服务失败,请检查服务是否正常!");
}
if (200 == entity.getStatus() && !ObjectUtils.isEmpty(entity.getResult())) {
String json = JSON.toJSONString(entity.getResult());
List<Map<String, String>> listObject = (List<Map<String, String>>) JSONArray.parse(json);
List<IotDataVO> vos = new ArrayList<>();
for (Map<String, String> mapList : listObject) {
for (Map.Entry entry : mapList.entrySet()) {
if (!"name".equals(entry.getKey()) && !"deviceName".equals(entry.getKey())) {
IotDataVO vo = new IotDataVO();
vo.setKey(String.valueOf(entry.getKey()));
vo.setValue(String.valueOf(entry.getValue()));
vos.add(vo);
} }
eqpId = detailDTO.getEqpId();
} }
EquipmentSpecific equipmentSpecific = equipmentSpecificService.getById(eqpId);
iotCode = equipmentSpecific.getIotCode();
} }
List<IotDataVO> timeList = vos.stream().filter(x -> x.getKey().equals("time")).collect(Collectors.toList()); String prefix = null;
List<Date> dates = new ArrayList<>(); String suffix = null;
for (IotDataVO vo : timeList) { if (StringUtil.isNotEmpty(iotCode) && iotCode.length() > 8) {
String value = String.valueOf(vo.getValue()); prefix = iotCode.substring(0, 8);
String strDate = value.substring(0, 19); suffix = iotCode.substring(8);
SimpleDateFormat sdf = new SimpleDateFormat(ISO8601_DATE_HOUR_MIN_SEC); } else {
SimpleDateFormat sdf1 = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN); return CommonResponseUtil.failure("装备物联编码不存在或编码错误,请确认!");
logger.info("返回时间===================================(" + vo.getValue() + ") =======================================");
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
Date date = sdf.parse(strDate);
// String time= sdf.format(date);
String time = DateTimeUtil.format(date, DateTimeUtil.ISO_DATE_HOUR24_MIN_SEC);
dates.add(sdf1.parse(time));
logger.info("返回时间===================================(" + sdf1.parse(time) + ") =======================================");
} }
List<EquipmentSpecificIndex> indexes = equipmentSpecificIndexMapper.getEquipmentSpeIndexByIotCodeAndTrend(iotCode); ResponseModel entity = null;
if (0 < indexes.size()) { try {
List<TopographyIotIndexTrendVo> list = new ArrayList<>(); entity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), beginDate, endDate, prefix, suffix, fieldKey);
vos.forEach(iotDataVO -> { } catch (Exception e) {
indexes.forEach(x -> { throw new RuntimeException("调用AMOS-API-IOT服务失败,请检查服务是否正常!");
if (x.getNameKey().equals(iotDataVO.getKey())) { }
TopographyIotIndexTrendVo vo = new TopographyIotIndexTrendVo(); if (200 == entity.getStatus() && !ObjectUtils.isEmpty(entity.getResult())) {
vo.setId(x.getId()); String json = JSON.toJSONString(entity.getResult());
vo.setName(x.getIndexName()); List<Map<String, String>> listObject = (List<Map<String, String>>) JSONArray.parse(json);
vo.setNameKey(x.getNameKey()); List<IotDataVO> vos = new ArrayList<>();
vo.setUnit(x.getIndexUnitName()); for (Map<String, String> mapList : listObject) {
vo.setTimes(dates); for (Map.Entry entry : mapList.entrySet()) {
vo.setIotData(iotDataVO); if (!"name".equals(entry.getKey()) && !"deviceName".equals(entry.getKey())) {
list.add(vo); IotDataVO vo = new IotDataVO();
vo.setKey(String.valueOf(entry.getKey()));
vo.setValue(String.valueOf(entry.getValue()));
vos.add(vo);
} }
}); }
});
Map<String, List<TopographyIotIndexTrendVo>> maps = list.stream().collect(Collectors.groupingBy(x -> x.getIotData().getKey()));
Map<String, List<IotDataVO>> map = new HashMap<>();
for (String str : maps.keySet()) {
map.put(str, maps.get(str).stream().map(TopographyIotIndexTrendVo::getIotData).collect(Collectors.toList()));
} }
Map<String, Long> mapIndex = new HashMap<>(); // List<IotDataVO> timeList = vos.stream().filter(x -> x.getKey().equals("time")).collect(Collectors.toList());
// List<Date> dates = new ArrayList<>();
for (String str : maps.keySet()) { Map<String, List<Date>> dateMap = new HashMap<>();
mapIndex.put(str, maps.get(str).get(0).getId()); // String indexKey = null;
// String useDate = null;
for (int i = 0; i < vos.size(); i = i + 2) {
Date useDate = null;
String indexKey = null;
if (vos.get(i).getKey().equals("time")) {
String strDate = String.valueOf(vos.get(i).getValue()).substring(0, 19);
SimpleDateFormat sdf = new SimpleDateFormat(ISO8601_DATE_HOUR_MIN_SEC);
useDate = sdf.parse(strDate);
indexKey = String.valueOf(vos.get(i + 1).getKey());
} else {
String strDate = String.valueOf(vos.get(i + 1).getValue()).substring(0, 19);
SimpleDateFormat sdf = new SimpleDateFormat(ISO8601_DATE_HOUR_MIN_SEC);
useDate = sdf.parse(strDate);
indexKey = String.valueOf(vos.get(i).getKey());
}
if (!dateMap.containsKey(indexKey)) {
ArrayList<Date> dates1 = new ArrayList<>();
dates1.add(useDate);
dateMap.put(indexKey, dates1);
} else {
dateMap.get(indexKey).add(useDate);
}
} }
List<IotIndexResVo> res = new ArrayList<>();
for (String s : mapIndex.keySet()) {
IotIndexResVo vo = new IotIndexResVo();
LambdaQueryWrapper<EquipmentIndex> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(EquipmentIndex::getId, mapIndex.get(s));
EquipmentIndex index = iEquipmentIndexService.getOne(queryWrapper);
vo.setIotData(map.get(s));
vo.setId(index.getId());
vo.setName(index.getPerfQuotaName());
vo.setNameKey(index.getPerfQuotaDefinitionId());
vo.setUnit(index.getUnitName());
vo.setTimes(dates);
res.add(vo);
}
for (IotIndexResVo s : res) { // for (IotDataVO vo : vos) {
s.setIotData(map.get(s.getNameKey())); // if (!vo.getKey().equals("time")) {
s.setTimes(dates); // indexKey = vo.getKey();
// if (useDate != null) {
// SimpleDateFormat sdf1 = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN);
// if (!dateMap.containsKey(indexKey)) {
// ArrayList<Date> dates1 = new ArrayList<>();
// dates1.add(sdf1.parse(useDate));
// dateMap.put(indexKey, dates1);
// } else {
// dateMap.get(indexKey).add(sdf1.parse(useDate));
// }
// indexKey = null;
// }
// } else {
// String value = String.valueOf(vo.getValue());
// String strDate = value.substring(0, 19);
// SimpleDateFormat sdf = new SimpleDateFormat(ISO8601_DATE_HOUR_MIN_SEC);
// SimpleDateFormat sdf1 = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN);
// logger.info("返回时间===================================(" + vo.getValue() + ") =======================================");
// sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
// Date date = sdf.parse(strDate);
// String time = DateTimeUtil.format(date, DateTimeUtil.ISO_DATE_HOUR24_MIN_SEC);
// if (indexKey == null) {
// useDate = time;
// }
//// dates.add(sdf1.parse(time));
// logger.info("返回时间===================================(" + sdf1.parse(time) + ") =======================================");
// }
// }
List<EquipmentSpecificIndex> indexes = equipmentSpecificIndexMapper.getEquipmentSpeIndexByIotCodeAndTrend(iotCode);
if (0 < indexes.size()) {
List<TopographyIotIndexTrendVo> list = new ArrayList<>();
vos.forEach(iotDataVO -> {
indexes.forEach(x -> {
if (x.getNameKey().equals(iotDataVO.getKey())) {
TopographyIotIndexTrendVo vo = new TopographyIotIndexTrendVo();
vo.setId(x.getId());
vo.setName(x.getIndexName());
vo.setNameKey(x.getNameKey());
vo.setUnit(x.getIndexUnitName());
vo.setTimes(dateMap.get(x.getNameKey()));
vo.setIotData(iotDataVO);
list.add(vo);
}
});
});
Map<String, List<TopographyIotIndexTrendVo>> maps = list.stream().collect(Collectors.groupingBy(x -> x.getIotData().getKey()));
Map<String, List<IotDataVO>> map = new HashMap<>();
for (String str : maps.keySet()) {
map.put(str, maps.get(str).stream().map(TopographyIotIndexTrendVo::getIotData).collect(Collectors.toList()));
}
Map<String, Long> mapIndex = new HashMap<>();
for (String str : maps.keySet()) {
mapIndex.put(str, maps.get(str).get(0).getId());
}
List<IotIndexResVo> res = new ArrayList<>();
List<IotIndexResVo> resContainsWaterLevelList = new ArrayList<>();
for (String s : mapIndex.keySet()) {
IotIndexResVo vo = new IotIndexResVo();
LambdaQueryWrapper<EquipmentIndex> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(EquipmentIndex::getId, mapIndex.get(s));
EquipmentIndex index = iEquipmentIndexService.getOne(queryWrapper);
vo.setIotData(map.get(s));
vo.setId(index.getId());
vo.setName(index.getPerfQuotaName());
vo.setNameKey(index.getPerfQuotaDefinitionId());
vo.setUnit(index.getUnitName());
vo.setTimes(dateMap.get(index.getPerfQuotaDefinitionId()));
vo.setEquipId(specId);
if (waterLevelIndexKey.contains(vo.getNameKey())) {
resContainsWaterLevelList.add(vo);
} else {
res.add(vo);
}
}
for (IotIndexResVo s : res) {
s.setIotData(map.get(s.getNameKey()));
s.setTimes(dateMap.get(s.getNameKey()));
}
finalRes.addAll(res);
finalResContainsWaterLevel.addAll(resContainsWaterLevelList);
} }
return CommonResponseUtil.success(res);
} }
} }
return CommonResponseUtil.success(); List<Date> containsWaterDates = new ArrayList<>();
Map<String, Map<Date, IotDataVO>> iotDataAndDateMap= new HashMap<>();
finalResContainsWaterLevel.stream().forEach(item -> {
if (!CollectionUtils.isEmpty(item.getTimes())) {
containsWaterDates.addAll(item.getTimes());
Map<Date, IotDataVO> dateDataMap = new HashMap<>();
for (int i = 0; i < item.getTimes().size(); i++) {
dateDataMap.put(item.getTimes().get(i), item.getIotData().get(i));
}
iotDataAndDateMap.put(item.getId() + item.getEquipId(), dateDataMap);
}
});
List<Date> collect = containsWaterDates.stream().distinct().sorted(Comparator.comparing(t -> t)).collect(Collectors.toList());
for (IotIndexResVo indexResVo : finalResContainsWaterLevel) {
IotIndexResVo iotIndexRes = new IotIndexResVo();
iotIndexRes.setName(indexResVo.getName());
iotIndexRes.setTimes(collect);
iotIndexRes.setId(indexResVo.getId());
iotIndexRes.setNameKey(indexResVo.getNameKey());
iotIndexRes.setUnit(indexResVo.getUnit());
Map<Date, IotDataVO> dateIotDataVOMap = iotDataAndDateMap.get(indexResVo.getId() + indexResVo.getEquipId());
List<IotDataVO> list = new ArrayList<>();
collect.forEach(item -> {
IotDataVO iotDataVO = new IotDataVO();
iotDataVO.setValue(0);
iotDataVO.setKey(indexResVo.getIotData().get(0).getKey());
if (dateIotDataVOMap.containsKey(item)) {
iotDataVO.setValue(dateIotDataVOMap.get(item).getValue());
}
list.add(iotDataVO);
});
iotIndexRes.setIotData(list);
resultResContainsWater.add(iotIndexRes);
}
resultMap.put("noMergeList", finalRes);
resultMap.put("mergeList", resultResContainsWater);
return CommonResponseUtil.success(resultMap);
} }
...@@ -1165,6 +1271,32 @@ public class TopographyController extends AbstractBaseController { ...@@ -1165,6 +1271,32 @@ public class TopographyController extends AbstractBaseController {
return CommonResponseUtil.success(indexResMinotFinalVo); return CommonResponseUtil.success(indexResMinotFinalVo);
} }
private List<IotIndexResItemVo> doIndexData(List<IotIndexResItemVo> iotData, Map<String, String> typeNameMap, Map<String, String> typeCodeAndIndexKeyMap) {
iotData.stream().forEach(item -> {
item.setKey(typeCodeAndIndexKeyMap.get(item.getKey()));
item.setName(typeNameMap.get(item.getKey()));
});
Map<String, IotIndexResItemVo> map = new HashMap<>();
List<IotIndexResItemVo> iotDataNew = new ArrayList<>();
for (IotIndexResItemVo iotDatum : iotData) {
if (!map.containsKey(iotDatum.getKey())) {
map.put(iotDatum.getKey(), iotDatum);
} else {
IotIndexResItemVo iotIndexResItemVo = map.get(iotDatum.getKey());
int i = 0;
for (int datum : iotIndexResItemVo.getData()) {
iotIndexResItemVo.getData()[i] = datum + iotDatum.getData()[i];
i++;
}
}
}
for (Map.Entry<String, IotIndexResItemVo> stringIotIndexResItemVoEntry : map.entrySet()) {
iotDataNew.add(stringIotIndexResItemVoEntry.getValue());
}
return iotDataNew;
}
private void fullData(List<IotIndexItemVo> iotIndexItemVos, List<IotIndexResItemVo> iotData, List<String> times, Map<String, String> map ) { private void fullData(List<IotIndexItemVo> iotIndexItemVos, List<IotIndexResItemVo> iotData, List<String> times, Map<String, String> map ) {
for(IotIndexItemVo iVo: iotIndexItemVos) { for(IotIndexItemVo iVo: iotIndexItemVos) {
IotIndexResItemVo itVo = new IotIndexResItemVo(); IotIndexResItemVo itVo = new IotIndexResItemVo();
...@@ -1232,7 +1364,7 @@ public class TopographyController extends AbstractBaseController { ...@@ -1232,7 +1364,7 @@ public class TopographyController extends AbstractBaseController {
for (String dat : dates) { for (String dat : dates) {
if (DateUtils.belongCalendar(dateParse(dat), bDate, dDate)) { if (DateUtils.belongCalendar(dateParse(dat), bDate, dDate)) {
if ("true".equals(timeAndValue.get(dat))) { if (("true".equals(timeAndValue.get(dat))) || (!"true".equals(timeAndValue.get(dat)) && !"false".equals(timeAndValue.get(dat)))) {
num++; num++;
} }
} }
...@@ -1311,4 +1443,233 @@ public class TopographyController extends AbstractBaseController { ...@@ -1311,4 +1443,233 @@ public class TopographyController extends AbstractBaseController {
String time = DateTimeUtil.format(date, DateTimeUtil.ISO_DATE_HOUR24_MIN_SEC); String time = DateTimeUtil.format(date, DateTimeUtil.ISO_DATE_HOUR24_MIN_SEC);
return sdf1.parse(time); return sdf1.parse(time);
} }
/***
*
* 根据设备id获取当前设备的物联指标趋势 【水源页面用】
*
* **/
@RequestMapping(value = "/equipment/trenIotByWater", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据设备id获取当前设备的物联指标趋势【水源页面】", notes = "根据设备id获取当前设备的物联指标趋势【水源页面】")
public ResponseModel trenIotByWater(@RequestParam(required = false) String totalType,
@RequestParam(required = false) String equipId,
@RequestParam(required = false) String fieldKey,
@RequestParam(required = false) String isTrend,
@RequestParam(required = false) String beginDate,
@RequestParam(required = false) String endDate) throws Exception {
List<String> split= Arrays.asList(equipId.split(","));
String allKeys = null;
String names = null;
List<IotIndexItemVo> iotIndexItemVos = new ArrayList<>();
List<IotIndexItemVo> iotIndexItemVoListNew = new ArrayList<>();
Map<String, String> keyIotMap = new HashMap<>();
Map<String, String> map = new HashMap<>();
Map<String, String> typeNameMap = new HashMap<>();
Map<String, String> typeCodeAndIndexKeyMap = new HashMap<>();
List<String> typeCodeList = new ArrayList<>();
List<String> typeNameList = new ArrayList<>();
List<String> indexKeyList = new ArrayList<>();
for (String specificId : split) {
EquipmentSpecific equipmentSpecific = equipmentSpecificService.getById(specificId);
String iotCode = equipmentSpecific.getIotCode();
List<EquipmentIndex> equipmentSpecifics = equipmentIndexService.getPerfQutoaIotList(Long.valueOf(specificId));
if (equipmentSpecifics.size() == 0) {
return CommonResponseUtil.success();
}
equipmentSpecifics.stream().forEach((e)->{
IotIndexItemVo itemVo = new IotIndexItemVo();
IotIndexItemVo indexItemVo = new IotIndexItemVo();
if(!e.getIsTrend()) {
if (!typeNameMap.containsKey(e.getTypeCode())) {
indexItemVo.setKey(e.getTypeCode());
indexItemVo.setName(e.getTypeName());
indexItemVo.setColor(e.getEmergencyLevelColor());
iotIndexItemVoListNew.add(indexItemVo);
}
map.put(e.getPerfQuotaDefinitionId(),e.getPerfQuotaName());
typeNameMap.put(e.getTypeCode(), e.getTypeName());
itemVo.setKey(e.getPerfQuotaDefinitionId());
itemVo.setName(e.getPerfQuotaName());
itemVo.setColor(e.getEmergencyLevelColor());
keyIotMap.put(e.getPerfQuotaDefinitionId() + iotCode, iotCode);
iotIndexItemVos.add(itemVo);
typeCodeAndIndexKeyMap.put(e.getPerfQuotaDefinitionId(), e.getTypeCode());
}
});
if (!CollectionUtils.isEmpty(equipmentSpecifics.stream().filter(equipmentIndex -> !equipmentIndex.getIsTrend()).map(EquipmentIndex::getTypeCode).distinct().collect(Collectors.toList()))) {
typeCodeList.addAll(equipmentSpecifics.stream().filter(equipmentIndex -> !equipmentIndex.getIsTrend()).map(EquipmentIndex::getTypeCode).distinct().collect(Collectors.toList()));
}
if (!CollectionUtils.isEmpty(equipmentSpecifics.stream().filter(equipmentIndex -> !equipmentIndex.getIsTrend()).map(EquipmentIndex::getTypeName).distinct().collect(Collectors.toList()))) {
typeNameList.addAll(equipmentSpecifics.stream().filter(equipmentIndex -> !equipmentIndex.getIsTrend()).map(EquipmentIndex::getTypeName).distinct().collect(Collectors.toList()));
}
if (!CollectionUtils.isEmpty(equipmentSpecifics.stream().filter(equipmentIndex -> !equipmentIndex.getIsTrend()).map(t -> {
return t.getPerfQuotaDefinitionId() + iotCode;
}).distinct().collect(Collectors.toList()))) {
indexKeyList.addAll(equipmentSpecifics.stream().filter(equipmentIndex -> !equipmentIndex.getIsTrend()).map(t -> {
return t.getPerfQuotaDefinitionId() + iotCode;
}).distinct().collect(Collectors.toList())); }
}
allKeys = typeCodeList.stream().distinct().collect(Collectors.joining(","));
names = typeNameList.stream().distinct().collect(Collectors.joining(","));
String parmfieldKey = "";
String parmfieldName = "";
if(StringUtils.isEmpty(fieldKey) ) {
parmfieldKey = allKeys;
parmfieldName = names;
} else {
parmfieldKey = fieldKey;
for(String s: fieldKey.split(",") ) {
parmfieldName = parmfieldName + typeNameMap.get(s) + ",";
}
}
ResponseModel entity = null;
String[] filedKeyArr = parmfieldKey.split(",");
List<IotIndexResMinotVo> res = new ArrayList<>();
IotIndexResMinotFinalVo indexResMinotFinalVo = new IotIndexResMinotFinalVo();
List<Date> datesFinal = new ArrayList<>();
for (String indexKey : indexKeyList) {
String prefix = null;
String suffix = null;
String iotCode = keyIotMap.get(indexKey);
String st = "";
if (StringUtil.isNotEmpty(iotCode) && iotCode.length() > 8) {
prefix = iotCode.substring(0, 8);
suffix = iotCode.substring(8);
st = indexKey.substring(0, indexKey.length() - 16);
} else {
return CommonResponseUtil.failure("装备物联编码不存在或编码错误,请确认!");
}
try {
entity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), beginDate, endDate, prefix, suffix, st);
} catch (Exception e) {
throw new RuntimeException("调用AMOS-API-IOT服务失败,请检查服务是否正常!");
}
if (200 == entity.getStatus() && !ObjectUtils.isEmpty(entity.getResult())) {
String json = JSON.toJSONString(entity.getResult());
List<Map<String, String>> listObject = (List<Map<String, String>>) JSONArray.parse(json);
List<IotDataVO> vos = new ArrayList<>();
Map<String, String> timeAndValue = new HashMap<>();
for (Map<String, String> mapList : listObject) {
for (Map.Entry entry : mapList.entrySet()) {
if (!"name".equals(entry.getKey()) && !"deviceName".equals(entry.getKey())) {
IotDataVO vo = new IotDataVO();
vo.setKey(String.valueOf(entry.getKey()));
vo.setValue(String.valueOf(entry.getValue()));
vos.add(vo);
}
}
if (mapList.containsKey(st)) {
timeAndValue.put(mapList.get("time"), mapList.get(st));
}
}
List<IotDataVO> timeList = vos.stream().filter(x -> x.getKey().equals("time")).collect(Collectors.toList());
List<String> dates = new ArrayList<>();
for (IotDataVO vo : timeList) {
String value = String.valueOf(vo.getValue());
dates.add(value);
}
List<IotDataVO> dataList = new ArrayList<>();
// 处理遥信 时间处理
if (totalType.equals("hour")) {
handle(datesFinal, dates, beginDate, st, dataList, timeAndValue);
} else if (totalType.equals("day")) {
handleDay(datesFinal, beginDate, endDate, st, dates, dataList, timeAndValue);
} else if (totalType.equals("week")) {
handWeek(beginDate, st,dates,dataList,timeAndValue);
} else {
handMonth(beginDate, st,dates,dataList,timeAndValue);
}
IotIndexResMinotVo iotIndexResVo = new IotIndexResMinotVo();
iotIndexResVo.setIotData(dataList);
res.add(iotIndexResVo);
}
}
List<IotIndexResItemVo> iotData = new ArrayList<>();
for(IotIndexResMinotVo s : res) {
IotIndexResItemVo itemVo = new IotIndexResItemVo();
List<Integer> list = new ArrayList<>();
for (IotDataVO v: s.getIotData()) {
list.add(Integer.parseInt(v.getValue().toString()));
itemVo.setName(map.get(v.getKey()));
itemVo.setKey(v.getKey());
}
itemVo.setData(list.stream().mapToInt(i->i).toArray());
iotData.add(itemVo);
}
if(totalType.equals("week") || totalType.equals("month") || totalType.equals("hour") || totalType.equals("day")) {
List<String> times = null;
if(totalType.equals("week")) {
times = DateUtils.getWeeksMap(DateUtils.dateToStringMonth(beginDate));
} else if(totalType.equals("month")) {
String year = beginDate.substring(0,4);
times = new ArrayList<>();
for(int i =1; i <= 12; i++) {
if(i < 10) {
String m = year + "-" + "0" + i;
times.add(m);
} else {
String m = year + "-" + i;
times.add(m);
}
}
} else if(totalType.equals("hour") || totalType.equals("day")) {
times = new ArrayList<>();
if(totalType.equals("hour")) {
String[] arr = DateUtils.TWENTY_FOUR;
Date date = DateUtils.dateParse(beginDate,DateUtils.DATE_PATTERN);
String dateDayT = DateUtils.dateFormat(date, DateUtils.DATE_PATTERN);
if (datesFinal.size() == 0) {
for (String str : arr) {
String dateDay = dateDayT;
dateDay = dateDay + str;
datesFinal.add(DateUtils.dateParse(dateDay, DateUtils.DATE_TIME_PATTERN));
}
}
} else {
if (datesFinal.size() == 0) {
datesFinal.addAll(DateUtils.findDaysStr(DateUtils.dateToString(beginDate), DateUtils.dateToString(endDate)));
}
}
for (Date date : datesFinal) {
times.add(DateUtils.convertDateToString(date, totalType.equals("hour") ? DateUtils.HOUR_PATTERN : DateUtils.DATE_PATTERN));
}
}
if(iotData.size() == 0) {
fullData(iotIndexItemVos,iotData,times,map);
}
List<IotIndexResItemVo> iotIndexResItemVos = doIndexData(iotData, typeNameMap, typeCodeAndIndexKeyMap);
indexResMinotFinalVo.setTimes(times);
indexResMinotFinalVo.setNameKey(StringUtils.isEmpty(fieldKey) ? allKeys.toString().split(",") : fieldKey.split(","));
indexResMinotFinalVo.setName(StringUtils.isEmpty(fieldKey) ? names.toString().split(",") : parmfieldName.split(","));
indexResMinotFinalVo.setItems(iotIndexItemVoListNew);
indexResMinotFinalVo.setIotData(iotIndexResItemVos);
}
return CommonResponseUtil.success(indexResMinotFinalVo);
}
} }
...@@ -221,6 +221,9 @@ public interface EquipmentSpecificAlarmMapper extends BaseMapper<EquipmentSpecif ...@@ -221,6 +221,9 @@ public interface EquipmentSpecificAlarmMapper extends BaseMapper<EquipmentSpecif
Map<String, Object> inspectionMessage(@Param("orgCode") String orgCode Map<String, Object> inspectionMessage(@Param("orgCode") String orgCode
, @Param("startTime") String startTime , @Param("startTime") String startTime
, @Param("endTime") String endTime); , @Param("endTime") String endTime);
Map<String, Object> pressureMessage(@Param("orgCode") String orgCode
, @Param("startTime") String startTime
, @Param("endTime") String endTime);
Page<Map<String, Object>> fireAlarmLogPage(Page page, @Param("param") CommonPageInfoParam param); Page<Map<String, Object>> fireAlarmLogPage(Page page, @Param("param") CommonPageInfoParam param);
......
...@@ -93,6 +93,7 @@ public interface IEquipmentSpecificAlarmService extends IService<EquipmentSpecif ...@@ -93,6 +93,7 @@ public interface IEquipmentSpecificAlarmService extends IService<EquipmentSpecif
List<Map<String, Object>> fireFacilitiesList(String bizOrgCode, String startTime, String endTime); List<Map<String, Object>> fireFacilitiesList(String bizOrgCode, String startTime, String endTime);
Map<String, Object> dailyMaintenance(String bizOrgCode,String orgCode, String startTime, String endTime); Map<String, Object> dailyMaintenance(String bizOrgCode,String orgCode, String startTime, String endTime);
Map<String, Object> inspectionMessage(String orgCode, String startTime, String endTime); Map<String, Object> inspectionMessage(String orgCode, String startTime, String endTime);
Map<String, Object> pressureMessage(String orgCode, String startTime, String endTime);
Page<Map<String, Object>> fireAlarmLogPage(CommonPageInfoParam param); Page<Map<String, Object>> fireAlarmLogPage(CommonPageInfoParam param);
......
...@@ -760,6 +760,38 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec ...@@ -760,6 +760,38 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
} }
@Override @Override
public Map<String, Object> pressureMessage(String orgCode, String startTime, String endTime) {
Map<String, Object> stringObjectMap = equipmentSpecificAlarmMapper.pressureMessage(orgCode, startTime, endTime);
Map<String, Object> retMap = new HashMap<>();
int allNum = Integer.parseInt(stringObjectMap.get("allNum").toString());
int startNum = Integer.parseInt(stringObjectMap.get("startNum").toString());
// 计算平均每小时打压频率
try {
int hour = DateUtils.dateBetweenNew(DateUtils.dateParse(startTime, null),DateUtils.dateParse(endTime, null));
int hafHour = DateUtils.dateBetweenNew1(DateUtils.dateParse(startTime, null),DateUtils.dateParse(endTime, null));
int twoHour = DateUtils.dateBetweenNew2(DateUtils.dateParse(startTime, null),DateUtils.dateParse(endTime, null));
int fourHour = DateUtils.dateBetweenNew3(DateUtils.dateParse(startTime, null),DateUtils.dateParse(endTime, null));
if(allNum/hour > 15) {
retMap.put("status","异常");
} else {
retMap.put("status","正常");
}
retMap.put("name", stringObjectMap.get("name").toString());
String frequency = "稳压泵总数"+stringObjectMap.get("allEqu").toString()+"台,平均近半小时启动"+startNum/hafHour+"次,"+
"平均2小时启动"+startNum/twoHour+"次,"+"平均4小时启动"+startNum/fourHour+"次";
retMap.put("frequency",frequency);
} catch (ParseException e) {
e.printStackTrace();
}
return retMap;
}
@Override
public Page<Map<String, Object>> fireAlarmLogPage(CommonPageInfoParam param) { public Page<Map<String, Object>> fireAlarmLogPage(CommonPageInfoParam param) {
Page result = new Page<>(param.getPageNumber(), param.getPageSize()); Page result = new Page<>(param.getPageNumber(), param.getPageSize());
return this.baseMapper.fireAlarmLogPage(result, param); return this.baseMapper.fireAlarmLogPage(result, param);
......
package com.yeejoin.equipmanage.service.impl; package com.yeejoin.equipmanage.service.impl;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -434,6 +435,41 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements ...@@ -434,6 +435,41 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
if (ValidationUtil.isEmpty(x.getBizOrgName())) { if (ValidationUtil.isEmpty(x.getBizOrgName())) {
throw new RuntimeException("机构/部门名称不能为空,请修改后上传!"); throw new RuntimeException("机构/部门名称不能为空,请修改后上传!");
} }
//字段长度效验
if (ValidationUtil.isEmpty(x.getName())&&x.getName().length()>100) {
throw new RuntimeException("错误行" + rowNum + ":名字过长");
}
if (ValidationUtil.isEmpty(x.getCode())&&x.getCode().length()>100) {
throw new RuntimeException("错误行" + rowNum + ":编号过长");
}
if (ValidationUtil.isEmpty(x.getUrl())&&x.getUrl().length()>255) {
throw new RuntimeException("错误行" + rowNum + ":视频地址过长");
}
if (ValidationUtil.isEmpty(x.getToken())&&x.getToken().length()>255) {
throw new RuntimeException("错误行" + rowNum + ":token过长");
}
if (ValidationUtil.isEmpty(x.getBizOrgCode())&&x.getBizOrgCode().length()>64) {
throw new RuntimeException("错误行" + rowNum + ":机构编码过长");
}
if (ValidationUtil.isEmpty(x.getBizOrgName())&&x.getBizOrgName().length()>128) {
throw new RuntimeException("错误行" + rowNum + ":机构名称过长");
}
if (ValidationUtil.isEmpty(x.getAddress())&&x.getAddress().length()>2000) {
throw new RuntimeException("错误行" + rowNum + ":地址过长");
}
if (ValidationUtil.isEmpty(x.getRemark())&&x.getRemark().length()>255) {
throw new RuntimeException("错误行" + rowNum + ":备注过长");
}
if (ValidationUtil.isEmpty(x.getImg())&&x.getImg().length()>100) {
throw new RuntimeException("错误行" + rowNum + ":备注过长");
}
// if (!urlPattern.matcher(x.getUrl().trim()).matches()) { // if (!urlPattern.matcher(x.getUrl().trim()).matches()) {
// throw new RuntimeException("错误行" + rowNum + ":视频地址格式有误,仅支持协议+ip+端口的格式"); // throw new RuntimeException("错误行" + rowNum + ":视频地址格式有误,仅支持协议+ip+端口的格式");
// } // }
...@@ -451,6 +487,8 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements ...@@ -451,6 +487,8 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
video.setBizOrgCode(x.getBizOrgCode()); video.setBizOrgCode(x.getBizOrgCode());
video.setBizOrgName(x.getBizOrgName()); video.setBizOrgName(x.getBizOrgName());
videos.add(video); videos.add(video);
try {
this.baseMapper.insert(video); this.baseMapper.insert(video);
// 处理监控和建筑关系 // 处理监控和建筑关系
if (!ValidationUtil.isEmpty(x.getBuildingCodes())) { if (!ValidationUtil.isEmpty(x.getBuildingCodes())) {
...@@ -467,7 +505,9 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements ...@@ -467,7 +505,9 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
videoEquipmentSpecifics.addAll(this.buildVideoEquipmentSpecific(equipMap, video.getId(), x.getEquipmentSpecificCodes(), rowNum)); videoEquipmentSpecifics.addAll(this.buildVideoEquipmentSpecific(equipMap, video.getId(), x.getEquipmentSpecificCodes(), rowNum));
// 处理监控和多个电力设备关系(1个摄像头对多个电力装备) // 处理监控和多个电力设备关系(1个摄像头对多个电力装备)
videoImportantEquipments.addAll(this.buildVideoImportantEquipment(fireMap, video.getId(), x.getImportantEquipmentCodes(), rowNum)); videoImportantEquipments.addAll(this.buildVideoImportantEquipment(fireMap, video.getId(), x.getImportantEquipmentCodes(), rowNum));
}catch (Exception e) {
throw new RuntimeException("系统异常!");
}
} }
if (!videoSources.isEmpty()) { if (!videoSources.isEmpty()) {
videoSourceService.saveBatch(videoSources); videoSourceService.saveBatch(videoSources);
......
...@@ -334,7 +334,9 @@ public class ExcelServiceImpl { ...@@ -334,7 +334,9 @@ public class ExcelServiceImpl {
break; break;
case "QDSJ": case "QDSJ":
SignDto dto = new SignDto(); SignDto dto = new SignDto();
String fileName=null;
if(par!=null && par.size()>0) { if(par!=null && par.size()>0) {
String date =par.containsKey("date")?par.get("date").toString():null; String date =par.containsKey("date")?par.get("date").toString():null;
// String bizOrgCode =par.containsKey("bizOrgCode")?par.get("bizOrgCode").toString():null; // String bizOrgCode =par.containsKey("bizOrgCode")?par.get("bizOrgCode").toString():null;
String bizOrgName =par.containsKey("bizOrgName")?par.get("bizOrgName").toString():null; String bizOrgName =par.containsKey("bizOrgName")?par.get("bizOrgName").toString():null;
...@@ -352,6 +354,12 @@ public class ExcelServiceImpl { ...@@ -352,6 +354,12 @@ public class ExcelServiceImpl {
dto.setSignTimeBIGGER(signTimeBIGGER); dto.setSignTimeBIGGER(signTimeBIGGER);
dto.setSignTimeLESS(signTimeLESS); dto.setSignTimeLESS(signTimeLESS);
dto.setType(type); dto.setType(type);
//区分统计和签到
if(!par.containsKey("current")){
OrgUsr orgUsr1 = orgUsrMapper.queryByBizCode(reginParams.getPersonIdentity().getCompanyBizOrgCode());
fileName="【"+orgUsr1.getBizOrgName()+"】-【"+date+"】·消防人员出勤明细";
}
} }
Page<SignDto> page = new Page<>(); Page<SignDto> page = new Page<>();
...@@ -362,7 +370,8 @@ public class ExcelServiceImpl { ...@@ -362,7 +370,8 @@ public class ExcelServiceImpl {
signDtos.getRecords().stream().forEach(e->{ signDtos.getRecords().stream().forEach(e->{
e.setType(e.getType().equals("0") ? "上班打卡" :"下班打卡" ); e.setType(e.getType().equals("0") ? "上班打卡" :"下班打卡" );
}); });
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(),
ExcelUtil.createTemplate(response, fileName!=null?fileName:excelDto.getFileName(), excelDto.getSheetName(),
signDtos.getRecords(), SignDto.class, null, false); signDtos.getRecords(), SignDto.class, null, false);
break; break;
case "KEYSITE": case "KEYSITE":
......
...@@ -122,4 +122,7 @@ state.code=GW190301 ...@@ -122,4 +122,7 @@ state.code=GW190301
state.name=\u9526\u5c4f\u6362\u6d41\u7ad9 state.name=\u9526\u5c4f\u6362\u6d41\u7ad9
# 是否开启遥测数据上报 # 是否开启遥测数据上报
is.open.telemetering=false is.open.telemetering=false
\ No newline at end of file
# 水池液位相关信号
water.level.indexKey=FHS_FirePoolDevice_WaterLevel,FHS_LevelDetector_WaterLevel,FHS_WirelessliquidDetector_WaterLevel,CAFS_FoamTank_FoamTankLevel,CAFS_WaterTank_WaterTankLevel
\ No newline at end of file
...@@ -523,7 +523,16 @@ ...@@ -523,7 +523,16 @@
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="tw" id="2022-12-12-21">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_video" columnName="address"/>
</not>
</preConditions>
<sql>
alter table `wl_video` MODIFY COLUMN `address` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '地址';
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
\ No newline at end of file
...@@ -14,18 +14,18 @@ ...@@ -14,18 +14,18 @@
select select
s.id, s.id,
CONCAT(s.name,',',#{beginDate},' - ',#{endDate} ,':',CHAR(10), CONCAT(s.name,',',#{beginDate},' - ',#{endDate} ,':',CHAR(10),
CONCAT('正常设备',IFNULL(f1.totalNormalEquipNum,0),'台,','正常率:',concat(TRUNCATE(IFNULL(f1.normalEquipNumPercent,0)*100, 2),'%'),',', CONCAT('正常设备',IFNULL(f1.totalNormalEquipNum,0),'台,','正常率:',concat(TRUNCATE(ABS(IFNULL(f1.normalEquipNumPercent,0)*100), 2),'%'),',',
'同比上月',IF(IFNULL(f1.totalNormalEquipNum,0)- IFNULL(f1.lastMonthTotalNormalEquipNum,0) >0 ,'增加','减少'), '同比上月',IF(IFNULL(f1.totalNormalEquipNum,0)- IFNULL(f1.lastMonthTotalNormalEquipNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalNormalEquipNum,0) = 0 ,'---',CONCAT(TRUNCATE(IFNULL(f1.totalNormalEquipNum,0)/f1.lastMonthTotalNormalEquipNum -1,2)* 100,'%')),',',CHAR(10)), if(IFNULL(f1.lastMonthTotalNormalEquipNum,0) = 0 ,'---',CONCAT(TRUNCATE(ABS(IFNULL(f1.totalNormalEquipNum,0)/f1.lastMonthTotalNormalEquipNum -1),2)* 100,'%')),',',CHAR(10)),
CONCAT('故障设备',IFNULL(f1.totalFaultEquipNum,0),'台,','故障率:',concat(TRUNCATE(IFNULL(f1.faultEquipPercent,0),2)*100,'%'),',', CONCAT('故障设备',IFNULL(f1.totalFaultEquipNum,0),'台,','故障率:',concat(TRUNCATE(ABS(IFNULL(f1.faultEquipPercent,0)),2)*100,'%'),',',
'同比上月',IF(IFNULL(f1.totalFaultEquipNum,0)- IFNULL(f1.lastMonthTotalFaultEquipNum,0) >0 ,'增加','减少'), '同比上月',IF(IFNULL(f1.totalFaultEquipNum,0)- IFNULL(f1.lastMonthTotalFaultEquipNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalFaultEquipNum,0) = 0 ,'---',CONCAT(TRUNCATE(IFNULL(f1.totalFaultEquipNum,0)/f1.lastMonthTotalFaultEquipNum -1,2)* 100,'%')),',',CHAR(10)), if(IFNULL(f1.lastMonthTotalFaultEquipNum,0) = 0 ,'---',CONCAT(TRUNCATE(ABS(IFNULL(f1.totalFaultEquipNum,0)/f1.lastMonthTotalFaultEquipNum -1),2)* 100,'%')),',',CHAR(10)),
CONCAT('告警设备',IFNULL(f1.totalAlarmEquipNum,0),'台,', CONCAT('告警设备',IFNULL(f1.totalAlarmEquipNum,0),'台,',
'同比上月',IF(IFNULL(f1.totalAlarmEquipNum,0)- IFNULL(f1.lastMonthTotalAlarmEquipNum,0) >0 ,'增加','减少'), '同比上月',IF(IFNULL(f1.totalAlarmEquipNum,0)- IFNULL(f1.lastMonthTotalAlarmEquipNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalAlarmEquipNum,0) = 0 ,'---',CONCAT(TRUNCATE(IFNULL(f1.totalAlarmEquipNum,0)/f1.lastMonthTotalAlarmEquipNum -1,2)* 100,'%')),',',CHAR(10)), if(IFNULL(f1.lastMonthTotalAlarmEquipNum,0) = 0 ,'---',CONCAT(TRUNCATE(ABS(IFNULL(f1.totalAlarmEquipNum,0)/f1.lastMonthTotalAlarmEquipNum -1),2)* 100,'%')),',',CHAR(10)),
CONCAT('告警总数',IFNULL(f1.totalAlarmInfoNum,0),'条,', CONCAT('告警总数',IFNULL(f1.totalAlarmInfoNum,0),'条,',
'同比上月',IF(IFNULL(f1.totalAlarmInfoNum,0)- IFNULL(f1.lastMonthTotalAlarmInfoNum,0) >0 ,'增加','减少'), '同比上月',IF(IFNULL(f1.totalAlarmInfoNum,0)- IFNULL(f1.lastMonthTotalAlarmInfoNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalAlarmInfoNum,0) = 0 ,'---', CONCAT(TRUNCATE(IFNULL(f1.totalAlarmInfoNum,0)/f1.lastMonthTotalAlarmInfoNum -1,2)* 100,'%')) if(IFNULL(f1.lastMonthTotalAlarmInfoNum,0) = 0 ,'---', CONCAT(TRUNCATE(ABS(IFNULL(f1.totalAlarmInfoNum,0)/f1.lastMonthTotalAlarmInfoNum -1),2)* 100,'%'))
,'。')) as content, ,'。')) as content,
s.`name`, s.`name`,
3 as report_type, 3 as report_type,
......
...@@ -225,7 +225,7 @@ ...@@ -225,7 +225,7 @@
group_name group_name
</select> </select>
<select id="getPerfQutoaIotList" resultType="com.yeejoin.equipmanage.common.entity.EquipmentIndex"> <select id="getPerfQutoaIotList" resultType="com.yeejoin.equipmanage.common.entity.EquipmentIndex">
select id,name as perfQuotaName, name_key as perfQuotaDefinitionId,is_trend as isTrend,emergency_level_color as emergencyLevelColor from wl_equipment_index s where equipment_id = ( select id,name as perfQuotaName, name_key as perfQuotaDefinitionId,is_trend as isTrend,emergency_level_color as emergencyLevelColor, type_name as typeName, type_code as typeCode from wl_equipment_index s where equipment_id = (
select equipment_id from wl_equipment_detail wei where id = ( select equipment_id from wl_equipment_detail wei where id = (
select equipment_detail_id from wl_equipment_specific where id = #{id}) select equipment_detail_id from wl_equipment_specific where id = #{id})
) )
......
...@@ -72,7 +72,12 @@ ...@@ -72,7 +72,12 @@
AND construction_unit = #{construction} AND construction_unit = #{construction}
</if> </if>
<if test="nameOrCode != null and nameOrCode != ''"> <if test="nameOrCode != null and nameOrCode != ''">
AND (CODE like CONCAT('%',#{nameOrCode},'%') or NAME like CONCAT('%',#{equimentName},'%')) AND (CODE like CONCAT('%',#{nameOrCode},'%') or NAME like CONCAT('%',#{nameOrCode},'%'))
</if>
<if test="typeIds != null and typeIds != ''">
AND system_type in
<foreach item="item" collection="typeIds" separator="," open="(" close=")" index=""> #{item}
</foreach>
</if> </if>
<if test="controBoxBuildId != null "> <if test="controBoxBuildId != null ">
AND contro_box_build = #{controBoxBuildId} AND contro_box_build = #{controBoxBuildId}
...@@ -99,6 +104,25 @@ ...@@ -99,6 +104,25 @@
wl_manufacturer_info wl_manufacturer_info
order by id order by id
</select> </select>
<select id="getSystemListNew" resultType="com.yeejoin.equipmanage.common.vo.EquipmentManageVo">
SELECT
id,
`name`,
`code`
FROM
wl_equipment_category
WHERE
parent_id = (
SELECT
CONCAT(id, '')
FROM
wl_equipment_category
WHERE
`code` = '92000000'
) AND name like CONCAT('%',#{nameOrCode},'%')
ORDER BY
`code`
</select>
<select id="getSystemList" resultType="com.yeejoin.equipmanage.common.vo.EquipmentManageVo"> <select id="getSystemList" resultType="com.yeejoin.equipmanage.common.vo.EquipmentManageVo">
SELECT SELECT
id, id,
......
...@@ -1476,4 +1476,41 @@ ...@@ -1476,4 +1476,41 @@
ORDER BY ORDER BY
`result`.`click_date` `result`.`click_date`
</select> </select>
<select id="pressureMessage" resultType="java.util.Map">
select
(
select
count(1)
from
wl_equipment_specific_index
where
equipment_index_key in ('FHS_PressurePump_Start', 'FHS_PressurePump_Stop')
and update_date >=
#{startTime} and #{endTime} >= update_date
) as allNum,
(
select
(
select
count(1)
from
wl_equipment_detail wed
where
wed.code like '92010800%' ) as allEqu) as allEqu,
(
select
'稳压泵平均打压频次' as name) as name,
(
select
(
select
count(1)
from
wl_equipment_specific_index
where
equipment_index_key in ('FHS_PressurePump_Start')
and update_date >=
#{startTime} and #{endTime} >= update_date
) as startNum) as startNum
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
</select> </select>
<select id="getCheckInputSyncBoList" resultType="com.yeejoin.amos.patrol.business.bo.CheckInputSyncBo" parameterType="java.util.Map"> <select id="getCheckInputSyncBoList" resultType="com.yeejoin.amos.patrol.business.bo.CheckInputSyncBo" parameterType="java.util.Map">
<![CDATA[ <![CDATA[
SELECT SELECT
ci.id, ci.id,
ci.input_name, ci.input_name,
ci.input_value, ci.input_value,
...@@ -120,19 +120,19 @@ ...@@ -120,19 +120,19 @@
LEFT JOIN wl_warehouse_structure wws ON wws.id = pp.risk_source_id LEFT JOIN wl_warehouse_structure wws ON wws.id = pp.risk_source_id
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
biz_org_name, o.biz_org_name,
biz_org_code bzOrgCode, o.biz_org_code bzOrgCode,
amos_org_id, o.amos_org_id,
amos_org_code, o.amos_org_code,
`code` o.`code`
FROM FROM
cb_org_usr cb_org_usr o,
`idx_biz_station_info` s
WHERE WHERE
amos_org_code <> '' o.biz_org_type = 'COMPANY'
AND amos_org_code IS NOT NULL and o.is_delete = 0
AND biz_org_type = 'COMPANY' and o.`code` = s.`code`
and is_delete = 0 ) cou ON LOCATE(cou.bzOrgCode, ci.org_code) > 0 ]]>
) cou ON cou.bzOrgCode = ci.org_code ]]>
<where> <where>
<if test="id != null"> <if test="id != null">
ci.id = #{id} ci.id = #{id}
......
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