Commit be235edf authored by tianbo's avatar tianbo

修改水源、联动单位、警情地址bug

parent 94fc52cf
package com.yeejoin.amos.boot.biz.common.constants;
/**
* @Description: 业务通用常量类
* @Author: DELL
* @Date: 2021/5/26
*/
public interface BizConstant {
/**
* 经度
*/
public final static String LONGITUDE = "longitude";
/**
* 纬度
*/
public final static String LATITUDE = "latitude";
/**
* 地址
*/
public final static String ADDRESS = "address";
}
...@@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
@FeignClient(name = "AMOS-API-WORKFLOW", path = "workflow", configuration = { CommonMultipartSupportConfig.class }) @FeignClient(name = "AMOS-API-WORKFLOW-CJHENHAO", path = "workflow", configuration = { CommonMultipartSupportConfig.class })
public interface WorkflowFeignService { public interface WorkflowFeignService {
/** /**
* 发起流程 * 发起流程
...@@ -74,7 +74,7 @@ public interface WorkflowFeignService { ...@@ -74,7 +74,7 @@ public interface WorkflowFeignService {
* @param processInstanceId * @param processInstanceId
* @return * @return
*/ */
@RequestMapping(value = "/activitiHistory/tasks/{processInstanceId}", method = RequestMethod.GET) @RequestMapping(value = "/activitiHistory/historyTask/{processInstanceId}", method = RequestMethod.GET)
JSONObject queryTasksByProcessInstanceId(@PathVariable("processInstanceId") String processInstanceId); JSONObject queryHistoryTasksByProcessInstanceId(@PathVariable("processInstanceId") String processInstanceId);
} }
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray; ...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.constants.BizConstant;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.EnumsUtils; import com.yeejoin.amos.boot.biz.common.utils.EnumsUtils;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceCraneDto; import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceCraneDto;
...@@ -91,19 +92,11 @@ public class WaterResourceController extends BaseController { ...@@ -91,19 +92,11 @@ public class WaterResourceController extends BaseController {
model.setRealityImg(JSONArray.toJSONString(model.getRealityImgList())); model.setRealityImg(JSONArray.toJSONString(model.getRealityImgList()));
model.setOrientationImg(JSONArray.toJSONString(model.getOrientationImgList())); model.setOrientationImg(JSONArray.toJSONString(model.getOrientationImgList()));
if(model.getAddress()!=null){ if(model.getAddress()!=null){
String[] data= model.getAddress().split("@address@"); JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(model.getAddress());
model.setAddress(data[0]); model.setAddress(address.getString(BizConstant.ADDRESS));
if(data[1]!=null&&!"".equals(data[1])){ model.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
JSONObject jSONObject = JSON.parseObject(data[1]); model.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE)));
if(jSONObject.getString("longitude")!=null&&!"".equals(jSONObject.getString("longitude"))) {
model.setLongitude(Double.valueOf(jSONObject.getString("longitude")));
}
if(jSONObject.getString("longitude")!=null&&!"".equals(jSONObject.getString("longitude"))) {
model.setLatitude(Double.valueOf(jSONObject.getString("latitude")));
}
}
} }
if (!StringUtils.isEmpty(resourceType)) { if (!StringUtils.isEmpty(resourceType)) {
...@@ -174,21 +167,13 @@ public class WaterResourceController extends BaseController { ...@@ -174,21 +167,13 @@ public class WaterResourceController extends BaseController {
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新") @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<WaterResourceDto> updateBySequenceNbrWaterResource(@RequestBody WaterResourceDto model, public ResponseModel<WaterResourceDto> updateBySequenceNbrWaterResource(@RequestBody WaterResourceDto model,
@PathVariable(value = "sequenceNbr") Long sequenceNbr) { @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
if (StringUtils.isNotEmpty(model.getAddress())) {
JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(model.getAddress());
if(model.getAddress()!=null){ model.setAddress(address.getString(BizConstant.ADDRESS));
String[] data= model.getAddress().split("@address@"); model.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
model.setAddress(data[0]); model.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE)));
if(data[1]!=null&&!"".equals(data[1])){
JSONObject jSONObject = JSON.parseObject(data[1]);
if(jSONObject.getString("longitude")!=null&&!"".equals(jSONObject.getString("longitude"))) {
model.setLongitude(Double.valueOf(jSONObject.getString("longitude")));
}
if(jSONObject.getString("longitude")!=null&&!"".equals(jSONObject.getString("longitude"))) {
model.setLatitude(Double.valueOf(jSONObject.getString("latitude")));
}
}
} }
// 更新基本信息 // 更新基本信息
model.setSequenceNbr(sequenceNbr); model.setSequenceNbr(sequenceNbr);
model.setRealityImg(JSONArray.toJSONString(model.getRealityImgList())); model.setRealityImg(JSONArray.toJSONString(model.getRealityImgList()));
......
...@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.constants.BizConstant;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary; import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl; import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
...@@ -26,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -26,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
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.rdbms.annotation.Condition; 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;
...@@ -124,17 +126,10 @@ public class LinkageUnitServiceImpl extends BaseService<LinkageUnitDto, LinkageU ...@@ -124,17 +126,10 @@ public class LinkageUnitServiceImpl extends BaseService<LinkageUnitDto, LinkageU
public LinkageUnitDto saveModel(LinkageUnitDto linkageUnitDto) { public LinkageUnitDto saveModel(LinkageUnitDto linkageUnitDto) {
if (linkageUnitDto.getAddress() != null) { if (linkageUnitDto.getAddress() != null) {
String[] data = linkageUnitDto.getAddress().split("@address@"); JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(linkageUnitDto.getAddress());
linkageUnitDto.setAddress(data[0]); linkageUnitDto.setAddress(address.getString(BizConstant.ADDRESS));
if (data[1] != null && !"".equals(data[1])) { linkageUnitDto.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
JSONObject jSONObject = JSON.parseObject(data[1]); linkageUnitDto.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE)));
if (jSONObject.getString("longitude") != null && !"".equals(jSONObject.getString("longitude"))) {
linkageUnitDto.setLongitude(Double.valueOf(jSONObject.getString("longitude")));
}
if (jSONObject.getString("longitude") != null && !"".equals(jSONObject.getString("longitude"))) {
linkageUnitDto.setLatitude(Double.valueOf(jSONObject.getString("latitude")));
}
}
} }
// 1.保存行数据 // 1.保存行数据
String groupCode = this.getGroupCode(); String groupCode = this.getGroupCode();
...@@ -178,8 +173,10 @@ public class LinkageUnitServiceImpl extends BaseService<LinkageUnitDto, LinkageU ...@@ -178,8 +173,10 @@ public class LinkageUnitServiceImpl extends BaseService<LinkageUnitDto, LinkageU
.list(new LambdaQueryWrapper<DynamicFormColumn>().eq(DynamicFormColumn::getGroupCode, groupCode)); .list(new LambdaQueryWrapper<DynamicFormColumn>().eq(DynamicFormColumn::getGroupCode, groupCode));
Map<String, Object> fieldCodes = Bean.listToMap(columns, "fieldCode", "queryStrategy", DynamicFormColumn.class); Map<String, Object> fieldCodes = Bean.listToMap(columns, "fieldCode", "queryStrategy", DynamicFormColumn.class);
LinkageUnitDto linkageUnitDto = linkageUnitMapper.selectOne(false, fieldCodes, groupCode, sequenceNbr); LinkageUnitDto linkageUnitDto = linkageUnitMapper.selectOne(false, fieldCodes, groupCode, sequenceNbr);
if (!ValidationUtil.isEmpty(linkageUnitDto)) {
List<SourceFile> sourceFiles = sourceFileServiceImpl.findBySourceId(linkageUnitDto.getSequenceNbr()); List<SourceFile> sourceFiles = sourceFileServiceImpl.findBySourceId(linkageUnitDto.getSequenceNbr());
linkageUnitDto.setImage(sourceFiles); linkageUnitDto.setImage(sourceFiles);
}
return linkageUnitDto; return linkageUnitDto;
} }
...@@ -204,17 +201,10 @@ public class LinkageUnitServiceImpl extends BaseService<LinkageUnitDto, LinkageU ...@@ -204,17 +201,10 @@ public class LinkageUnitServiceImpl extends BaseService<LinkageUnitDto, LinkageU
public LinkageUnitDto updateById(LinkageUnitDto linkageUnitDto) { public LinkageUnitDto updateById(LinkageUnitDto linkageUnitDto) {
if (linkageUnitDto.getAddress() != null) { if (linkageUnitDto.getAddress() != null) {
String[] data = linkageUnitDto.getAddress().split("@address@"); JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(linkageUnitDto.getAddress());
linkageUnitDto.setAddress(data[0]); linkageUnitDto.setAddress(address.getString(BizConstant.ADDRESS));
if (data[1] != null && !"".equals(data[1])) { linkageUnitDto.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
JSONObject jSONObject = JSON.parseObject(data[1]); linkageUnitDto.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE)));
if (jSONObject.getString("longitude") != null && !"".equals(jSONObject.getString("longitude"))) {
linkageUnitDto.setLongitude(Double.valueOf(jSONObject.getString("longitude")));
}
if (jSONObject.getString("longitude") != null && !"".equals(jSONObject.getString("longitude"))) {
linkageUnitDto.setLatitude(Double.valueOf(jSONObject.getString("latitude")));
}
}
} }
// 修改基本信息 // 修改基本信息
updateWithModel(linkageUnitDto); updateWithModel(linkageUnitDto);
......
...@@ -6,7 +6,10 @@ import java.util.Optional; ...@@ -6,7 +6,10 @@ import java.util.Optional;
import javax.annotation.Resource; import javax.annotation.Resource;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.constants.BizConstant;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom; import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import com.yeejoin.amos.boot.module.common.api.dto.*; import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.*; import com.yeejoin.amos.boot.module.common.api.entity.*;
...@@ -235,4 +238,31 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -235,4 +238,31 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
public List<WaterResourceTypeDto> getWaterResourceTypeList(Boolean isDelete) { public List<WaterResourceTypeDto> getWaterResourceTypeList(Boolean isDelete) {
return waterResourceMapper.getWaterResourceTypeList(isDelete); return waterResourceMapper.getWaterResourceTypeList(isDelete);
} }
public static JSONObject getLongLatFromAddress(String address) {
JSONObject result = new JSONObject();
result.put(BizConstant.ADDRESS, "");
result.put(BizConstant.LONGITUDE, "0");
result.put(BizConstant.LATITUDE, "0");
if (StringUtils.isNotEmpty(address)) {
String[] addressData = address.split("@address@");
if (addressData.length > 1) {
result.put(BizConstant.ADDRESS, addressData[0]);
JSONObject langLatObj = JSON.parseObject(addressData[1]);
if (StringUtils.isNotEmpty(langLatObj.getString(BizConstant.LONGITUDE))) {
result.put(BizConstant.LONGITUDE, langLatObj.getString(BizConstant.LONGITUDE));
} else {
result.put(BizConstant.LONGITUDE, "0");
}
if (StringUtils.isNotEmpty(langLatObj.getString(BizConstant.LATITUDE))) {
result.put(BizConstant.LATITUDE, langLatObj.getString(BizConstant.LATITUDE));
} else {
result.put(BizConstant.LATITUDE, "0");
}
} else {
result.put(BizConstant.ADDRESS, addressData[0]);
}
}
return result;
}
} }
...@@ -8,12 +8,20 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -8,12 +8,20 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.constants.BizConstant;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.FormValue; import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
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.jcs.api.dto.*; 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.KeyValueLabel;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerData;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled; 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.AlertFormValue;
import com.yeejoin.amos.boot.module.jcs.api.entity.Template; import com.yeejoin.amos.boot.module.jcs.api.entity.Template;
...@@ -32,63 +40,66 @@ import org.springframework.stereotype.Service; ...@@ -32,63 +40,66 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.emq.EmqKeeper; 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.StringUtil;
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.ResponseHelper;
import javax.annotation.Resource; import java.util.ArrayList;
import java.util.*; import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* 警情接警记录 服务实现类 * 警情接警记录 服务实现类
* *
* @author tb * @author tb
* @date 2021-06-17 * @date 2021-06-17
*/ */
@Service @Service
public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCalled,AlertCalledMapper> implements IAlertCalledService { public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCalled, AlertCalledMapper> implements IAlertCalledService {
@Autowired @Autowired
RedisUtils redisUtils; RedisUtils redisUtils;
@Autowired @Autowired
AlertCalledMapper alertCalledMapper; AlertCalledMapper alertCalledMapper;
@Autowired
RuleAlertCalledService ruleAlertCalledService;
@Autowired
TemplateMapper templateMapper;
@Autowired
PowerTransferMapper powerTransferMapper;
@Autowired
AlertSubmittedMapper alertSubmittedMapper;
@Autowired @Autowired
private AlertFormValueServiceImpl iAlertFormValueService; private AlertFormValueServiceImpl iAlertFormValueService;
@Autowired @Autowired
private ESAlertCalledService eSAlertCalledService; private ESAlertCalledService eSAlertCalledService;
@Autowired
RuleAlertCalledService ruleAlertCalledService;
@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;
@Autowired private static int comparingByGroupVal(Map<String, Object> map, Map<String, Object> map2, String key) {
TemplateMapper templateMapper; int result = 0;
@Autowired if (map.get(key) instanceof Date) {
PowerTransferMapper powerTransferMapper; long r1 = ((Date) map.get(key)).getTime();
@Autowired long r2 = ((Date) map2.get(key)).getTime();
AlertSubmittedMapper alertSubmittedMapper; result = Long.compare(r1, r2);
}
return result;
}
/** /**
*
* 指挥系统 未结束的警情列表 * 指挥系统 未结束的警情列表
* **/
* **/
@Override @Override
public List<AlertCalledZhDto> alertCalledListByAlertStatus( Integer pageNum, Integer pageSize,RequestData par) { public List<AlertCalledZhDto> alertCalledListByAlertStatus(Integer pageNum, Integer pageSize, RequestData par) {
List<AlertCalledZhDto> list = alertCalledMapper.alertCalledListByAlertStatus( pageNum, pageSize,par); List<AlertCalledZhDto> list = alertCalledMapper.alertCalledListByAlertStatus(pageNum, pageSize, par);
return list; return list;
} }
...@@ -99,16 +110,14 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall ...@@ -99,16 +110,14 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
} }
/** /**
*
* 根据灾情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<>();
...@@ -116,21 +125,20 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall ...@@ -116,21 +125,20 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
// 警情动态表单数据 // 警情动态表单数据
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(), "text", alertFormValue.getFieldValue(),alertFormValue.getBlock()); FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), "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;
} }
} }
/** /**
*
* <pre> * <pre>
* 保存警情信息 * 保存警情信息
* </pre> * </pre>
...@@ -142,30 +150,18 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall ...@@ -142,30 +150,18 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
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());
String[] data= alertCalled.getAddress().split("@address@"); alertCalled.setAddress(address.getString(BizConstant.ADDRESS));
alertCalled.setAddress(data[0]); alertCalled.setCoordinateX(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
if(data[1]!=null&&!"".equals(data[1])){ alertCalled.setCoordinateY(Double.valueOf(address.getString(BizConstant.LATITUDE)));
JSONObject jSONObject = JSON.parseObject(data[1]);
if(jSONObject.getString("longitude")!=null&&!"".equals(jSONObject.getString("longitude"))) {
alertCalled.setCoordinateX(Double.valueOf(jSONObject.getString("longitude")));
}
if(jSONObject.getString("longitude")!=null&&!"".equals(jSONObject.getString("longitude"))) {
alertCalled.setCoordinateY(Double.valueOf(jSONObject.getString("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");
} }
...@@ -227,11 +223,9 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall ...@@ -227,11 +223,9 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
} }
} }
/** /**
* 根据id 修改警情 * 根据id 修改警情
* type:警情相关 操作类型 0警情续报 1非警情确认 2 警情结案 * type:警情相关 操作类型 0警情续报 1非警情确认 2 警情结案
*
*/ */
@Override @Override
@Transactional(rollbackFor = RuntimeException.class) @Transactional(rollbackFor = RuntimeException.class)
...@@ -271,16 +265,6 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall ...@@ -271,16 +265,6 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
} }
} }
private static int comparingByGroupVal(Map<String, Object> map, Map<String, Object> map2, String key) {
int result = 0;
if (map.get(key) instanceof Date) {
long r1 = ((Date) map.get(key)).getTime();
long r2 = ((Date) map2.get(key)).getTime();
result = Long.compare(r1, r2);
}
return result;
}
/** /**
* 根据时间区间查询警情列表信息 * 根据时间区间查询警情列表信息
* *
...@@ -365,65 +349,67 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall ...@@ -365,65 +349,67 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
} }
return StringUtils.replaceEach(tempContent, keys, strList.toArray(new String[strList.size()])); return StringUtils.replaceEach(tempContent, keys, strList.toArray(new String[strList.size()]));
} }
@Override @Override
public Map<String,Object> selectAlertCalledKeyValueLabelById(Long id) { public Map<String, Object> selectAlertCalledKeyValueLabelById(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 -> {
listdate.add(new KeyValueLabel(AlertFormValue.getFieldName(),AlertFormValue.getFieldCode(), AlertFormValue.getFieldValue())); listdate.add(new KeyValueLabel(AlertFormValue.getFieldName(), AlertFormValue.getFieldCode(), AlertFormValue.getFieldValue()));
}); });
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;
} }
......
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