Commit 5b66aa10 authored by tangwei's avatar tangwei

修改扫描bug

parent 517cb0b8
......@@ -15,12 +15,17 @@ public class IndexLogsRequest {
private String timeStart;
private String timeEnd;
private String fieldKey;
private String equipmentIndex;
private Long page;
private Long total;
private Long size;
public IndexLogsRequest(String iotCode, String timeStart, String timeEnd, String fieldKey) {
this.iotCode = iotCode;
public IndexLogsRequest( String timeStart, String timeEnd, String equipmentIndex, Long page, Long size) {
this.timeStart = timeStart;
this.timeEnd = timeEnd;
this.fieldKey = fieldKey;
this.equipmentIndex = equipmentIndex;
this.page = page;
this.size = size;
}
public IndexLogsRequest() {
......
......@@ -61,5 +61,5 @@ public interface IEquipmentSpecificAlarmLogService extends IService<EquipmentSpe
* endTime:结束时间
* @return
*/
Page<EquipmentAlarmLogDto> getEquipAlarmLog(String id, String startTime, String endTime, int pageSize, int current );
Page<EquipmentAlarmLogDto> getEquipAlarmLog(String id, String startTime, String endTime, long pageSize, long 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;
......@@ -9,7 +8,6 @@ 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;
......@@ -94,7 +92,7 @@ public class EquipmentSpecificAlarmLogServiceImpl extends ServiceImpl<EquipmentS
}
@Override
public Page<EquipmentAlarmLogDto> getEquipAlarmLog(String code, String startTime, String endTime,int pageSize, int current) {
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);
......@@ -105,16 +103,14 @@ public class EquipmentSpecificAlarmLogServiceImpl extends ServiceImpl<EquipmentS
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);
this.getEquiplistBySystemIdList(id, mapkey,iotCodes);
//装备为空返回空
if(iotCodes.isEmpty()||mapkey.isEmpty()){
return pageBean;
......@@ -123,7 +119,7 @@ public class EquipmentSpecificAlarmLogServiceImpl extends ServiceImpl<EquipmentS
endTime= endTime.replace("00:00:00","23:59:59");
IndexLogsRequest indexLogsRequest=new IndexLogsRequest( iotCode, startTime, endTime, null);
IndexLogsRequest indexLogsRequest=new IndexLogsRequest( startTime, endTime, iotCode, current, pageSize);
//调用iot 获取数据
ResponseModel<List<Map<String, Object>>> date = iotFeign.getEquipAlarmLog(indexLogsRequest);
......@@ -140,63 +136,35 @@ public class EquipmentSpecificAlarmLogServiceImpl extends ServiceImpl<EquipmentS
if(mapkey.containsKey(key)){
EquipmentAlarmLogDto da=new EquipmentAlarmLogDto();
da.setId(UUID.randomUUID().toString());
da.setName(mapcode.get(map.get("iotCode").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;
}
/**
* 获取系统下装备,并组装数据
*
* @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) {
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());
}
}
}
......
......@@ -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);
......
......@@ -4,6 +4,7 @@ package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.common.api.entity.DutyShift;
......@@ -20,11 +21,13 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.client.HttpClientErrorException;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSONObject;
......@@ -123,6 +126,13 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
@Autowired
private DutyShiftMapper dutyShiftMapper;
private static final String PERSON="person";
private static final String USERNAME="userName";
private static final String COUNT= "count";
private static final String TOTAL= "total";
@Override
public PowerTransferSimpleDto getPowerTransferList(Long alertCalledId) {
List<PowerTransferCompanyResourcesDto> powerTransferList = this.baseMapper.getPowerTransferList(alertCalledId);
......@@ -161,23 +171,20 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
.getOne(new QueryWrapper<Template>().eq("type_code", "LLDP").eq("format", false));
String content = template.getContent();
Map<String, String> definitions = new HashMap<>();
// initDefinitions(definitions, alertCalled, powerTransferDto);
// 创建力量调派单位
createPowerTransferCompany(powerTransferDto, powerTransferSequenceNbr, definitions, content, alertCalled);
// 封装调派任务的集合,以便于实现任务规则校验
try {
packagePowerTransferDetail(powerTransferDto);
} catch (Exception e) {
log.error("调用规则失败:PowerTransferServiceImpl。createPowerTransfer()");
}
// 发送调派通知
// 通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, false);
} catch (MqttException e) {
throw new RuntimeException();
} catch (Exception e) {
throw new BadRequest("系统异常");
}
return true;
......@@ -235,30 +242,10 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
// 1.调用装备服务接口查询车辆列表
List<FireBrigadeResourceDto> fireCarDtoList = Lists.newArrayList();
ResponseModel<Object> result = equipFeignService.getFireCarListAll();
// if (!ObjectUtils.isEmpty(result)) {
// List<Map<String, Object>> fireCarListMapList = (List<Map<String, Object>>) result.getResult();
// if (!ValidationUtil.isEmpty(fireCarListMapList)) {
// fireCarListMapList.stream().filter(car -> ObjectUtils.isNotEmpty(car.get("teamId"))).filter(car ->
// FireCarStatusEnum.执勤.getCode().equals(car.get("carState")) //TODO 后续如果需要多个状态需要删掉这个过滤条件
// || FireCarStatusEnum.出动.getCode().equals(car.get("carState"))).forEach(car -> {
//
// FireBrigadeResourceDto fireCarDto = (FireBrigadeResourceDto) Bean.mapToBean(car, FireBrigadeResourceDto.class);
// // TODO 后期根据车物联状态来返回,现在为"(装备)在位=执勤","(装备)执勤=出动"
// if (FireCarStatusEnum.执勤.getCode().equals(fireCarDto.getCarState())) {
// fireCarDto.setCarStateDesc(FireCarStatusEnum.执勤.getName());
// } else {
// fireCarDto.setCarState(FireCarStatusEnum.出动.getCode());
// fireCarDto.setCarStateDesc(FireCarStatusEnum.出动.getName());
// }
// fireCarDtoList.add(fireCarDto);
// });
// }
// }
// 查询车辆当前任务状态
QueryWrapper<PowerTransferCompanyResources> queryWrapper = new QueryWrapper<>();
// queryWrapper.notIn("car_status",
// FireCarStatusEnum.返队.getCode(),FireCarStatusEnum.加油.getCode(),FireCarStatusEnum.演练.getCode(),FireCarStatusEnum.训练.getCode(),FireCarStatusEnum.试车.getCode());
queryWrapper.eq("status", FireCarStatusEnum.执行中.getCode());
List<PowerTransferCompanyResources> alertFormValue = powerTransferCompanyResourcesService.list(queryWrapper);
......@@ -317,10 +304,10 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
LinkedHashMap<String, String> infoMap_1 = new LinkedHashMap<String, String>();
for (Map<String, Object> specify : specifyDateList) {
//
if (specify.containsKey("userName") && specify.get("userName") != null) {
if (specify.containsKey(USERNAME) && specify.get(USERNAME) != null) {
if (specify.get("userName").toString().contains(",")) {
String[] userNames = specify.get("userName").toString().split(",");
if (specify.get(USERNAME).toString().contains(",")) {
String[] userNames = specify.get(USERNAME).toString().split(",");
num = num+ userNames.length;
infoMap_1.put(dutyDetail.get("name").toString(), userNames.length + "");
} else {
......@@ -427,21 +414,7 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
// 3.消防队伍-监控大队
List<FireBrigadeResourceDto> monitorFireBrigadeList = fireTeamService
.listMonitorFireBrigade(FireBrigadeTypeEnum.监控大队.getCode());
// List<FireBrigadeResourceDto> monitorFireBrigadeList =
// fireTeamService.listMonitorFireBrigade();
/* bug 2403 队伍未显示图片 2021-09-23 陈召开始 */
// for (FireBrigadeResourceDto fireBrigadeResourceDto : monitorFireBrigadeList) {
// if (fireBrigadeResourceDto.getPic() != null) {
// String[] split = fireBrigadeResourceDto.getPic().split(",");
// if (split.length > 1) {
// fireBrigadeResourceDto.setImage(Arrays.asList(split));
// } else {
// List<String> objects = new ArrayList<>();
// objects.add(fireBrigadeResourceDto.getPic());
// fireBrigadeResourceDto.setImage(objects);
// }
// }
// }
/* bug 2403 队伍未显示图片 2021-09-23 陈召结束 */
FireBrigadeResourceDto monitorResourceDto = new FireBrigadeResourceDto();
monitorResourceDto.setId("0");
......@@ -461,14 +434,14 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
Long powerTransferCompanySequenceNbr) {
ArrayList<PowerTransferCompanyResources> powerTransferCompanyResourcesList = new ArrayList<>();
PowerTransferCompanyResources powerTransferCompanyResources;
List idList = powerTransferCompanyResourcesDtoList.stream()
List<String> idList = powerTransferCompanyResourcesDtoList.stream()
.map(PowerTransferCompanyResourcesDto::getResourcesId).collect(Collectors.toList());
QueryWrapper<PowerTransferCompanyResources> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status", FireCarStatusEnum.执行中.getCode());
queryWrapper.in("resources_id", idList);
List<PowerTransferCompanyResources> alertFormValue = powerTransferCompanyResourcesService.list(queryWrapper);
if (alertFormValue != null && alertFormValue.size() > 0) {
throw new RuntimeException("已选车辆有已调派车辆!");
throw new BadRequest("已选车辆有已调派车辆!");
} else {
for (PowerTransferCompanyResourcesDto powerTransferCompanyResourcesDto : powerTransferCompanyResourcesDtoList) {
......@@ -483,15 +456,7 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
List<Map<String, Object>> equipmentList = iDutyCarService.getDutyCaruser(Long.valueOf(powerTransferCompanyResources.getResourcesId()));
if (!ValidationUtil.isEmpty(equipmentList)) {
// String str = "";
// String newStr = "";
// for (int i = 0; i < equipmentList.size(); i++) {
// if (i == equipmentList.size() - 1) {
// newStr =newStr+ str.concat(equipmentList.get(i).get("userName") + "");
// } else {
// newStr = newStr+str.concat(equipmentList.get(i).get("userName") + ",");
// }
// }
powerTransferCompanyResources.setCarUser(equipmentList.size()+"");
}else{
powerTransferCompanyResources.setCarUser("0");
......@@ -508,16 +473,10 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
PowerTransferDto powerTransferDto) {
List<AlertFormValue> alertFormValue = alertFormValueService
.list(new QueryWrapper<AlertFormValue>().eq("alert_called_id", alertCalled.getSequenceNbr()));
// definitions.put("rescueGrid", alertCalled.getRescueGrid());
// definitions.put("alertType", alertCalled.getAlertType());
// definitions.put("address", alertCalled.getAddress());
// definitions.put("trappedNum", alertCalled.getTrappedNum().toString());
// definitions.put("casualtiesNum", alertCalled.getCasualtiesNum().toString());
// definitions.put("companyName", powerTransferDto.getCompanyName());
for (AlertFormValue formValue : alertFormValue) {
definitions.put(formValue.getFieldCode(), formValue.getFieldValue());
}
}
private String getTaskInformation(String content, Map<String, String> definitions) {
......@@ -577,8 +536,6 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
powerTransferCompany.setIsDistributionAgencies(false);
StringBuilder taskInformation = new StringBuilder();
for (PowerTransferCompanyResourcesDto powerTransferCompanyResourcesDto : powerTransferCompanyResourcesDtoList) {
// definitions.put("type", powerTransferCompanyResourcesDto.getType());
// definitions.put("resourcesNum", powerTransferCompanyResourcesDto.getResourcesNum());
String information = powerTransferCompanyResourcesDto.getType().concat("车牌号")
.concat(powerTransferCompanyResourcesDto.getResourcesNum());
taskInformation.append(information).append("丶");
......@@ -610,7 +567,7 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
List<Controller> controllers = controllerServiceImpl.list(new LambdaQueryWrapper<Controller>().eq(Controller::getFireTeamSeq, powerTransferCompanyDto.getCompanyId()));
//bug 5863 打印日志 调派车辆后对应警铃未打开
log.info("消防车队伍ID:{}, 根据队伍ID查出来的jc_controller数据:{},查出来的数据量size:{}", powerTransferCompanyDto.getCompanyId(), JSONObject.toJSONString(controllers), controllers.size());
log.info("消防车队伍ID:{}, 根据队伍ID查出来的jc_controller数据:{},查出来的数据量size:{}", powerTransferCompanyDto.getCompanyId(), JSON.toJSONString(controllers), controllers.size());
if (controllers.size() > 0) {
......@@ -728,7 +685,7 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
case "car":
resultPage = getPowerTransferCarResource(page, alertCalledId);
break;
case "person":
case PERSON:
// TODO 暂时没有调度人员
resultPage = new Page<>();
break;
......@@ -745,7 +702,7 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
if (ValidationUtil.isEmpty(result)) {
ResourceStatisticsDto team = new ResourceStatisticsDto("team", 0, 0, 0);
ResourceStatisticsDto car = new ResourceStatisticsDto("car", 0, 0, 0);
ResourceStatisticsDto person = new ResourceStatisticsDto("person", 0, 0, 0);
ResourceStatisticsDto person = new ResourceStatisticsDto(PERSON, 0, 0, 0);
result.add(team);
result.add(car);
result.add(person);
......@@ -817,19 +774,11 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
List<Map<String, Object>> totalCarList = carList.stream()
.filter(c -> carIdList.contains(Long.valueOf((String) c.get("id")))).collect(Collectors.toList());
// TODO 车辆枚举后期修改为已到达状态车辆
// List<Map<String, Object>> arrivedCarList = carList.stream()
// .filter(c -> carIdList.contains(Long.valueOf((String) c.get("id")))
// && FireCarStatusEnum.执勤.getCode().equals(c.get("carState")))
// .collect(Collectors.toList());
// 调派-已到达车辆id列表
List<Long> arrivedCarIdList = Lists.newArrayList();
// arrivedCarList.forEach(c -> {
// if (FireCarStatusEnum.到场.getCode().equals(c.get("carState"))) {
// arrivedCarIdList.add(Long.valueOf((String) c.get("id")));
// }
// });
List<PowerTransferResourceDto> tot=null;
if(carResourcePage.getRecords()!=null&&carResourcePage.getRecords().size()>0){
carResourcePage.getRecords().forEach(c -> {
......@@ -839,21 +788,6 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
});
}
// List<Map<String, Object>> collect = new ArrayList<>();
// if (null != totalCarList && totalCarList.size() > 0) {
// List<StatusDto> statusByIds1 = powerTransferCompanyResourcesMapper.findStatusByIds(carIdList);
// Map<Long, String> statusMap = statusByIds1.stream().collect(Collectors.toMap(StatusDto::getCardId, StatusDto::getCarStatus));
// collect = totalCarList.stream().map(item -> {
// item.put("carState", statusMap.get(Long.valueOf((String) item.get("id"))));
// return item;
// }).collect(Collectors.toList());
// }
//
// //到场车辆信息
// List<Map<String, Object>> arrivedCarList = collect.stream()
// .filter(c -> FireCarStatusEnum.到场.getCode().equals(c.get("carState")))
// .collect(Collectors.toList());
JSONObject resourceStatistics = new JSONObject();
double carTotal = carResourcePage.getTotal();
......@@ -870,24 +804,19 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
// 车载药剂统计 车载水量统计
waterCount(carIdList,resourceStatistics,carTotal,"water");
// carCount(arrivedCarList, resourceStatistics, carTotal, "water");
// 车载药剂统计
/* fireAgentOnCarCount(totalCarList, arrivedCarList, resourceStatistics, "fireAgent", "medicament");*/
return resourceStatistics;
}
public void carCount( List<Long> arrivedCarList, JSONObject resourceStatistics, double carTotal,
String jsoKey) {
JSONObject car = new JSONObject();
int total=0;
if(carTotal>0){
car.put("total", arrivedCarList.size());
car.put("count", arrivedCarList.size());
}else{
car.put("total", 0);
car.put("count", 0);
total=arrivedCarList.size();
}
car.put(TOTAL,total);
car.put(COUNT, total);
resourceStatistics.put(jsoKey, car);
}
......@@ -899,18 +828,18 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
if(carTotal>0){
// 泡沫和水车载统计 获取调用车辆的车载资源
ResponseModel<Map<String, Object>> carPropertyByCarIds = equipFeignService.getCarPropertyByCarIds(carIds);
obj.put("total", carTotal);
obj.put("count", carPropertyByCarIds.getResult().get("waterNum")!=null?carPropertyByCarIds.getResult().get("waterNum"):0);
obj.put(TOTAL, carTotal);
obj.put(COUNT, carPropertyByCarIds.getResult().get("waterNum")!=null?carPropertyByCarIds.getResult().get("waterNum"):0);
jsonObject.put("total", carTotal);
jsonObject.put("count", carPropertyByCarIds.getResult().get("foamNum")!=null?carPropertyByCarIds.getResult().get("foamNum"):0);
jsonObject.put(TOTAL, carTotal);
jsonObject.put(COUNT, carPropertyByCarIds.getResult().get("foamNum")!=null?carPropertyByCarIds.getResult().get("foamNum"):0);
}else{
obj.put("total", 0);
obj.put("count", 0);
jsonObject.put("total", 0);
jsonObject.put("count",0);
obj.put(TOTAL, 0);
obj.put(COUNT, 0);
jsonObject.put(TOTAL, 0);
jsonObject.put(COUNT,0);
}
resourceStatistics.put("medicament", jsonObject);
......@@ -920,25 +849,7 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
public void dutyPersonCount(List<Long> carIdList, List<Long> arrivedCarIdList, JSONObject resourceStatistics) {
JSONObject person = new JSONObject();
if(arrivedCarIdList!=null&&arrivedCarIdList.size()>0){
// // 当前时间所在班次
// List<Long> shiftIdList = dutyCarService.getDutyShiftIdList();
// List<Map<String, Object>> allDutyPersonList = Lists.newArrayList();
//
// if (!ValidationUtil.isEmpty(shiftIdList)) {
// // 当前值班车辆-人
// allDutyPersonList = dutyCarService.dayDutyPersonList(DateUtils.getDateNowShortStr(), shiftIdList.get(0),
// null);
// }
// // 当前车辆执勤人员
// List<Map<String, Object>> allTransferDutyPerson = allDutyPersonList.stream()
// .filter(c -> carIdList.contains(Long.valueOf((String) c.get("carId")))).collect(Collectors.toList());
//
//
// 当前已到达车辆执勤人员
// List<Map<String, Object>> allArrivedTransferDutyPerson = allDutyPersonList.stream()
// .filter(c -> arrivedCarIdList.contains(Long.valueOf((String) c.get("carId"))))
// .collect(Collectors.toList());
int num=0;
for (Long aLong : arrivedCarIdList) {
......@@ -947,40 +858,20 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
}
person.put("total", num);
person.put("count", num);
person.put(TOTAL, num);
person.put(COUNT, num);
}else{
person.put("total", 0);
person.put("count", 0);
person.put(TOTAL, 0);
person.put(COUNT, 0);
}
resourceStatistics.put("person", person);
resourceStatistics.put(PERSON, person);
}
public void fireAgentOnCarCount(List<Map<String, Object>> totalCarList, List<Long> arrivedCarList,
JSONObject resourceStatistics, String equipType, String jsonKey) {
//
// double agentCountArrived = 0;
// double agentCountAll = 0;
// if (null != totalCarList && totalCarList.size()>0) {
// agentCountAll = totalCarList.stream().mapToDouble(
// car -> car.get("resourceList") != null ? ((List<Map<String, Object>>) car.get("resourceList")).stream()
// .filter(res -> equipType.equals(res.get("equipType")))
// .mapToDouble(c -> Double.parseDouble(ValidationUtil.isEmpty(c.get("equipCount")) ? "0" : c.get("equipCount").toString())).sum() : 0)
// .sum();
// if (null != arrivedCarList && arrivedCarList.size()>0) {
// agentCountArrived = arrivedCarList.stream().mapToDouble(
// car -> car.get("resourceList") != null ? ((List<Map<String, Object>>) car.get("resourceList")).stream()
// .filter(res -> equipType.equals(res.get("equipType")))
// .mapToDouble(c -> Double.parseDouble(ValidationUtil.isEmpty(c.get("equipCount")) ? "0" : c.get("equipCount").toString())).sum() : 0)
// .sum();
// }
// }
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("total", agentCountAll);
// jsonObject.put("count", agentCountArrived);
// resourceStatistics.put(jsonKey, jsonObject);
JSONObject jsonObject = new JSONObject();
......@@ -991,16 +882,12 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
.mapToDouble(c -> Double.parseDouble(ValidationUtil.isEmpty(c.get("equipCount") ) ? "0" : c.get("equipCount").toString())).sum() : 0)
.sum();
// double agentCountArrived = arrivedCarList.stream().mapToDouble(
// car -> car.get("resourceList") != null ? ((List<Map<String, Object>>) car.get("resourceList")).stream()
// .filter(res -> equipType.equals(res.get("equipType")))
// .mapToDouble(c -> Double.parseDouble(ValidationUtil.isEmpty(c.get("equipCount") ) ? "0" : c.get("equipCount").toString())).sum() : 0)
// .sum();
jsonObject.put("total", agentCountAll);
jsonObject.put("count", agentCountAll);
jsonObject.put(TOTAL, agentCountAll);
jsonObject.put(COUNT, agentCountAll);
}else{
jsonObject.put("total", 0);
jsonObject.put("count", 0);
jsonObject.put(TOTAL, 0);
jsonObject.put(COUNT, 0);
}
resourceStatistics.put(jsonKey, jsonObject);
......
......@@ -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>
......@@ -134,7 +136,7 @@ public class RuleAlertCalledService {
{
alertCalledRo.setFireSituation(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("dangerousExplosives"))
if (alertFormValue.getFieldCode().equals(DANGEROUSEXPLOSIVES))
{
alertCalledRo.setDangerousExplosives(alertFormValue.getFieldValue());
}
......@@ -297,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")) {
......@@ -312,7 +314,7 @@ public class RuleAlertCalledService {
if (alertFormValue.getKey().equals("ageGroup")) {
ageGroup = alertFormValue.getValue();
}
if (alertFormValue.getKey().equals("dangerousExplosives")) {
if (alertFormValue.getKey().equals(DANGEROUSEXPLOSIVES)) {
dangerousExplosives = alertFormValue.getValue();
}
}
......
......@@ -58,7 +58,7 @@
<select id="getEquiplistBySystemIdList" resultMap="EquiplistBySystemId">
SELECT
det.`name` equipmentName,
spe.`iot_code` iotCode,
ein.equipment_index_name indexName,
ein.equipment_index_key indexKey,
......
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