Commit 47379af3 authored by tangwei's avatar tangwei

对接物联数据

parent 2381c24b
package com.yeejoin.equipmanage.common.entity.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @description:
* @author: tw
* @createDate: 2023/3/7
*/
@Data
public class EquipmentAlarmLogDto {
@ApiModelProperty(value = "id")
private String id;
@ApiModelProperty(value = "时间")
private String time;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "事件内容")
private String content;
}
package com.yeejoin.equipmanage.common.entity.dto;
import lombok.Data;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @description:
* @author: tw
* @createDate: 2023/3/9
*/
@Data
public class IndexLogsRequest {
private String iotCode;
private String timeStart;
private String timeEnd;
private String fieldKey;
public IndexLogsRequest(String iotCode, String timeStart, String timeEnd, String fieldKey) {
this.iotCode = iotCode;
this.timeStart = timeStart;
this.timeEnd = timeEnd;
this.fieldKey = fieldKey;
}
public IndexLogsRequest() {
}
}
......@@ -21,6 +21,8 @@ public class EquiplistSpecificBySystemVO {
@ApiModelProperty(value = "设备编码")
private String code;
@ApiModelProperty(value = "iot编码")
private String iotCode;
@ApiModelProperty(value = "设备分组名称")
private String categoryName;
......@@ -30,4 +32,10 @@ public class EquiplistSpecificBySystemVO {
@ApiModelProperty(value = "是否绑定")
private Boolean isBound;
@ApiModelProperty(value = "指标名称")
private String indexName;
@ApiModelProperty(value = "指标key")
private String indexKey;
@ApiModelProperty(value = "是否告警")
private String isAlarm;
}
package com.yeejoin.equipmanage.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -13,6 +17,8 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
/**
* @author ZeHua Li
* @date 2020/10/29 14:26
......@@ -39,8 +45,25 @@ public class EquipmentSpecificAlarmLogController extends AbstractBaseController
public ResponseModel equipAlarmLink(@RequestParam(required = false) String date) {
return CommonResponseUtil.success(equipmentSpecificAlarmLogService.equipAlarmLink(date));
}
/**
* 获取设备物联日志
*
* @param
* id:系统id
* startTime:开始时间
* endTime:结束时间
* @return
*/
@RequestMapping(value = "/getEquipAlarmLog", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取设备物联日志", notes = "获取设备物联日志")
public ResponseModel getEquipAlarmLog(@RequestParam(required = false) String code,
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime,
@RequestParam(required = false) int pageSize,
@RequestParam(required = false) int current ) {
return CommonResponseUtil.success(equipmentSpecificAlarmLogService.getEquipAlarmLog(code,startTime,endTime, pageSize,current));
}
}
......
package com.yeejoin.equipmanage.fegin;
import com.yeejoin.equipmanage.common.entity.dto.IndexLogsRequest;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map;
/**
* @author DELL
......@@ -69,4 +70,6 @@ public interface IotFeign {
@RequestParam(required = false, value = "fieldKey") String fieldKey);
@RequestMapping(value = "v1/livedata/index/logs", method = RequestMethod.POST, consumes = "application/json")
ResponseModel<List<Map<String ,Object>>> getEquipAlarmLog( @RequestBody IndexLogsRequest indexLogsRequest );
}
......@@ -25,6 +25,15 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
*/
List<EquiplistSpecificBySystemVO> getEquiplistBySystemId(Long systemId);
/**
* 根据系统id查询设备列表
*
* @param systemId
* @return
*/
List<EquiplistSpecificBySystemVO> getEquiplistBySystemIdList(Long systemId);
/**
* 根据系统id查询分组设备数量
*
......
package com.yeejoin.equipmanage.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarm;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog;
import com.yeejoin.equipmanage.common.entity.dto.EquipmentAlarmLogDto;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
......@@ -48,4 +51,15 @@ public interface IEquipmentSpecificAlarmLogService extends IService<EquipmentSpe
* @return
*/
List<EquipmentSpecificAlarmLog> getAlarmLogInfoList(String equipmentCode, String nameKeys, String value, String isCleanTime, String bizOrgCode);
/**
* 获取设备物联日志
*
* @param
* id:系统id
* startTime:开始时间
* endTime:结束时间
* @return
*/
Page<EquipmentAlarmLogDto> getEquipAlarmLog(String id, String startTime, String endTime, int pageSize, int current );
}
package com.yeejoin.equipmanage.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarm;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity;
import com.yeejoin.equipmanage.common.entity.OrgUsr;
import com.yeejoin.equipmanage.common.entity.dto.EquipmentAlarmLogDto;
import com.yeejoin.equipmanage.common.entity.dto.IndexLogsRequest;
import com.yeejoin.equipmanage.common.entity.vo.EquiplistSpecificBySystemVO;
import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.fegin.VideoFeignClient;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificAlarmLogMapper;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmLogService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @author keyong
* @title: EquipmentSpecificAlarmLogServiceImpl
* <pre>
* @description: TODO
* @description:
* </pre>
* @date 2021/8/19 10:37
*/
......@@ -30,6 +41,16 @@ public class EquipmentSpecificAlarmLogServiceImpl extends ServiceImpl<EquipmentS
@Autowired
EquipmentSpecificAlarmLogMapper equipmentSpecificAlarmLogMapper;
@Autowired
FireFightingSystemMapper fireFightingSystemMapper;
@Autowired
VideoFeignClient videoFeignClient;
@Autowired
IotFeign iotFeign;
@Override
public void updateAlarmLogByIotCodeAndIndexKey(EquipmentSpecificAlarm equipmentSpecificAlarm) {
......@@ -71,4 +92,116 @@ public class EquipmentSpecificAlarmLogServiceImpl extends ServiceImpl<EquipmentS
public List<EquipmentSpecificAlarmLog> getAlarmLogInfoList(String equipmentCode, String nameKeys, String value, String isCleanTime, String bizOrgCode) {
return equipmentSpecificAlarmLogMapper.getAlarmLogInfoList(equipmentCode, nameKeys, value, isCleanTime, bizOrgCode);
}
}
@Override
public Page<EquipmentAlarmLogDto> getEquipAlarmLog(String code, String startTime, String endTime,int pageSize, int current) {
Page<EquipmentAlarmLogDto> pageBean = new Page<EquipmentAlarmLogDto>(current,pageSize);
QueryWrapper<FireFightingSystemEntity> wrapper = new QueryWrapper<>();
wrapper.eq("code", code);
FireFightingSystemEntity sys = fireFightingSystemMapper.selectOne(wrapper);
if(sys==null){
throw new BadRequest("系统不存在!");
}
String id =sys.getId().toString();
//iotcode集合
List<String> iotCodes = new ArrayList<>();
//装备名称集合
Map<String, String> mapcode = new HashMap<>();
//物联参数判断集合
Map<String, EquiplistSpecificBySystemVO> mapkey = new HashMap<>();
//存储整理后的数据
List<EquipmentAlarmLogDto> listDate = new ArrayList<>();
//获取系统下所有装备组装数据
this.getEquiplistBySystemId(id, iotCodes, mapcode);
//获取系统下所有装备物联指标
this.getEquiplistBySystemIdList(id, mapkey);
//装备为空返回空
if(iotCodes.isEmpty()||mapkey.isEmpty()){
return pageBean;
}
String iotCode= String.join(",",iotCodes);
endTime= endTime.replace("00:00:00","23:59:59");
IndexLogsRequest indexLogsRequest=new IndexLogsRequest( "YJ210093SBMC0001", startTime, endTime, null);
//调用iot 获取数据
ResponseModel<List<Map<String, Object>>> date = iotFeign.getEquipAlarmLog(indexLogsRequest);
if (date.getStatus() != 200 ) {
throw new BadRequest("系统错误!");
}
List<Map<String, Object>> listObject = date.getResult();
if (listObject != null) {
//数据处理
for (Map<String, Object> map : listObject) {
//过滤告警
String key=map.get("iotCode").toString()+map.get("indexName");
if(mapkey.containsKey(key)){
EquipmentAlarmLogDto da=new EquipmentAlarmLogDto();
da.setId(UUID.randomUUID().toString());
da.setName(mapcode.get(map.get("iotCode").toString()));
da.setTime(map.get("createdTime").toString());
String value=map.get("indexValue").toString();
value= getReadableStatus(value );
da.setContent(mapkey.get(key).getIndexName()+":"+value);
listDate.add(da);
}
}
}
pageBean.setTotal(listDate.size());
pageBean.setRecords(listDate);
return pageBean;
}
public String getReadableStatus(String value ) {
if("true".equals(value)){
return "是";
}
return "false".equals(value)?"否":value;
}
/**
* 获取系统下装备,并组装数据
*
* @param id:系统id iotCodes:装备iot集合
*
* map:key:iotcode,value:装备名称
* @param
* @return
*/
public void getEquiplistBySystemId(String id, List<String> iotCodes, Map<String, String> map) {
//获取系统下所有装备
List<EquiplistSpecificBySystemVO> list = fireFightingSystemMapper.getEquiplistBySystemId(Long.valueOf(id));
if (!list.isEmpty()) {
for (EquiplistSpecificBySystemVO equiplistSpecificBySystemVO : list) {
if (equiplistSpecificBySystemVO.getIotCode() != null) {
iotCodes.add(equiplistSpecificBySystemVO.getIotCode());
map.put(equiplistSpecificBySystemVO.getIotCode(), equiplistSpecificBySystemVO.getEquipmentName());
}
}
}
}
public void getEquiplistBySystemIdList(String id, Map<String, EquiplistSpecificBySystemVO> map) {
//获取系统下所有装备
List<EquiplistSpecificBySystemVO> list = fireFightingSystemMapper.getEquiplistBySystemIdList(Long.valueOf(id));
if (!list.isEmpty()) {
for (EquiplistSpecificBySystemVO equiplistSpecificBySystemVO : list) {
map.put(equiplistSpecificBySystemVO.getIotCode()+equiplistSpecificBySystemVO.getIndexKey(),equiplistSpecificBySystemVO);
}
}
}
}
\ No newline at end of file
......@@ -132,7 +132,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
@Autowired
ESOrgUsrService eSOrgUsrService;
@Value("${mqtt.topic.command.alert.notice}")
private String topic;
......@@ -144,7 +144,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
private long time;
@Value("${mqtt.topic.command.power.deployment}")
private String topic1;
@Value("${mqtt.topic.command.knowledgebase.alert.match}")
private String topicMatch;
......@@ -1244,8 +1244,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
AlertStageEnums.责任单位.getValue() + "," + condition2,
AlertStageEnums.重点部位名称.getValue() + "," + condition3);
//
} else if (alertCalled.getAlertTypeCode().equals(AlertStageEnums.HKJY.getCode())) {
String condition1 = alertCalled.getAlertType();// 航空器救援
String condition2 = "";
......@@ -1260,9 +1260,9 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
String condition1 = alertCalled.getAlertType();
result= getIdsList1(alertCalled.getAlertTypeCode(),AlertStageEnums.救援预案警情类型.getValue() + "," + condition1, null, null);
}
return result;
}
// private List<Map<String, Object>> getIdsList(String condition1, String condition2, String condition3) {
......@@ -1340,7 +1340,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
private Object getIdsList1(String type ,String condition1, String condition2, String condition3)throws Exception {
List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
ResponseModel<Object> responseForcondition1Name = knowledgebaseFeignClient
.queryListByTagName(condition1.split(",")[0]);
if(200!= responseForcondition1Name.getStatus()) {
......@@ -1379,7 +1379,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
condition3Name = condition3Array[0];
condition3value = condition3Array[1];
}
}
ResponseModel<Object> targetSeqResult = knowledgebaseFeignClient
.queryListByTargetSeq(Long.parseLong(listForcondition1Nameobj.getString("targetSeq")));
......@@ -1399,7 +1399,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
flag2 = true;
}
}
if (condition3Name != null && condition3Name.equals(detailJson.getString("tagName"))) {
ResponseModel<Object> condition3ResponseForInstanceId = knowledgebaseFeignClient
.queryByInstance(Long.parseLong(detailJson.getString("sequenceNbr")));
......
......@@ -452,8 +452,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
if(e.containsKey(fireBrigade)) {
// 根据人员岗位:班组长、队长、通讯员; 消防队伍--消防人员 中,对应岗位的人员
List<FirefightersDto> fireBrigade = firefightersService.queryById(e.get(fireBrigade).toString().split(","), e.get("name").toString());
fireBrigade.stream().forEach(f->{
List<FirefightersDto> fireBrigades = firefightersService.queryById(e.get(fireBrigade).toString().split(","), e.get("name").toString());
fireBrigades.stream().forEach(f->{
HashMap<String,Object> map = new HashMap<>();
map.put(telephone,f.getMobilePhone());
map.put(sequenceNbr,f.getSequenceNbr());
......
......@@ -84,16 +84,12 @@ public class RuleAlertCalledService {
if(!ValidationUtil.isEmpty(mobiles)) {
alertCalledRo.setIds(mobiles);
}
System.out.println("触发规则调用--------------西咸机场119接处警规则/alertCalledRule");
//触发规则
// ruleTrigger.publish(alertCalledRo, "西咸机场119接处警规则/alertCalledRule", new String[0]);
FactBaseModel factBaseModel = new FactBaseModel();
factBaseModel.setPackageId("西咸机场119接处警规则/alertCalledRule");
HashMap<String, byte[]> map = new HashMap<>();
// map.put("com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo", ClazzUtils.serializableObject(alertCalledRo));
map.put("com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo", JSONObject.toJSON(alertCalledRo).toString().getBytes());
map.put("com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo", JSON.toJSON(alertCalledRo).toString().getBytes());
factBaseModel.setFactMap(map);
Rule.ruleClient.fireRule(factBaseModel);
......@@ -270,8 +266,7 @@ public class RuleAlertCalledService {
if (alertCalledFormDto == null) {
return false;
}
/* //任务型计划 // bug 5973
alertCallePowerTransferRo.setCategory(RuleTypeEnum.任务型计划生成.getCategory());*/
AlertCalled alertCalled = alertCalledFormDto.getAlertCalled();
alertCallePowerTransferRo
......@@ -322,20 +317,10 @@ public class RuleAlertCalledService {
}
}
}
if (FireBrigadeTypeEnum.专职消防队.getKey().equals(type)) {
alertCallePowerTransferRo.setCompany(JSONArray.toJSONString(i));
if (FireBrigadeTypeEnum.专职消防队.getKey().equals(type)||FireBrigadeTypeEnum.监控大队.getKey().equals(type)) {
alertCallePowerTransferRo.setCompany(JSON.toJSONString(i));
alertCallePowerTransferRo.setPowerTransType(type);
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(" 失火位置:"+alertCallePowerTransferRo.getFireLocation());
stringBuffer.append(" 燃烧物质:"+alertCallePowerTransferRo.getBurningMaterial());
stringBuffer.append(" 火势情况:"+alertCallePowerTransferRo.getFireSituation());
stringBuffer.append(" 有无危险爆炸品:"+dangerousExplosives);
alertCallePowerTransferRo.setContent(stringBuffer.toString());
} else if (FireBrigadeTypeEnum.监控大队.getKey().equals(type)) {
alertCallePowerTransferRo.setCompany(JSONArray.toJSONString(i));
alertCallePowerTransferRo.setPowerTransType(type);
StringBuffer stringBuffer = new StringBuffer();
StringBuilder stringBuffer = new StringBuilder();
stringBuffer.append(" 失火位置:"+alertCallePowerTransferRo.getFireLocation());
stringBuffer.append(" 燃烧物质:"+alertCallePowerTransferRo.getBurningMaterial());
stringBuffer.append(" 火势情况:"+alertCallePowerTransferRo.getFireSituation());
......@@ -343,9 +328,9 @@ public class RuleAlertCalledService {
alertCallePowerTransferRo.setContent(stringBuffer.toString());
} else if (FireBrigadeTypeEnum.医疗救援队.getKey().equals(type)) {
alertCallePowerTransferRo.setCompany(JSONArray.toJSONString(i));
alertCallePowerTransferRo.setCompany(JSON.toJSONString(i));
alertCallePowerTransferRo.setPowerTransType(type);
StringBuffer stringBuffer = new StringBuffer();
StringBuilder stringBuffer = new StringBuilder();
stringBuffer.append(" 患者现状:"+ageGroup==null?"无":ageGroup);
stringBuffer.append(" 性别:"+presentSituation==null?"无":presentSituation);
stringBuffer.append(" 年龄段:"+gender==null?"无":gender);
......@@ -354,14 +339,7 @@ public class RuleAlertCalledService {
// 触发规则
ruleTrigger.publish(alertCallePowerTransferRo, "西咸机场119接处警规则/powerTransferCalledRule", new String[0]); // 废弃
// System.out.println("触发规则调用--------------西咸机场119接处警规则/powerTransferCalledRule");
// FactBaseModel factBaseModel = new FactBaseModel();
// factBaseModel.setPackageId("西咸机场119接处警规则/powerTransferCalledRule");
// HashMap<String, byte[]> map = new HashMap<>();
//
// map.put("com.yeejoin.amos.boot.module.jcs.api.dto.AlertCallePowerTransferRo", ClazzUtils.serializableObject(alertCallePowerTransferRo));
// factBaseModel.setFactMap(map);
// Rule.ruleClient.fireRule(factBaseModel);
return true;
}
......
......@@ -19,7 +19,7 @@ public class ShieldServiceImpl implements IHomePageService {
@Autowired
EquipFeignClient quipFeignClient;
private static EquipFeignClient quipFeignClient1;
private EquipFeignClient quipFeignClient1;
@PostConstruct
public void init(){
......
......@@ -13,6 +13,7 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -62,6 +63,9 @@ public class ShiftChangeServiceImpl extends BaseService<ShiftChangeDto, ShiftCha
private final String GROUP_CODE = "shiftChanges";
private final String INSTANCEID ="instanceId";
@Override
public Map<String, Object> createFormAndEntry(Map<String, Object> model) {
Long instanceId = dynamicFormInstanceService.commonSave(GROUP_CODE, model);
......@@ -79,9 +83,9 @@ public class ShiftChangeServiceImpl extends BaseService<ShiftChangeDto, ShiftCha
ShiftChangeDto shiftChange = this.queryBySeq(sequenceNbr);
if (shiftChange != null) {
dynamicFormInstanceService.remove(new LambdaQueryWrapper<DynamicFormInstance>().eq(DynamicFormInstance::getInstanceId, shiftChange.getInstanceId()));
this.removeById(sequenceNbr);
return this.removeById(sequenceNbr);
}
return null;
return false;
}
@Override
......@@ -106,7 +110,7 @@ public class ShiftChangeServiceImpl extends BaseService<ShiftChangeDto, ShiftCha
Map<Long,ShiftChange> shiftChangeMap = shiftChanges.stream().collect(Collectors.toMap(ShiftChange::getInstanceId, Function.identity()));
page.getRecords().forEach(r->{
//instanceId 必输 所以未进行 null判断
ShiftChange shiftChange = shiftChangeMap.get(Long.parseLong(r.get("instanceId").toString()));
ShiftChange shiftChange = shiftChangeMap.get(Long.parseLong(r.get(INSTANCEID).toString()));
r.putAll(Bean.BeantoMap(shiftChange));
});
return page;
......@@ -122,7 +126,7 @@ public class ShiftChangeServiceImpl extends BaseService<ShiftChangeDto, ShiftCha
Map<Long,ShiftChange> shiftChangeMap = shiftChanges.stream().collect(Collectors.toMap(ShiftChange::getInstanceId, Function.identity()));
page.getRecords().forEach(r->{
//instanceId 必输 所以未进行 null判断
ShiftChange shiftChange = shiftChangeMap.get(Long.parseLong(r.get("instanceId").toString()));
ShiftChange shiftChange = shiftChangeMap.get(Long.parseLong(r.get(INSTANCEID).toString()));
r.putAll(Bean.BeantoMap(shiftChange));
});
return page;
......@@ -135,7 +139,7 @@ public class ShiftChangeServiceImpl extends BaseService<ShiftChangeDto, ShiftCha
Map<Long,ShiftChange> shiftChangeMap = shiftChanges.stream().collect(Collectors.toMap(ShiftChange::getInstanceId, Function.identity()));
list.forEach(r -> {
//instanceId 必输 所以未进行 null判断
ShiftChange shiftChange = shiftChangeMap.get(Long.parseLong(r.get("instanceId").toString()));
ShiftChange shiftChange = shiftChangeMap.get(Long.parseLong(r.get(INSTANCEID).toString()));
r.putAll(Bean.BeantoMap(shiftChange));
});
return list;
......@@ -144,7 +148,7 @@ public class ShiftChangeServiceImpl extends BaseService<ShiftChangeDto, ShiftCha
@Override
public Map<String, Object> lastRecord() {
List<Map<String, Object>> list = dynamicFormInstanceService.listAll(GROUP_CODE);
list = list.stream().sorted(Comparator.comparing(e->e.get("instanceId"), Comparator.comparingLong(s -> -Long.parseLong(s.toString())))).collect(Collectors.toList());
list = list.stream().sorted(Comparator.comparing(e->e.get(INSTANCEID), Comparator.comparingLong(s -> -Long.parseLong(s.toString())))).collect(Collectors.toList());
Map<String, Object> map = new HashMap<>();
map = list.isEmpty() ? map : list.get(0);
return map;
......@@ -243,10 +247,10 @@ public class ShiftChangeServiceImpl extends BaseService<ShiftChangeDto, ShiftCha
ShiftChangePowerDto powerDto = new ShiftChangePowerDto();
if (dutyJson != null) {
dutyDto = JSONObject.toJavaObject(dutyJson, ShiftChangeDutyDto.class);
dutyDto = JSON.toJavaObject(dutyJson, ShiftChangeDutyDto.class);
}
if (powerJson != null) {
powerDto = JSONObject.toJavaObject(powerJson, ShiftChangePowerDto.class);
powerDto = JSON.toJavaObject(powerJson, ShiftChangePowerDto.class);
}
List<String> infoList = dutyDto.getAlertInfoList();
......@@ -294,7 +298,7 @@ public class ShiftChangeServiceImpl extends BaseService<ShiftChangeDto, ShiftCha
document.add(docTitle);
document.add(table1);;
}catch (DocumentException E){
throw new RuntimeException("PDF写入文件报错");
throw new BadRequest("PDF写入文件报错");
}
document.close();
}
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -73,19 +74,7 @@ public class SignServiceImpl extends BaseService<SignDto,Sign,SignMapper> implem
numberFormat.setMaximumFractionDigits(2);
sinStaticDtoIPage.getRecords().stream().forEach(e->{
// int num = this.baseMapper.queryPersonNum(e.getBizOrgCode());
// int signNum ;
// if((Integer.parseInt(e.getSignNum()) & 1) != 0) {
// signNum = (Integer.parseInt(e.getSignNum()) + 1) / 2;
// } else {
// signNum = (Integer.parseInt(e.getSignNum())) / 2;
// }
// if(num != 0) {
// e.setAttendance(numberFormat.format((float) Integer.valueOf(signNum)/(float) num * 100) + "%");
// } else {
// e.setAttendance("0%");
// }
e.setAttendance(e.getSignNum() + "/" + e.getPersonOfDay());
});
......@@ -142,7 +131,7 @@ public class SignServiceImpl extends BaseService<SignDto,Sign,SignMapper> implem
map.put("recUserId", ObjectUtils.isEmpty(sign.getRecUserId())?"":sign.getRecUserId());
map.put("recUserName", ObjectUtils.isEmpty(sign.getRecUserName())?"":sign.getRecUserName());
map.put("sequenceNbr", ObjectUtils.isEmpty(sign.getRecUserName())?"":sign.getSequenceNbr());
String json=JSONObject.toJSONString(map, SerializerFeature.PrettyFormat,
String json=JSON.toJSONString(map, SerializerFeature.PrettyFormat,
SerializerFeature.WriteMapNullValue);
try {
emqKeeper.getMqttClient().publish(personSign, json.getBytes(), RuleConfig.DEFAULT_QOS, false);
......@@ -154,7 +143,7 @@ public class SignServiceImpl extends BaseService<SignDto,Sign,SignMapper> implem
map.put("recDate", ObjectUtils.isEmpty(sign.getRecDate())?"":sign.getRecDate());
map.put("isDelete", ObjectUtils.isEmpty(sign.getIsDelete())?"":sign.getIsDelete());
map.put("source", ObjectUtils.isEmpty(sign.getSource())?"":sign.getSource());
String json1=JSONObject.toJSONString(map, SerializerFeature.PrettyFormat,
String json1= JSON.toJSONString(map, SerializerFeature.PrettyFormat,
SerializerFeature.WriteMapNullValue);
// 发送emq消息转kafka
JSONObject jsonObject = new JSONObject();
......
......@@ -29,11 +29,12 @@ public class UserCarServiceImpl extends BaseService<AircraftDto, UserCar, UserCa
@Autowired
IPowerTransferCompanyResourcesService companyResourcesService;
private static final String AMOS_USER_ID="amos_user_id";
@Override
public UserCar selectByAmosUserId(Long id) {
QueryWrapper<UserCar> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("amos_user_id", id);
queryWrapper.eq(AMOS_USER_ID, id);
return UserCarMapper.selectOne(queryWrapper);
}
......@@ -58,7 +59,7 @@ public class UserCarServiceImpl extends BaseService<AircraftDto, UserCar, UserCa
public void add(UserCar userCar) {
QueryWrapper<UserCar> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("amos_user_id", userCar.getAmosUserId());
queryWrapper.eq(AMOS_USER_ID, userCar.getAmosUserId());
UserCar uer = UserCarMapper.selectOne(queryWrapper);
if (uer != null) {
userCar.setSequenceNbr(uer.getSequenceNbr());
......@@ -71,7 +72,7 @@ public class UserCarServiceImpl extends BaseService<AircraftDto, UserCar, UserCa
@Override
public void delete(UserCar userCar) {
QueryWrapper<UserCar> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("amos_user_id", userCar.getAmosUserId());
queryWrapper.eq(AMOS_USER_ID, userCar.getAmosUserId());
UserCarMapper.delete(queryWrapper);
}
......@@ -82,16 +83,7 @@ public class UserCarServiceImpl extends BaseService<AircraftDto, UserCar, UserCa
return 0;
}
return companyResourcesService.getCarExecutingCountById(userCar.getCarId().toString(), "executing");
//bug 6065 首页报错,接口selectOne 一个资源对应多条数据。
// PowerTransferCompanyResources resource = companyResourcesService.getResourceById(userCar.getCarId().toString());
// if (resource == null) {
// return 0;
// }
// if ("executing".equals(resource.getCarStatus())) {
// return 1;
// } else {
// return 0;
// }
}
}
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -43,10 +44,9 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,
private final String SINGLE_PAWN = "FUSION_TERMINAL_SINGLE_PAWN";
@Autowired
private VoiceRecordFileServiceImpl voiceRecordFileServiceImpl;
private final Logger logger = LogManager.getLogger(VoiceRecordFileServiceImpl.class);
@Autowired
AlertCalledServiceImpl iAlertCalledService;
......@@ -54,7 +54,7 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,
@Autowired
FusionServiceImpl fusionService;
private volatile JSONArray ctiInfos;
@Autowired
EmqKeeper emqKeeper;
......@@ -93,9 +93,7 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,
log.setDealTimes(0);
if (!ValidationUtil.isEmpty(callRecord)) {
model.setFilePath(String.format("/%s/%s", callRecord.get("subPath"), callRecord.get("recordName").replace("wav", "mp3")));
String logs=String.format("音频地址:【%s】", String.format("/%s/%s", callRecord.get("subPath"), callRecord.get("recordName")));
logger.info(logs);
} else { // 无录音地址记录日志
iVoiceRecordLogServiceImpl.save(log);
}
......@@ -108,7 +106,7 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,
telStartTimeStr, telEndTimeStr, fileType, caller,
called, sortParam, sortRule);
Page<VoiceRecordFileDto> page1 = new Page<>();
List<VoiceRecordFileDto> resultDtoList = JSONArray.parseArray(JSONArray.toJSONString(list.getRecords()), VoiceRecordFileDto.class);
List<VoiceRecordFileDto> resultDtoList = JSON.parseArray(JSON.toJSONString(list.getRecords()), VoiceRecordFileDto.class);
page1.setCurrent(page.getCurrent());
page1.setSize(page.getSize());
page1.setTotal(list.getTotal());
......@@ -172,7 +170,7 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,
public List<VoiceRecordFileDto> listByAlertId(Long alertId) {
LambdaQueryWrapper<VoiceRecordFile> queryWrapper = new LambdaQueryWrapper<VoiceRecordFile>();
queryWrapper.eq(VoiceRecordFile::getAlertId, alertId).orderByDesc(VoiceRecordFile::getRecDate);
List<VoiceRecordFile> list = voiceRecordFileServiceImpl.list(queryWrapper);
List<VoiceRecordFile> list = this.list(queryWrapper);
List<VoiceRecordFileDto> dtoList = new ArrayList<>();
list.stream().forEach(voiceRecord -> {
// 创建新的对象实例
......@@ -214,9 +212,9 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,
}
private FusionDto buildFusionDtoAndId(FusionDto fusionDto, List<String> employeeIDs, Boolean hasFusion, Map<String,Object> map) {
List carPropertyList = (List) map.get("carPropertyList");
List<Map<String,Object>> carPropertyList = ( List<Map<String,Object>>) map.get("carPropertyList");
carPropertyList.forEach(carProperty -> {
Map<String,Object> carPropertyMap = (Map<String,Object>) carProperty;
Map<String,Object> carPropertyMap = carProperty;
Object nameKey = carPropertyMap.get("nameKey");
if((hasFusion &&PropertyEnum.GIS.getValue().equals(nameKey))|| (!hasFusion &&PropertyEnum.VIDEO.getValue().equals(nameKey))){
......
......@@ -43,6 +43,7 @@
spe.id,
det.`name` equipment_name,
spe.`code`,
spe.`iot_code` iotCode,
wle.`name` AS category_name,
find_in_set(spe.id,(select point_in_scene from wl_source_scene where source_id=#{systemId})) is_bound
......@@ -54,6 +55,30 @@
WHERE
find_in_set(#{systemId},spe.system_id) and spe.single = true and wlsd.`status` = 1
</select>
<select id="getEquiplistBySystemIdList" resultMap="EquiplistBySystemId">
SELECT
spe.`iot_code` iotCode,
ein.equipment_index_name indexName,
ein.equipment_index_key indexKey,
ein.is_alarm isAlarm
FROM
wl_equipment_specific AS spe
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
LEFT JOIN wl_stock_detail AS wlsd on wlsd.equipment_detail_id = det.id
LEFT JOIN wl_equipment_specific_index ein on ein.equipment_specific_id =spe.id
WHERE
find_in_set(#{systemId},spe.system_id) and spe.single = true and wlsd.`status` = 1
and spe.`iot_code` is not null and ein.is_alarm =0
</select>
<!-- 任务 3711 by litw 2021年9月17日 新增装备分类名称-->
<select id="getEquipCountBySystemId" resultMap="EquipCountBySystemId">
SELECT
......
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