Commit 9e872afd authored by chenzhao's avatar chenzhao

修改bug

parent 3423fc85
......@@ -19,6 +19,7 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledObjsDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.ESAlertCalledDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.ESAlertCalledRequestDto;
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.enums.AlertStatusEnum;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertFormValueServiceImpl;
......@@ -55,7 +56,6 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 警情接警记录
*
......@@ -85,6 +85,10 @@ public class AlertCalledController extends BaseController {
OrgUsrServiceImpl iOrgUsrService;
@Value("${redis.cache.failure.time}")
private long time;
private static String ALETR_TYPE_AID = "1214";
private static String ALETR_TYPE_AID_STATUS = "patientStatus";
/**
* 新增警情接警记录
*
......@@ -94,18 +98,40 @@ public class AlertCalledController extends BaseController {
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增警情接警记录", notes = "新增警情接警记录")
@Transactional
public ResponseModel<AlertCalled> saveAlertCalled(@RequestBody AlertCalledObjsDto alertCalledObjsDto) throws Exception{
public ResponseModel<AlertCalled> saveAlertCalled(@RequestBody AlertCalledObjsDto alertCalledObjsDto) throws Exception {
if (ValidationUtil.isEmpty(alertCalledObjsDto)
|| ValidationUtil.isEmpty(alertCalledObjsDto.getAlertCalled()))
throw new BadRequest("参数校验失败.");
ReginParams reginParams =getSelectedOrgInfo();
ReginParams reginParams = getSelectedOrgInfo();
//获取当前登录人公司
String name= reginParams.getCompany().getCompanyName();
String name = reginParams.getCompany().getCompanyName();
AlertCalled alertCalled = alertCalledObjsDto.getAlertCalled();
alertCalled.setCompanyName(name);
if (alertCalled.getAlertTypeCode().equals(ALETR_TYPE_AID)) {
List<AlertFormValue> alertFormValue = alertCalledObjsDto.getAlertFormValue();
alertFormValue.forEach(e -> {
if (e.getFieldCode().equals(ALETR_TYPE_AID_STATUS)) {
if (e.getFieldValueCode() != null) {
if (e.getFieldValueCode().contains(",")) {
String[] split = e.getFieldValueCode().split(",");
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < split.length; i++) {
DataDictionary hzxz = dataDictionaryService.getByCode(split[i], "HZXZ");
stringBuilder.append(hzxz.getName() + " ");
e.setFieldValue(stringBuilder.toString());
}
} else {
DataDictionary hzxz = dataDictionaryService.getByCode(e.getFieldValueCode(), "HZXZ");
e.setFieldValue(hzxz.getName());
}
}
}
});
alertCalledObjsDto.setAlertFormValue(alertFormValue);
}
alertCalledObjsDto.setAlertCalled(alertCalled);
alertCalledObjsDto =iAlertCalledService.createAlertCalled(alertCalledObjsDto);
alertCalledObjsDto = iAlertCalledService.createAlertCalled(alertCalledObjsDto);
return ResponseHelper.buildResponse(alertCalledObjsDto.getAlertCalled());
}
......@@ -161,7 +187,7 @@ public class AlertCalledController extends BaseController {
String alertTypeCode,
String alertSourceCode,
String callTimeStart,
String callTimeEnd){
String callTimeEnd) {
/* Page<AlertCalled> pageBean;
IPage<AlertCalled> page;
QueryWrapper<AlertCalled> alertCalledQueryWrapper = new QueryWrapper<>();
......@@ -175,7 +201,7 @@ public class AlertCalledController extends BaseController {
page.setCurrent(0L);
page.setSize(Long.MAX_VALUE);
} else {
page.setCurrent( (Long.parseLong(pageNum) - 1) * Long.parseLong(pageSize));
page.setCurrent((Long.parseLong(pageNum) - 1) * Long.parseLong(pageSize));
page.setSize(Long.parseLong(pageSize));
}
/*分页存在问题 修改分页参数 陈召 2021-09-22 结束*/
......@@ -184,10 +210,10 @@ public class AlertCalledController extends BaseController {
/* bug2408 筛选参数解析异常 修改筛选条件方法 修改入参分离筛选条件
alertStatus 警情状态 alertTypeCode 报警类型code alertSourceCode 警情来源code
陈召 2021-08-21 开始*/
IPage<AlertCalled> alertCalledIPage = iAlertCalledService.queryForCalledList(page, alertStatus,alertTypeCode, alertSourceCode, callTimeStart, callTimeEnd,sort);
IPage<AlertCalled> alertCalledIPage = iAlertCalledService.queryForCalledList(page, alertStatus, alertTypeCode, alertSourceCode, callTimeStart, callTimeEnd, sort);
/* bug 2406 接警记录,列表缺少警情状态字段 by litw start*/
alertCalledIPage.getRecords().stream().forEach(e->{
if(e.getAlertStatus()) {
alertCalledIPage.getRecords().stream().forEach(e -> {
if (e.getAlertStatus()) {
e.setAlertStatusStr(AlertStatusEnum.CLOSED.getName());
} else {
e.setAlertStatusStr(AlertStatusEnum.UNCLOSED.getName());
......@@ -200,7 +226,6 @@ public class AlertCalledController extends BaseController {
}
/**
*
* <pre>
* 相似警情分页查询
* </pre>
......@@ -223,8 +248,8 @@ public class AlertCalledController extends BaseController {
List<ESAlertCalledDto> records = esAlertCalledDtoPage.getRecords();
for (ESAlertCalledDto record : records) {
if (record.getResponseLevelCode() != null){
DataDictionary byCode = dataDictionaryService.getByCode(record.getResponseLevelCode(),"XYJBR");
if (record.getResponseLevelCode() != null) {
DataDictionary byCode = dataDictionaryService.getByCode(record.getResponseLevelCode(), "XYJBR");
record.setResponseLevel(byCode.getName());
}
}
......@@ -233,7 +258,6 @@ public class AlertCalledController extends BaseController {
}
/**
*
* <pre>
* 初始化ES
* </pre>
......@@ -257,23 +281,23 @@ public class AlertCalledController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "列表无分页查询", notes = "列表无分页查询")
public ResponseModel<List<AlertCalled>> list(AlertCalled alertCalled) {
QueryWrapper<AlertCalled> alertCalledQueryWrapper = new QueryWrapper<>();
setQueryWrapper(alertCalledQueryWrapper, alertCalled,null);
setQueryWrapper(alertCalledQueryWrapper, alertCalled, null);
List<AlertCalled> list = iAlertCalledService.list(alertCalledQueryWrapper);
return ResponseHelper.buildResponse(list);
}
private QueryWrapper<AlertCalled> setQueryWrapper(QueryWrapper<AlertCalled> queryWrapper, AlertCalled alertCalled,String sort){
private QueryWrapper<AlertCalled> setQueryWrapper(QueryWrapper<AlertCalled> queryWrapper, AlertCalled alertCalled, String sort) {
Class<? extends AlertCalled> aClass = alertCalled.getClass();
queryWrapper.eq("is_delete", 0);
if(sort!=null) {
String[] date= sort.split(",");
if(date[1].equals("ascend")) {
if (sort != null) {
String[] date = sort.split(",");
if (date[1].equals("ascend")) {
queryWrapper.orderByAsc(RedisKey.humpToLine(date[0]));
}else {
} else {
queryWrapper.orderByDesc(RedisKey.humpToLine(date[0]));
}
}else {
} else {
queryWrapper.orderByDesc("call_time");
}
......@@ -283,7 +307,7 @@ public class AlertCalledController extends BaseController {
if (alertCalled.getIsFatherAlert()) { // 0:接警;1:处警
queryWrapper.isNull("father_alert");
}
if (!ValidationUtil.isEmpty(alertCalled.getAlertSourceCodeStr())){
if (!ValidationUtil.isEmpty(alertCalled.getAlertSourceCodeStr())) {
String[] arr = alertCalled.getAlertSourceCodeStr().split(",");
List<String> collect = Arrays.stream(arr).collect(Collectors.toList());
queryWrapper.in("alert_source_code", collect);
......@@ -308,7 +332,7 @@ public class AlertCalledController extends BaseController {
} else if (type.equals(Boolean.class)) {
Boolean fileValue = (Boolean) field.get(alertCalled);
queryWrapper.eq(name, fileValue);
}else if (type.equals(Long.class) || "long".equals(type.toString())) {
} else if (type.equals(Long.class) || "long".equals(type.toString())) {
Long fileValue = (Long) field.get(alertCalled);
queryWrapper.eq(name, fileValue);
}
......@@ -335,7 +359,6 @@ public class AlertCalledController extends BaseController {
}
/**
*
* <pre>
* 设备联动紧急响应
* 启动所有消防队伍的警铃、广播,并自动开启所有车库门
......@@ -349,7 +372,7 @@ public class AlertCalledController extends BaseController {
@ApiOperation(httpMethod = "POST", value = "设备联动紧急响应", notes = "启动所有消防队伍的警铃、广播,并自动开启所有车库门")
@Transactional
@RestEventTrigger(value = "opreateLogEventHandler")
public ResponseModel<Boolean> controlEquip() throws Exception{
public ResponseModel<Boolean> controlEquip() throws Exception {
return ResponseHelper.buildResponse(iAlertCalledService.controlEquip());
}
......@@ -366,7 +389,8 @@ public class AlertCalledController extends BaseController {
@RequestParam String latitude) {
return ResponseHelper.buildResponse(iAlertCalledService.reLocate(alertCalled, longitude, latitude));
}
/*2304 地址 联系人模糊查询缺失 陈召 2021-09-23 开始*/
/*2304 地址 联系人模糊查询缺失 陈召 2021-09-23 开始*/
/**
* 警情填报联系人模糊查询
*
......@@ -376,14 +400,14 @@ public class AlertCalledController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getAmosId", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "警情填报联系人模糊查询", notes = "警情填报联系人模糊查询")
public ResponseModel< Object> getContact ( ) {
public ResponseModel<Object> getContact() {
if (redisUtils.hasKey(RedisKey.CONTACT_USER)) {
Object obj = redisUtils.get(RedisKey.CONTACT_USER);
return ResponseHelper.buildResponse(obj);
} else {
List<Map<String, String>> contactName = iAlertCalledService.getContactName();
redisUtils.set(RedisKey.CONTACT_USER , contactName, time);
redisUtils.set(RedisKey.CONTACT_USER, contactName, time);
return ResponseHelper.buildResponse(contactName);
}
}
......@@ -397,7 +421,7 @@ public class AlertCalledController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getAddress", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "警情填报地址模糊查询", notes = "警情填报地址模糊查询")
public ResponseModel<List<String>> getAddress () {
public ResponseModel<List<String>> getAddress() {
return ResponseHelper.buildResponse(iAlertCalledService.getCalledAddress());
}
......@@ -412,12 +436,12 @@ public class AlertCalledController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getAlarmGiveStatistics", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "app领导统计", notes = "app领导统计")
public ResponseModel<AlarmGiveStatisticsDto> getAlarmGiveStatistics () {
public ResponseModel<AlarmGiveStatisticsDto> getAlarmGiveStatistics() {
AlarmGiveStatisticsDto dto = new AlarmGiveStatisticsDto();
LambdaQueryWrapper<AlertCalled> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.isNull(AlertCalled::getFatherAlert);
queryWrapper.eq(AlertCalled::getAlertStatus,true);
queryWrapper.eq(AlertCalled::getIsDelete,false);
queryWrapper.eq(AlertCalled::getAlertStatus, true);
queryWrapper.eq(AlertCalled::getIsDelete, false);
Integer alertNum = iAlertCalledService.getBaseMapper().selectCount(queryWrapper);
dto.setAlarmNum(alertNum);
......@@ -433,13 +457,13 @@ public class AlertCalledController extends BaseController {
map = monitorEvent.getResult();
int monitorEventNum = !ValidationUtil.isEmpty(map.get("monitorEventNum")) ? Integer.valueOf(map.get("monitorEventNum").toString()) : 0;
dto.setIotDetection(fireAlarmNum+faultAlarmNum+monitorEventNum);
dto.setIotDetection(fireAlarmNum + faultAlarmNum + monitorEventNum);
ResponseModel<Object> currentHiddenDanger = latentDangerFeignClient.getUnFinishedDangerCount();
Integer currentHiddenDangerNum = (Integer) currentHiddenDanger.getResult();
dto.setCurrentHiddenDanger(currentHiddenDangerNum);
dto.setAllNum(dto.getAlarmNum()+dto.getIotDetection()+currentHiddenDangerNum);
dto.setAllNum(dto.getAlarmNum() + dto.getIotDetection() + currentHiddenDangerNum);
return ResponseHelper.buildResponse(dto);
}
......
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