Commit 66a1a530 authored by lisong's avatar lisong

Merge remote-tracking branch 'origin/develop_dl_plan6' into develop_dl_plan6

parents cf02e7ac 7cd9874a
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.common.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.biz.common.annotations.DataAuth;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import org.apache.ibatis.annotations.Param;
......@@ -124,4 +125,12 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
List<OrgUsr> selectPersonListByCompanyIdList(@Param("companyIdList") List<String> companyIdList);
Map<String,String> getManagePerson(@Param("name")String name ,@Param("ids")List<Long> ids);
/**
* 检查身份证号码是否存在
* @param certificatesNumber
* @param orgUserId
* @return
*/
List<DynamicFormInstance> checkCertificatesNumber(String certificatesNumber, Long orgUserId);
}
......@@ -111,7 +111,7 @@
IFNULL(b.employee_hierarchy, '无')
employeeHierarchy,
IFNULL(b.areas_expertise, '无') areasExpertise,
IFNULL(a.gender, '无') gender,
IFNULL((SELECT NAME FROM cb_data_dictionary WHERE CODE = a.gender AND type = 'XB'), a.gender) gender,
IFNULL(b.post_qualification, '无')
postQualification, year ( from_days( datediff( now( ),
a.birthday_time))) age
......@@ -255,7 +255,7 @@ SELECT
)
AND cf.is_delete = FALSE
<if test="jobCode != null">
AND cf.job_title_code = #{jobCode}
AND find_in_set(#{jobCode},cf.job_title_code) > 0
</if>
) cff
......
......@@ -42,7 +42,7 @@
max(case v.field_code when 'administrativePositionCode' then IFNULL(v.field_value_label,v.field_value) end) administrativePositionCode,
max(case v.field_code when 'internalPositionCode' then IFNULL(v.field_value_label,v.field_value) end) internalPositionCode,
max(case v.field_code when 'fireManagementPostCode' then IFNULL(v.field_value_label,v.field_value) end) fireManagementPostCode,
max(case v.field_code when 'positionType' then IFNULL(v.field_value_label,v.field_value) end) positionType,
max(case v.field_code when 'positionType' then IFNULL(v.field_value,v.field_value_label) end) positionType,
max(case v.field_code when 'certificateType' then IFNULL(v.field_value_label,v.field_value) end) certificateType,
max(case v.field_code when 'holdingTime' then IFNULL(v.field_value_label,v.field_value) end) holdingTime,
max(case v.field_code when 'auditCycle' then IFNULL(v.field_value_label,v.field_value) end) auditCycle,
......@@ -701,10 +701,10 @@ GROUP BY
FROM cb_dynamic_form_instance GROUP BY instance_id) b
on b.instance_id=a.sequence_nbr
LEFT JOIN cb_firefighters_contacts fc ON a.sequence_nbr = fc.org_usr_id
LEFT JOIN cb_firefighters_workexperience fw ON a.sequence_nbr = fw.org_usr_id
LEFT JOIN cb_firefighters_education fe ON a.sequence_nbr = fe.org_usr_id
LEFT JOIN cb_firefighters_post fp ON a.sequence_nbr = fp.org_usr_id
LEFT JOIN cb_firefighters_contacts fc ON CAST(a.sequence_nbr as char) = fc.org_usr_id
LEFT JOIN cb_firefighters_workexperience fw ON CAST(a.sequence_nbr as char) = fw.org_usr_id
LEFT JOIN cb_firefighters_education fe ON CAST(a.sequence_nbr as char) = fe.org_usr_id
LEFT JOIN cb_firefighters_post fp ON CAST(a.sequence_nbr as char) = fp.org_usr_id
where a.biz_org_name is not null and a.is_delete = 0 and a.biz_org_type = 'PERSON'
<if test="parentId != null and parentId != '' and parentId != '-1'">
......@@ -1037,4 +1037,17 @@ LEFT JOIN (
#{item}
</foreach>;
</select>
<select id="checkCertificatesNumber" resultType="com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance">
SELECT
*
FROM
cb_dynamic_form_instance cdf
LEFT JOIN cb_org_usr cou ON cdf.instance_id = cou.sequence_nbr
WHERE
cdf.field_code = 'certificatesNumber' AND cdf.field_value = #{certificatesNumber}
<if test="orgUserId != null">
AND cdf.instance_id <![CDATA[<>]]> #{orgUserId}
</if>
AND cou.is_delete = 0
</select>
</mapper>
......@@ -146,4 +146,8 @@ public class EquipmentSpecificIndex extends BaseEntity {
@TableField(exist = false)
private String buildId;
@ApiModelProperty(value = "是否遥测")
@TableField(exist = false)
private Integer isTrend;
}
package com.yeejoin.equipmanage.common.entity.vo;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.util.Date;
/**
* 物联指标日志实体
* @author xxz
*/
@Data
@ApiModel(description = "物联指标日志实体")
public class IotIndexInfoVo {
/**
* 指标类型
*/
private String type;
/**
* 上报内容
*/
private String content;
/**
* 日志编号
*/
private String number;
/**
* 上报时间
*/
private String sendTime;
}
......@@ -2,11 +2,11 @@ package com.yeejoin.equipmanage.common.utils;
import org.apache.commons.lang3.StringUtils;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.*;
/**
* @description: 时间工具类
......@@ -17,13 +17,25 @@ public class DateUtils {
public static final String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
public static final String MINUTE_PATTERN = "yyyy-MM-dd HH:mm";
public static final String HOUR_PATTERN = "yyyy-MM-dd HH:mm:ss";
public static final String HOUR_PATTERN = "yyyy-MM-dd HH";
public static final String DATE_PATTERN = "yyyy-MM-dd";
public static final String MONTH_PATTERN = "yyyy-MM";
public static final String YEAR_PATTERN = "yyyy";
public static final String MINUTE_ONLY_PATTERN = "mm";
public static final String HOUR_ONLY_PATTERN = "HH";
public static final String DATE_TIME_T_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
public static final String[] TWENTY_FOUR = new String[]{" 00:00:00"," 01:00:00"," 02:00:00",
" 03:00:00"," 04:00:00"," 05:00:00"," 06:00:00"," 07:00:00"," 08:00:00"," 09:00:00"," 10:00:00"," 11:00:00"," 12:00:00"," 13:00:00",
" 14:00:00"," 15:00:00"," 16:00:00"," 17:00:00"," 18:00:00"," 19:00:00"," 20:00:00"," 21:00:00"," 22:00:00"," 23:00:00"};
/**
* 获取 当前年、半年、季度、月、日、小时 开始结束时间
*/
private static final SimpleDateFormat shortSdf = new SimpleDateFormat("yyyy-MM-dd");
private static final SimpleDateFormat longHourSdf = new SimpleDateFormat("yyyy-MM-dd HH");
private static final SimpleDateFormat longSdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private static final Calendar calendar = Calendar.getInstance();
private static final SimpleDateFormat shortDateNew = new SimpleDateFormat("yyyy/M/d");
/**
* 获取当前时间
*
......@@ -163,6 +175,46 @@ public class DateUtils {
return content;
}
/**
* 暂时不操作原生截取做下转换
*
* @param str
* @return
* @throws ParseException
*/
public static String dateToStringMonth(String str) {
SimpleDateFormat sdf = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN);
Date parse = null;
String content = null;
try {
parse = sdf.parse(str);
content = DateUtils.dateFormat(parse, DateUtils.MONTH_PATTERN);
} catch (ParseException e) {
e.printStackTrace();
}
return content;
}
/**
* 暂时不操作原生截取做下转换
*
* @param str
* @return
* @throws ParseException
*/
public static String dateToStringY(String str) {
SimpleDateFormat sdf = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN);
Date parse = null;
String content = null;
try {
parse = sdf.parse(str);
content = DateUtils.dateFormat(parse, DateUtils.YEAR_PATTERN);
} catch (ParseException e) {
e.printStackTrace();
}
return content;
}
/*
* 将时间戳转换为时间
......@@ -594,4 +646,237 @@ public class DateUtils {
return cal.getTime();
}
/**
* 判断一个时间是否在一个时间段内
*
* @param nowTime 当前时间
* @param beginTime 开始时间
* @param endTime 结束时间
*/
public static boolean belongCalendar(Date nowTime, Date beginTime, Date endTime) {
Calendar date = Calendar.getInstance();
date.setTime(nowTime);
Calendar begin = Calendar.getInstance();
begin.setTime(beginTime);
Calendar end = Calendar.getInstance();
end.setTime(endTime);
return date.after(begin) && date.before(end);
}
/**
* 获得本天的开始时间,即2012-01-01 00:00:00
*
* @return
*/
public static Date getCurrentDayStartTime(Date date) {
try {
date = shortSdf.parse(shortSdf.format(date) + " 00:00:00");
} catch (ParseException e) {
e.printStackTrace();
}
return date;
}
/**
* 获得本天的结束时间,即2012-01-01 23:59:59
*
* @return
*/
public static Date getCurrentDayEndTime(Date date) {
try {
date = longSdf.parse(shortSdf.format(date) + " 23:59:59");
} catch (ParseException e) {
e.printStackTrace();
}
return date;
}
public static List<Date> findDaysStr(String cntDateBeg, String cntDateEnd) {
List<Date> list = new ArrayList<>();
//拆分成数组
String[] dateBegs = cntDateBeg.split("-");
String[] dateEnds = cntDateEnd.split("-");
//开始时间转换成时间戳
Calendar start = Calendar.getInstance();
start.set(Integer.valueOf(dateBegs[0]), Integer.valueOf(dateBegs[1]) - 1, Integer.valueOf(dateBegs[2]));
Long startTIme = start.getTimeInMillis();
//结束时间转换成时间戳
Calendar end = Calendar.getInstance();
end.set(Integer.valueOf(dateEnds[0]), Integer.valueOf(dateEnds[1]) - 1, Integer.valueOf(dateEnds[2]));
Long endTime = end.getTimeInMillis();
//定义一个一天的时间戳时长
Long oneDay = 1000 * 60 * 60 * 24L;
Long time = startTIme;
//循环得出
while (time <= endTime) {
list.add(DateUtils.getCurrentDayStartTime(new Date(time)));
time += oneDay;
}
return list;
}
/**
* 获取当前月自然周数,并返回每周开始日期和每周结束日期
* @param date 2013-9 : 1-1,2-8,9-15,16-22,23-29,30-30
* @return
* @throws Exception
*/
public static List<String> getWeeks(String date){
List<String> dates = new ArrayList<>();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
Date date1 = null;
try {
date1 = dateFormat.parse(date);
} catch (ParseException e) {
System.out.println("获取当前月自然周,日期格式转换错误!11");
e.printStackTrace();
}
Calendar calendar = new GregorianCalendar();
calendar.setTime(date1);
int days = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
int count = 0;
for (int i = 1; i <= days; i++) {
DateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd");
Date date2 = null;
try {
date2 = dateFormat1.parse(date + "-" + i);
} catch (ParseException e) {
System.out.println("获取当前月自然周,日期格式转换错误!22");
e.printStackTrace();
}
calendar.clear();
calendar.setTime(date2);
int k = new Integer(calendar.get(Calendar.DAY_OF_WEEK));
int startDay = 0;
int endDay = 0;
// 若当天是周日
if (k == 1) {
count++;
if (i - 6 <= 1) {
startDay = 1;
} else {
startDay = i - 6;
}
endDay = i;
}
// 若是本月最好一天,且不是周日
if (k != 1 && i == days) {
count++;
startDay = i - k + 2;
endDay = i;
}
if(startDay != 0 && endDay != 0){
dates.add(startDay + "-" + endDay);
}
}
return dates;
}
/**
* 获取当前月自然周数,并返回每周开始日期和每周结束日期
* @param date 2013-9 : 1-1,2-8,9-15,16-22,23-29,30-30
* @return
* @throws Exception
*/
public static List<String> getWeeksMap(String date){
List<String> dates = new ArrayList<>();
String year = date.substring(0,4);
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
Date date1 = null;
try {
date1 = dateFormat.parse(date);
} catch (ParseException e) {
System.out.println("获取当前月自然周,日期格式转换错误!11");
e.printStackTrace();
}
Calendar calendar = new GregorianCalendar();
calendar.setTime(date1);
int days = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
int count = 0;
for (int i = 1; i <= days; i++) {
DateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd");
Date date2 = null;
try {
date2 = dateFormat1.parse(date + "-" + i);
} catch (ParseException e) {
System.out.println("获取当前月自然周,日期格式转换错误!22");
e.printStackTrace();
}
calendar.clear();
calendar.setTime(date2);
int k = new Integer(calendar.get(Calendar.DAY_OF_WEEK));
int startDay = 0;
int endDay = 0;
// 若当天是周日
if (k == 1) {
count++;
if (i - 6 <= 1) {
startDay = 1;
} else {
startDay = i - 6;
}
endDay = i;
}
// 若是本月最好一天,且不是周日
if (k != 1 && i == days) {
count++;
startDay = i - k + 2;
endDay = i;
}
if(startDay != 0 && endDay != 0){
String s = year + "第" + getWeekOfYear(date2) + "周" + "(" + date.substring(5) + "月" + startDay +
"日至" + date.substring(5) + "月" + endDay + "日" +")";
dates.add(s);
}
}
return dates;
}
/**
* 获取一年的第几周
*
* @param date
* @return
*/
public static int getWeekOfYear(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
int week_of_year = c.get(Calendar.WEEK_OF_YEAR);
return week_of_year;
}
/**
* 获得本月的开始时间,即2012-01-01 00:00:00
*
* @return
*/
public static Date getCurrentMonthStartTime(Date date) throws Exception {
Calendar c = Calendar.getInstance();
c.setTime(date);
Date now = null;
c.set(Calendar.DATE, 1);
now = shortSdf.parse(shortSdf.format(c.getTime()) + " 00:00:00");
return now;
}
/**
* 当前月的结束时间,即2012-01-31 23:59:59
*
* @return
*/
public static Date getCurrentMonthEndTime(Date date) throws Exception {
Calendar c = Calendar.getInstance();
c.setTime(date);
Date now = null;
c.set(Calendar.DATE, 1);
c.add(Calendar.MONTH, 1);
c.add(Calendar.DATE, -1);
now = longSdf.parse(shortSdf.format(c.getTime()) + " 23:59:59");
return now;
}
}
package com.yeejoin.equipmanage.common.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class IotIndexItemVo {
private String id;
private String key;
private String name;
private String color;
}
package com.yeejoin.equipmanage.common.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class IotIndexResItemVo {
private String key;
private String name;
private int[] data;
}
package com.yeejoin.equipmanage.common.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class IotIndexResMinotFinalVo {
private Long id;
private String[] name;
private String[] nameKey;
private String unit;
private List<String> times;
private List<IotIndexItemVo> items;
private List<IotIndexResItemVo> iotData;
}
package com.yeejoin.equipmanage.common.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class IotIndexResMinotVo {
private Long id;
private String name;
private String nameKey;
private String unit;
private List<String> times;
private List<IotDataVO> iotData;
}
......@@ -168,6 +168,9 @@ public class WaterResourceController extends BaseController {
if (model.getAttachments() != null) {
sourceFileService.saveAttachments(model.getSequenceNbr(), model.getAttachments());
}
if (model.getSequenceNbr() != null) {
model.setResourceId(model.getSequenceNbr());
}
return ResponseHelper.buildResponse(model);
}
......
......@@ -3084,12 +3084,11 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
// 获取联系人
QueryWrapper<FirefightersContacts> queryWrapper1 = new QueryWrapper<>();
queryWrapper1.eq("org_usr_id", id);
queryWrapper1.eq("org_usr_id", String.valueOf(id));
FirefightersContacts firefightersContacts = ifirefightersContactsService.getOne(queryWrapper1);
// 获取岗位标签
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("org_usr_id", id);
queryWrapper.eq("org_usr_id", String.valueOf(id));
FirefightersDataDto firefightersDataDto = new FirefightersDataDto(
ifirefightersWorkexperienceService.getOne(queryWrapper),
ifirefightersEducationService.getOne(queryWrapper), iFirefightersPostService.getOne(queryWrapper));
......@@ -3221,11 +3220,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Override
public boolean checkCertificatesNumber(String certificatesNumber, Long orgUserId) {
LambdaQueryWrapper<DynamicFormInstance> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DynamicFormInstance::getFieldCode, "certificatesNumber");
queryWrapper.eq(DynamicFormInstance::getFieldValue, certificatesNumber);
queryWrapper.ne(orgUserId !=null, DynamicFormInstance::getInstanceId, orgUserId);
List<DynamicFormInstance> list = dynamicFormInstanceService.list(queryWrapper);
List<DynamicFormInstance> list = orgUsrMapper.checkCertificatesNumber(certificatesNumber, orgUserId);
return !list.isEmpty();
}
......
......@@ -38,8 +38,9 @@ public class PersonIdentifyAspect {
@Autowired
private JcsFeign jcsFeignClient;
@Pointcut("execution(public * com.yeejoin.amos.*.business.controller..*(..))")
// package com.yeejoin.equipmanage.controller;
// com.yeejoin.amos.boot.biz.common.controller.BaseController
@Pointcut("execution(public * com.*.equipmanage.controller..*(..))")
public void userDate() {
}
......@@ -49,7 +50,7 @@ public class PersonIdentifyAspect {
public void personIdentity(JoinPoint joinPoint) {
ReginParams reginParam = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
if (reginParam != null) {
if (reginParam.getPersonIdentity() == null) {
if (reginParam.getPersonIdentity() == null || reginParam.getPersonIdentity().getBizOrgCode() == null) {
String userId = reginParam.getUserModel().getUserId();
if (userId != null) {
FeignClientResult responseModel = jcsFeignClient.selectById(userId);
......
package com.yeejoin.equipmanage.controller;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.equipmanage.common.utils.*;
import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmService;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import java.util.List;
import java.util.Map;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
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.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@RestController
@Api(tags = "组态需求 -- API")
......@@ -45,6 +37,12 @@ public class ConfigureController extends AbstractBaseController {
@Autowired
private IEquipmentSpecificAlarmService equipmentSpecificAlarmService;
@Autowired
private IFireFightingSystemService iFireFightingSystemService;
@Autowired
private IotFeign iotFeign;
@RequestMapping(value = "/alarmLogPage", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", produces = "application/json;charset=UTF-8", notes = "列表分页查询")
......@@ -91,7 +89,7 @@ public class ConfigureController extends AbstractBaseController {
@RequestMapping(value = "/equipAlarmLine", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "系统近一周告警趋势图", produces = "application/json;charset=UTF-8", notes = "系统近一周告警趋势图")
public ResponseModel equipStatusCount(@RequestParam(required = false) String systemCode, @RequestParam(required = false) String indexKeys) {
public ResponseModel equipAlarmLine(@RequestParam(required = false) String systemCode, @RequestParam(required = false) String indexKeys) {
HashMap<String, Object> hashMap = new HashMap<>();
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
......@@ -110,35 +108,49 @@ public class ConfigureController extends AbstractBaseController {
return CommonResponseUtil.success(equipmentSpecificAlarmService.equipAlarmLine(hashMap));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取系统告警信息")
@GetMapping("/getSystemAlarmInfo")
public ResponseModel getSystemAlarmInfo() {
public ResponseModel getSystemAlarmInfo(CommonPageable commonPageable) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
return CommonResponseUtil.success(fireFightingSystemMapper.getSystemAlarmInfo(bizOrgCode));
if (StringUtils.isEmpty(bizOrgCode)) {
return CommonResponseUtil.success(null);
}
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
return CommonResponseUtil.success(fireFightingSystemMapper.getSystemAlarmInfo(page, bizOrgCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取设备告警待确认和未处理信息")
@ApiOperation(value = "获取设备告警待确认和未处理信息(根据系统编码查询)")
@GetMapping("/getEquipAlarmInfoNum")
public ResponseModel getEquipAlarmInfoNum() {
public ResponseModel getEquipAlarmInfoNum(@RequestParam(required = false) String systemCode) {
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
return CommonResponseUtil.success(fireFightingSystemMapper.getEquipAlarmInfoNum(bizOrgCode));
return CommonResponseUtil.success(fireFightingSystemMapper.getEquipAlarmInfoNum(systemCode, bizOrgCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取消防力量信息(队伍值班等)")
@GetMapping("/getFireTeamInfo")
public ResponseModel getFireTeamInfo() {
@ApiOperation(value = "获取消防力量信息(队伍值班等(专职))")
@GetMapping("/getFireTeamInfoBy116")
public ResponseModel getFireTeamInfoBy116() {
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
return CommonResponseUtil.success(fireFightingSystemMapper.getFireTeamInfo(bizOrgCode));
return CommonResponseUtil.success(fireFightingSystemMapper.getFireTeamInfoBy116(bizOrgCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取消防力量信息(队伍值班等(志愿消防队))")
@GetMapping("/getFireTeamInfoBy117")
public ResponseModel getFireTeamInfoBy117() {
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
return CommonResponseUtil.success(fireFightingSystemMapper.getFireTeamInfoBy117(bizOrgCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "消防车辆信息")
......@@ -152,11 +164,273 @@ public class ConfigureController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "物联监控页面消防车辆信息")
@GetMapping("/getFireCarInfoByWL")
public ResponseModel getFireCarInfoByWL() {
public ResponseModel getFireCarInfoByWL(CommonPageable commonPageable) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
if (StringUtils.isEmpty(bizOrgCode)) {
return CommonResponseUtil.success(null);
}
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
return CommonResponseUtil.success(fireFightingSystemMapper.getFireCarInfoByWL(page, bizOrgCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "概览水源信息")
@GetMapping("/getWaterInfo")
public ResponseModel getWaterInfo(CommonPageable commonPageable) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
return CommonResponseUtil.success(fireFightingSystemMapper.getWaterInfo(page, bizOrgCode, null));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "概览稳压泵信息")
@GetMapping("/getPressurePumpInfo")
public ResponseModel getPressurePumpInfo(CommonPageable commonPageable) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
if (StringUtils.isEmpty(bizOrgCode)) {
return CommonResponseUtil.success(null);
}
Page<Map<String, Object>> pressurePumpInfo = fireFightingSystemMapper.getPressurePumpInfo(page, bizOrgCode, null);
pressurePumpInfo.getRecords().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 ? "正常" : "异常");
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(pressurePumpInfo);
}
@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;
return CommonResponseUtil.success(fireFightingSystemMapper.getFireCarInfoByWL(bizOrgCode));
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) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
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);
}
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
return CommonResponseUtil.success(iFireFightingSystemService.getSmallWaterInfo(page, hashMap));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "获取系统名称(根据系统编码查询)")
@GetMapping("/getSystemName")
public ResponseModel getEquipSystemName(@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);
}
return CommonResponseUtil.success(iFireFightingSystemService.getSystemName(hashMap));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "获取系统工作状态(根据系统编码查询)")
@GetMapping("/getSystemStatus")
public ResponseModel getEquipSystemStatus(@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);
}
return CommonResponseUtil.success(iFireFightingSystemService.getSystemStatus(hashMap));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取系统近一月告警设备top5(根据系统编码查询)")
@GetMapping("/getAlarmOneMonth")
public ResponseModel getSpecificAlarmOneMonthTOP(@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);
}
return CommonResponseUtil.success(iFireFightingSystemService.equipAlarmTOP(hashMap));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取系统设备状态(根据系统编码查询)")
@GetMapping("/getEquipmentState")
public ResponseModel getEquipmentState(@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);
}
return CommonResponseUtil.success(iFireFightingSystemService.equipmentState(result, hashMap));
}
}
......@@ -3,8 +3,10 @@ package com.yeejoin.equipmanage.controller;
import java.util.*;
import java.util.stream.Collectors;
import com.yeejoin.equipmanage.common.constant.Constant;
import com.yeejoin.equipmanage.common.entity.vo.EquiplistSpecificBySystemVO;
import com.yeejoin.equipmanage.common.utils.SpringUtils;
import com.yeejoin.equipmanage.common.utils.*;
import com.yeejoin.equipmanage.fegin.IotFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -31,7 +33,6 @@ import com.yeejoin.equipmanage.common.entity.dto.EquipmentSpecificDTO;
import com.yeejoin.equipmanage.common.entity.dto.SourceNameListDTO;
import com.yeejoin.equipmanage.common.entity.vo.ComplementCodeVO;
import com.yeejoin.equipmanage.common.entity.vo.SourceNameByEquipSpeIdVO;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.common.vo.EquipmentOnCarVo;
import com.yeejoin.equipmanage.common.vo.VideoOnEquipmentSpecificVo;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificMapper;
......@@ -66,6 +67,8 @@ import java.util.stream.Collectors;
@RequestMapping(value = "/equipSpecific")
public class EquipmentSpecificController extends AbstractBaseController {
public static final int RESULT_SUCCESS_CODE = 200;
@Autowired
IEquipmentSpecificSerivce equipmentSpecificSerivce;
......@@ -81,6 +84,9 @@ public class EquipmentSpecificController extends AbstractBaseController {
@Autowired
FireFightingSystemServiceImpl fireFightingSystemServiceImpl;
@Autowired
IotFeign iotFeign;
/**
* 补码页面分页
*
......@@ -355,4 +361,41 @@ public class EquipmentSpecificController extends AbstractBaseController {
return equipmentSpecificSerivce.getListByEquipmentCode(code);
}
@RequestMapping(value = "/equipment/iotIndexInfo/{equipSpeId}", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据装备id获取物联日志", notes = "根据装备id获取物联日志")
public ResponseModel getEquipmentIotIndexInfo(@PathVariable String equipSpeId, @RequestParam String beginDate, @RequestParam String endDate,
@RequestParam(required = false) Integer isTrend, @RequestParam(required = false) String fieldKey) {
// 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("物联日志数据为空");
}
return CommonResponseUtil.success(equipmentSpecificSerivce.getIndexInfoList(iotCode, entity, isTrend, fieldKey));
}
}
......@@ -22,6 +22,7 @@ import com.yeejoin.equipmanage.service.impl.TopographyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.models.auth.In;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -752,7 +753,7 @@ public class TopographyController extends AbstractBaseController {
}
ResponseModel entity = null;
try {
entity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), beginDate, endDate, prefix, suffix);
entity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), beginDate, endDate, prefix, suffix, null);
} catch (Exception e) {
e.printStackTrace();
}
......@@ -761,7 +762,7 @@ public class TopographyController extends AbstractBaseController {
String json = JSON.toJSONString(entity.getResult());
List<Map<String, String>> listObject = (List<Map<String, String>>) JSONArray.parse(json);
List<IotDataVO> iotDatalist = new ArrayList<>();
for(Map<String, String> mapList : listObject) {
for (Map<String, String> mapList : listObject) {
for (Map.Entry entry : mapList.entrySet()) {
if (!"name".equals(entry.getKey()) && !"deviceName".equals(entry.getKey())) {
IotDataVO iotDataVO = new IotDataVO();
......@@ -774,12 +775,12 @@ public class TopographyController extends AbstractBaseController {
List<IotDataVO> timeList = iotDatalist.stream().filter(x -> "time".equals(x.getKey())).collect(Collectors.toList());
List<EquipmentSpecificIndex> indexes = equipmentSpecificIndexMapper.getEquipmentSpeIndexByIotCode(iotCode);
if (0 <indexes.size()) {
if (0 < indexes.size()) {
int j = 0;
Map<String, Object> map = new HashMap<>();
for (int i=0; i<timeList.size(); i++) {
for (int i = 0; i < timeList.size(); i++) {
TopographyIotVo iotVo = new TopographyIotVo();
List<TopographyIotDataVO> lists = new ArrayList<>();
// if (i == 0) {
......@@ -805,8 +806,8 @@ public class TopographyController extends AbstractBaseController {
SimpleDateFormat sdf = new SimpleDateFormat(ISO8601_DATE_HOUR_MIN_SEC);
SimpleDateFormat sdf1 = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN);
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
Date date1=sdf.parse(strDate);
String time= DateTimeUtil.format(date1, DateTimeUtil.ISO_DATE_HOUR24_MIN_SEC);
Date date1 = sdf.parse(strDate);
String time = DateTimeUtil.format(date1, DateTimeUtil.ISO_DATE_HOUR24_MIN_SEC);
iotVo.setTime(sdf1.parse(time));
} catch (Exception e) {
......@@ -834,21 +835,44 @@ public class TopographyController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据节点id查询当前节点物联指标趋势", notes = "根据节点id查询当前节点物联指标趋势")
public ResponseModel getEquipmentIndexTrendInfo(@RequestParam(required = false) String id,
@RequestParam(required = false) String equipSpeId,
@RequestParam(required = false) String beginDate,
@RequestParam(required = false) String endDate) throws ParseException {
@RequestParam(required = false) String equipSpeId,
@RequestParam(required = false) String beginDate,
@RequestParam(required = false) String fieldKey,
@RequestParam(required = false) String isTrend,
@RequestParam(required = false) String endDate) throws ParseException {
String eqpId;
if (StringUtil.isNotEmpty(equipSpeId)) {
eqpId = equipSpeId;
String iotCode = null;
if(null != fieldKey || null != isTrend) {
EquipmentSpecific equipmentSpecific = equipmentSpecificService.getById(equipSpeId);
iotCode = equipmentSpecific.getIotCode();
List<EquipmentIndex> equipmentSpecifics = equipmentIndexService.getPerfQutoaIotList(Long.valueOf(equipSpeId));
if (equipmentSpecifics.size() == 0) {
return CommonResponseUtil.success();
}
if ("true".equals(isTrend)) {
fieldKey = equipmentSpecifics.stream().filter(equipmentIndex -> equipmentIndex.getIsTrend()).map(EquipmentIndex::getPerfQuotaDefinitionId).collect(Collectors.joining(","));
}
} else {
TopographyNodeDetailDTO detailDTO = topographyNodeDetailService.queryByNodeid(id);
if (null == detailDTO || !StringUtil.isNotEmpty(detailDTO.getEqpId())) {
throw new RuntimeException("节点信息错误或此节点下未绑定装备!");
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();
}
eqpId = detailDTO.getEqpId();
EquipmentSpecific equipmentSpecific = equipmentSpecificService.getById(eqpId);
iotCode = equipmentSpecific.getIotCode();
}
EquipmentSpecific equipmentSpecific = equipmentSpecificService.getById(eqpId);
String iotCode = equipmentSpecific.getIotCode();
String prefix = null;
String suffix = null;
if (iotCode.length() > 8) {
......@@ -859,7 +883,7 @@ public class TopographyController extends AbstractBaseController {
}
ResponseModel entity = null;
try {
entity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), beginDate, endDate, prefix, suffix);
entity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), beginDate, endDate, prefix, suffix, fieldKey);
} catch (Exception e) {
e.printStackTrace();
}
......@@ -867,8 +891,8 @@ public class TopographyController extends AbstractBaseController {
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()){
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()));
......@@ -887,18 +911,18 @@ public class TopographyController extends AbstractBaseController {
SimpleDateFormat sdf1 = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN);
logger.info("返回时间===================================(" + vo.getValue() + ") =======================================");
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
Date date=sdf.parse(strDate);
Date date = sdf.parse(strDate);
// String time= sdf.format(date);
String time= DateTimeUtil.format(date, DateTimeUtil.ISO_DATE_HOUR24_MIN_SEC);
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);
if (0 <indexes.size()) {
if (0 < indexes.size()) {
List<TopographyIotIndexTrendVo> list = new ArrayList<>();
vos.forEach(iotDataVO -> {
indexes.forEach(x -> {
vos.forEach(iotDataVO -> {
indexes.forEach(x -> {
if (x.getNameKey().equals(iotDataVO.getKey())) {
TopographyIotIndexTrendVo vo = new TopographyIotIndexTrendVo();
vo.setId(x.getId());
......@@ -926,7 +950,7 @@ public class TopographyController extends AbstractBaseController {
List<IotIndexResVo> res = new ArrayList<>();
for (String s : mapIndex.keySet()) {
IotIndexResVo vo = new IotIndexResVo();
LambdaQueryWrapper <EquipmentIndex> queryWrapper = new LambdaQueryWrapper<>();
LambdaQueryWrapper<EquipmentIndex> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(EquipmentIndex::getId, mapIndex.get(s));
EquipmentIndex index = iEquipmentIndexService.getOne(queryWrapper);
vo.setIotData(map.get(s));
......@@ -949,6 +973,342 @@ public class TopographyController extends AbstractBaseController {
}
/***
*
* 根据设备id获取当前设备的物联指标趋势
*
* **/
@RequestMapping(value = "/equipment/trenIot", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据设备id获取当前设备的物联指标趋势", notes = "根据设备id获取当前设备的物联指标趋势")
public ResponseModel getEquipmentIndexTrendIotInfo(@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 {
EquipmentSpecific equipmentSpecific = equipmentSpecificService.getById(equipId);
String iotCode = equipmentSpecific.getIotCode();
List<EquipmentIndex> equipmentSpecifics = equipmentIndexService.getPerfQutoaIotList(Long.valueOf(equipId));
if (equipmentSpecifics.size() == 0) {
return CommonResponseUtil.success();
}
String allKeys;
String names;
Map<String, String> map = new HashMap<>();
List<IotIndexItemVo> iotIndexItemVos = new ArrayList<>();
equipmentSpecifics.stream().forEach((e)->{
IotIndexItemVo itemVo = new IotIndexItemVo();
if(!e.getIsTrend()) {
map.put(e.getPerfQuotaDefinitionId(),e.getPerfQuotaName());
itemVo.setKey(e.getPerfQuotaDefinitionId());
itemVo.setName(e.getPerfQuotaName());
itemVo.setColor(e.getEmergencyLevelColor());
iotIndexItemVos.add(itemVo);
}
});
allKeys = equipmentSpecifics.stream().filter(equipmentIndex -> !equipmentIndex.getIsTrend()).map(EquipmentIndex::getPerfQuotaDefinitionId).collect(Collectors.joining(","));
names = equipmentSpecifics.stream().filter(equipmentIndex -> !equipmentIndex.getIsTrend()).map(EquipmentIndex::getPerfQuotaName).collect(Collectors.joining(","));
String parmfieldKey = "";
String parmfieldName = "";
if(StringUtils.isEmpty(fieldKey) ) {
parmfieldKey = allKeys;
} else {
parmfieldKey = fieldKey;
for(String s: fieldKey.split(",") ) {
parmfieldName = parmfieldName + map.get(s) + ",";
}
}
String prefix = null;
String suffix = null;
if (iotCode.length() > 8) {
prefix = iotCode.substring(0, 8);
suffix = iotCode.substring(8);
} else {
return CommonResponseUtil.failure("装备物联编码错误,请确认!");
}
ResponseModel entity = null;
String[] filedKeyArr = parmfieldKey.split(",");
List<IotIndexResMinotVo> res = new ArrayList<>();
IotIndexResMinotFinalVo indexResMinotFinalVo = new IotIndexResMinotFinalVo();
List<Date> datesFinal = new ArrayList<>();
for (String st : filedKeyArr) {
try {
entity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), beginDate, endDate, prefix, suffix, st);
} catch (Exception e) {
e.printStackTrace();
}
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);
}
indexResMinotFinalVo.setTimes(times);
indexResMinotFinalVo.setNameKey(StringUtils.isEmpty(fieldKey) ? allKeys.split(",") : fieldKey.split(","));
indexResMinotFinalVo.setName(StringUtils.isEmpty(fieldKey) ? names.split(",") : parmfieldName.split(","));
indexResMinotFinalVo.setItems(iotIndexItemVos);
indexResMinotFinalVo.setIotData(iotData);
}
return CommonResponseUtil.success(indexResMinotFinalVo);
}
private void fullData(List<IotIndexItemVo> iotIndexItemVos, List<IotIndexResItemVo> iotData, List<String> times, Map<String, String> map ) {
for(IotIndexItemVo iVo: iotIndexItemVos) {
IotIndexResItemVo itVo = new IotIndexResItemVo();
itVo.setName(map.get(iVo.getKey()));
itVo.setKey(iVo.getKey());
List<Integer> list = new ArrayList<>();
for (int i = 1; i <= times.size() ; i++) {
list.add(0);
}
itVo.setData(list.stream().mapToInt(i->i).toArray());
iotData.add(itVo);
}
}
private void handMonth( String beginDate, String nameKey, List<String> dates, List<IotDataVO> dataList, Map<String, String> timeAndValue) throws Exception {
for(int i =1; i <= 12; i++) {
int num = 0;
Date bDate = DateUtils.getCurrentMonthStartTime(DateUtils.dateParse(DateUtils.dateToStringY(beginDate) + "-" + i,DateUtils.MONTH_PATTERN));
Date dDate = DateUtils.getCurrentMonthEndTime(DateUtils.dateParse(DateUtils.dateToStringY(beginDate) + "-" + i,DateUtils.MONTH_PATTERN));
for (String dat : dates) {
if (DateUtils.belongCalendar(dateParse(dat), bDate, dDate)) {
if (null != timeAndValue.get(dat)) {
num++;
}
}
}
IotDataVO iotDataVO = new IotDataVO();
iotDataVO.setKey(nameKey);
iotDataVO.setValue(num);
dataList.add(iotDataVO);
}
}
private void handWeek( String beginDate, String nameKey, List<String> dates, List<IotDataVO> dataList, Map<String, String> timeAndValue) throws Exception {
List<String> weeks = DateUtils.getWeeks(DateUtils.dateToStringMonth(beginDate));
for(String s:weeks) {
int num = 0;
String[] arr = s.split("-");
Date bDate;
Date dDate;
String sStr = "";
String eStr = "";
if(Integer.parseInt(arr[0]) < 10 ) {
sStr = "0" + arr[0];
} else {
sStr = arr[1];
}
if(Integer.parseInt(arr[1]) < 10 ) {
eStr = "0" + arr[1];
} else {
eStr = arr[1];
}
if(arr[0].equals(arr[1])) {
bDate = DateUtils.dateParse(DateUtils.dateToStringMonth(beginDate) + "-" + sStr + " 00:00:00" ,DateUtils.DATE_TIME_PATTERN);
dDate = DateUtils.dateParse(DateUtils.dateToStringMonth(beginDate) + "-" + eStr + " 23:59:59"
,DateUtils.DATE_PATTERN);
} else {
bDate = DateUtils.dateParse(DateUtils.dateToStringMonth(beginDate) + "-" + sStr + " 00:00:00",DateUtils.DATE_TIME_PATTERN);
dDate = DateUtils.dateParse(DateUtils.dateToStringMonth(beginDate) + "-" + eStr + " 00:00:00",DateUtils.DATE_TIME_PATTERN);
}
for (String dat : dates) {
if (DateUtils.belongCalendar(dateParse(dat), bDate, dDate)) {
if (null != timeAndValue.get(dat)) {
num++;
}
}
}
IotDataVO iotDataVO = new IotDataVO();
iotDataVO.setKey(nameKey);
iotDataVO.setValue(num);
dataList.add(iotDataVO);
}
}
private void handleDay(List<Date> datesFinal, String beginDate, String endDate, String nameKey, List<String> dates, List<IotDataVO> dataList, Map<String, String> timeAndValue
) throws ParseException {
if (datesFinal.size() == 0) {
datesFinal.addAll(DateUtils.findDaysStr(DateUtils.dateToString(beginDate), DateUtils.dateToString(endDate)));
}
if (timeAndValue.size() > 0) {
finalHandle(datesFinal, nameKey, dates, dataList, timeAndValue);
}
}
private void handle(List<Date> datesFinal, List<String> dates, String beginDate, String nameKey, List<IotDataVO> dataList,
Map<String, String> timeAndValue) throws ParseException {
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));
}
}
if (timeAndValue.size() > 0) {
finalHandle(datesFinal, nameKey, dates, dataList, timeAndValue);
}
}
private void finalHandle(List<Date> datesFinal, String nameKey, List<String> dates, List<IotDataVO> dataList, Map<String, String> timeAndValue) throws ParseException {
for (int i = 0; i < datesFinal.size(); i++) {
int num = 0;
for (String dat : dates) {
if (i == datesFinal.size() - 1) {
if (DateUtils.belongCalendar(dateParse(dat), datesFinal.get(i),
DateUtils.getCurrentDayEndTime(datesFinal.get(i)))) {
if (null != timeAndValue.get(dat)) {
num++;
}
}
} else {
if (DateUtils.belongCalendar(dateParse(dat), datesFinal.get(i), datesFinal.get(i + 1))) {
if (null != timeAndValue.get(dat)) {
num++;
}
}
}
}
IotDataVO iotDataVO = new IotDataVO();
iotDataVO.setKey(nameKey);
iotDataVO.setValue(num);
dataList.add(iotDataVO);
}
}
private Date dateParse(String value) throws ParseException {
String strDate = value.substring(0, 19);
SimpleDateFormat sdf = new SimpleDateFormat(ISO8601_DATE_HOUR_MIN_SEC);
SimpleDateFormat sdf1 = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN);
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
Date date = sdf.parse(strDate);
String time = DateTimeUtil.format(date, DateTimeUtil.ISO_DATE_HOUR24_MIN_SEC);
return sdf1.parse(time);
}
}
......@@ -22,6 +22,7 @@ public interface IotFeign {
@RequestParam(value = "timeStart") String beginDate,
@RequestParam(value = "timeEnd") String endDate,
@RequestParam(value = "productKey") String productKey,
@RequestParam(value = "deviceName") String deviceName);
@RequestParam(value = "deviceName") String deviceName,
@RequestParam(required = false, value = "fieldKey") String fieldKey);
}
......@@ -133,7 +133,7 @@ public interface JcsFeign {
* @return ResponseModel<OrgUsrDto>
*/
@GetMapping(value = "/org-usr/{authKey}/treeWithAuth")
FeignClientResult<List<OrgMenuDto>> getCompanyDeptTreeWithAuth(@PathVariable(value = "authKey") String authKey, @RequestParam(value = "orgTypes", required = false) String orgType);
FeignClientResult<List<OrgMenuDto>> getCompanyDeptTreeWithAuth(@PathVariable(value = "authKey") String authKey, @RequestParam(value = "orgType", required = false) String orgType);
/**
* 查询有权限的公司部门列表
......
......@@ -63,5 +63,7 @@ public interface EquipmentIndexMapper extends BaseMapper<EquipmentIndex> {
List<EquipmentIndexVO> getEquipmentIndexByIot();
List<EquipmentIndex> getPerfQutoaIotList(Long id);
List<String> getGruopName(Long equipmentId);
}
......@@ -108,4 +108,6 @@ public interface EquipmentSpecificIndexMapper extends BaseMapper<EquipmentSpecif
List<Map<String, Object>> getEquipSpecificIndexByUpdateDateDesc();
List<EquipmentSpecificIndex> getEquipmentSpeIndexByIotCodeTrend(String iotCode, Integer isTrend, String fieldKey);
}
......@@ -2,6 +2,7 @@ package com.yeejoin.equipmanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.datasync.entity.FireFightingSystem;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity;
import com.yeejoin.equipmanage.common.entity.dto.EquipTypeAmountPageDTO;
......@@ -9,6 +10,7 @@ import com.yeejoin.equipmanage.common.entity.vo.*;
import com.yeejoin.equipmanage.common.vo.*;
import org.apache.ibatis.annotations.Param;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -75,9 +77,9 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
*
* @return
*/
List<PointTreeVo> getPointData(@Param("id") String id,@Param("instanceId") String instanceId);
List<PointTreeVo> getPointData(@Param("id") String id, @Param("instanceId") String instanceId);
List<PointTreeVo> getPointDataNew(@Param("id") String id,@Param("instanceId") String instanceId,@Param("displayName") String displayName);
List<PointTreeVo> getPointDataNew(@Param("id") String id, @Param("instanceId") String instanceId, @Param("displayName") String displayName);
List<PointTreeVo> getPointDataNum(@Param("id") String id);
......@@ -104,37 +106,35 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
*/
List<AlarmDataVO> getSystemById(Long id);
IPage<EquipmentAlarmBySystemIdOrSourceIdVO> getEquipmentAlarmBySystemIdOrSourceIdVO(@Param("page")IPage<EquipmentAlarmBySystemIdOrSourceIdVO> page
, @Param("sourceId")Long sourceId
, @Param("systemId")Long systemId
, @Param("confirmType")Integer confirmType
, @Param("createDate")String createDate
, @Param("type")String type);
IPage<EquipmentAlarmBySystemIdOrSourceIdVO> getEquipmentAlarmBySystemIdOrSourceIdVO(@Param("page") IPage<EquipmentAlarmBySystemIdOrSourceIdVO> page
, @Param("sourceId") Long sourceId
, @Param("systemId") Long systemId
, @Param("confirmType") Integer confirmType
, @Param("createDate") String createDate
, @Param("type") String type);
IPage<EquipTypeImgAmountVO> getColaCategoryAmountList(@Param("page")IPage page,
@Param("hierarchy")int hierarchy,
@Param("codeHead")String codeHead,
@Param("equipTypeAmountPage")EquipTypeAmountPageDTO equipTypeAmountPage);
IPage<EquipTypeImgAmountVO> getColaCategoryAmountListIot(@Param("page")IPage page,
@Param("hierarchy")int hierarchy,
@Param("codeHead")String codeHead,
@Param("equipTypeAmountPage")EquipTypeAmountPageDTO equipTypeAmountPage);
IPage<EquipTypeImgAmountVO> getColaCategoryAmountCarList(@Param("page")IPage page,
@Param("hierarchy")int hierarchy,
@Param("codeHead")String codeHead,
@Param("equipTypeAmountPage")EquipTypeAmountPageDTO equipTypeAmountPage);
IPage<EquipTypeImgAmountVO> getColaCategoryAmountList(@Param("page") IPage page,
@Param("hierarchy") int hierarchy,
@Param("codeHead") String codeHead,
@Param("equipTypeAmountPage") EquipTypeAmountPageDTO equipTypeAmountPage);
IPage<EquipTypeImgAmountVO> getColaCategoryAmountEquList(@Param("page")IPage page,
@Param("hierarchy")int hierarchy,
@Param("codeHead")String codeHead,
@Param("equipTypeAmountPage")EquipTypeAmountPageDTO equipTypeAmountPage);
IPage<EquipTypeImgAmountVO> getColaCategoryAmountListIot(@Param("page") IPage page,
@Param("hierarchy") int hierarchy,
@Param("codeHead") String codeHead,
@Param("equipTypeAmountPage") EquipTypeAmountPageDTO equipTypeAmountPage);
IPage<EquipTypeImgAmountVO> getColaCategoryAmountCarList(@Param("page") IPage page,
@Param("hierarchy") int hierarchy,
@Param("codeHead") String codeHead,
@Param("equipTypeAmountPage") EquipTypeAmountPageDTO equipTypeAmountPage);
IPage<EquipTypeImgAmountVO> getColaCategoryAmountEquList(@Param("page") IPage page,
@Param("hierarchy") int hierarchy,
@Param("codeHead") String codeHead,
@Param("equipTypeAmountPage") EquipTypeAmountPageDTO equipTypeAmountPage);
List<FireFightingSystem> getFireFightingSystemDetail(@Param("fireFightingSystemVo")FireFightingSystemVo fireFightingSystemVo);
List<FireFightingSystem> getFireFightingSystemDetail(@Param("fireFightingSystemVo") FireFightingSystemVo fireFightingSystemVo);
List<FireFightingSystemEntity> getFightingSysByCodes(@Param("ids") String[] idsArr);
......@@ -143,13 +143,12 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
List<FireFightingSystem3dVo> get3dFightingSystemList(@Param("list") List<String> collect);
List<SpeIndexVo> getSpeIndexIn(@Param("list") List<Long> idList);
Map<String, Object> getFireSystemState();
Map<String, Object> getFireOnlSystem();
Map<String, Object> getFireOnlSystemThreeSmall();
Map<String, Object> getFireCafsSystem();
......@@ -161,77 +160,87 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
Map<String, Object> getFireAcsSystem();
Map<String, Object> getFireFhsSystem();
Map<String, Object> getTodayConfirmAlarmInfo();
Map<String, Object> getPoolInfo();
FireFightingSystemVo getFightingSysInfo(@Param("code") String code, @Param("id") Long id);
/**
* 火灾报警系统3小 ,装备定义数量
* @return Map<String,Object>
*
* @return Map<String, Object>
*/
Map<String,Object> fireAlarmSysEquipmentNumber();
Map<String, Object> fireAlarmSysEquipmentNumber();
/**
* 火灾报警系统3小,指标
* @return Map<String,Object>
*
* @return Map<String, Object>
*/
Map<String,Object> fireAlarmSysIndexNumber();
Map<String, Object> fireAlarmSysIndexNumber();
/**
* 消防水系统-》12号消防水池
* @return Map<String,Object>
* 消防水系统-》12号消防水池
*
* @return Map<String, Object>
*/
Map<String,Object> fireWaterSysPool();
Map<String, Object> fireWaterSysPool();
/**
* 消防水系统-》消防管网
* @return Map<String,Object>
* 消防水系统-》消防管网
*
* @return Map<String, Object>
*/
Map<String,Object> fireWaterSysPipeNetwork();
Map<String, Object> fireWaterSysPipeNetwork();
/**
* 消防水系统-》消火栓按钮
* @return Map<String,Object>
*
* @return Map<String, Object>
*/
Map<String,Object> fireWaterSysHydrant();
Map<String, Object> fireWaterSysHydrant();
/**
* 消防水系统-》水泵房采集装置
* @return Map<String,Object>
*
* @return Map<String, Object>
*/
Map<String,Object> fireWaterSysCollectingDevice();
Map<String, Object> fireWaterSysCollectingDevice();
/**
* 消防水系统-》消防泵、稳压泵,大屏用
* @return Map<String,Object>
*
* @return Map<String, Object>
*/
Map<String,Object> fireWaterSysWaterPump();
Map<String, Object> fireWaterSysWaterPump();
/**
* 预混泡沫灭火系统3小
* @return Map<String,Object>
*
* @return Map<String, Object>
*/
Map<String,Object> fireFoamSysEquipmentIndexNumber();
Map<String, Object> fireFoamSysEquipmentIndexNumber();
/**
* 其他系统总数及指标数量
* @return Map<String,Object>
*
* @return Map<String, Object>
*/
Map<String,Object> otherSysIndexNumAndTotal();
Map<String, Object> otherSysIndexNumAndTotal();
/**
* 预混泡沫灭火系统概览
* @return Map<String,Object>
*
* @return Map<String, Object>
*/
Map<String,Object> fireFoamSysEquipmentNumber();
Map<String, Object> fireFoamSysEquipmentNumber();
/**
* 根据bizorgcode获取系统分类数量
*
* @param bizOrgCode
* @return
*/
......@@ -239,36 +248,114 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
/**
* 获取系统告警信息
*
* @param bizOrgCode
* @return
*/
List<Map<String, Object>> getSystemAlarmInfo(@Param("bizOrgCode") String bizOrgCode);
Page<Map<String, Object>> getSystemAlarmInfo(Page page, @Param("bizOrgCode") String bizOrgCode);
/**
* 获取设备告警待确认和未处理信息
*
* @param bizOrgCode
* @return
*/
List<Map<String, Object>> getEquipAlarmInfoNum(@Param("bizOrgCode") String bizOrgCode);
Map<String, Object> getEquipAlarmInfoNum(@Param("systemCode") String systemCode, @Param("bizOrgCode") String bizOrgCode);
/**
* 获取消防力量信息(队伍值班等)
*
* @param bizOrgCode
* @return
*/
Map<String, Object> getFireTeamInfoBy117(@Param("bizOrgCode") String bizOrgCode);
/**
* 获取消防力量信息(队伍值班等)
*
* @param bizOrgCode
* @return
*/
List<Map<String, Object>> getFireTeamInfo(@Param("bizOrgCode") String bizOrgCode);
Map<String, Object> getFireTeamInfoBy116(@Param("bizOrgCode") String bizOrgCode);
/**
* 消防车辆信息
*
* @param bizOrgCode
* @return
*/
List<Map<String, Object>> getFireCarInfo(@Param("bizOrgCode") String bizOrgCode);
Map<String, Object> getFireCarInfo(@Param("bizOrgCode") String bizOrgCode);
/**
* 物联监控页面消防车辆信息
*
* @param bizOrgCode
* @return
*/
Page<Map<String, Object>> getFireCarInfoByWL(Page page, @Param("bizOrgCode") String bizOrgCode);
/**
* 获取水源信息
*
* @param bizOrgCode
* @return
*/
Page<Map<String, Object>> getWaterInfo(Page page, @Param("bizOrgCode") String bizOrgCode, @Param("systemCode") String systemCode);
/**
* 获取系统名称及该系统工作状态
*
* @return
*/
Map<String, Object> getFireSystemInfo(HashMap<String, Object> hashMap);
/**
* 获取系统近一月告警设备top5
*
* @param hashMap
* @return
*/
List<Map<String, Object>> equipAlarmTOP(HashMap<String, Object> hashMap);
/**
* 获取设备id
*
* @param hashMap
* @return
*/
String equipmentId(HashMap<String, Object> hashMap);
/**
* 获取系统设备状态
*
* @param page
* @param id
* @return
*/
Page<Map<String, Object>> equipmentState(Page page, String id);
/**
* 稳压泵信息
*
* @param page
* @param bizOrgCode
* @param systemCode
* @return
*/
Page<Map<String, Object>> getPressurePumpInfo(Page page, @Param("bizOrgCode") String bizOrgCode, @Param("systemCode") String systemCode);
/**
* 根据装备ID查指标信息
* @param id
* @return
*/
Map<String, String> queryPressureNowStateBySpecificId(@Param("id") Long id);
/**
* 稳压泵信息-3小消防给水信息
* @param bizOrgCode
* @param systemCode
* @return
*/
List<Map<String, Object>> getFireCarInfoByWL(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getPressurePumpInfo3Small(@Param("bizOrgCode") String bizOrgCode, @Param("systemCode") String systemCode);
}
......@@ -63,4 +63,12 @@ public interface IEquipmentIndexService extends IService<EquipmentIndex> {
List<String> getGruopName(Long equipmentId);
/**
* 分页查询
* @param id
* @return
*/
List<EquipmentIndex> getPerfQutoaIotList(Long id);
}
......@@ -14,9 +14,11 @@ import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex;
import com.yeejoin.equipmanage.common.entity.dto.EquipmentSpecificDTO;
import com.yeejoin.equipmanage.common.entity.vo.ComplementCodeVO;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentSpecificVo;
import com.yeejoin.equipmanage.common.entity.vo.IotIndexInfoVo;
import com.yeejoin.equipmanage.common.entity.vo.SourceNameByEquipSpeIdVO;
import com.yeejoin.equipmanage.common.vo.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.LinkedHashMap;
import java.util.List;
......@@ -224,4 +226,15 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
* @return 装备list
*/
List<Map<String, Object>> getListByEquipmentCode(String code);
/**
* 根据装备id获取物联日志
* @param iotCode code
* @param entity 日志
* @param isTrend 是否遥测 不传默认查遥测遥信
* @param fieldKey 指标key 不传默认查全部指标
* @return 物联日志list
*/
List<IotIndexInfoVo> getIndexInfoList(String iotCode, ResponseModel entity, Integer isTrend, String fieldKey);
}
package com.yeejoin.equipmanage.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import com.yeejoin.amos.feign.morphic.model.ResourceDTO;
......@@ -10,6 +11,8 @@ import com.yeejoin.equipmanage.common.entity.dto.EquipTypeAmountPageDTO;
import com.yeejoin.equipmanage.common.entity.vo.*;
import com.yeejoin.equipmanage.common.vo.*;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
......@@ -233,5 +236,14 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
Object refreshCarTypeAndCount(String bizOrgCode) throws Exception;
Map<String, Object> getSystemName(HashMap<String, Object> hashMap);
Map<String, Object> getSystemStatus(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);
}
......@@ -77,6 +77,11 @@ public class EquipmentIndexImpl extends ServiceImpl<EquipmentIndexMapper, Equipm
}
@Override
public List<EquipmentIndex> getPerfQutoaIotList(Long id) {
return this.baseMapper.getPerfQutoaIotList(id);
}
@Override
public EquipmentIndexVO getOnePrefQuota(Long id) {
return this.baseMapper.getOnePrefQuota(id);
}
......
......@@ -670,35 +670,46 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
List<EquipAlarmLineVo> list = equipmentSpecificAlarmMapper.equipAlarmLine(hashMap);
if (!CollectionUtils.isEmpty(list)) {
LinkedHashSet<String> xAxis = new LinkedHashSet<>();
LinkedHashMap<String, Object> yAxis = new LinkedHashMap<>();
List<Map<String, LinkedList<Object>>> yAxis = new ArrayList<>();
// 取出所有非空indexName
Set<Object> indexKNameSet = list.stream().map(EquipAlarmLineVo::getIndexName).filter(StringUtils::isNotBlank).collect(Collectors.toSet());
Set<String> indexKNameSet = list.stream().map(EquipAlarmLineVo::getIndexName).filter(StringUtils::isNotBlank).collect(Collectors.toSet());
Map<String, List<EquipAlarmLineVo>> dateCollect = list.stream().collect(Collectors.groupingBy(EquipAlarmLineVo::getDate));
Map<String, List<EquipAlarmLineVo>> sortMap = new TreeMap<>((o1, o2) -> o2.compareTo(o1));
sortMap.putAll(dateCollect);
// 迭代器倒序遍历map
ListIterator<Map.Entry<String, List<EquipAlarmLineVo>>> i = new ArrayList<Map.Entry<String, List<EquipAlarmLineVo>>>(dateCollect.entrySet()).listIterator(dateCollect.size());
while (i.hasPrevious()) {
String date = null;
for (String indexName : indexKNameSet) {
HashMap<String, LinkedList<Object>> dataMap = new HashMap<>();
LinkedList<Object> yData = new LinkedList<>();
Map.Entry<String, List<EquipAlarmLineVo>> entry = i.previous();
String key = entry.getKey();
List<EquipAlarmLineVo> value = entry.getValue();
for (EquipAlarmLineVo vo : value) {
String indexName = vo.getIndexName();
if (indexKNameSet.contains(indexName)) {
yData.add(vo.getTotal());
} else {
yData.add(0);
// 解决迭代器遍历一次的问题
ListIterator<Map.Entry<String, List<EquipAlarmLineVo>>> i = new ArrayList<Map.Entry<String, List<EquipAlarmLineVo>>>(sortMap.entrySet()).listIterator(sortMap.size());
while (i.hasPrevious()) {
Map.Entry<String, List<EquipAlarmLineVo>> entry = i.previous();
String key = entry.getKey();
List<EquipAlarmLineVo> value = entry.getValue();
for (EquipAlarmLineVo vo : value) {
String name = vo.getIndexName();
if (key.equals(date)) {
yData = yAxis.get(i.previousIndex()).get("data");
}
if (indexName.equals(name)) {
yData.add(vo.getTotal());
} else {
yData.add(0);
}
}
xAxis.add(key.substring(5));
date = key;
}
yAxis.put(key, yData);
xAxis.add(key);
dataMap.put("data", yData);
yAxis.add(dataMap);
}
resultMap.put("legend", indexKNameSet);
resultMap.put("xAxis", xAxis);
resultMap.put("yAxis", yAxis);
resultMap.put("axisData", xAxis);
resultMap.put("seriesData", yAxis);
}
return resultMap;
}
......
......@@ -5,6 +5,13 @@ import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONArray;
import com.yeejoin.equipmanage.common.entity.vo.*;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.common.vo.*;
import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.mapper.*;
import org.apache.catalina.util.IOTools;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -55,25 +62,6 @@ import com.yeejoin.equipmanage.common.entity.VideoEquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.Warehouse;
import com.yeejoin.equipmanage.common.entity.WarehouseStructure;
import com.yeejoin.equipmanage.common.entity.dto.EquipmentSpecificDTO;
import com.yeejoin.equipmanage.common.entity.vo.AlamVideoVO;
import com.yeejoin.equipmanage.common.entity.vo.AlarmInfoVO;
import com.yeejoin.equipmanage.common.entity.vo.AlarmVO;
import com.yeejoin.equipmanage.common.entity.vo.ComplementCodeVO;
import com.yeejoin.equipmanage.common.entity.vo.CurrAlaramVO;
import com.yeejoin.equipmanage.common.entity.vo.DetailPaneVO;
import com.yeejoin.equipmanage.common.entity.vo.DevInfoVO;
import com.yeejoin.equipmanage.common.entity.vo.DevOverviewVO;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentIndexVO;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentSecificDetailVO;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentSpecificVo;
import com.yeejoin.equipmanage.common.entity.vo.ManufacturerVO;
import com.yeejoin.equipmanage.common.entity.vo.PartDetailVO;
import com.yeejoin.equipmanage.common.entity.vo.ProductInfoVO;
import com.yeejoin.equipmanage.common.entity.vo.SourceNameByEquipSpeIdVO;
import com.yeejoin.equipmanage.common.entity.vo.SurrVideoVO;
import com.yeejoin.equipmanage.common.entity.vo.TechInfoListVO;
import com.yeejoin.equipmanage.common.entity.vo.TechInfoVO;
import com.yeejoin.equipmanage.common.entity.vo.VideoVO;
import com.yeejoin.equipmanage.common.enums.AlarmStatusEnum;
import com.yeejoin.equipmanage.common.enums.BillContentEnum;
import com.yeejoin.equipmanage.common.enums.BitmapEnum;
......@@ -85,21 +73,6 @@ import com.yeejoin.equipmanage.common.exception.BaseException;
import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.common.utils.QRCodeUtil;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.common.vo.EquipFor3DVO;
import com.yeejoin.equipmanage.common.vo.EquipmentDate;
import com.yeejoin.equipmanage.common.vo.EquipmentDetailVo;
import com.yeejoin.equipmanage.common.vo.EquipmentOnCarVo;
import com.yeejoin.equipmanage.common.vo.EquipmentSpecific3dVo;
import com.yeejoin.equipmanage.common.vo.VideoOnEquipmentSpecificVo;
import com.yeejoin.equipmanage.mapper.EquipmentIndexMapper;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificAlarmMapper;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificMapper;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
import com.yeejoin.equipmanage.mapper.FormInstanceMapper;
import com.yeejoin.equipmanage.mapper.SignalClassifyMapper;
import com.yeejoin.equipmanage.mapper.UploadFileMapper;
import com.yeejoin.equipmanage.mapper.VideoMapper;
import com.yeejoin.equipmanage.mapper.WarehouseStructureMapper;
import com.yeejoin.equipmanage.service.ICarService;
import com.yeejoin.equipmanage.service.IEquPropertyService;
import com.yeejoin.equipmanage.service.IEquipmentCategoryService;
......@@ -123,6 +96,10 @@ import com.yeejoin.equipmanage.service.IVideoService;
import com.yeejoin.equipmanage.service.IWarehouseService;
import com.yeejoin.equipmanage.service.IWarehouseStructureService;
import com.yeejoin.equipmanage.utils.RelationRedisUtil;
import org.typroject.tyboot.core.foundation.utils.DateTimeUtil;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import static org.typroject.tyboot.core.foundation.utils.DateTimeUtil.ISO8601_DATE_HOUR_MIN_SEC;
/**
* @author ZeHua Li
......@@ -233,6 +210,9 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Autowired
FormInstanceMapper formInstanceMapper;
@Autowired
EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
@Value("${systemctl.sync.switch}")
private Boolean syncSwitch;
......@@ -1792,4 +1772,48 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
return list;
}
@Override
public List<IotIndexInfoVo> getIndexInfoList(String iotCode, ResponseModel entity, Integer isTrend, String fieldKey) {
List<IotIndexInfoVo> infoVoList = new ArrayList<>();
String json = JSON.toJSONString(entity.getResult());
List<Map<String, String>> listObject = (List<Map<String, String>>) JSONArray.parse(json);
List<EquipmentSpecificIndex> indexes = equipmentSpecificIndexMapper.getEquipmentSpeIndexByIotCodeTrend(iotCode, isTrend, fieldKey);
if (!ObjectUtils.isEmpty(indexes)) {
Map<String, EquipmentSpecificIndex> collect = indexes.stream().collect(Collectors.toMap(EquipmentSpecificIndex::getNameKey, equipmentSpecificIndex -> equipmentSpecificIndex));
for(Map<String, String> mapList : listObject){
String dateStr = null;
String deviceName = String.valueOf(mapList.get("deviceName"));
try {
String value = String.valueOf(mapList.get("time"));
String strDate = value.substring(0, 19);
SimpleDateFormat sdf = new SimpleDateFormat(ISO8601_DATE_HOUR_MIN_SEC);
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
Date date =sdf.parse(strDate);
dateStr = DateTimeUtil.format(date, DateTimeUtil.ISO_DATE_HOUR24_MIN_SEC);
} catch (Exception e) {
log.error("日期转换失败");
}
for (Map.Entry entry : mapList.entrySet()){
if (!ObjectUtils.isEmpty(entry.getValue()) && !"null".equals(entry.getValue())) {
EquipmentSpecificIndex equipmentSpecificIndex = collect.get(entry.getKey());
if (!ObjectUtils.isEmpty(equipmentSpecificIndex)) {
IotIndexInfoVo iotIndexInfoVo = new IotIndexInfoVo();
iotIndexInfoVo.setType(equipmentSpecificIndex.getIndexName());
iotIndexInfoVo.setNumber(deviceName);
if (equipmentSpecificIndex.getIsTrend() == 1) {
iotIndexInfoVo.setContent(equipmentSpecificIndex.getIndexName() + entry.getValue() + equipmentSpecificIndex.getIndexUnitName());
} else {
iotIndexInfoVo.setContent(equipmentSpecificIndex.getEquipmentIndexName());
}
iotIndexInfoVo.setSendTime(dateStr);
infoVoList.add(iotIndexInfoVo);
}
}
}
}
}
return infoVoList;
}
}
......@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
......@@ -25,6 +26,7 @@ import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.dto.EquipTypeAmountPageDTO;
import com.yeejoin.equipmanage.common.entity.vo.*;
import com.yeejoin.equipmanage.common.enums.*;
import com.yeejoin.equipmanage.common.utils.CommonPageInfoParam;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.common.vo.*;
import com.yeejoin.equipmanage.mapper.*;
......@@ -280,7 +282,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
FeignClientResult<AgencyUserModel> result = Privilege.agencyUserClient.queryByUserId(vo.getChargePerson());
AgencyUserModel userModel = result == null ? new AgencyUserModel() : result.getResult();
if(userModel!=null&&userModel.getRealName()!=null){
if (userModel != null && userModel.getRealName() != null) {
vo.setChargePersonName(userModel.getRealName());
}
......@@ -400,27 +402,27 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// responses.add(p);
// });
// List<PointTreeVo> regionList = responses.stream().filter(r -> "TRUE".equals(r.getIsRegion())).collect(Collectors.toList());
List<PointTreeVo> buildList = buildingMapper.getBuildList(orgCode,null);
return transferListToPointTree(buildList, id,null);
List<PointTreeVo> buildList = buildingMapper.getBuildList(orgCode, null);
return transferListToPointTree(buildList, id, null);
}
@Override
public List<SpeIndexVo> getSpeIndex(Long id,int flag) {
public List<SpeIndexVo> getSpeIndex(Long id, int flag) {
// 因此处代码其他地方有调用 增加表示判断 flag == 1 为 消防点位图处需要iot编码所用
if (flag == 1){
if (flag == 1) {
List<SpeIndexVo> speIndexVos = makeStatus(fireFightingSystemMapper.getSpeIndex(id));
if (!ValidationUtil.isEmpty(speIndexVos)){
if (!ValidationUtil.isEmpty(speIndexVos)) {
EquipmentSpecific equipmentSpecific = equipmentSpecificSerivce.getBaseMapper().selectById(id);
if (!ValidationUtil.isEmpty(equipmentSpecific)){
if (!ValidationUtil.isEmpty(equipmentSpecific)) {
SpeIndexVo speIndexVo = new SpeIndexVo();
speIndexVo.setName("设备编码");
speIndexVo.setValue(equipmentSpecific.getCode());
speIndexVos.add(0,speIndexVo);
speIndexVos.add(0, speIndexVo);
}
}
return speIndexVos;
}
return makeStatus(fireFightingSystemMapper.getSpeIndex(id));
return makeStatus(fireFightingSystemMapper.getSpeIndex(id));
}
private void insertFiles(FireFightingSystemVo vo) {
......@@ -495,9 +497,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
* @param id
* @return
*/
public List<PointTreeVo> transferListToPointTree(List<PointTreeVo> allRiskSource, String id,String instanceId) {
public List<PointTreeVo> transferListToPointTree(List<PointTreeVo> allRiskSource, String id, String instanceId) {
//TODO id为空,为消防建筑使用;id不为空,为点位图使用
List<PointTreeVo> pointData = fireFightingSystemMapper.getPointData(id,instanceId);
List<PointTreeVo> pointData = fireFightingSystemMapper.getPointData(id, instanceId);
if (!CollectionUtils.isEmpty(pointData)) {
// 查询所有wl_source_scene,判断是否绑定
LambdaQueryWrapper<SourceScene> wrapper = new LambdaQueryWrapper<>();
......@@ -516,7 +518,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
// 优化不查指标
for (PointTreeVo p : pointData) {
Long buildOrSysId = p.getParentId();
Long buildOrSysId = p.getParentId();
Long equipSpecificId = p.getSequenceNbr();
Map map = new HashMap(7);
map.put("imgPath", p.getImgPath());
......@@ -582,9 +584,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
* @param id
* @return
*/
public List<PointTreeVo> transferListToPointTreeNew(List<PointTreeVo> allRiskSource, String id,String instanceId,String displayName) {
public List<PointTreeVo> transferListToPointTreeNew(List<PointTreeVo> allRiskSource, String id, String instanceId, String displayName) {
//TODO id为空,为消防建筑使用;id不为空,为点位图使用
List<PointTreeVo> pointData = fireFightingSystemMapper.getPointDataNew(id,instanceId,displayName);
List<PointTreeVo> pointData = fireFightingSystemMapper.getPointDataNew(id, instanceId, displayName);
if (!CollectionUtils.isEmpty(pointData)) {
// 查询所有wl_source_scene,判断是否绑定
List<SourceScene> sourceSceneList = sourceSceneMapper.selectList(null);
......@@ -782,7 +784,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
try {
FeignUtil.remoteCall(() -> Morphic.morphicSubjectClient.delete(entity.getSceneId()));
} catch (Exception e) {
log.error("远程调用 MORPHIC 服务的删除操作出错:"+e.getMessage().toString(),e);
log.error("远程调用 MORPHIC 服务的删除操作出错:" + e.getMessage().toString(), e);
}
}
formInstanceMapper.clearSystemId(id);
......@@ -851,9 +853,10 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
});
return list;
}
@Override
public IPage<EquipTypeImgAmountVO> getColaCategoryAmountListIot(int hierarchy, String codeHead,
EquipTypeAmountPageDTO equipTypeAmountPage) {
EquipTypeAmountPageDTO equipTypeAmountPage) {
String type = equipTypeAmountPage.getType();
if (!"".equals(type) && "car".equals(type)) {
equipTypeAmountPage.setSystemId(null);
......@@ -868,6 +871,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
});
return list;
}
@Override
public IPage<EquipTypeImgAmountVO> getColaCategoryAmountCarList(int hierarchy, String codeHead,
EquipTypeAmountPageDTO equipTypeAmountPage) {
......@@ -1139,8 +1143,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// return JSONArray.parseArray(
// JSONArray.toJSONString(redisUtils.get(equipTypeAndCount + bizOrgCode)), EquipmentCategory.class);
// } else {
return refreshEquipmentTypeAndCount(bizOrgCode);
// }
return refreshEquipmentTypeAndCount(bizOrgCode);
// }
}
@Override
......@@ -1150,8 +1154,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
return null;
}
List<EquipmentCategory> equipmentTypeList = responseList.stream()
.filter(i -> !i.getCode().startsWith("2") && "2".equals(i.getIndustryCode()))
.filter(m->!m.getCode().startsWith("9306") && "2".equals(m.getIndustryCode()))
.filter(i -> !i.getCode().startsWith("2") && "2".equals(i.getIndustryCode()))
.filter(m -> !m.getCode().startsWith("9306") && "2".equals(m.getIndustryCode()))
.collect(Collectors.toList());
List<EquipmentCategory> list = typeListTree(equipmentTypeList, bizOrgCode, SourceTypeEnum.EQUIPMENT);
redisUtils.set(equipTypeAndCount + bizOrgCode, list, 86400);
......@@ -1263,4 +1267,65 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
return this.baseMapper.selectList(wrapper);
}
@Override
public Map<String, Object> getSystemStatus(HashMap<String, Object> hashMap) {
Map<String, Object> resultMap = new HashMap<>();
Map<String, Object> map = fireFightingSystemMapper.getFireSystemInfo(hashMap);
if (!map.isEmpty()) {
ArrayList<Object> status = new ArrayList<>();
status.add(map.get("status"));
resultMap.put("values", status);
resultMap.put("labels", status);
}
return resultMap;
}
@Override
public Map<String, Object> getSystemName(HashMap<String, Object> hashMap) {
Map<String, Object> resultMap = new HashMap<>();
Map<String, Object> map = fireFightingSystemMapper.getFireSystemInfo(hashMap);
if (!map.isEmpty()) {
resultMap.put("name", map.get("name"));
}
return resultMap;
}
@Override
public Map<String, Object> equipAlarmTOP(HashMap<String, Object> hashMap) {
Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> list = fireFightingSystemMapper.equipAlarmTOP(hashMap);
if (!CollectionUtils.isEmpty(list)) {
LinkedHashSet<String> yAxis = new LinkedHashSet<>();
ArrayList<String> xAxis = new ArrayList<>();
String yKey = "";
String xResult = "";
for (Map<String, Object> stringObjectMap : list) {
yKey = stringObjectMap.get("equipName").toString();
xResult = stringObjectMap.get("total").toString();
yAxis.add(yKey);
xAxis.add(xResult);
}
resultMap.put("xAxis", xAxis);
resultMap.put("yAxis", yAxis);
}
return resultMap;
}
@Override
public Page<Map<String, Object>> equipmentState(Page res, HashMap<String, Object> hashMap) {
Page result = new Page<>(res.getCurrent(), res.getSize());
String id = fireFightingSystemMapper.equipmentId(hashMap);
Page<Map<String, Object>> mapPage = fireFightingSystemMapper.equipmentState(result, id);
return mapPage;
}
@Override
public Page<Map<String, Object>> getSmallWaterInfo(Page page, HashMap<String, Object> hashMap) {
String bizOrgCode = hashMap.get("bizOrgCode").toString();
String systemCode = hashMap.get("systemCode").toString();
return fireFightingSystemMapper.getWaterInfo(page, bizOrgCode, systemCode);
}
}
......@@ -264,8 +264,7 @@ public class ExcelServiceImpl {
AircraftDto.class, dataSourcesImpl, false);
break;
case "XFDW":
// 暂时先还原代码不加 “非” ,由此原因导致导出队伍没有数据,后续若需修改请排查加了此逻辑的相关导出功能
if(authFalg) {
if(!authFalg) {
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), null,
FireTeamDto.class, dataSourcesImpl, false);
break;
......@@ -752,11 +751,7 @@ public class ExcelServiceImpl {
logger.error("日期转换失败");
}
}
if ("peopleType".equals(key)) {
dynamicFormInstanceDto.setFieldValue("1");
dynamicFormInstanceDto.setFieldValueLabel("非消防人员");
orgUsrExcelDto.setPeopleType("1");
}
DynamicFormInstance dynamicFormInstance = new DynamicFormInstance();
BeanUtils.copyProperties(dynamicFormInstanceDto, dynamicFormInstance);
dynamicFormInstancelist.add(dynamicFormInstance);
......
......@@ -353,7 +353,9 @@
</select>
<select id="getEquipmentCount" resultType="Long">
select
if(sum(sto.amount) is null,0,sum(sto.amount)) as count from
-- IF ( sum( sto.amount ) IS NULL, 0, sum( sto.amount ) ) AS count
count(1)
from
wl_stock_detail as sto
left join wl_warehouse_structure as war on sto.warehouse_structure_id = war.id
where war.source_id in(
......@@ -523,11 +525,12 @@
</select>
<select id="getEquipCount" resultType="java.lang.Long">
SELECT
IF (
sum(sto.amount) IS NULL,
0,
sum(sto.amount)
) AS count
-- IF (
-- sum(sto.amount) IS NULL,
-- 0,
-- sum(sto.amount)
-- ) AS count
count( 1 )
FROM
wl_stock_detail AS sto
LEFT JOIN wl_warehouse_structure AS war ON sto.warehouse_structure_id = war.id
......
......@@ -223,4 +223,10 @@
GROUP BY
group_name
</select>
<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 equipment_id from wl_equipment_detail wei where id = (
select equipment_detail_id from wl_equipment_specific where id = #{id})
)
</select>
</mapper>
......@@ -259,7 +259,7 @@
</select>
<select id="pageQuery" resultType="java.util.HashMap">
SELECT
`wlesal`.`id` AS `id`,
`wlesal`.`equipment_specific_alarm_id` AS `id`,
`wles`.`code` AS `code`,
`wlesal`.`equipment_specific_name` AS `specificName`,
`wlesal`.`equipment_specific_index_key` AS `indexKey`,
......@@ -268,7 +268,7 @@
IF
( `wlesal`.`clean_time` IS NOT NULL, '已消除', '未消除' ) AS `cleanStatus`,
`wlesal`.`iot_code` AS `iotCode`,
`wlesal`.`create_date` AS `createDate`
CONVERT ( `wlesal`.`create_date`, CHAR ) AS `createDate`
FROM
`wl_equipment_specific_alarm_log` `wlesal`
LEFT JOIN `wl_equipment_specific` `wles` ON `wlesal`.`equipment_specific_id` = `wles`.`id`
......@@ -1238,6 +1238,6 @@
s.date,
s1.equipment_specific_index_key
ORDER BY
s.date
s.date DESC
</select>
</mapper>
\ No newline at end of file
......@@ -456,4 +456,35 @@ WHERE wles.id=#{id}
esi.update_date DESC
LIMIT 50
</select>
<select id="getEquipmentSpeIndexByIotCodeTrend" resultType="com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex">
SELECT
wei.id AS id,
wei.name_key AS nameKey,
wesi.value AS value,
wesi.equipment_specific_id AS equipmentSpecificId,
wesi.equipment_index_id AS equipmentIndexId,
wes.org_code AS code,
wes.iot_code AS iotCode,
wes.org_code AS orgCode,
wei.type_code AS typeCode,
wei.name AS indexName,
wei.unit AS indexUnitName,
wei.is_trend isTrend,
wesi.value_label,
wesi.equipment_index_name,
wesi.update_date AS updateDate
FROM
wl_equipment_specific_index AS wesi
LEFT JOIN wl_equipment_specific AS wes ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
WHERE
wes.iot_code = #{iotCode}
<if test="isTrend != null">
AND wei.is_trend = #{isTrend}
</if>
<if test="fieldKey != null">
AND wei.name_key = #{fieldKey}
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -1051,45 +1051,45 @@
GROUP BY
fs.id;
</select>
<select id="getFireSystemState" resultType="Map">
select * from v_fire_system_state
</select>
<select id="getFireOnlSystem" resultType="Map">
select * from v_fire_onl_num
</select>
<select id="getFireCafsSystem" resultType="Map">
select * from v_fire_cafs_num
</select>
<select id="getFireFfsSystem" resultType="Map">
select * from v_fire_ffs_num
</select>
<select id="getFireFasSystem" resultType="Map">
select * from v_fire_fas_num
</select>
<select id="getFireAcsSystem" resultType="Map">
select * from v_fire_acs_num
</select>
<select id="getFireFhsSystem" resultType="Map">
select * from v_fire_fhs_num
</select>
<select id="getTodayConfirmAlarmInfo" resultType="Map">
select * from v_equip_alarm_today_statistics
</select>
<select id="getPoolInfo" resultType="Map">
select * from v_fire_fhs_yl_num
</select>
<select id="getFightingSysInfo" resultType="com.yeejoin.equipmanage.common.vo.FireFightingSystemVo">
select * from v_fire_system_info fs
<where>
......@@ -1101,7 +1101,7 @@
</if>
</where>
</select>
<select id="getFireOnlSystemThreeSmall" resultType="Map">
select * from v_fire_onl_three_small
</select>
......@@ -1804,7 +1804,7 @@
where
si.equipment_index_key = 'ES_Elevator_Shield'
and si.`value` = 'true'
) AS `dtpb`,
(
select
......@@ -2402,6 +2402,9 @@
<if test="bizOrgCode!=null and bizOrgCode!=''">
and es.biz_org_code = #{bizOrgCode,jdbcType=VARCHAR}
</if>
<if test="systemCode!=null and systemCode!=''">
and FIND_IN_SET( #{systemCode,jdbcType=VARCHAR}, log.system_codes )
</if>
</where>
) AS unclearInfoNum,
(
......@@ -2419,29 +2422,33 @@
) AS unConfirmInfoNum
</select>
<select id="getFireTeamInfo" resultType="java.util.Map">
<select id="getFireTeamInfoBy117" resultType="java.util.Map">
SELECT
ifnull( count( 0 ), 0 ) AS `total`,
ifnull( sum(( SELECT count( 0 ) FROM `d_duty_details` `duty` WHERE ( `duty`.`user_id` = `cou`.`sequence_nbr` ))), 0 ) AS `on_duty`,
'志愿消防队'
'志愿消防队' as typeName
FROM
( SELECT * FROM `cb_org_usr` WHERE `cb_org_usr`.`is_firefighters` = 1 AND `cb_org_usr`.`type_code` = 117
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND biz_org_code = #{bizOrgCode,jdbcType=VARCHAR}
</if> ) `cou` UNION ALL
</if> ) `cou`
</select>
<select id="getFireTeamInfoBy116" resultType="java.util.Map">
SELECT
ifnull( count( 0 ), 0 ) AS `total`,
ifnull( sum(( SELECT count( 0 ) FROM `d_duty_details` `duty` WHERE ( `duty`.`user_id` = `cou`.`sequence_nbr` ))), 0 ) AS `on_duty`,
'专职驻站消防队'
ifnull( count( 0 ), 0 ) AS `total`,
ifnull( sum(( SELECT count( 0 ) FROM `d_duty_details` `duty` WHERE ( `duty`.`user_id` = `cou`.`sequence_nbr` ))), 0 ) AS `on_duty`,
'专职驻站消防队' as typeName
FROM
( SELECT * FROM `cb_org_usr` WHERE `cb_org_usr`.`is_firefighters` = 1 AND `cb_org_usr`.`type_code` = 116
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND biz_org_code = #{bizOrgCode,jdbcType=VARCHAR}
</if> ) `cou`
( SELECT * FROM `cb_org_usr` WHERE `cb_org_usr`.`is_firefighters` = 1 AND `cb_org_usr`.`type_code` = 116
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND biz_org_code = #{bizOrgCode,jdbcType=VARCHAR}
</if> ) `cou`
</select>
<select id="getFireCarInfo" resultType="java.util.Map">
SELECT
a.total,
IFNULL( sum( a.carStartState ), 0 ) AS carStartNum,
IFNULL( sum( a.carCloseState ), 0 ) AS carCloseNum
FROM
......@@ -2449,6 +2456,7 @@
SELECT
`wc`.`id` AS `id`,
`wc`.`name` AS `name`,
count(wc.id) as total,
max(
CASE
......@@ -2513,4 +2521,233 @@
</if>
</where>
</select>
<select id="getWaterInfo" resultType="java.util.Map">
SELECT
r.`name`,
ou.`code`,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
IFNULL((
abs(
IFNULL(
max( CASE WHEN ei.name_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.perf_value END ),
IFNULL( rp.min_water_level, 0 )) /
IF
(
IFNULL( rp.max_water_level, 0 ) = 0,
1,
IFNULL( rp.max_water_level, 0 ))) * 100
),
0
) AS levelAbs,
IFNULL(
max( CASE WHEN ei.name_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.perf_value END ),
IFNULL( rp.min_water_level, 0 )) AS nowLevel,
(
CASE
WHEN IFNULL(
max( CASE WHEN ei.name_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.perf_value END ),
IFNULL( rp.min_water_level, 0 )) &lt; IFNULL( rp.min_water_level, 0 ) THEN
'缺水' ELSE '正常'
END
) AS levelStatus,
IFNULL( rp.volume, 0 ) AS volume,
ec.image,
r.resource_type
FROM
cb_water_resource r
LEFT JOIN cb_org_usr ou ON ou.biz_org_code = r.biz_org_code
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
LEFT JOIN wl_equipment_specific es ON es.id = rp.level_device_id
LEFT JOIN wl_equipment_detail ed ON ed.id = es.equipment_detail_id
LEFT JOIN wl_equipment_index ei ON ei.equipment_id = ed.equipment_id
LEFT JOIN wl_equipment e ON e.id = ei.equipment_id
LEFT JOIN wl_equipment_category ec ON ec.id = e.category_id
LEFT JOIN f_fire_fighting_system fs ON fs.biz_org_code = r.biz_org_code
WHERE
r.resource_type IN ( 'pool', 'industryPool' )
AND r.is_delete = 1
AND ou.`code` IS NOT NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code = #{bizOrgCode,jdbcType=VARCHAR}
</if>
<if test="systemCode!=null and systemCode!=''">
AND fs.code = #{systemCode,jdbcType=VARCHAR}
</if>
GROUP BY
r.sequence_nbr
</select>
<select id="getFireSystemInfo" resultType="java.util.Map">
select `nz`.name,`nz`.status from ( SELECT
`fs`.`id` AS `id`,
`fs`.`code` AS `code`,
`fs`.`biz_org_code` AS `biz_org_code`,
`fs`.`name` AS `name`,
`fs`.`install_date` AS `installdate`,
`fs`.`charge_person_name` AS `chargeperson`,
`fs`.`charge_person_phone` AS `chargepersonphone`,
`mim`.`name` AS `maintenanceunit`,
`mic`.`name` AS `constructionunit`,(
CASE
WHEN ((
SELECT
count( 1 )
FROM
`wl_equipment_specific_alarm`
WHERE
((
`wl_equipment_specific_alarm`.`status` = 1
)
AND (
0 != find_in_set( `fs`.`id`, `wl_equipment_specific_alarm`.`system_ids` )))) > 0
) THEN
'异常' ELSE '正常'
END
) AS `status`
FROM
((
`f_fire_fighting_system` `fs`
LEFT JOIN `wl_manufacturer_info` `mic` ON ((
`mic`.`id` = `fs`.`maintenance_unit`
)))
LEFT JOIN `wl_manufacturer_info` `mim` ON ((
`mim`.`id` = `fs`.`construction_unit`
)))) `nz` where `nz`.code = #{systemCode} and `nz`.biz_org_code = #{bizOrgCode}
</select>
<select id="equipAlarmTOP" resultType="java.util.Map">
SELECT
ifnull( `a`.`fightSysName`, NULL ) AS `fightSysName`,
ifnull( `a`.`fightSysCode`, NULL ) AS `fightSysCode`,
ifnull( `a`.`fightSysId`, NULL ) AS `fightSysId`,
ifnull( `a`.`report_date`, NULL ) AS `reportDate`,
`a`.`equipName` AS `equipName`,
sum( `a`.`total` ) AS `total`
FROM
(
SELECT
`rd`.`index_type` AS `indxKey`,
`rd`.`index_name` AS `index_name`,
`rd`.`equipment_specific_name` AS `equipName`,
count( DISTINCT `rd`.`equipment_specific_id` ) AS `total`,
`rd`.`report_date` AS `report_date`,
`fs`.`name` AS `fightSysName`,
`fs`.`code` AS `fightSysCode`,
`fs`.`id` AS `fightSysId`,
`rd`.`equipment_specific_id` AS `equipId`
FROM
(
`wl_equipment_alarm_report_day` `rd`
LEFT JOIN `f_fire_fighting_system` `fs` ON ((
0 != find_in_set( `fs`.`id`, `rd`.`system_ids` ))))
WHERE
(((
curdate() - INTERVAL 30 DAY
) &lt;= cast( `rd`.`report_date` AS date ))
AND ( `fs`.`code` = #{systemCode} )
AND ( `fs`.`biz_org_code` = #{bizOrgCode} )
AND ((
`rd`.`index_type` LIKE '%Fault'
)
OR ( `rd`.`index_type` LIKE '%FireAlarm' )
OR ( `rd`.`index_type` LIKE '%Shield' ))
AND ( `rd`.`value` = 'true' ))
GROUP BY
`rd`.`equipment_specific_id`,
`rd`.`report_date`
) `a`
GROUP BY
`a`.`equipId`
ORDER BY
`total` DESC
LIMIT 5
</select>
<select id="equipmentId" resultType="String">
select
id
from
f_fire_fighting_system
where
code = #{systemCode} and
biz_org_code = #{bizOrgCode}
</select>
<select id="equipmentState" resultType="java.util.Map">
SELECT
b.equipName,
(CASE WHEN
b.totalNum > 0 THEN
'异常' ELSE '正常' END) `status`,
b.totalNum AS totalNum
FROM
(
SELECT
a.equipName,
count( wesl.id ) AS totalNum
FROM
(
SELECT
wes.`name` AS equipName,
wed.equipment_id AS equipmentId
FROM
wl_equipment_specific wes
LEFT JOIN wl_equipment_detail wed ON wed.id = wes.equipment_detail_id
WHERE
FIND_IN_SET( #{id}, wes.system_id ) > 0
GROUP BY
wed.equipment_id
) a
LEFT JOIN wl_equipment_specific_alarm_log wesl ON wesl.equipment_id = a.equipmentId
GROUP BY
a.equipmentId
) b
</select>
<select id="getPressurePumpInfo" 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>
<select id="queryPressureNowStateBySpecificId" resultType="java.util.Map">
SELECT
i.update_date,
i.equipment_index_name
FROM
wl_equipment_specific_index i
WHERE
i.equipment_index_key IN ( 'FHS_PressurePump_Start', 'FHS_PressurePump_Stop' )
AND i.equipment_specific_id = #{id,jdbcType=VARCHAR}
and i.`value` = 'true'
ORDER BY
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