Commit 45308987 authored by chenhao's avatar chenhao

提交关于预案匹配的后端接口

parent 2e7a6dca
package com.yeejoin.amos.boot.module.common.api.feign;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
@FeignClient(name = "${Knowledgebase.fegin.name}",path = "knowledgebase" ,configuration = {MultipartSupportConfig.class})
public interface KnowledgebaseFeignClient {
@RequestMapping(value = "/v1/tagvalue/getAll/tegartValue", method = RequestMethod.GET)
ResponseModel<Object> getAllTegartValue(@RequestParam String value) ;
@RequestMapping(value = "/v1/taginstance/find/{id}", method = RequestMethod.GET)
ResponseModel<Object> findById(@PathVariable("id") Long id);
@RequestMapping(value = "/v1/doccontent/getSimpleDetail/{sequenceNbr}", method = RequestMethod.GET)
ResponseModel<Object> getSimpleDetail(@PathVariable(value = "sequenceNbr") String sequenceNbr);
@RequestMapping(value = "/v1/taginstance/targetSeq/{id}", method = RequestMethod.GET)
ResponseModel<Object> queryListByTargetSeq(@PathVariable("id") Long id);
@RequestMapping(value = "/v1/tagvalue/getOne/", method = RequestMethod.GET)
ResponseModel<Object> queryByInstance(@RequestParam Long id) ;
@RequestMapping(value = "/v1/taginstance/getTarget/byName", method = RequestMethod.GET)
ResponseModel<Object> queryListByTagName(@RequestParam String name);
}
...@@ -52,6 +52,12 @@ public enum AlertStageEnums { ...@@ -52,6 +52,12 @@ public enum AlertStageEnums {
fireBrigade("fireBrigade", "岗位名称,规则配置"), fireBrigade("fireBrigade", "岗位名称,规则配置"),
airportUnit("airportUnit", "人员职务规则配置"), airportUnit("airportUnit", "人员职务规则配置"),
flag("flag", "值班单位"), flag("flag", "值班单位"),
keySiteExcle("keySiteExcle","重点部位"),
救援预案警情类型("0","救援预案警情类型"),
责任单位("1","责任单位"),
重点部位名称("2","重点部位名称"),
航空器救援子类("3","航空器救援子类"),
aircraftRescueSub("aircraftRescueSub","航空器救援子类"),
JKDD("6", "企(事)业单位监控大队"); JKDD("6", "企(事)业单位监控大队");
......
package com.yeejoin.amos.boot.module.jcs.biz.controller; package com.yeejoin.amos.boot.module.jcs.biz.controller;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
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.RestController;
import org.typroject.tyboot.component.event.RestEventTrigger;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
...@@ -25,36 +54,9 @@ import com.yeejoin.amos.boot.module.jcs.api.enums.AlertStatusEnum; ...@@ -25,36 +54,9 @@ import com.yeejoin.amos.boot.module.jcs.api.enums.AlertStatusEnum;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertCalledServiceImpl; import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertFormValueServiceImpl; import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertFormValueServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.ESAlertCalledService; import com.yeejoin.amos.boot.module.jcs.biz.service.impl.ESAlertCalledService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
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.RestController;
import org.typroject.tyboot.component.event.RestEventTrigger;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
...@@ -515,4 +517,14 @@ public class AlertCalledController extends BaseController { ...@@ -515,4 +517,14 @@ public class AlertCalledController extends BaseController {
public ResponseModel<Object> getLocationLike(@RequestParam(required = false) String locationt) { public ResponseModel<Object> getLocationLike(@RequestParam(required = false) String locationt) {
return ResponseHelper.buildResponse(iAlertCalledService.getLocationLike(locationt)); return ResponseHelper.buildResponse(iAlertCalledService.getLocationLike(locationt));
} }
/**
* 警情预案匹配
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/police/situation/match")
@ApiOperation(httpMethod = "GET", value = "警情预案匹配", notes = "警情预案匹配")
public ResponseModel<Object> toCompletePoliceSituationMatch(@RequestParam Long id)throws Exception {
return ResponseHelper.buildResponse(iAlertCalledService.toCompletePoliceSituationMatch(id));
}
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.jcs.biz.service.impl; package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import static org.hamcrest.CoreMatchers.nullValue;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.jcs.api.dto.*; import org.apache.commons.lang3.ObjectUtils;
import com.yeejoin.amos.boot.module.jcs.api.entity.*;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertBusinessTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.service.IVoiceRecordFileService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
...@@ -25,8 +26,10 @@ import org.typroject.tyboot.component.emq.EmqKeeper; ...@@ -25,8 +26,10 @@ import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...@@ -44,10 +47,27 @@ import com.yeejoin.amos.boot.module.common.api.dto.FormValue; ...@@ -44,10 +47,27 @@ import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrzhDto; import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrzhDto;
import com.yeejoin.amos.boot.module.common.api.dto.RequestData; import com.yeejoin.amos.boot.module.common.api.dto.RequestData;
import com.yeejoin.amos.boot.module.common.api.feign.JcsControlServerClient; import com.yeejoin.amos.boot.module.common.api.feign.JcsControlServerClient;
import com.yeejoin.amos.boot.module.common.api.feign.KnowledgebaseFeignClient;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.KeySiteServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.KeySiteServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledObjsDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledTodyDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledZhDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.ControllerDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.ControllerEquipDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.KeyValueLabel;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerData;
import com.yeejoin.amos.boot.module.jcs.api.dto.VoiceRecordFileDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertLocationLog;
import com.yeejoin.amos.boot.module.jcs.api.entity.Template;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertBusinessTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertStageEnums; import com.yeejoin.amos.boot.module.jcs.api.enums.AlertStageEnums;
import com.yeejoin.amos.boot.module.jcs.api.enums.ControllerTypeEnum; import com.yeejoin.amos.boot.module.jcs.api.enums.ControllerTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.DutyInfoEnum; import com.yeejoin.amos.boot.module.jcs.api.enums.DutyInfoEnum;
...@@ -66,98 +86,100 @@ import com.yeejoin.amos.component.rule.config.RuleConfig; ...@@ -66,98 +86,100 @@ import com.yeejoin.amos.component.rule.config.RuleConfig;
*/ */
@Service @Service
public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCalled, AlertCalledMapper> public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCalled, AlertCalledMapper>
implements IAlertCalledService { implements IAlertCalledService {
private final Logger logger = LogManager.getLogger(AlertCalledServiceImpl.class);
private final Logger logger = LogManager.getLogger(AlertCalledServiceImpl.class);
@Autowired
@Autowired RedisUtils redisUtils;
RedisUtils redisUtils; @Autowired
@Autowired AlertCalledMapper alertCalledMapper;
AlertCalledMapper alertCalledMapper; @Autowired
@Autowired RuleAlertCalledService ruleAlertCalledService;
RuleAlertCalledService ruleAlertCalledService; @Autowired
@Autowired TemplateMapper templateMapper;
TemplateMapper templateMapper; @Autowired
@Autowired PowerTransferMapper powerTransferMapper;
PowerTransferMapper powerTransferMapper; @Autowired
@Autowired AlertSubmittedMapper alertSubmittedMapper;
AlertSubmittedMapper alertSubmittedMapper; @Autowired
@Autowired private JcsControlServerClient jcsControlServerClient;
private JcsControlServerClient jcsControlServerClient; @Autowired
@Autowired private AlertFormValueServiceImpl iAlertFormValueService;
private AlertFormValueServiceImpl iAlertFormValueService; @Autowired
@Autowired private ESAlertCalledService eSAlertCalledService;
private ESAlertCalledService eSAlertCalledService; @Autowired
@Autowired private ControllerServiceImpl controllerService;
private ControllerServiceImpl controllerService; @Autowired
@Autowired private ControllerEquipServiceImpl controllerEquipService;
private ControllerEquipServiceImpl controllerEquipService; @Autowired
@Autowired FirefightersServiceImpl firefightersService;
FirefightersServiceImpl firefightersService; @Autowired
@Autowired KeySiteServiceImpl keySiteService;
KeySiteServiceImpl keySiteService; @Autowired
@Autowired AlertSubmittedServiceImpl alertSubmittedService;
AlertSubmittedServiceImpl alertSubmittedService;
@Autowired
@Autowired private AlertLocationLogServiceImpl alertLocationLogService;
private AlertLocationLogServiceImpl alertLocationLogService;
@Autowired
@Autowired private EmqKeeper emqKeeper;
private EmqKeeper emqKeeper; @Value("${mqtt.topic.command.alert.notice}")
@Value("${mqtt.topic.command.alert.notice}") private String topic;
private String topic; @Value("${redis.cache.failure.time}")
@Value("${redis.cache.failure.time}") private long time;
private long time; @Value("${mqtt.topic.command.power.deployment}")
@Value("${mqtt.topic.command.power.deployment}") private String topic1;
private String topic1;
@Autowired
@Autowired private OrgUsrServiceImpl iOrgUsrService;
private OrgUsrServiceImpl iOrgUsrService;
@Autowired
@Autowired AircraftServiceImpl aircraftService;
AircraftServiceImpl aircraftService;
@Autowired
@Autowired AlertFormValueServiceImpl alertFormValueService;
AlertFormValueServiceImpl alertFormValueService;
@Autowired
@Autowired OrgUsrServiceImpl orgUsrServiceImpl;
OrgUsrServiceImpl orgUsrServiceImpl; @Autowired
@Autowired VoiceRecordFileServiceImpl voiceRecordFileService;
VoiceRecordFileServiceImpl voiceRecordFileService;
@Autowired
private static int comparingByGroupVal(Map<String, Object> map, Map<String, Object> map2, String key) { KnowledgebaseFeignClient knowledgebaseFeignClient;
int result = 0;
if (map.get(key) instanceof DateTime) { private static int comparingByGroupVal(Map<String, Object> map, Map<String, Object> map2, String key) {
long r1 = ((Date) map.get(key)).getTime(); int result = 0;
long r2 = ((Date) map2.get(key)).getTime(); if (map.get(key) instanceof DateTime) {
result = Long.compare(r1, r2); long r1 = ((Date) map.get(key)).getTime();
} long r2 = ((Date) map2.get(key)).getTime();
return result; result = Long.compare(r1, r2);
} }
return result;
/** }
* 指挥系统 未结束的警情列表
**/ /**
@Override * 指挥系统 未结束的警情列表
public List<AlertCalledZhDto> alertCalledListByAlertStatus(Integer pageNum, Integer pageSize, RequestData par) { **/
@Override
List<AlertCalledZhDto> list = alertCalledMapper.alertCalledListByAlertStatus(pageNum, pageSize, par); public List<AlertCalledZhDto> alertCalledListByAlertStatus(Integer pageNum, Integer pageSize, RequestData par) {
return list;
List<AlertCalledZhDto> list = alertCalledMapper.alertCalledListByAlertStatus(pageNum, pageSize, par);
} return list;
@Override }
public int alertCalledListByAlertStatusCount(RequestData par) {
return alertCalledMapper.alertCalledListByAlertStatusCount(par); @Override
} public int alertCalledListByAlertStatusCount(RequestData par) {
return alertCalledMapper.alertCalledListByAlertStatusCount(par);
/** }
* 接警记录 列表分页查询
**/ /* /**
* bug2407 筛选参数解析异常 修改筛选条件方法 XML中添加了selectAllPage 方法 data代表排序条件 lift 升降序 陈召 * 接警记录 列表分页查询
* 2021-09-03 开始 **/ /*
*/ * bug2407 筛选参数解析异常 修改筛选条件方法 XML中添加了selectAllPage 方法 data代表排序条件 lift 升降序 陈召
* 2021-09-03 开始
*/
// public IPage<AlertCalled> queryForCalledList(Page pageBean, Integer alertStatus, // public IPage<AlertCalled> queryForCalledList(Page pageBean, Integer alertStatus,
// String alertTypeCode, // String alertTypeCode,
// String alertSourceCode, // String alertSourceCode,
...@@ -174,467 +196,468 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal ...@@ -174,467 +196,468 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
// //
// List<AlertCalled> list = alertCalledMapper.selectAllPage(pageBean.getCurrent(), pageBean.getSize(), alertStatus, alertTypeCode, alertSourceCode, startTime, endTime, data, lift); // List<AlertCalled> list = alertCalledMapper.selectAllPage(pageBean.getCurrent(), pageBean.getSize(), alertStatus, alertTypeCode, alertSourceCode, startTime, endTime, data, lift);
// } // }
public IPage<AlertCalled> queryForCalledList(Page pageBean, Integer alertStatus, String alertTypeCode, public IPage<AlertCalled> queryForCalledList(Page pageBean, Integer alertStatus, String alertTypeCode,
String alertSourceCode, String startTime, String endTime, String sort, String isFatherAlert) { String alertSourceCode, String startTime, String endTime, String sort, String isFatherAlert) {
String[] split = sort != null ? sort.split(",") : null; String[] split = sort != null ? sort.split(",") : null;
/* 2407 【web】日常值班>警情记录>接警记录,表头排序功能失效 chenzhao 09-28 start */ /* 2407 【web】日常值班>警情记录>接警记录,表头排序功能失效 chenzhao 09-28 start */
if (split != null) { if (split != null) {
if (split[0] != null) { if (split[0] != null) {
if (split[0].equals("alertType") || split[0].equals("alertSource") || split[0].equals("alarmType")) { if (split[0].equals("alertType") || split[0].equals("alertSource") || split[0].equals("alarmType")) {
split[0] = split[0] + "Code"; split[0] = split[0] + "Code";
} }
if (split[0].equals("alertStatusStr")) { if (split[0].equals("alertStatusStr")) {
split[0] = "alertStatus"; split[0] = "alertStatus";
} }
} }
if (split[1] != null) { if (split[1] != null) {
if (split[1].equals("ascend")) { if (split[1].equals("ascend")) {
split[1] = "ASC"; split[1] = "ASC";
} }
if (split[1].equals("descend")) { if (split[1].equals("descend")) {
split[1] = "DESC"; split[1] = "DESC";
} }
} }
} }
String data = split != null ? RedisKey.humpToLine(split[0]) : null; String data = split != null ? RedisKey.humpToLine(split[0]) : null;
/* 2407 【web】日常值班>警情记录>接警记录,表头排序功能失效 chenzhao 09-28 end */ /* 2407 【web】日常值班>警情记录>接警记录,表头排序功能失效 chenzhao 09-28 end */
String lift = split != null ? split[1] : null; String lift = split != null ? split[1] : null;
List<AlertCalled> list = alertCalledMapper.selectAllPage(pageBean.getCurrent(), pageBean.getSize(), alertStatus, List<AlertCalled> list = alertCalledMapper.selectAllPage(pageBean.getCurrent(), pageBean.getSize(), alertStatus,
alertTypeCode, alertSourceCode, startTime, endTime, data, lift, isFatherAlert); alertTypeCode, alertSourceCode, startTime, endTime, data, lift, isFatherAlert);
IPage<AlertCalled> iPage = new Page<>(); IPage<AlertCalled> iPage = new Page<>();
iPage.setRecords(list); iPage.setRecords(list);
iPage.setTotal( iPage.setTotal(alertCalledMapper.selectAllCount(alertStatus, alertTypeCode, alertSourceCode, startTime, endTime,
alertCalledMapper.selectAllCount(alertStatus, alertTypeCode, alertSourceCode, startTime, endTime, isFatherAlert)); isFatherAlert));
//iPage.setSize(pageBean.getSize()); // iPage.setSize(pageBean.getSize());
return iPage; return iPage;
/* bug2407 表头筛选失效 补充条件方法 XML中添加了排序条件判断 data代表排序条件 lift 升降序 陈召 2021-09-03 结束 */ /* bug2407 表头筛选失效 补充条件方法 XML中添加了排序条件判断 data代表排序条件 lift 升降序 陈召 2021-09-03 结束 */
} }
/** /**
* 根据灾情id 查询灾情详情 * 根据灾情id 查询灾情详情
**/ **/
@Override @Override
public Object selectAlertCalledById(Long id) { public Object selectAlertCalledById(Long id) {
if (redisUtils.hasKey(RedisKey.ALERTCALLED_ID + id)) { if (redisUtils.hasKey(RedisKey.ALERTCALLED_ID + id)) {
Object obj = redisUtils.get(RedisKey.ALERTCALLED_ID + id); Object obj = redisUtils.get(RedisKey.ALERTCALLED_ID + id);
return obj; return obj;
} else { } else {
// 警情基本信息 // 警情基本信息
AlertCalled alertCalled = this.getById(id); AlertCalled alertCalled = this.getById(id);
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>(); QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_called_id", id); queryWrapper.eq("alert_called_id", id);
// 警情动态表单数据 // 警情动态表单数据
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper); List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
List<FormValue> formValue = new ArrayList<FormValue>(); List<FormValue> formValue = new ArrayList<FormValue>();
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
for (AlertFormValue alertFormValue : list) { for (AlertFormValue alertFormValue : list) {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(),
"text", alertFormValue.getFieldValue(), alertFormValue.getBlock()); "text", alertFormValue.getFieldValue(), alertFormValue.getBlock());
formValue.add(value); formValue.add(value);
} }
} }
AlertCalledFormDto alertCalledFormVo = new AlertCalledFormDto(alertCalled, formValue); AlertCalledFormDto alertCalledFormVo = new AlertCalledFormDto(alertCalled, formValue);
redisUtils.set(RedisKey.ALERTCALLED_ID + id, JSON.toJSON(alertCalledFormVo), time); redisUtils.set(RedisKey.ALERTCALLED_ID + id, JSON.toJSON(alertCalledFormVo), time);
return alertCalledFormVo; return alertCalledFormVo;
} }
} }
/** /**
* 根据灾情id 查询灾情详情 * 根据灾情id 查询灾情详情
**/ **/
@Override @Override
public Object selectAlertCalledByIdNoRedis(Long id) { public Object selectAlertCalledByIdNoRedis(Long id) {
// 警情基本信息 // 警情基本信息
AlertCalled alertCalled = this.getById(id); AlertCalled alertCalled = this.getById(id);
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>(); QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_called_id", id); queryWrapper.eq("alert_called_id", id);
// 警情动态表单数据 // 警情动态表单数据
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper); List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
List<FormValue> formValue = new ArrayList<FormValue>(); List<FormValue> formValue = new ArrayList<FormValue>();
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
for (AlertFormValue alertFormValue : list) { for (AlertFormValue alertFormValue : list) {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), "text",
"text", alertFormValue.getFieldValue(), alertFormValue.getBlock()); alertFormValue.getFieldValue(), alertFormValue.getBlock());
formValue.add(value); formValue.add(value);
} }
} }
AlertCalledFormDto alertCalledFormVo = new AlertCalledFormDto(alertCalled, formValue); AlertCalledFormDto alertCalledFormVo = new AlertCalledFormDto(alertCalled, formValue);
return alertCalledFormVo; return alertCalledFormVo;
} }
/** /**
* 根据灾情id 查询灾情详情 * 根据灾情id 查询灾情详情
**/ **/
@Override @Override
public Object selectAlertCalledByIdNoRedisNew(Long id) { public Object selectAlertCalledByIdNoRedisNew(Long id) {
// 警情基本信息 // 警情基本信息
AlertCalled alertCalled = this.getById(id); AlertCalled alertCalled = this.getById(id);
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>(); QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_called_id", id); queryWrapper.eq("alert_called_id", id);
// 警情动态表单数据 // 警情动态表单数据
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper); List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
List<FormValue> formValue = new ArrayList<FormValue>(); List<FormValue> formValue = new ArrayList<FormValue>();
// //
AlertCalledObjsDto alertCalledFormVo = new AlertCalledObjsDto(); AlertCalledObjsDto alertCalledFormVo = new AlertCalledObjsDto();
alertCalledFormVo.setAlertCalled(alertCalled); alertCalledFormVo.setAlertCalled(alertCalled);
alertCalledFormVo.setAlertFormValue(list); alertCalledFormVo.setAlertFormValue(list);
return alertCalledFormVo; return alertCalledFormVo;
} }
/** /**
* <pre> * <pre>
* 保存警情信息 * 保存警情信息
* </pre> * </pre>
* *
* @param alertCalledObjsDto * @param alertCalledObjsDto
* @return * @return
*/ */
@Transactional(rollbackFor = RuntimeException.class) @Transactional(rollbackFor = RuntimeException.class)
public AlertCalledObjsDto createAlertCalled(AlertCalledObjsDto alertCalledObjsDto) { public AlertCalledObjsDto createAlertCalled(AlertCalledObjsDto alertCalledObjsDto) {
try { try {
// 警情基本信息 // 警情基本信息
AlertCalled alertCalled = alertCalledObjsDto.getAlertCalled(); AlertCalled alertCalled = alertCalledObjsDto.getAlertCalled();
//主表增加备注字段 // 主表增加备注字段
if (alertCalled.getAddress() != null) { if (alertCalled.getAddress() != null) {
JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(alertCalled.getAddress()); JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(alertCalled.getAddress());
alertCalled.setAddress(address.getString(BizConstant.ADDRESS)); alertCalled.setAddress(address.getString(BizConstant.ADDRESS));
alertCalled.setCoordinateX(Double.valueOf(address.getString(BizConstant.LONGITUDE))); alertCalled.setCoordinateX(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
alertCalled.setCoordinateY(Double.valueOf(address.getString(BizConstant.LATITUDE))); alertCalled.setCoordinateY(Double.valueOf(address.getString(BizConstant.LATITUDE)));
} }
alertCalled.setCallTime(new Date()); alertCalled.setCallTime(new Date());
if (AlertStageEnums.RG.getValue().equals(alertCalled.getAlertSourceCode()) if (AlertStageEnums.RG.getValue().equals(alertCalled.getAlertSourceCode())
|| AlertStageEnums.RG.getValue().equals(alertCalled.getAlertSourceCode())) { || AlertStageEnums.RG.getValue().equals(alertCalled.getAlertSourceCode())) {
alertCalled.setType("0"); alertCalled.setType("0");
} else { } else {
alertCalled.setType("1"); alertCalled.setType("1");
} }
// 动态表单 // 动态表单
List<AlertFormValue> alertFormValuelist = alertCalledObjsDto.getAlertFormValue(); List<AlertFormValue> alertFormValuelist = alertCalledObjsDto.getAlertFormValue();
// 判断是否航空器救援 如果为航空器救援则保存冗余字段 response_level_code bug2542 bykongfm // 判断是否航空器救援 如果为航空器救援则保存冗余字段 response_level_code bug2542 bykongfm
if (AlertStageEnums.HKJY.getCode().equals(alertCalled.getAlertTypeCode())) { if (AlertStageEnums.HKJY.getCode().equals(alertCalled.getAlertTypeCode())) {
alertFormValuelist.stream().forEach(alertFormValue -> { alertFormValuelist.stream().forEach(alertFormValue -> {
if (alertFormValue.getFieldCode().equals("responseLevel")) { if (alertFormValue.getFieldCode().equals("responseLevel")) {
alertCalled.setResponseLevelCode(alertFormValue.getFieldValueCode()); alertCalled.setResponseLevelCode(alertFormValue.getFieldValueCode());
alertCalled.setResponseLevel(alertFormValue.getFieldValue()); alertCalled.setResponseLevel(alertFormValue.getFieldValue());
} }
}); });
} }
// 判断是否归并警情 // 判断是否归并警情
if (alertCalled.getFatherAlert() != null) { if (alertCalled.getFatherAlert() != null) {
// 警情归并,设置当前警情状态为结束。 // 警情归并,设置当前警情状态为结束。
alertCalled.setAlertStatus(true); alertCalled.setAlertStatus(true);
alertCalled.setAlertStage(AlertStageEnums.JQJB.getValue()); alertCalled.setAlertStage(AlertStageEnums.JQJB.getValue());
alertCalled.setAlarmType(AlertStageEnums.JQGB.getValue()); alertCalled.setAlarmType(AlertStageEnums.JQGB.getValue());
alertCalled.setAlarmTypeCode(AlertStageEnums.JQGB.getCode()); alertCalled.setAlarmTypeCode(AlertStageEnums.JQGB.getCode());
alertCalled.setUpdateTime(new Date()); alertCalled.setUpdateTime(new Date());
alertCalled.setRemark(alertCalledObjsDto.getRemark()); alertCalled.setRemark(alertCalledObjsDto.getRemark());
this.save(alertCalled); this.save(alertCalled);
// 填充警情主键 // 填充警情主键
alertFormValuelist.stream().forEach(alertFormValue -> { alertFormValuelist.stream().forEach(alertFormValue -> {
alertFormValue.setAlertCalledId(alertCalled.getSequenceNbr()); alertFormValue.setAlertCalledId(alertCalled.getSequenceNbr());
alertFormValue.setAlertTypeCode(alertCalled.getAlertTypeCode()); alertFormValue.setAlertTypeCode(alertCalled.getAlertTypeCode());
}); });
// 保存动态表单数据 // 保存动态表单数据
iAlertFormValueService.saveBatch(alertFormValuelist); iAlertFormValueService.saveBatch(alertFormValuelist);
emqKeeper.getMqttClient().publish(topic1, "1".getBytes(), RuleConfig.DEFAULT_QOS, true); emqKeeper.getMqttClient().publish(topic1, "1".getBytes(), RuleConfig.DEFAULT_QOS, true);
} else { } else {
// 警情报送 // 警情报送
// ****************************************************待确认开发 // ****************************************************待确认开发
alertCalled.setAlertStatus(false); alertCalled.setAlertStatus(false);
alertCalled.setIsDelete(false); alertCalled.setIsDelete(false);
alertCalled.setAlertStage(AlertStageEnums.LLDP.getValue()); alertCalled.setAlertStage(AlertStageEnums.LLDP.getValue());
alertCalled.setAlarmType(AlertStageEnums.JQCB.getValue()); alertCalled.setAlarmType(AlertStageEnums.JQCB.getValue());
alertCalled.setAlarmTypeCode(AlertStageEnums.JQCB.getCode()); alertCalled.setAlarmTypeCode(AlertStageEnums.JQCB.getCode());
alertCalled.setRemark(alertCalledObjsDto.getRemark()); alertCalled.setRemark(alertCalledObjsDto.getRemark());
this.save(alertCalled); this.save(alertCalled);
// 填充警情主键 // 填充警情主键
alertFormValuelist.stream().forEach(alertFormValue -> { alertFormValuelist.stream().forEach(alertFormValue -> {
alertFormValue.setAlertCalledId(alertCalled.getSequenceNbr()); alertFormValue.setAlertCalledId(alertCalled.getSequenceNbr());
alertFormValue.setAlertTypeCode(alertCalled.getAlertTypeCode()); alertFormValue.setAlertTypeCode(alertCalled.getAlertTypeCode());
}); });
// 保存动态表单数据 // 保存动态表单数据
iAlertFormValueService.saveBatch(alertFormValuelist); iAlertFormValueService.saveBatch(alertFormValuelist);
alertCalledObjsDto.setAlertCalled(alertCalled); alertCalledObjsDto.setAlertCalled(alertCalled);
alertCalledObjsDto.setAlertFormValue(alertFormValuelist); alertCalledObjsDto.setAlertFormValue(alertFormValuelist);
// 警情报送 // 警情报送
// 调用规则 警情初报 // 调用规则 警情初报
ruleAlertCalledService.fireAlertCalledRule(alertCalledObjsDto, AlertBusinessTypeEnum.警情初报.getCode(), null, null, null); ruleAlertCalledService.fireAlertCalledRule(alertCalledObjsDto, AlertBusinessTypeEnum.警情初报.getCode(),
// 通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化 null, null, null);
emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true); // 通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
/** emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true);
* 同步保存ES /**
*/ * 同步保存ES
eSAlertCalledService.saveAlertCalledToES(alertCalled); */
} eSAlertCalledService.saveAlertCalledToES(alertCalled);
return alertCalledObjsDto; }
} catch (Exception e) { return alertCalledObjsDto;
e.printStackTrace(); } catch (Exception e) {
throw new RuntimeException("报送失败,系统异常!"); e.printStackTrace();
} throw new RuntimeException("报送失败,系统异常!");
} }
}
/**
* 根据id 修改警情 type:警情相关 操作类型 0警情续报 1非警情确认 2 警情结案 /**
*/ * 根据id 修改警情 type:警情相关 操作类型 0警情续报 1非警情确认 2 警情结案
@Override */
@Transactional(rollbackFor = RuntimeException.class) @Override
public boolean updateAlertCalled(Long id, String code) { @Transactional(rollbackFor = RuntimeException.class)
// TODO Auto-generated method stub public boolean updateAlertCalled(Long id, String code) {
try { // TODO Auto-generated method stub
switch (code) { try {
case "314": switch (code) {
alertCalledMapper.update(null, case "314":
new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id).set("alert_status", 1) alertCalledMapper.update(null,
.set("alert_stage", AlertStageEnums.ZBQJ.getValue()) new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id).set("alert_status", 1)
.set("update_time", new Date()) .set("alert_stage", AlertStageEnums.ZBQJ.getValue()).set("update_time", new Date())
.set("alarm_type", AlertStageEnums.FJQ.getValue()) .set("alarm_type", AlertStageEnums.FJQ.getValue())
.set("alarm_type_code", AlertStageEnums.FJQ.getCode())); .set("alarm_type_code", AlertStageEnums.FJQ.getCode()));
break; break;
case "315": case "315":
alertCalledMapper.update(null, new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id) alertCalledMapper.update(null,
.set("alert_status", 1).set("update_time", new Date()).set("alert_stage", AlertStageEnums.CZJS.getValue())); new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id).set("alert_status", 1)
break; .set("update_time", new Date()).set("alert_stage", AlertStageEnums.CZJS.getValue()));
default: break;
alertCalledMapper.update(null, new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id) default:
.set("update_time", new Date()).set("alert_stage", AlertStageEnums.CZGZ.getValue())); alertCalledMapper.update(null, new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id)
.set("update_time", new Date()).set("alert_stage", AlertStageEnums.CZGZ.getValue()));
break;
} break;
}
AlertCalled alertCalled = this.getById(id);
// 删除缓存 AlertCalled alertCalled = this.getById(id);
redisUtils.del(RedisKey.ALERTCALLED_ID + id); // 删除缓存
/** redisUtils.del(RedisKey.ALERTCALLED_ID + id);
* 同步更新存ES /**
*/ * 同步更新存ES
eSAlertCalledService.saveAlertCalledToES(alertCalled); */
eSAlertCalledService.saveAlertCalledToES(alertCalled);
// 通知实战指挥页面发送mqtt 默认发送 String 类型 0新警情, 1警情状态变化
emqKeeper.getMqttClient().publish(topic, "1".getBytes(), RuleConfig.DEFAULT_QOS, true); // 通知实战指挥页面发送mqtt 默认发送 String 类型 0新警情, 1警情状态变化
emqKeeper.getMqttClient().publish(topic, "1".getBytes(), RuleConfig.DEFAULT_QOS, true);
return true;
} catch (Exception e) { return true;
throw new RuntimeException("系统异常!"); } catch (Exception e) {
} throw new RuntimeException("系统异常!");
} }
}
/**
* 根据时间区间查询警情列表信息 /**
* * 根据时间区间查询警情列表信息
* @param beginDate 开始时间 *
* @param endDate 结束时间 * @param beginDate 开始时间
*/ * @param endDate 结束时间
public List<Map<String, Object>> listByDateRange(String beginDate, String endDate) { */
// 查询指定日期内的警情列表 public List<Map<String, Object>> listByDateRange(String beginDate, String endDate) {
// 查询指定日期内的警情列表
List<AlertCalled> alertCalledList = this.list(new LambdaQueryWrapper<AlertCalled>()
.apply(!ValidationUtil.isEmpty(beginDate), "call_time >= '" + beginDate + "'") List<AlertCalled> alertCalledList = this.list(new LambdaQueryWrapper<AlertCalled>()
.le(true, AlertCalled::getCallTime, endDate)); .apply(!ValidationUtil.isEmpty(beginDate), "call_time >= '" + beginDate + "'")
Map<String, String> queryParams = Maps.newHashMap(); .le(true, AlertCalled::getCallTime, endDate));
queryParams.put("beginDate", beginDate); Map<String, String> queryParams = Maps.newHashMap();
queryParams.put("endDate", endDate); queryParams.put("beginDate", beginDate);
List<Map<String, Object>> allList = Lists.newArrayList(); queryParams.put("endDate", endDate);
if (!ValidationUtil.isEmpty(alertCalledList)) { List<Map<String, Object>> allList = Lists.newArrayList();
Map<String, List<AlertCalled>> alertCalledMap = alertCalledList.stream() if (!ValidationUtil.isEmpty(alertCalledList)) {
.collect(Collectors.groupingBy(AlertCalled::getAlertTypeCode)); Map<String, List<AlertCalled>> alertCalledMap = alertCalledList.stream()
Map<Long, AlertCalled> calledMap = alertCalledList.stream() .collect(Collectors.groupingBy(AlertCalled::getAlertTypeCode));
.collect(Collectors.toMap(AlertCalled::getSequenceNbr, Function.identity())); Map<Long, AlertCalled> calledMap = alertCalledList.stream()
alertCalledMap.forEach((alertTypeCode, list) -> { .collect(Collectors.toMap(AlertCalled::getSequenceNbr, Function.identity()));
allList.addAll(iAlertFormValueService.listAll(alertTypeCode, queryParams)); alertCalledMap.forEach((alertTypeCode, list) -> {
}); allList.addAll(iAlertFormValueService.listAll(alertTypeCode, queryParams));
});
allList.forEach(i -> {
// 增加非空判断 cz 2021-10-08 allList.forEach(i -> {
if (calledMap.get(Long.parseLong(i.get("instanceId").toString())) != null) { // 增加非空判断 cz 2021-10-08
AlertCalled alertCalled = calledMap.get(Long.parseLong(i.get("instanceId").toString())); if (calledMap.get(Long.parseLong(i.get("instanceId").toString())) != null) {
i.putAll(Bean.BeantoMap(alertCalled)); AlertCalled alertCalled = calledMap.get(Long.parseLong(i.get("instanceId").toString()));
} i.putAll(Bean.BeantoMap(alertCalled));
}); }
} });
// 按接警时间正序排序 }
allList.sort((e, o) -> comparingByGroupVal(e, o, "recDate")); // 按接警时间正序排序
return allList; allList.sort((e, o) -> comparingByGroupVal(e, o, "recDate"));
} return allList;
}
public Map<String, Object> getAlertInfoList(String beginDate, String endDate) {
Map<String, Object> result = Maps.newHashMap(); public Map<String, Object> getAlertInfoList(String beginDate, String endDate) {
List<Map<String, Object>> list = listByDateRange(beginDate, endDate); Map<String, Object> result = Maps.newHashMap();
// 获取接警情况模板 List<Map<String, Object>> list = listByDateRange(beginDate, endDate);
List<Template> templateList = templateMapper.selectList(new LambdaQueryWrapper<Template>() // 获取接警情况模板
.eq(Template::getFormat, false).like(Template::getTypeCode, DutyInfoEnum.接警情况.getKey() + "-")); List<Template> templateList = templateMapper.selectList(new LambdaQueryWrapper<Template>()
Map<String, Template> templateMap = templateList.stream() .eq(Template::getFormat, false).like(Template::getTypeCode, DutyInfoEnum.接警情况.getKey() + "-"));
.collect(Collectors.toMap(Template::getTypeCode, Function.identity())); Map<String, Template> templateMap = templateList.stream()
List<String> contentList = Lists.newArrayList(); .collect(Collectors.toMap(Template::getTypeCode, Function.identity()));
// 增加非空判断 cz 2021-10-08 List<String> contentList = Lists.newArrayList();
list.forEach(i -> { // 增加非空判断 cz 2021-10-08
if (i.get("alertTypeCode") != null) { list.forEach(i -> {
String tempContent = templateMap.get(DutyInfoEnum.接警情况.getKey() + "-" + i.get("alertTypeCode")) if (i.get("alertTypeCode") != null) {
.getContent(); String tempContent = templateMap.get(DutyInfoEnum.接警情况.getKey() + "-" + i.get("alertTypeCode"))
contentList.add(replaceTemplate(tempContent, i)); .getContent();
} contentList.add(replaceTemplate(tempContent, i));
}); }
Map<String, Integer> statusCountMap = alertCalledMapper.queryAlertStatusCount(beginDate, endDate); });
Integer unFinishedCount = this Map<String, Integer> statusCountMap = alertCalledMapper.queryAlertStatusCount(beginDate, endDate);
.count(new LambdaQueryWrapper<AlertCalled>().eq(AlertCalled::getAlertStatus, false));// bug2532 Integer unFinishedCount = this
// 未结案警情统计错误 .count(new LambdaQueryWrapper<AlertCalled>().eq(AlertCalled::getAlertStatus, false));// bug2532
// bykongfm // 未结案警情统计错误
// bykongfm
result.put("alertInfoList", contentList);
result.putAll(statusCountMap); result.put("alertInfoList", contentList);
result.put("unFinishedCount", unFinishedCount); result.putAll(statusCountMap);
return result; result.put("unFinishedCount", unFinishedCount);
} return result;
}
/**
* 替换模板 /**
* * 替换模板
* @param tempContent 模板 *
* @param objMap 对象map * @param tempContent 模板
* @return * @param objMap 对象map
*/ * @return
private String replaceTemplate(String tempContent, Map<String, Object> objMap) { */
int size = objMap.size(); private String replaceTemplate(String tempContent, Map<String, Object> objMap) {
String[] keys = objMap.keySet().toArray(new String[size]); int size = objMap.size();
Object[] values = objMap.values().toArray(new Object[size]); String[] keys = objMap.keySet().toArray(new String[size]);
List<String> strList = Lists.newArrayList(); Object[] values = objMap.values().toArray(new Object[size]);
for (Object obj : values) { List<String> strList = Lists.newArrayList();
if (!ValidationUtil.isEmpty(obj)) { for (Object obj : values) {
if (obj instanceof Date) { if (!ValidationUtil.isEmpty(obj)) {
obj = DateUtils.date2LongStr((Date) obj); if (obj instanceof Date) {
} obj = DateUtils.date2LongStr((Date) obj);
strList.add(obj.toString()); }
} else { strList.add(obj.toString());
strList.add(""); } else {
} strList.add("");
} }
return StringUtils.replaceEach(tempContent, keys, strList.toArray(new String[strList.size()])); }
} return StringUtils.replaceEach(tempContent, keys, strList.toArray(new String[strList.size()]));
}
@Override
public Map<String, Object> selectAlertCalledKeyValueLabelById(Long id) { @Override
public Map<String, Object> selectAlertCalledKeyValueLabelById(Long id) {
// 警情基本信息
AlertCalled alertCalled = this.getById(id); // 警情基本信息
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>(); AlertCalled alertCalled = this.getById(id);
Map<String, Object> map = new HashMap<String, Object>(); QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
map.put("title", "【" + alertCalled.getAlertType() + "】" + alertCalled.getAddress()); Map<String, Object> map = new HashMap<String, Object>();
queryWrapper.eq("alert_called_id", id); map.put("title", "【" + alertCalled.getAlertType() + "】" + alertCalled.getAddress());
queryWrapper.eq("alert_called_id", id);
// 警情动态表单数据
List<KeyValueLabel> listdate = new ArrayList<>(); // 警情动态表单数据
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper); List<KeyValueLabel> listdate = new ArrayList<>();
listdate.add(new KeyValueLabel("接警时间", "callTime", alertCalled.getCallTime())); List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
listdate.add(new KeyValueLabel("警情地点", "address", alertCalled.getAddress())); listdate.add(new KeyValueLabel("接警时间", "callTime", alertCalled.getCallTime()));
listdate.add(new KeyValueLabel("警情类型", "alertType", alertCalled.getAlertType())); listdate.add(new KeyValueLabel("警情地点", "address", alertCalled.getAddress()));
listdate.add(new KeyValueLabel("警情阶段", "alertStage", alertCalled.getAlertStage())); listdate.add(new KeyValueLabel("警情类型", "alertType", alertCalled.getAlertType()));
listdate.add(new KeyValueLabel("警情等级", "responseLevel", "无")); listdate.add(new KeyValueLabel("警情阶段", "alertStage", alertCalled.getAlertStage()));
listdate.add(new KeyValueLabel("被困人数", "trappedNum", alertCalled.getTrappedNum())); listdate.add(new KeyValueLabel("警情等级", "responseLevel", "无"));
listdate.add(new KeyValueLabel("伤亡人数", "casualtiesNum", alertCalled.getCasualtiesNum())); listdate.add(new KeyValueLabel("被困人数", "trappedNum", alertCalled.getTrappedNum()));
listdate.add(new KeyValueLabel("联系人", "contactUser", alertCalled.getContactUser())); listdate.add(new KeyValueLabel("伤亡人数", "casualtiesNum", alertCalled.getCasualtiesNum()));
listdate.add(new KeyValueLabel("联系电话", "contactPhone", alertCalled.getContactPhone())); listdate.add(new KeyValueLabel("联系人", "contactUser", alertCalled.getContactUser()));
listdate.add(new KeyValueLabel("联系电话", "contactPhone", alertCalled.getContactPhone()));
// listdate.add(new KeyValueLabel("联系人电话", "contactPhone", alertCalled.getContactPhone())); // listdate.add(new KeyValueLabel("联系人电话", "contactPhone", alertCalled.getContactPhone()));
list.stream().forEach(alertFormValue -> { list.stream().forEach(alertFormValue -> {
/* 2661 灾情详情中字典类数据错误显示为code 改为value值 2021-09-23 陈召 开始 */ /* 2661 灾情详情中字典类数据错误显示为code 改为value值 2021-09-23 陈召 开始 */
String valueCode = alertFormValue.getFieldValue(); String valueCode = alertFormValue.getFieldValue();
/* 2661 灾情详情中字典类数据错误显示为code 改为value值 2021-09-23 陈召 结束 */ /* 2661 灾情详情中字典类数据错误显示为code 改为value值 2021-09-23 陈召 结束 */
/* /*
* if(null == valueCode) { valueCode = alertFormValue.getFieldValue(); } * if(null == valueCode) { valueCode = alertFormValue.getFieldValue(); }
*/ */
listdate.add(new KeyValueLabel(alertFormValue.getFieldName(), alertFormValue.getFieldCode(), valueCode)); listdate.add(new KeyValueLabel(alertFormValue.getFieldName(), alertFormValue.getFieldCode(), valueCode));
}); });
map.put("data", listdate); map.put("data", listdate);
return map; return map;
} }
@Override @Override
public List<KeyValueLabel> selectAlertCalledcount(Long id) { public List<KeyValueLabel> selectAlertCalledcount(Long id) {
// 警情基本信息 // 警情基本信息
AlertCalled alertCalled = this.getById(id); AlertCalled alertCalled = this.getById(id);
List<KeyValueLabel> listdate = new ArrayList<>(); List<KeyValueLabel> listdate = new ArrayList<>();
listdate.add(new KeyValueLabel("被困人数", "trappedNum", alertCalled.getTrappedNum())); listdate.add(new KeyValueLabel("被困人数", "trappedNum", alertCalled.getTrappedNum()));
listdate.add(new KeyValueLabel("伤亡人数", "casualtiesNum", alertCalled.getCasualtiesNum())); listdate.add(new KeyValueLabel("伤亡人数", "casualtiesNum", alertCalled.getCasualtiesNum()));
return listdate; return listdate;
} }
@Override @Override
public List<KeyValueLabel> powercount(Long id) { public List<KeyValueLabel> powercount(Long id) {
Map<String, Integer> map = powerTransferMapper.getCarNum(id); Map<String, Integer> map = powerTransferMapper.getCarNum(id);
// Map<String,Integer> mapc=powerTransferMapper.getCompanyNum(id); // Map<String,Integer> mapc=powerTransferMapper.getCompanyNum(id);
// Map<String,Integer> mapu= alertSubmittedMapper.getUseNum(id); // Map<String,Integer> mapu= alertSubmittedMapper.getUseNum(id);
// 统计参与人员 // 统计参与人员
List<KeyValueLabel> listdate = new ArrayList<>(); List<KeyValueLabel> listdate = new ArrayList<>();
listdate.add(new KeyValueLabel("调动人力", "useNum", "0", "人")); listdate.add(new KeyValueLabel("调动人力", "useNum", "0", "人"));
// 统计参与车辆 // 统计参与车辆
listdate.add(new KeyValueLabel("调动人力", "carNum", map.get("carNum"), "辆")); listdate.add(new KeyValueLabel("调动人力", "carNum", map.get("carNum"), "辆"));
// 统计参与队伍 // 统计参与队伍
listdate.add(new KeyValueLabel("调动单位", "companyNum", map.get("companyNum"), "个")); listdate.add(new KeyValueLabel("调动单位", "companyNum", map.get("companyNum"), "个"));
return listdate; return listdate;
} }
@Override @Override
public List<PowerData> getPowerDataList(Long id) { public List<PowerData> getPowerDataList(Long id) {
List<PowerData> list = powerTransferMapper.getPowerDataList(id); List<PowerData> list = powerTransferMapper.getPowerDataList(id);
return list; return list;
} }
@Override @Override
public AlertCalled getAlertCalledById(Long id) { public AlertCalled getAlertCalledById(Long id) {
return this.getById(id); return this.getById(id);
} }
@Override @Override
public Integer AlertCalledcountTime(int type) { public Integer AlertCalledcountTime(int type) {
return alertCalledMapper.AlertCalledcountTime(type); return alertCalledMapper.AlertCalledcountTime(type);
} }
@Override @Override
public List<AlertCalledTodyDto> getTodayAlertCalled() { public List<AlertCalledTodyDto> getTodayAlertCalled() {
return alertCalledMapper.getTodayAlertCalled(); return alertCalledMapper.getTodayAlertCalled();
} }
public Boolean controlEquip() { public Boolean controlEquip() {
/** /**
* 获取控制器设备 * 获取控制器设备
*/ */
List<ControllerEquipDto> controllerEquipDtoList = controllerEquipService.queryAllForList(); List<ControllerEquipDto> controllerEquipDtoList = controllerEquipService.queryAllForList();
Map<Long, List<String>> controllerEquipMap = new HashMap<>(); Map<Long, List<String>> controllerEquipMap = new HashMap<>();
for (ControllerEquipDto controllerEquipDto : controllerEquipDtoList) { for (ControllerEquipDto controllerEquipDto : controllerEquipDtoList) {
List<String> numList = controllerEquipMap.get(controllerEquipDto.getControllerSeq()); List<String> numList = controllerEquipMap.get(controllerEquipDto.getControllerSeq());
if (ValidationUtil.isEmpty(numList)) { if (ValidationUtil.isEmpty(numList)) {
numList = new ArrayList<>(); numList = new ArrayList<>();
} }
numList.add(controllerEquipDto.getNum()); numList.add(controllerEquipDto.getNum());
controllerEquipMap.put(controllerEquipDto.getControllerSeq(), numList); controllerEquipMap.put(controllerEquipDto.getControllerSeq(), numList);
} }
/** /**
* 获取联动控制器 * 获取联动控制器
*/ */
List<ControllerDto> controllerDtoList = controllerService.queryAllForList(); List<ControllerDto> controllerDtoList = controllerService.queryAllForList();
StringBuilder bellNumSb = new StringBuilder(); StringBuilder bellNumSb = new StringBuilder();
// StringBuilder broadcastNumSb = new StringBuilder(); // StringBuilder broadcastNumSb = new StringBuilder();
for (ControllerDto controllerDto : controllerDtoList) { for (ControllerDto controllerDto : controllerDtoList) {
// 消防警铃 // 消防警铃
if (controllerDto.getType().equals(ControllerTypeEnum.BELL.getCode())) { if (controllerDto.getType().equals(ControllerTypeEnum.BELL.getCode())) {
List<String> bellNumList = controllerEquipMap.get(controllerDto.getSequenceNbr()); List<String> bellNumList = controllerEquipMap.get(controllerDto.getSequenceNbr());
if (!ValidationUtil.isEmpty(bellNumList)) { if (!ValidationUtil.isEmpty(bellNumList)) {
for (String num : bellNumList) { for (String num : bellNumList) {
bellNumSb.append(num).append(","); bellNumSb.append(num).append(",");
} }
} }
} }
// 广播 // 广播
// if (controllerDto.getType().equals(ControllerTypeEnum.BROADCAST.getCode())) { // if (controllerDto.getType().equals(ControllerTypeEnum.BROADCAST.getCode())) {
// List<String> broadcastList = controllerEquipMap.get(controllerDto.getSequenceNbr()); // List<String> broadcastList = controllerEquipMap.get(controllerDto.getSequenceNbr());
// if (!ValidationUtil.isEmpty(broadcastList)) { // if (!ValidationUtil.isEmpty(broadcastList)) {
...@@ -643,266 +666,267 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal ...@@ -643,266 +666,267 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
// } // }
// } // }
// } // }
} }
/** /**
* 打开消防警铃 * 打开消防警铃
*/ */
if (!ValidationUtil.isEmpty(bellNumSb.toString())) { if (!ValidationUtil.isEmpty(bellNumSb.toString())) {
String bellNum = bellNumSb.toString(); String bellNum = bellNumSb.toString();
bellNum = bellNum.substring(0, bellNum.length() - 1); bellNum = bellNum.substring(0, bellNum.length() - 1);
String[] bellNums = bellNum.split(","); String[] bellNums = bellNum.split(",");
for (int i = 0; i < bellNums.length; i++) { for (int i = 0; i < bellNums.length; i++) {
//打开15s后自动关闭 // 打开15s后自动关闭
try { try {
jcsControlServerClient.sendBellActionWithTime(bellNums[i], "1", 15); jcsControlServerClient.sendBellActionWithTime(bellNums[i], "1", 15);
} catch (Exception e) { } catch (Exception e) {
logger.info("打开警铃【" + bellNums[i] + "】异常!"); logger.info("打开警铃【" + bellNums[i] + "】异常!");
} }
} }
} }
/** /**
* 播放广播 * 播放广播
*/ */
// if (!ValidationUtil.isEmpty(broadcastNumSb.toString())) { // if (!ValidationUtil.isEmpty(broadcastNumSb.toString())) {
// String broadcastNum = broadcastNumSb.toString(); // String broadcastNum = broadcastNumSb.toString();
// broadcastNum = broadcastNum.substring(0, broadcastNum.length() - 1); // broadcastNum = broadcastNum.substring(0, broadcastNum.length() - 1);
// jcsControlServerClient.sendFileAction(broadcastNum, "1490075199246.mp3"); // jcsControlServerClient.sendFileAction(broadcastNum, "1490075199246.mp3");
// } // }
/** /**
* 打开北站车库门 * 打开北站车库门
*/ */
List<ControllerDto> northDoor = controllerService.queryForList("3", ControllerTypeEnum.DOOR.getCode()); List<ControllerDto> northDoor = controllerService.queryForList("3", ControllerTypeEnum.DOOR.getCode());
if (!ValidationUtil.isEmpty(northDoor)) { if (!ValidationUtil.isEmpty(northDoor)) {
ControllerDto controllerDto = northDoor.get(0); ControllerDto controllerDto = northDoor.get(0);
// 打开北站车库门 // 打开北站车库门
try { try {
jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 100, "1,1,1,1"); jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 100, "1,1,1,1");
} catch (Exception e) { } catch (Exception e) {
logger.info("打开北站车库门【" + controllerDto.getIp() + "】异常!"); logger.info("打开北站车库门【" + controllerDto.getIp() + "】异常!");
} }
// 打开北站车库门弱电警铃 // 打开北站车库门弱电警铃
try { try {
jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 107, "1"); jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 107, "1");
} catch (Exception e) { } catch (Exception e) {
logger.info("打开北站弱电警铃【" + controllerDto.getIp() + "】异常!"); logger.info("打开北站弱电警铃【" + controllerDto.getIp() + "】异常!");
} }
} }
/** /**
* 打开南站车库门 * 打开南站车库门
*/ */
List<ControllerDto> southDoor = controllerService.queryForList("2", ControllerTypeEnum.DOOR.getCode()); List<ControllerDto> southDoor = controllerService.queryForList("2", ControllerTypeEnum.DOOR.getCode());
if (!ValidationUtil.isEmpty(southDoor)) { if (!ValidationUtil.isEmpty(southDoor)) {
ControllerDto controllerDto = southDoor.get(0); ControllerDto controllerDto = southDoor.get(0);
// 打开南站车库门 // 打开南站车库门
try { try {
jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 100, "1"); jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 100, "1");
} catch (Exception e) { } catch (Exception e) {
logger.info("打开南站车库门【" + controllerDto.getIp() + "】异常!"); logger.info("打开南站车库门【" + controllerDto.getIp() + "】异常!");
} }
// 打开南站车库门弱电警铃 // 打开南站车库门弱电警铃
try { try {
jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 107, "1"); jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 107, "1");
} catch (Exception e) { } catch (Exception e) {
logger.info("打开南站弱电警铃【" + controllerDto.getIp() + "】异常!"); logger.info("打开南站弱电警铃【" + controllerDto.getIp() + "】异常!");
} }
} }
return true; return true;
} }
/** /**
* 警情重新定位 * 警情重新定位
* *
* @param alertId 警情id * @param alertId 警情id
* @param longitude 经度 * @param longitude 经度
* @param latitude 纬度 * @param latitude 纬度
* @return * @return
*/ */
public Boolean reLocate(String alertId, String longitude, String latitude) { public Boolean reLocate(String alertId, String longitude, String latitude) {
try { try {
// 更新警情主表 // 更新警情主表
AlertCalled alertCalled = this.baseMapper.selectById(alertId); AlertCalled alertCalled = this.baseMapper.selectById(alertId);
alertCalled.setCoordinateX(Double.valueOf(longitude)); alertCalled.setCoordinateX(Double.valueOf(longitude));
alertCalled.setCoordinateY(Double.valueOf(latitude)); alertCalled.setCoordinateY(Double.valueOf(latitude));
this.updateById(alertCalled); this.updateById(alertCalled);
// 插入定位日志表 // 插入定位日志表
AlertLocationLog alertLocationLog = new AlertLocationLog(); AlertLocationLog alertLocationLog = new AlertLocationLog();
alertLocationLog.setAlertId(Long.valueOf(alertId)); alertLocationLog.setAlertId(Long.valueOf(alertId));
alertLocationLog.setLongitude(longitude); alertLocationLog.setLongitude(longitude);
alertLocationLog.setLatitude(latitude); alertLocationLog.setLatitude(latitude);
alertLocationLogService.save(alertLocationLog); alertLocationLogService.save(alertLocationLog);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
log.error(e.toString()); log.error(e.toString());
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("警情定位失败!"); throw new RuntimeException("警情定位失败!");
} }
} }
@Override @Override
public Map<String, Object> queryAlertCalledById(Long id) { public Map<String, Object> queryAlertCalledById(Long id) {
// 警情基本信息 // 警情基本信息
AlertCalled alertCalled = this.getById(id); AlertCalled alertCalled = this.getById(id);
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>(); QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("title", "【" + alertCalled.getAlertType() + "】" + alertCalled.getAddress()); map.put("title", "【" + alertCalled.getAlertType() + "】" + alertCalled.getAddress());
queryWrapper.eq("alert_called_id", id); queryWrapper.eq("alert_called_id", id);
// 警情动态表单数据 // 警情动态表单数据
List<KeyValueLabel> listdate = new ArrayList<>(); List<KeyValueLabel> listdate = new ArrayList<>();
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper); List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
listdate.add(new KeyValueLabel("接警时间", "callTime", alertCalled.getCallTime())); listdate.add(new KeyValueLabel("接警时间", "callTime", alertCalled.getCallTime()));
listdate.add(new KeyValueLabel("警情地点", "address", alertCalled.getAddress())); listdate.add(new KeyValueLabel("警情地点", "address", alertCalled.getAddress()));
listdate.add(new KeyValueLabel("警情类型", "alertType", alertCalled.getAlertType())); listdate.add(new KeyValueLabel("警情类型", "alertType", alertCalled.getAlertType()));
listdate.add(new KeyValueLabel("警情阶段", "alertStage", alertCalled.getAlertStage())); listdate.add(new KeyValueLabel("警情阶段", "alertStage", alertCalled.getAlertStage()));
listdate.add(new KeyValueLabel("警情等级", "responseLevel", "无")); listdate.add(new KeyValueLabel("警情等级", "responseLevel", "无"));
listdate.add(new KeyValueLabel("被困人数", "trappedNum", alertCalled.getTrappedNum())); listdate.add(new KeyValueLabel("被困人数", "trappedNum", alertCalled.getTrappedNum()));
listdate.add(new KeyValueLabel("伤亡人数", "casualtiesNum", alertCalled.getCasualtiesNum())); listdate.add(new KeyValueLabel("伤亡人数", "casualtiesNum", alertCalled.getCasualtiesNum()));
listdate.add(new KeyValueLabel("联系人", "contactUser", alertCalled.getContactUser())); listdate.add(new KeyValueLabel("联系人", "contactUser", alertCalled.getContactUser()));
listdate.add(new KeyValueLabel("联系电话", "contactPhone", alertCalled.getContactPhone())); listdate.add(new KeyValueLabel("联系电话", "contactPhone", alertCalled.getContactPhone()));
listdate.add(new KeyValueLabel("联系人电话", "contactPhone", alertCalled.getContactPhone())); listdate.add(new KeyValueLabel("联系人电话", "contactPhone", alertCalled.getContactPhone()));
list.stream().forEach(alertFormValue -> { list.stream().forEach(alertFormValue -> {
String valueCode = alertFormValue.getFieldValueCode(); String valueCode = alertFormValue.getFieldValueCode();
if (null == valueCode) { if (null == valueCode) {
valueCode = alertFormValue.getFieldValue(); valueCode = alertFormValue.getFieldValue();
} }
listdate.add(new KeyValueLabel(alertFormValue.getFieldName(), alertFormValue.getFieldCode(), valueCode)); listdate.add(new KeyValueLabel(alertFormValue.getFieldName(), alertFormValue.getFieldCode(), valueCode));
if ("fireTime".equals(alertFormValue.getFieldCode())) { if ("fireTime".equals(alertFormValue.getFieldCode())) {
map.put("occurrenceTime", alertFormValue.getFieldValue()); map.put("occurrenceTime", alertFormValue.getFieldValue());
} }
}); });
map.put("data", listdate); map.put("data", listdate);
// app警情首页使用alarmDetailInfo,alarmContactInfo // app警情首页使用alarmDetailInfo,alarmContactInfo
if (!AlertStageEnums.YBHZ.getCode().equals(alertCalled.getAlertTypeCode())) { if (!AlertStageEnums.YBHZ.getCode().equals(alertCalled.getAlertTypeCode())) {
map.put("occurrenceTime", alertCalled.getCallTime()); map.put("occurrenceTime", alertCalled.getCallTime());
} }
map.put("alertType", alertCalled.getAlertType()); map.put("alertType", alertCalled.getAlertType());
map.put("address", alertCalled.getAddress()); map.put("address", alertCalled.getAddress());
map.put("contactUser", alertCalled.getContactUser()); map.put("contactUser", alertCalled.getContactUser());
map.put("contactPhone", alertCalled.getContactPhone()); map.put("contactPhone", alertCalled.getContactPhone());
map.put("callTime", alertCalled.getCallTime()); map.put("callTime", alertCalled.getCallTime());
//获取通话录音文件地址 // 获取通话录音文件地址
List<VoiceRecordFileDto> voiceRecordFileDtos = voiceRecordFileService.listByAlertId(alertCalled.getSequenceNbr()); List<VoiceRecordFileDto> voiceRecordFileDtos = voiceRecordFileService
if (!voiceRecordFileDtos.isEmpty()) { .listByAlertId(alertCalled.getSequenceNbr());
map.put("voiceRecordFile", voiceRecordFileDtos.get(0).getFilePath()); if (!voiceRecordFileDtos.isEmpty()) {
} map.put("voiceRecordFile", voiceRecordFileDtos.get(0).getFilePath());
return map; }
} return map;
}
// 未结案警情统计
@Override // 未结案警情统计
public Integer AlertCalledcount(int type) { @Override
return alertCalledMapper.AlertCalledcount(0); public Integer AlertCalledcount(int type) {
} return alertCalledMapper.AlertCalledcount(0);
}
@Override
public List<AlertCalled> AlertCalledStatusPage(Integer current, Integer size) { @Override
return alertCalledMapper.AlertCalledStatusPage(current, size); public List<AlertCalled> AlertCalledStatusPage(Integer current, Integer size) {
} return alertCalledMapper.AlertCalledStatusPage(current, size);
}
@Override
public List<JSONObject> queryDisposalObjectList(String alertId) { @Override
AlertCalled alertCalled = this.getById(Long.valueOf(alertId)); public List<JSONObject> queryDisposalObjectList(String alertId) {
String alertTypeCode = alertCalled.getAlertTypeCode(); AlertCalled alertCalled = this.getById(Long.valueOf(alertId));
AlertStageEnums alertStage = AlertStageEnums.getEnum(alertTypeCode); String alertTypeCode = alertCalled.getAlertTypeCode();
List<JSONObject> resultList = Lists.newArrayList(); AlertStageEnums alertStage = AlertStageEnums.getEnum(alertTypeCode);
if (alertStage != null) { List<JSONObject> resultList = Lists.newArrayList();
switch (alertStage) { if (alertStage != null) {
case YBHZ: switch (alertStage) {
case TFSJ: case YBHZ:
case QTJQ: case TFSJ:
resultList = queryDisposalObjectUnit(alertCalled); case QTJQ:
break; resultList = queryDisposalObjectUnit(alertCalled);
case HKJY: break;
case LYXC: case HKJY:
case ZJBZ: case LYXC:
resultList = queryDisposalObjectAircraft(alertCalled); case ZJBZ:
default: resultList = queryDisposalObjectAircraft(alertCalled);
break; default:
} break;
} }
return resultList; }
} return resultList;
}
private List<JSONObject> queryDisposalObjectUnit(AlertCalled alertCalled) {
List<JSONObject> resultList = Lists.newArrayList(); private List<JSONObject> queryDisposalObjectUnit(AlertCalled alertCalled) {
if (!ValidationUtil.isEmpty(alertCalled.getUnitInvolved())) { List<JSONObject> resultList = Lists.newArrayList();
List<OrgUsrzhDto> unitInvolvedDto = iOrgUsrService.getOrgUsrzhDto(alertCalled.getUnitInvolved()); if (!ValidationUtil.isEmpty(alertCalled.getUnitInvolved())) {
JSONObject a1 = new JSONObject(); List<OrgUsrzhDto> unitInvolvedDto = iOrgUsrService.getOrgUsrzhDto(alertCalled.getUnitInvolved());
a1.put("name", "单位名称"); JSONObject a1 = new JSONObject();
a1.put("value", a1.put("name", "单位名称");
!ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getBizOrgName() : ""); a1.put("value",
JSONObject a2 = new JSONObject(); !ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getBizOrgName() : "");
a2.put("name", "单位性质"); JSONObject a2 = new JSONObject();
a2.put("value", a2.put("name", "单位性质");
!ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getCompanyNature() : ""); a2.put("value",
JSONObject a3 = new JSONObject(); !ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getCompanyNature() : "");
a3.put("name", "单位电话"); JSONObject a3 = new JSONObject();
a3.put("value", a3.put("name", "单位电话");
!ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getCompanyPhone() : ""); a3.put("value",
JSONObject a4 = new JSONObject(); !ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getCompanyPhone() : "");
a4.put("name", "单位地址"); JSONObject a4 = new JSONObject();
a4.put("value", a4.put("name", "单位地址");
!ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getCompanyLocation() : ""); a4.put("value",
JSONObject a5 = new JSONObject(); !ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getCompanyLocation() : "");
a5.put("name", "重点部位数量"); JSONObject a5 = new JSONObject();
a5.put("value", !ValidationUtil.isEmpty(unitInvolvedDto.get(0)) a5.put("name", "重点部位数量");
? unitInvolvedDto.get(0).getKeySiteCount() != null ? unitInvolvedDto.get(0).getKeySiteCount() : 0 a5.put("value", !ValidationUtil.isEmpty(unitInvolvedDto.get(0))
: 0 + "个"); ? unitInvolvedDto.get(0).getKeySiteCount() != null ? unitInvolvedDto.get(0).getKeySiteCount() : 0
resultList.add(a1); : 0 + "个");
resultList.add(a2); resultList.add(a1);
resultList.add(a3); resultList.add(a2);
resultList.add(a4); resultList.add(a3);
resultList.add(a5); resultList.add(a4);
} resultList.add(a5);
return resultList; }
} return resultList;
}
private List<JSONObject> queryDisposalObjectAircraft(AlertCalled alertCalled) {
// 警情动态表单数据 private List<JSONObject> queryDisposalObjectAircraft(AlertCalled alertCalled) {
List<AlertFormValue> list = alertFormValueService.getzqlist(alertCalled.getSequenceNbr()); // 警情动态表单数据
Aircraft aircraft = new Aircraft(); List<AlertFormValue> list = alertFormValueService.getzqlist(alertCalled.getSequenceNbr());
for (AlertFormValue alertFormValue : list) { Aircraft aircraft = new Aircraft();
if ("aircraftModel".equals(alertFormValue.getFieldCode())) { for (AlertFormValue alertFormValue : list) {
String aircraftModel = alertFormValue.getFieldValue(); if ("aircraftModel".equals(alertFormValue.getFieldCode())) {
aircraft = aircraftService.queryAircraftInfoByModel(aircraftModel); String aircraftModel = alertFormValue.getFieldValue();
break; aircraft = aircraftService.queryAircraftInfoByModel(aircraftModel);
} break;
} }
List<JSONObject> resultList = Lists.newArrayList(); }
if (!ValidationUtil.isEmpty(aircraft)) { List<JSONObject> resultList = Lists.newArrayList();
JSONObject a1 = new JSONObject(); if (!ValidationUtil.isEmpty(aircraft)) {
a1.put("name", "飞机型号"); JSONObject a1 = new JSONObject();
a1.put("value", aircraft.getAircraftModel()); a1.put("name", "飞机型号");
JSONObject a2 = new JSONObject(); a1.put("value", aircraft.getAircraftModel());
a2.put("name", "发动机类型"); JSONObject a2 = new JSONObject();
a2.put("value", aircraft.getEngineType()); a2.put("name", "发动机类型");
JSONObject a3 = new JSONObject(); a2.put("value", aircraft.getEngineType());
a3.put("name", "发动机数量"); JSONObject a3 = new JSONObject();
a3.put("value", aircraft.getEnginesmNum()); a3.put("name", "发动机数量");
JSONObject a4 = new JSONObject(); a3.put("value", aircraft.getEnginesmNum());
a4.put("name", "燃油类型"); JSONObject a4 = new JSONObject();
a4.put("value", aircraft.getFuelType()); a4.put("name", "燃油类型");
JSONObject a5 = new JSONObject(); a4.put("value", aircraft.getFuelType());
a5.put("name", "主要燃烧物质"); JSONObject a5 = new JSONObject();
a5.put("value", aircraft.getCombustionMaterial()); a5.put("name", "主要燃烧物质");
resultList.add(a1); a5.put("value", aircraft.getCombustionMaterial());
resultList.add(a2); resultList.add(a1);
resultList.add(a3); resultList.add(a2);
resultList.add(a4); resultList.add(a3);
resultList.add(a5); resultList.add(a4);
} resultList.add(a5);
return resultList; }
} return resultList;
}
/* 2304 地址 联系人模糊查询缺失 陈召 2021-09-23 开始 */
public List<Map<String, String>> getContactName() { /* 2304 地址 联系人模糊查询缺失 陈召 2021-09-23 开始 */
// List<Map<String,String>> firefightersName = public List<Map<String, String>> getContactName() {
// firefightersService.getFirefightersName(); // List<Map<String,String>> firefightersName =
// firefightersName.forEach(r->{ // firefightersService.getFirefightersName();
// firefightersName.forEach(r->{
// String phone = r.get("phone"); // String phone = r.get("phone");
// phone = QRCodeUtil.generateQRCode()+"@"+phone; // phone = QRCodeUtil.generateQRCode()+"@"+phone;
// r.put("phone",phone); // r.put("phone",phone);
...@@ -916,32 +940,248 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal ...@@ -916,32 +940,248 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
// } // }
// ); // );
// firefightersName.addAll(contactNames); // firefightersName.addAll(contactNames);
List<Map<String, String>> list = orgUsrServiceImpl.getPersonSimpleDetail(); List<Map<String, String>> list = orgUsrServiceImpl.getPersonSimpleDetail();
list.stream().forEach(i -> { list.stream().forEach(i -> {
String phone = ""; String phone = "";
if (i.containsKey("phone")) { if (i.containsKey("phone")) {
phone = QRCodeUtil.generateQRCode() + "@" + i.get("phone").toString(); phone = QRCodeUtil.generateQRCode() + "@" + i.get("phone").toString();
i.replace("phone", phone); i.replace("phone", phone);
} else { } else {
phone = QRCodeUtil.generateQRCode() + "@" + phone; phone = QRCodeUtil.generateQRCode() + "@" + phone;
i.put("phone", phone); i.put("phone", phone);
} }
}); });
return list; return list;
} }
public List<String> getCalledAddress() { public List<String> getCalledAddress() {
List<String> keyAddress = keySiteService.getAddress(); List<String> keyAddress = keySiteService.getAddress();
List<String> alertAddress = alertCalledMapper.getAddress(); List<String> alertAddress = alertCalledMapper.getAddress();
keyAddress.addAll(alertAddress); keyAddress.addAll(alertAddress);
return keyAddress; return keyAddress;
} }
/* 2304 地址 联系人模糊查询缺失 陈召 2021-09-23 结束 */ /* 2304 地址 联系人模糊查询缺失 陈召 2021-09-23 结束 */
public Set<Map<String, Object>> getLocationLike(String locationt) { public Set<Map<String, Object>> getLocationLike(String locationt) {
Set<Map<String, Object>> set = alertCalledMapper.getLocation(); Set<Map<String, Object>> set = alertCalledMapper.getLocation();
set.remove(null); set.remove(null);
return set; return set;
} }
@SuppressWarnings("unchecked")
public Object toCompletePoliceSituationMatch(Long id) throws Exception{
AlertCalledFormDto dto = (AlertCalledFormDto) selectAlertCalledByIdNoRedis(id);
AlertCalled alertCalled = dto.getAlertCalled();
List<FormValue> list = dto.getDynamicFormAlert();
if (alertCalled.getAlertTypeCode().equals(AlertStageEnums.YBHZ.getCode())) {// 一般火灾
String condition1 = alertCalled.getAlertType();// 一般火灾
String condition2 = alertCalled.getUnitInvolved();// 事发单位
String condition3 = "";
for (FormValue i : list) {
if (i.getKey().equals(AlertStageEnums.keySiteExcle.getCode())) {
condition3 = i.getValue();
break;
}
}
return getIdsList1( alertCalled.getAlertTypeCode() ,AlertStageEnums.救援预案警情类型.getValue() + "," + condition1,
AlertStageEnums.责任单位.getValue() + "," + condition2,
AlertStageEnums.重点部位名称.getValue() + "," + condition3);
} else if (alertCalled.getAlertTypeCode().equals(AlertStageEnums.HKJY.getCode())) {
String condition1 = alertCalled.getAlertType();// 航空器救援
String condition2 = "";
for (FormValue i : list) {
if (i.getKey().equals(AlertStageEnums.aircraftRescueSub.getCode())) {
condition2 = condition1 + i.getValue();
}
}
return getIdsList1(alertCalled.getAlertTypeCode(),AlertStageEnums.救援预案警情类型.getValue() + "," + condition1,
AlertStageEnums.航空器救援子类.getValue() + "," + condition2, null);
} else {
String condition1 = alertCalled.getAlertType();
return getIdsList1(alertCalled.getAlertTypeCode(),AlertStageEnums.救援预案警情类型.getValue() + "," + condition1, null, null);
}
}
// private List<Map<String, Object>> getIdsList(String condition1, String condition2, String condition3) {
// List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
// ResponseModel condition1Response = knowledgebaseFeignClient.getAllTegartValue(condition1.split(",")[1]);
// List condition1List = (List) condition1Response.getResult();
// if (condition1List.size() < 1) {
// return null;
// } else {
// for (Object i : condition1List) {
// int priority = 1;
// JSONObject obj = JSONObject.parseObject(JSONObject.toJSONString(i));
// String instanceSeq = obj.getString("instanceSeq");
// ResponseModel<Object> list = knowledgebaseFeignClient.findById(Long.parseLong(instanceSeq));
// Object instanceReslt = list.getResult();
// if (instanceReslt != null) {
// JSONObject instanceResltobj = JSONObject.parseObject(JSONObject.toJSONString(instanceReslt));
// String targetSeq = instanceResltobj.getString("targetSeq");
// ResponseModel<Object> targetSeqResult = knowledgebaseFeignClient
// .queryListByTargetSeq(Long.parseLong(targetSeq));
// Object targetSeqResultObj = targetSeqResult.getResult();
// JSONArray targetSeqResultArray = JSONArray.parseArray(JSONArray.toJSONString(targetSeqResultObj));
// boolean flag2 = false;
// boolean flag3 = false;
// for (Object targetDetail : targetSeqResultArray) {
// JSONObject targetDetailJson = JSONObject.parseObject(JSONObject.toJSONString(targetDetail));
// String sequenceNbr = targetDetailJson.getString("sequenceNbr");
// ResponseModel<Object> detailResponseModel = knowledgebaseFeignClient
// .queryByInstance(Long.parseLong(sequenceNbr));
// Object detailResponseModelObj = detailResponseModel.getResult();
// JSONArray detailResponseModelArray = JSONArray
// .parseArray(JSONArray.toJSONString(detailResponseModelObj));
// JSONObject detailJson = JSONObject
// .parseObject(JSONObject.toJSONString(detailResponseModelArray.get(0)));
// if (!detailJson.containsKey("tagValue")) {
// continue;
// }
// if (condition2 != null && condition2.split(",")[1].equals(detailJson.getString("tagValue"))) {
// flag2 = true;
// }
// if (condition3 != null && condition3.split(",")[1].equals(detailJson.getString("tagValue"))) {
// flag3 = true;
// }
// }
// if (StringUtils.isNotBlank(condition3)) {
// if (flag2 && flag3) {
// priority = 1;
// } else if (flag2) {
// priority = 2;
// } else if (flag3) {
// priority = 3;
// } else {
// priority = 0;
// }
// } else if (StringUtils.isNotBlank(condition2) && condition3 == null) {
// if (flag2) {
// priority = 1;
// } else {
// priority = 2;
// }
// }
//
// Map<String, Object> map = new HashMap<String, Object>();
// ResponseModel<Object> SimpleDetailResponse = knowledgebaseFeignClient.getSimpleDetail(targetSeq);
// if (ObjectUtils.isNotEmpty(SimpleDetailResponse) && priority != 0) {
// map.put("priority", priority);
// map.put("data", SimpleDetailResponse.getResult());
// resultList.add(map);
// }
// }
// }
// }
// return resultList;
// }
private Object getIdsList1(String type ,String condition1, String condition2, String condition3)throws Exception {
List<Object> resultList = new ArrayList<Object>();
ResponseModel<Object> responseForcondition1Name = knowledgebaseFeignClient
.queryListByTagName(condition1.split(",")[0]);
if(200!= responseForcondition1Name.getStatus()) {
return responseForcondition1Name;
}
List listForcondition1Name = (List) responseForcondition1Name.getResult();
if (listForcondition1Name.size() > 0) {
for (Object i : listForcondition1Name) {
int priority = 1;
boolean flag2 = false;
boolean flag3 = false;
JSONObject listForcondition1Nameobj = JSONObject.parseObject(JSONObject.toJSONString(i));
ResponseModel<Object> responseForInstanceId = knowledgebaseFeignClient
.queryByInstance(Long.parseLong(listForcondition1Nameobj.getString("sequenceNbr")));
List responseForInstanceIdList = (List) responseForInstanceId.getResult();
Object responseForInstanceIdDetail = responseForInstanceIdList.get(0);
JSONObject responseForInstanceIdJsonDetail = JSONObject
.parseObject(JSONObject.toJSONString(responseForInstanceIdDetail));
if (!(condition1.split(",")[1]).equals(responseForInstanceIdJsonDetail.getString("tagValue"))) {
continue;
}
String condition2Name = null;
String condition2value = null;
if (condition2 != null) {
String[] condition2Array = condition2.split(",");
if(condition2Array.length>1) {
condition2Name = condition2Array[0];
condition2value = condition2Array[1];
}
}
String condition3Name = null;
String condition3value = null;
if (condition3 != null) {
String[] condition3Array = condition3.split(",");
if(condition3Array.length>1) {
condition3Name = condition3Array[0];
condition3value = condition3Array[1];
}
}
ResponseModel<Object> targetSeqResult = knowledgebaseFeignClient
.queryListByTargetSeq(Long.parseLong(listForcondition1Nameobj.getString("targetSeq")));
Object targetSeqResultObj = targetSeqResult.getResult();
JSONArray targetSeqResultArray = JSONArray.parseArray(JSONArray.toJSONString(targetSeqResultObj));
for (Object m : targetSeqResultArray) {
JSONObject detailJson = JSONObject.parseObject(JSONObject.toJSONString(m));
if (condition2Name != null && condition2Name.equals(detailJson.getString("tagName"))) {
ResponseModel<Object> condition2ResponseForInstanceId = knowledgebaseFeignClient
.queryByInstance(Long.parseLong(detailJson.getString("sequenceNbr")));
List condition2ResponseForInstanceIdList = (List) condition2ResponseForInstanceId.getResult();
Object condition2ResponseForInstanceIdDetail = condition2ResponseForInstanceIdList.get(0);
JSONObject condition2ResponseForInstanceIdJsonDetail = JSONObject
.parseObject(JSONObject.toJSONString(condition2ResponseForInstanceIdDetail));
if (condition2value != null && condition2value
.equals(condition2ResponseForInstanceIdJsonDetail.getString("tagValue"))) {
flag2 = true;
}
}
if (condition3Name != null && condition3Name.equals(detailJson.getString("tagName"))) {
ResponseModel<Object> condition3ResponseForInstanceId = knowledgebaseFeignClient
.queryByInstance(Long.parseLong(detailJson.getString("sequenceNbr")));
List condition3ResponseForInstanceIdList = (List) condition3ResponseForInstanceId.getResult();
Object condition3ResponseForInstanceIdDetail = condition3ResponseForInstanceIdList.get(0);
JSONObject condition3ResponseForInstanceIdJsonDetail = JSONObject
.parseObject(JSONObject.toJSONString(condition3ResponseForInstanceIdDetail));
if (condition3value != null && condition3value
.equals(condition3ResponseForInstanceIdJsonDetail.getString("tagValue"))) {
flag3 = true;
}
}
}
if (type.equals(AlertStageEnums.YBHZ.getCode())) {
if (flag2 && flag3) {
priority = 1;
} else if (flag2) {
priority = 2;
} else if (flag3) {
priority = 3;
} else {
priority = 0;
}
} else if (type.equals(AlertStageEnums.HKJY.getCode())) {
if (flag2) {
priority = 1;
} else {
priority = 2;
}
}
Map<String, Object> map = new HashMap<String, Object>();
ResponseModel<Object> SimpleDetailResponse = knowledgebaseFeignClient
.getSimpleDetail(listForcondition1Nameobj.getString("targetSeq"));
if (ObjectUtils.isNotEmpty(SimpleDetailResponse.getResult()) && priority != 0) {
JSONArray detailJsonArray = JSONArray.parseArray(JSONArray.toJSONString(SimpleDetailResponse.getResult()));
JSONObject detailJsonObject= detailJsonArray.getJSONObject(0);
map.put("recDate",detailJsonObject.getString("REC_DATE"));
map.put("sequenceNbr", detailJsonObject.getString("SEQUENCE_NBR"));
map.put("docTitle", detailJsonObject.getString("DOC_TITLE"));
map.put("priority", priority);
resultList.add(map);
}
}
}
return resultList;
}
} }
package com.yeejoin.amos.knowledgebase.controller; package com.yeejoin.amos.knowledgebase.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import java.util.List;
import com.yeejoin.amos.knowledgebase.face.enumeration.DynamicsFunctional; import java.util.Map;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDocContentModel;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocContent; import javax.servlet.http.HttpServletRequest;
import com.yeejoin.amos.knowledgebase.face.service.DocContentService;
import com.yeejoin.amos.knowledgebase.face.service.DocLibraryService;
import com.yeejoin.amos.knowledgebase.face.service.DynamicsOptionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
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.RestController;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.DateUtil;
import org.typroject.tyboot.core.foundation.utils.StringUtil; import org.typroject.tyboot.core.foundation.utils.StringUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
...@@ -22,10 +22,16 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest; ...@@ -22,10 +22,16 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.Date; import com.yeejoin.amos.knowledgebase.face.enumeration.DynamicsFunctional;
import java.util.List; import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDocContentModel;
import java.util.Map; import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocContent;
import com.yeejoin.amos.knowledgebase.face.service.DocContentService;
import com.yeejoin.amos.knowledgebase.face.service.DocLibraryService;
import com.yeejoin.amos.knowledgebase.face.service.DynamicsOptionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/** /**
* <p> * <p>
...@@ -221,5 +227,12 @@ public class DocContentResource { ...@@ -221,5 +227,12 @@ public class DocContentResource {
@PathVariable(value = "sequenceNbr") Long sequenceNbr) { @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(docContentService.queryLikeOrDis(sequenceNbr)); return ResponseHelper.buildResponse(docContentService.queryLikeOrDis(sequenceNbr));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取简单的预案信息")
@RequestMapping(value = "/getSimpleDetail/{sequenceNbr}", method = RequestMethod.GET)
public ResponseModel<List<Map<String, Object>>> getSimpleDetail(
@PathVariable(value = "sequenceNbr") String sequenceNbr) {
return ResponseHelper.buildResponse(docContentService.getSimpleDetail(sequenceNbr));
}
} }
package com.yeejoin.amos.knowledgebase.controller; package com.yeejoin.amos.knowledgebase.controller;
import com.yeejoin.amos.knowledgebase.face.service.TagInstanceService; import java.util.List;
import io.swagger.annotations.Api;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; 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.RestController; import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.doc.TycloudResource; import org.typroject.tyboot.core.restful.doc.TycloudResource;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagInstanceModel;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagInstance;
import com.yeejoin.amos.knowledgebase.face.service.TagInstanceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/** /**
* <p> * <p>
...@@ -27,4 +41,25 @@ public class TagInstanceResource { ...@@ -27,4 +41,25 @@ public class TagInstanceResource {
private final Logger logger = LogManager.getLogger(TagInstanceResource.class); private final Logger logger = LogManager.getLogger(TagInstanceResource.class);
@Autowired @Autowired
private TagInstanceService tagInstanceService; private TagInstanceService tagInstanceService;
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据主键查询实例标签")
@RequestMapping(value = "find/{id}", method = RequestMethod.GET)
public ResponseModel<KnowledgeTagInstance> findById(@PathVariable("id") Long id) {
return ResponseHelper.buildResponse(tagInstanceService.findById(id));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据targetSeq查询实例标签")
@RequestMapping(value = "targetSeq/{id}", method = RequestMethod.GET)
public ResponseModel<List<KnowledgeTagInstanceModel>> queryListByTargetSeq(@PathVariable("id") Long id) {
return ResponseHelper.buildResponse(tagInstanceService.queryListByTargetSeq(id));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据targetSeq查询实例标签")
@RequestMapping(value = "getTarget/byName", method = RequestMethod.GET)
public ResponseModel<List<KnowledgeTagInstanceModel>> queryListByTagName(@RequestParam String name) {
return ResponseHelper.buildResponse(tagInstanceService.queryListByTagName(name));
}
} }
package com.yeejoin.amos.knowledgebase.controller; package com.yeejoin.amos.knowledgebase.controller;
import com.yeejoin.amos.knowledgebase.face.service.TagValueService;
import io.swagger.annotations.Api;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; 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.RestController; import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.doc.TycloudResource; import org.typroject.tyboot.core.restful.doc.TycloudResource;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.yeejoin.amos.knowledgebase.face.service.TagValueService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/** /**
* <p> * <p>
...@@ -27,5 +36,17 @@ public class TagValueResource { ...@@ -27,5 +36,17 @@ public class TagValueResource {
private final Logger logger = LogManager.getLogger(TagValueResource.class); private final Logger logger = LogManager.getLogger(TagValueResource.class);
@Autowired @Autowired
private TagValueService tagValueService; private TagValueService tagValueService;
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取所有当前系统的值标签的实例值")
@RequestMapping(value = "/getAll/tegartValue", method = RequestMethod.GET)
public ResponseModel<Object> getAllTegartValue(@RequestParam String value) {
return ResponseHelper.buildResponse(tagValueService.getAllTegartValue(value));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取所有当前系统的值标签的实例值")
@RequestMapping(value = "/getOne/", method = RequestMethod.GET)
public ResponseModel<Object> queryByInstance(@RequestParam Long id) {
return ResponseHelper.buildResponse(tagValueService.queryByInstance(id));
}
} }
...@@ -16,6 +16,7 @@ import com.yeejoin.amos.knowledgebase.face.feign.RemoteData; ...@@ -16,6 +16,7 @@ import com.yeejoin.amos.knowledgebase.face.feign.RemoteData;
import com.yeejoin.amos.knowledgebase.face.model.*; import com.yeejoin.amos.knowledgebase.face.model.*;
import com.yeejoin.amos.knowledgebase.face.orm.dao.DocContentMapper; import com.yeejoin.amos.knowledgebase.face.orm.dao.DocContentMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocContent; import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocContent;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagValue;
import com.yeejoin.amos.knowledgebase.face.util.Constants; import com.yeejoin.amos.knowledgebase.face.util.Constants;
import com.yeejoin.amos.knowledgebase.face.util.DocSortUtil; import com.yeejoin.amos.knowledgebase.face.util.DocSortUtil;
import com.yeejoin.amos.knowledgebase.face.util.QuoteCountFlushTiming; import com.yeejoin.amos.knowledgebase.face.util.QuoteCountFlushTiming;
...@@ -657,4 +658,19 @@ public class DocContentService extends BaseService<KnowledgeDocContentModel, Kno ...@@ -657,4 +658,19 @@ public class DocContentService extends BaseService<KnowledgeDocContentModel, Kno
private List<KnowledgeDocContentModel> queryListByCategorySeqList(@Condition(Operator.in) List<Long> directoryId) { private List<KnowledgeDocContentModel> queryListByCategorySeqList(@Condition(Operator.in) List<Long> directoryId) {
return this.queryForList(null, false, directoryId); return this.queryForList(null, false, directoryId);
} }
public List<Map<String, Object>> getSimpleDetail(String sequenceNbrs) {
String[] idStrings= sequenceNbrs.split(",");
List<String> idListString= Arrays.asList(idStrings);
List<Long> idList= new ArrayList<Long>();
idListString.stream().forEach(i->{
idList.add(Long.parseLong(i));
});
QueryWrapper<KnowledgeDocContent> wrapper = new QueryWrapper<KnowledgeDocContent>();
wrapper.eq("DOC_STATUS", "PUBLISHED");
wrapper.in("SEQUENCE_NBR",idList);
wrapper.select("SEQUENCE_NBR","DOC_TITLE","REC_DATE");
return this.baseMapper.selectMaps(wrapper);
}
} }
package com.yeejoin.amos.knowledgebase.face.service; package com.yeejoin.amos.knowledgebase.face.service;
import com.baomidou.mybatisplus.core.toolkit.Sequence; import java.util.ArrayList;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDynamicsValueModel; import java.util.Collection;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagInstanceModel; import java.util.List;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagModel; import java.util.Map;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagValueModel;
import com.yeejoin.amos.knowledgebase.face.orm.dao.TagInstanceMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagInstance;
import com.yeejoin.amos.knowledgebase.face.util.Constants;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -19,7 +15,14 @@ import org.typroject.tyboot.core.rdbms.annotation.Condition; ...@@ -19,7 +15,14 @@ import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator; import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.*; import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDynamicsValueModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagInstanceModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagValueModel;
import com.yeejoin.amos.knowledgebase.face.orm.dao.TagInstanceMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagInstance;
import com.yeejoin.amos.knowledgebase.face.util.Constants;
/** /**
...@@ -152,4 +155,16 @@ public class TagInstanceService extends BaseService<KnowledgeTagInstanceModel, K ...@@ -152,4 +155,16 @@ public class TagInstanceService extends BaseService<KnowledgeTagInstanceModel, K
public List<KnowledgeTagInstanceModel> queryListByTargetSeqs(@Condition(Operator.in) Collection<Long> targetSeq) { public List<KnowledgeTagInstanceModel> queryListByTargetSeqs(@Condition(Operator.in) Collection<Long> targetSeq) {
return this.queryForList(null, false, targetSeq); return this.queryForList(null, false, targetSeq);
} }
public KnowledgeTagInstance findById(Long id) {
return this.baseMapper.selectById(id);
}
public List<KnowledgeTagInstanceModel> queryListByTagName(String tagName) {
// TODO Auto-generated method stub
return this.queryForList(null, false, tagName);
}
} }
package com.yeejoin.amos.knowledgebase.face.service; package com.yeejoin.amos.knowledgebase.face.service;
import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
...@@ -12,10 +13,14 @@ import org.typroject.tyboot.core.foundation.utils.Bean; ...@@ -12,10 +13,14 @@ import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagValueModel; import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagValueModel;
import com.yeejoin.amos.knowledgebase.face.orm.dao.TagValueMapper; import com.yeejoin.amos.knowledgebase.face.orm.dao.TagValueMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagValue; import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagValue;
import net.bytebuddy.asm.Advice.This;
/** /**
* <p> * <p>
...@@ -66,4 +71,13 @@ public class TagValueService extends BaseService<KnowledgeTagValueModel, Knowled ...@@ -66,4 +71,13 @@ public class TagValueService extends BaseService<KnowledgeTagValueModel, Knowled
public List<KnowledgeTagValueModel> queryTagValuesByDocIds(Collection<Long> docSeqList) { public List<KnowledgeTagValueModel> queryTagValuesByDocIds(Collection<Long> docSeqList) {
return Bean.toModels(this.getBaseMapper().queryTagValuesByDocIds(docSeqList), KnowledgeTagValueModel.class); return Bean.toModels(this.getBaseMapper().queryTagValuesByDocIds(docSeqList), KnowledgeTagValueModel.class);
} }
public List<KnowledgeTagValue> getAllTegartValue(String value) {
String[] strings = value.split(",");
QueryWrapper<KnowledgeTagValue> wrapper = new QueryWrapper<KnowledgeTagValue>();
wrapper.eq("AGENCY_CODE", RequestContext.getAgencyCode());
wrapper.in("TAG_VALUE", Arrays.asList(strings));
return this.baseMapper.selectList(wrapper);
}
} }
...@@ -79,6 +79,8 @@ equip.fegin.name=AMOS-EQUIPMANAGE ...@@ -79,6 +79,8 @@ equip.fegin.name=AMOS-EQUIPMANAGE
## 设备联动服务(车库门、广播、警铃) ## 设备联动服务(车库门、广播、警铃)
control.fegin.name=JCS-API-CONTROL control.fegin.name=JCS-API-CONTROL
Knowledgebase.fegin.name=AMOS-API-KNOWLEDGEBASE
## 故障报修流程 ## 故障报修流程
failure.work.flow.processDefinitionKey=malfunction_repair failure.work.flow.processDefinitionKey=malfunction_repair
#设置文件上传的大小限制 #设置文件上传的大小限制
......
...@@ -9,6 +9,9 @@ import org.slf4j.LoggerFactory; ...@@ -9,6 +9,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.boot.WebApplicationType; import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
...@@ -20,6 +23,9 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler; ...@@ -20,6 +23,9 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
*/ */
@EnableScheduling @EnableScheduling
@EnableFeignClients
@EnableDiscoveryClient
@EnableEurekaClient
@EnableAsync @EnableAsync
@MapperScan({"com.yeejoin.amos.knowledgebase.face.orm.dao*", @MapperScan({"com.yeejoin.amos.knowledgebase.face.orm.dao*",
"org.typroject.tyboot.face.*.orm.dao*", "org.typroject.tyboot.face.*.orm.dao*",
......
##开发环境配置文件 ##开发环境配置文件
# jdbc_config # jdbc_config
spring.datasource.url=jdbc:mysql://localhost:3306/safety-knowledge-3.0.0?characterEncoding=utf8&serverTimezone=Asia/Shanghai spring.datasource.url=jdbc:mysql://172.16.6.60:3306/knowledge_base?characterEncoding=utf8&serverTimezone=Asia/Shanghai
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=root_123 spring.datasource.password=root_123
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
......
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