Commit aad60da0 authored by litengwei's avatar litengwei

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

parents ce5ade74 5b66aa10
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;
private String equipmentIndex;
private Long page;
private Long total;
private Long size;
public IndexLogsRequest( String timeStart, String timeEnd, String equipmentIndex, Long page, Long size) {
this.timeStart = timeStart;
this.timeEnd = timeEnd;
this.equipmentIndex = equipmentIndex;
this.page = page;
this.size = size;
}
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));
}
}
......
......@@ -106,7 +106,22 @@ public class SupervisionConfigureController extends AbstractBaseController {
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.getFoamTankBySuper(page, bizOrgCode));
Page<Map<String, Object>> page1 = fireFightingSystemMapper.getFoamTankBySuper(page, bizOrgCode);
List<Map<String, Object>> res = page1.getRecords();
if (0 < res.size()) {
for (Map<String, Object> m : res) {
Map<String, Object> transResult = UnitTransformUtil.transformValues(String.valueOf(m.get("nowLevel")),
String.valueOf(m.get("unit")), String.valueOf(m.get("minLevel")), String.valueOf(m.get("maxLevel")));
m.put("nowLevel", transResult.get("nowValue"));
if (StringUtil.isNotEmpty(IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))))) {
m.put("levelStatus", IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))).getDescribe1());
} else {
m.put("levelStatus", "--");
}
m.put("levelAbs", transResult.get("abs"));
}
}
return CommonResponseUtil.success(page1);
}
@PersonIdentify
......
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, long pageSize, long current );
}
package com.yeejoin.equipmanage.service.impl;
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.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 +39,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 +90,86 @@ 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,long pageSize, long 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, EquiplistSpecificBySystemVO> mapkey = new HashMap<>();
//存储整理后的数据
List<EquipmentAlarmLogDto> listDate = new ArrayList<>();
//获取系统下所有装备物联指标
this.getEquiplistBySystemIdList(id, mapkey,iotCodes);
//装备为空返回空
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( startTime, endTime, iotCode, current, pageSize);
//调用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(mapkey.get(key).getEquipmentName());
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;
}
public void getEquiplistBySystemIdList(String id, Map<String, EquiplistSpecificBySystemVO> map, List<String> iotCodes) {
//获取系统下所有装备
List<EquiplistSpecificBySystemVO> list = fireFightingSystemMapper.getEquiplistBySystemIdList(Long.valueOf(id));
if (!list.isEmpty()) {
for (EquiplistSpecificBySystemVO equiplistSpecificBySystemVO : list) {
map.put(equiplistSpecificBySystemVO.getIotCode()+equiplistSpecificBySystemVO.getIndexKey(),equiplistSpecificBySystemVO);
iotCodes.add(equiplistSpecificBySystemVO.getIotCode()+equiplistSpecificBySystemVO.getIndexKey());
}
}
}
}
\ 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")));
......
......@@ -19,7 +19,7 @@ public class NoServiceImpl implements IHomePageService {
@Autowired
EquipFeignClient quipFeignClient;
private static EquipFeignClient quipFeignClient1;
private EquipFeignClient quipFeignClient1;
@PostConstruct
public void init(){
......
......@@ -35,6 +35,8 @@ public class OrganizationImpl extends BaseService<Organization,Organization, Org
@Autowired
private OrganizationUserMapper organizationUserMapper;
private static String NAME="组员信息表第";
@Override
public Page<Map<String, Object>> getOrganizationInfo(Page<Map<String, Object>> page, String bizOrgCode) {
return organizationMapper.getOrganizationInfo(page, bizOrgCode);
......@@ -42,20 +44,7 @@ public class OrganizationImpl extends BaseService<Organization,Organization, Org
@Override
public Page<Map<String, Object>> getOrganizationList(Page<Map<String, Object>> page, String bizOrgCode) {
// Page<Map<String, Object>> groupPage = new Page<>();
// Page<Map<String, Object>> group = organizationMapper.getOrganizationGroup(groupPage, bizOrgCode);
// Page<Map<String, Object>> mapPage = organizationMapper.getOrganizationList(page, bizOrgCode);
// List<Map<String, Object>> records = group.getRecords();
// ArrayList<Map<String, Object>> result = new ArrayList<>();
// for (Map<String, Object> record : records) {
//
// List<Map<String, Object>> collect = mapPage.getRecords().stream().filter(item -> String.valueOf(record.get("id")).equals(String.valueOf(item.get("groupId")))).collect(Collectors.toList());
// record.put("persons", collect);
// result.add(record);
//
// }
// mapPage.setRecords(result);
// return mapPage;
return organizationMapper.getOrganizationList(page, bizOrgCode);
}
......@@ -74,12 +63,12 @@ public class OrganizationImpl extends BaseService<Organization,Organization, Org
public void saveOrganization(List<OrganizationExportDto> data, List<OrganizationUserExportDto> userData, String bizOrgCode) {
//由于可以单独导入组,或者单独导入人,只做都为空效验
if(data==null&&userData==null){
if(data==null&&userData==null&&data.size()>0&&userData.size()>0){
throw new BadRequest("请填入数据导入!");
}
//对分组数据入库
if(data.size()>0){
int sort = organizationMapper.selectMaxSort();
int sort1 = organizationMapper.selectMaxSort();
checkOrganizationData(data);
for (OrganizationExportDto dto : data) {
LambdaQueryWrapper<Organization> lambda = new QueryWrapper<Organization>().lambda();
......@@ -89,18 +78,16 @@ public class OrganizationImpl extends BaseService<Organization,Organization, Org
Organization organization = new Organization();
if (CollectionUtils.isEmpty(organizations)){
BeanUtils.copyProperties(dto, organization);
sort = sort + 1;
organization.setSort(sort);
sort1 = sort1 + 1;
organization.setSort(sort1);
organization.setBizOrgCode(bizOrgCode);
organizationMapper.insert(organization);
}
// else{
// throw new BadRequest("用户组"+dto.getEmergencyTeamName()+"已存不能重复导入!");
// }
}
}
//对人员数据入库
if(userData.size()>0){
checkOrganizationUserData(userData);
int sort = organizationMapper.selectOrganizationUserMaxSort();
for (OrganizationUserExportDto userExportDto : userData) {
......@@ -120,35 +107,9 @@ public class OrganizationImpl extends BaseService<Organization,Organization, Org
organizationUserMapper.insert(organizationUser);
}
}
}
// int sort = organizationMapper.selectMaxSort();
// checkOrganizationData(data);
// checkOrganizationUserData(userData);
// for (OrganizationExportDto dto : data) {
// LambdaQueryWrapper<Organization> lambda = new QueryWrapper<Organization>().lambda();
// lambda.eq(Organization::getIsDelete, false);
// lambda.eq(Organization::getEmergencyTeamName, dto.getEmergencyTeamName());
// List<Organization> organizations = organizationMapper.selectList(lambda);
// Organization organization = new Organization();
// if (CollectionUtils.isEmpty(organizations)){
// BeanUtils.copyProperties(dto, organization);
// sort = sort + 1;
// organization.setSort(sort);
// organization.setBizOrgCode(bizOrgCode);
// organizationMapper.insert(organization);
// }else {
// Organization organization1 = organizations.get(0);
// BeanUtils.copyProperties(organization1, organization);
// }
// List<OrganizationUserExportDto> collect = userData.stream().filter(item -> item.getEmergencyTeamName().equals(dto.getEmergencyTeamName())).collect(Collectors.toList());
// for (OrganizationUserExportDto userExportDto : collect) {
// OrganizationUser organizationUser = new OrganizationUser();
// BeanUtils.copyProperties(userExportDto, organizationUser);
// organizationUser.setEmergencyTeamId(String.valueOf(organization.getSequenceNbr()));
// organizationUserMapper.insert(organizationUser);
// }
// }
}
private void checkOrganizationData(List<OrganizationExportDto> data) {
......@@ -167,13 +128,13 @@ public class OrganizationImpl extends BaseService<Organization,Organization, Org
for (int i = 0; i < data.size(); i++) {
OrganizationUserExportDto dto = data.get(i);
if (ObjectUtils.isEmpty(dto.getEmergencyTeamName())) {
throw new BadRequest("组员信息表第" + (i + 1) + "行, 应急救援小组名称为必填信息!");
throw new BadRequest(NAME + (i + 1) + "行, 应急救援小组名称为必填信息!");
}
if (ObjectUtils.isEmpty(dto.getMemberName())) {
throw new BadRequest("组员信息表第" + (i + 1) + "行, 组员姓名为必填信息!");
throw new BadRequest(NAME + (i + 1) + "行, 组员姓名为必填信息!");
}
if (ObjectUtils.isEmpty(dto.getTelephone())) {
throw new BadRequest("组员信息表第" + (i + 1)+ "行, 组员电话为必填信息!");
throw new BadRequest(NAME + (i + 1)+ "行, 组员电话为必填信息!");
}
}
}
......@@ -222,7 +183,6 @@ public class OrganizationImpl extends BaseService<Organization,Organization, Org
this.updateById(organization);
upOrganization.setSort(sort);
this.updateById(upOrganization);
return true;
} else {
// 下移,查询下一条数据
LambdaQueryWrapper<Organization> wrapper = new LambdaQueryWrapper<>();
......@@ -238,8 +198,9 @@ public class OrganizationImpl extends BaseService<Organization,Organization, Org
this.updateById(organization);
downOrganization.setSort(sort);
this.updateById(downOrganization);
return true;
}
return true;
}
@Override
......
......@@ -38,7 +38,6 @@ public class OrganizationUserImpl extends BaseService<OrganizationUser,Organizat
if (!ObjectUtils.isEmpty(id) && id != 0) {
wrapper.eq(OrganizationUser::getEmergencyTeamId, id);
}
// wrapper.orderByDesc(BaseEntity::getRecDate);
wrapper.eq(OrganizationUser::getIsDelete, false);
wrapper.orderByDesc(OrganizationUser::getSort);
return this.baseMapper.selectPage(page, wrapper);
......
......@@ -27,6 +27,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
......@@ -60,13 +61,17 @@ public class PowerTransferCompanyResourcesServiceImpl extends BaseService<PowerT
@Value("${mqtt.topic.command.power.deployment}")
private String topic;
private static String RESOURCES_ID ="resources_id";
private static String PHOTOS ="/photos:";
@Override
public AlertCalled getByPowerTransferCompanyResourId(Long id) {
QueryWrapper<PowerTransferCompanyResources> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status", FireCarStatusEnum.执行中.getCode());
queryWrapper.eq("resources_id", id.toString());
queryWrapper.eq(RESOURCES_ID, id.toString());
PowerTransferCompanyResources alertFormValue = this.getOne(queryWrapper);
if (alertFormValue != null) {
return powerTransferCompanyResourcesMapper.getByPowerTransferCompanyResourId(alertFormValue.getPowerTransferCompanyId());
......@@ -126,7 +131,7 @@ public class PowerTransferCompanyResourcesServiceImpl extends BaseService<PowerT
jcSituationDetail.setInfo(info);
if (CollectionUtils.isNotEmpty(photos)){
jcSituationDetail.setInfo(info+"/photos:"+Joiner.on(",").join(photos));
jcSituationDetail.setInfo(info+PHOTOS+Joiner.on(",").join(photos));
}
jcSituationDetail.setPowerTransferCompanyResourcesId(powerTransferCompanyResources.getSequenceNbr());
......@@ -137,7 +142,7 @@ public class PowerTransferCompanyResourcesServiceImpl extends BaseService<PowerT
// 定义指令信息消息推送 页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, false);
} catch (Exception e) {
throw new RuntimeException("修改失败!");
throw new BadRequest("修改失败!");
}
}
......@@ -154,8 +159,8 @@ public class PowerTransferCompanyResourcesServiceImpl extends BaseService<PowerT
wrapper.orderByDesc(BaseEntity::getRecDate);
List<JcSituationDetail> list = jcSituationDetailMapper.selectList(wrapper);
list.stream().forEach(e->{
if (e.getInfo().contains("/photos:")){
String[] content = e.getInfo().split("/photos:");
if (e.getInfo().contains(PHOTOS)){
String[] content = e.getInfo().split(PHOTOS);
String info = content[0];
String photoUrls = content[1];
List<String> photos = Arrays.asList(photoUrls);
......@@ -170,14 +175,14 @@ public class PowerTransferCompanyResourcesServiceImpl extends BaseService<PowerT
@Override
public PowerTransferCompanyResources getResourceById(String resourceId) {
QueryWrapper<PowerTransferCompanyResources> powerTransferCompanyResourcesQueryWrapper = new QueryWrapper<>();
powerTransferCompanyResourcesQueryWrapper.eq("resources_id", resourceId);
powerTransferCompanyResourcesQueryWrapper.eq(RESOURCES_ID, resourceId);
return powerTransferCompanyResourcesMapper.selectOne(powerTransferCompanyResourcesQueryWrapper);
}
@Override
public int getCarExecutingCountById(String resourceId, String status) {
QueryWrapper<PowerTransferCompanyResources> powerTransferCompanyResourcesQueryWrapper = new QueryWrapper<>();
powerTransferCompanyResourcesQueryWrapper.eq("resources_id", resourceId);
powerTransferCompanyResourcesQueryWrapper.eq(RESOURCES_ID, resourceId);
powerTransferCompanyResourcesQueryWrapper.eq("status", status);
powerTransferCompanyResourcesQueryWrapper.eq("is_delete", 0);
return powerTransferCompanyResourcesMapper.selectCount(powerTransferCompanyResourcesQueryWrapper);
......
......@@ -115,9 +115,9 @@ public class PowerrTransferLogServiceImpl extends BaseService<PowerrTransferLogD
final String receiveName = personName;
List<PowerrTransferLog> list = new ArrayList<>();
if (FireBrigadeTypeEnum.专职消防队.getKey().equals(powerTransType)) {
List<Object> companyDetail = JSONArray.parseArray(JSON.toJSON(alertCallePowerTransferRo.getCompany()).toString(),Object.class);
List<Object> companyDetail = JSON.parseArray(JSON.toJSON(alertCallePowerTransferRo.getCompany()).toString(),Object.class);
for (Object powerTransferCompanyDto : companyDetail) {
PowerTransferCompanyDto powerDto = JSONObject.parseObject(JSON.toJSON(powerTransferCompanyDto).toString(), PowerTransferCompanyDto.class);
PowerTransferCompanyDto powerDto = JSON.parseObject(JSON.toJSON(powerTransferCompanyDto).toString(), PowerTransferCompanyDto.class);
List<PowerTransferCompanyResourcesDto> powerTransferCompanyResourcesDtoList = powerDto.getPowerTransferCompanyResourcesDtoList();
powerTransferCompanyResourcesDtoList.stream().forEach(f-> {
PowerrTransferLog pw = new PowerrTransferLog();
......@@ -135,9 +135,9 @@ public class PowerrTransferLogServiceImpl extends BaseService<PowerrTransferLogD
});
}
} else if (FireBrigadeTypeEnum.医疗救援队.getKey().equals(powerTransType) || FireBrigadeTypeEnum.监控大队.getKey().equals(powerTransType)) {
List<Object> companyDetail = JSONArray.parseArray(JSON.toJSON(alertCallePowerTransferRo.getCompany()).toString(),Object.class);
List<Object> companyDetail = JSON.parseArray(JSON.toJSON(alertCallePowerTransferRo.getCompany()).toString(),Object.class);
for (Object powerTransferCompanyDto : companyDetail) {
PowerTransferCompanyDto powerDto = JSONObject.parseObject(JSON.toJSON(powerTransferCompanyDto).toString(), PowerTransferCompanyDto.class);
PowerTransferCompanyDto powerDto = JSON.parseObject(JSON.toJSON(powerTransferCompanyDto).toString(), PowerTransferCompanyDto.class);
PowerrTransferLog pw = new PowerrTransferLog();
pw.setTeamId(powerDto.getSequenceNbr());
pw.setReceiveName(receiveName);
......
......@@ -54,6 +54,8 @@ public class RuleAlertCalledService {
AlertCalledServiceImpl alertCalledServiceImpl;
private static final String DANGEROUSEXPLOSIVES="dangerousExplosives";
/**
*
* <pre>
......@@ -84,16 +86,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);
......@@ -138,7 +136,7 @@ public class RuleAlertCalledService {
{
alertCalledRo.setFireSituation(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("dangerousExplosives"))
if (alertFormValue.getFieldCode().equals(DANGEROUSEXPLOSIVES))
{
alertCalledRo.setDangerousExplosives(alertFormValue.getFieldValue());
}
......@@ -270,8 +268,7 @@ public class RuleAlertCalledService {
if (alertCalledFormDto == null) {
return false;
}
/* //任务型计划 // bug 5973
alertCallePowerTransferRo.setCategory(RuleTypeEnum.任务型计划生成.getCategory());*/
AlertCalled alertCalled = alertCalledFormDto.getAlertCalled();
alertCallePowerTransferRo
......@@ -302,7 +299,7 @@ public class RuleAlertCalledService {
if (alertFormValue.getKey().equals("fireSituation")) {
alertCallePowerTransferRo.setFireSituation(alertFormValue.getValue());
}
if (alertFormValue.getKey().equals("dangerousExplosives")) {
if (alertFormValue.getKey().equals(DANGEROUSEXPLOSIVES)) {
alertCallePowerTransferRo.setDangerousExplosives(alertFormValue.getValue());
}
if (alertFormValue.getKey().equals("fireTime")) {
......@@ -317,25 +314,15 @@ public class RuleAlertCalledService {
if (alertFormValue.getKey().equals("ageGroup")) {
ageGroup = alertFormValue.getValue();
}
if (alertFormValue.getKey().equals("dangerousExplosives")) {
if (alertFormValue.getKey().equals(DANGEROUSEXPLOSIVES)) {
dangerousExplosives = alertFormValue.getValue();
}
}
}
if (FireBrigadeTypeEnum.专职消防队.getKey().equals(type)) {
alertCallePowerTransferRo.setCompany(JSONArray.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));
if (FireBrigadeTypeEnum.专职消防队.getKey().equals(type)||FireBrigadeTypeEnum.监控大队.getKey().equals(type)) {
alertCallePowerTransferRo.setCompany(JSON.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 +330,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 +341,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))){
......
......@@ -22,6 +22,7 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.patrol.business.service.intfc.*;
import com.yeejoin.amos.patrol.business.util.*;
import com.yeejoin.amos.patrol.core.async.TaskExecutorPoolConfig;
......@@ -176,11 +177,12 @@ public class CheckController extends AbstractBaseController {
token.setAppKey(request.getHeader("appKey"));
int statu = -1;
PlanTask planTask =null;
log.info("手机app保存巡检记录++++++++++++++++++++++: {}", JSON.toJSONString(requestParam));
if(requestParam.getPlanTaskId()!=null && requestParam.getPlanTaskId() !=0){
List<Map<String, Object>> map = checkService.selectCheckById(requestParam.getPlanTaskId());
List<Map<String, Object>> map = checkService.selectCheckById(requestParam.getPlanTaskId(), requestParam.getPointId());
if (!CollectionUtils.isEmpty(map)) {
List<Long> ids = map.stream().map(m -> Long.valueOf(m.get("id").toString())).collect(Collectors.toList());
checkService.delCheckByTaskId(requestParam.getPlanTaskId(), ids);
checkService.delCheckByTaskId(requestParam.getPlanTaskId(), ids, requestParam.getPointId());
}
planTask = planTaskService.selectPlanTaskStatus(requestParam.getPlanTaskId());
}
......
......@@ -4,7 +4,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.patrol.dao.entity.Check;
import org.apache.ibatis.annotations.Param;
import com.yeejoin.amos.patrol.business.entity.mybatis.CheckDetailBo;
......@@ -283,10 +282,10 @@ public interface CheckMapper extends BaseMapper {
//Map<String, String> queryUserInfoByIds(@Param(value = "userIds") String userIds);
int delCheckByTaskId(@Param(value = "taskId") Long taskId);
Integer delCheckByTaskId(@Param(value = "taskId") Long taskId, @Param(value = "pointId") Long pointId);
int delCheckInputByCheckId(@Param(value = "ids") List<Long> ids);
Integer delCheckInputByCheckId(@Param(value = "ids") List<Long> ids);
List<Map<String, Object>> selectCheckById(@Param(value = "taskId") Long taskId);
List<Map<String, Object>> selectCheckById(@Param(value = "taskId") Long taskId, @Param(value = "pointId") Long pointId);
}
......@@ -15,7 +15,6 @@ import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.transaction.Transactional;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
......@@ -30,7 +29,6 @@ import org.assertj.core.util.Sets;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cglib.beans.BeanMap;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
......@@ -739,13 +737,13 @@ public class CheckServiceImpl implements ICheckService {
}
@Override
public List<Map<String, Object>> selectCheckById(Long id) {
return checkMapper.selectCheckById(id);
public List<Map<String, Object>> selectCheckById(Long id, Long pointId) {
return checkMapper.selectCheckById(id, pointId);
}
@Override
public void delCheckByTaskId(Long id, List<Long> ids) {
checkMapper.delCheckByTaskId(id);
public void delCheckByTaskId(Long id, List<Long> ids, Long pointId) {
checkMapper.delCheckByTaskId(id, pointId);
checkMapper.delCheckInputByCheckId(ids);
}
......
......@@ -55,9 +55,9 @@ public interface ICheckService {
void delCheckById(List<Long> ids);
void delCheckByTaskId(Long id, List<Long> ids);
void delCheckByTaskId(Long id, List<Long> ids, Long pointId);
List<Map<String, Object>> selectCheckById(Long id);
List<Map<String, Object>> selectCheckById(Long id, Long pointId);
/**
* 获取检查结果中所有不合格检查项
......
......@@ -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
det.`name` equipmentName,
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
......@@ -4732,44 +4757,19 @@
<select id="getFoamTankBySuper" resultType="java.util.Map">
SELECT
a.`name`,
IFNULL(a.nowLevel, '--') AS nowLevel,
IFNULL( a.nowLevel, '--' ) AS nowLevel,
a.id,
IFNULL(a.image, '') AS image,
(
CASE
WHEN a.nowLevel IS NULL THEN
'--'
WHEN a.nowLevel >= IFNULL( a.minLevel, 0 )
AND a.maxLevel IS NULL THEN
'100'
WHEN IFNULL( a.minLevel, 0 ) > a.nowLevel
AND a.maxLevel IS NULL THEN
'--' ELSE IFNULL((
FORMAT(
abs(
IFNULL(
a.nowLevel,
IFNULL( a.minLevel, 0 )) /
IF
(
IFNULL( a.maxLevel, 0 ) = 0,
1,
IFNULL( a.maxLevel, 0 ))) * 100,
2
)
),
0
)
END
) AS levelAbs,
IFNULL( a.image, '' ) AS image,
a.unit,
a.minLevel AS minLevel,
a.maxLevel AS maxLevel,
(
CASE
WHEN a.nowLevel IS NULL
OR a.minLevel IS NULL THEN
'--'
WHEN a.minLevel - a.nowLevel > 0 THEN
WHEN a.minLevel - a.nowLevel > 0 THEN
'缺水' ELSE '正常'
END
) AS levelStatus,
......@@ -4781,6 +4781,7 @@
es.iot_code,
es.id,
ec.image,
ei.unit,
max( CASE WHEN ei.equipment_index_key = 'CAFS_FoamTank_FoamTankLevel' THEN ei.`value` END ) AS nowLevel,
max( CASE WHEN fi.field_name = 'minLevel' THEN fi.field_value END ) AS minLevel,
max( CASE WHEN fi.field_name = 'maxLevel' THEN fi.field_value END ) AS maxLevel
......@@ -4800,44 +4801,19 @@
) a UNION ALL
SELECT
a.`name`,
IFNULL(a.nowLevel, '--') as nowLevel,
IFNULL( a.nowLevel, '--' ) AS nowLevel,
a.id,
IFNULL(a.image, '') AS image,
(
CASE
WHEN a.nowLevel IS NULL THEN
'--'
WHEN a.nowLevel >= IFNULL( a.minLevel, 0 )
AND a.maxLevel IS NULL THEN
'100'
WHEN IFNULL( a.minLevel, 0 ) > a.nowLevel
AND a.maxLevel IS NULL THEN
'--' ELSE IFNULL((
FORMAT(
abs(
IFNULL(
a.nowLevel,
IFNULL( a.minLevel, 0 )) /
IF
(
IFNULL( a.maxLevel, 0 ) = 0,
1,
IFNULL( a.maxLevel, 0 ))) * 100,
2
)
),
0
)
END
) AS levelAbs,
IFNULL( a.image, '' ) AS image,
'M' AS unit,
a.minLevel AS minLevel,
a.maxLevel AS maxLevel,
(
CASE
WHEN a.nowLevel IS NULL
OR a.minLevel IS NULL THEN
'--'
WHEN a.minLevel - a.nowLevel > 0 THEN
WHEN a.minLevel - a.nowLevel > 0 THEN
'缺水' ELSE '正常'
END
) AS levelStatus,
......@@ -4848,13 +4824,15 @@
r.`name`,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
(select
FORMAT(avg(IFNULL(ei.`value`,0)), 2)
from
wl_equipment_specific_index ei
where
(ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel')
and FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id) > 0) AS nowLevel,
(
SELECT
FORMAT( avg( IFNULL( ei.`value`, 0 ) ), 2 )
FROM
wl_equipment_specific_index ei
WHERE
( ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' OR ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' )
AND FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id ) > 0
) AS nowLevel,
ec.image,
r.resource_type AS type,
r.sequence_nbr AS id
......@@ -4865,11 +4843,13 @@
WHERE
r.resource_type = 'waterTank'
AND r.biz_org_code LIKE concat(#{bizOrgCode}, '%')
AND r.is_delete = 1
GROUP BY
r.sequence_nbr
) a
ORDER BY levelStatus DESC
ORDER BY
levelStatus DESC
</select>
<select id="getPipeNetworkBySuper" resultType="java.util.Map">
......
......@@ -2159,13 +2159,13 @@
d.date
</select>
<select id="delCheckByTaskId" resultType="int">
<select id="delCheckByTaskId" resultType="java.lang.Integer">
DELETE FROM
p_check pc
WHERE pc.plan_task_id = #{taskId}
WHERE pc.plan_task_id = #{taskId} AND pc.point_id = #{pointId} AND pc.is_ok = 3
</select>
<select id="delCheckInputByCheckId" resultType="int">
<select id="delCheckInputByCheckId" resultType="java.lang.Integer">
DELETE FROM
p_check_input pci
WHERE pci.check_id in
......@@ -2176,7 +2176,7 @@
SELECT *
FROM
p_check pc
WHERE pc.plan_task_id = #{taskId}
WHERE pc.plan_task_id = #{taskId} AND pc.point_id = #{pointId} AND pc.is_ok = 3
</select>
</mapper>
\ No newline at end of file
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