Commit fe5366ab authored by H2T's avatar H2T

bug修改

parent 4356443c
......@@ -70,6 +70,9 @@ public class AlertCalledDto extends BaseDto {
@ApiModelProperty(value = "父警情id")
private Long fatherAlert;
@ApiModelProperty(value = "警情归并返回父警情基本信息时的自身id")
private Long selfAlert;
@ApiModelProperty(value = "设备识别码")
private String deviceId;
......
......@@ -20,4 +20,8 @@ public class ESAlertCalledRequestDto extends AlertCalledObjsDto
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "警情状态")
private String[] alertStatus;
@ApiModelProperty(value = "当前页码")
private int current;
@ApiModelProperty(value = "分页数量")
private int size;
}
......@@ -7,7 +7,7 @@ public class ElevatorMessageDto {
private String sequenceNbr;
private String address;
private Integer rescueCode;
private String rescueCode;
private String registerCode;
private String useUnit;
private String useStatus;
......
......@@ -56,7 +56,9 @@ public interface ElevatorMapper extends BaseMapper<Elevator> {
Map<String, Object> selectMaintenanceInspectionFiles(@Param("record") String record);
Map<String,Object> selectElevatorList(@Param("elevator") Elevator elevator);
Map<String,Object> selectElevator(@Param("elevator") Elevator elevator);
List<Map<String,Object>> selectElevatorList(@Param("elevator") Elevator elevator);
List<Map<String, Object>> selectElevatorEsList(int pageNum, int pageSize);
......
......@@ -34,7 +34,9 @@ public interface IElevatorService extends IService<Elevator> {
List<ElevatorDto> selectExportData(String exportId);
Map<String,Object> selectElevatorList(Elevator elevator);
List<Map<String,Object>> selectElevatorList(Elevator elevator);
Map<String,Object> selectElevator(Elevator elevator);
Page<Map<String, Object>> selectElevators(Page<Map<String, Object>>page, ElevatorDto dto);
......
......@@ -339,7 +339,42 @@
</select>
<select id="selectElevatorList" resultType="java.util.Map">
<select id="selectElevator" resultType="java.util.Map">
SELECT
jui.RECORD AS sequenceNbr,
ifnull ( joi.CODE96333, null ) AS rescueCode,
ifnull ( joi.SUPERVISORY_CODE, null ) AS registerCode,
ifnull ( jui.USE_UNIT_NAME, null ) AS useUnit,
ifnull ( jui.EQU_STATE,'')AS useStatus,
ifnull ( ( SELECT NAME FROM cb_data_dictionary WHERE code = jui.USE_PLACE and type = 'ADDRESS' ), null ) AS useSiteCategory,
ifnull ( jui.ADDRESS, null ) AS address,
ifnull ( jui.PROVINCE_NAME, null ) AS province,
ifnull ( jui.CITY_NAME, null ) AS city,
ifnull ( jui.COUNTY_NAME, null ) AS district,
ifnull ( jui."LONGITUDE_LATITUDE"::json->> 'latitude', null ) AS latitude,
ifnull ( jui."LONGITUDE_LATITUDE"::json->> 'longitude', null ) AS longitude,
ifnull(jui.FACTORY_USE_SITE_STREET, '') AS street,
concat(jui.PROVINCE, '#',jui.CITY, '#',jui.COUNTY) AS regionCode,
jsi.ORG_BRANCH_CODE as orgCode
FROM
idx_biz_jg_use_info jui
LEFT JOIN idx_biz_jg_other_info joi ON jui.RECORD = joi.RECORD
LEFT JOIN idx_biz_jg_register_info jri ON jri.RECORD = jui.RECORD
LEFT JOIN idx_biz_jg_supervision_info jsi ON jsi.RECORD = jui.RECORD
WHERE
jri.EQU_LIST = '3000'
<if test="elevator.rescueCode!=null and elevator.rescueCode!='' ">
AND joi.CODE96333 = #{elevator.rescueCode}
</if>
<if test="elevator.registerCode!=null and elevator.registerCode!='' ">
AND joi.SUPERVISORY_CODE = #{elevator.registerCode}
</if>
<if test="elevator.originalId!=null and elevator.originalId!='' ">
AND jui.RECORD = #{elevator.originalId}
</if>
</select>
<select id="selectElevatorList" resultType="java.util.LinkedHashMap">
SELECT
jui.RECORD AS sequenceNbr,
ifnull ( joi.CODE96333, null ) AS rescueCode,
......
......@@ -139,7 +139,7 @@ public class AlertCalledController extends BaseController {
//queryWrapper.eq(Elevator::getRescueCode,alertCalledObjsDto.getAlertCalledDto().getDeviceId());
Elevator elevator = new Elevator();
elevator.setRescueCode(Integer.valueOf(alertCalledObjsDto.getAlertCalledDto().getDeviceId()));
Map<String,Object> map = iElevatorService.selectElevatorList(elevator);
Map<String,Object> map = iElevatorService.selectElevator(elevator);
if(ObjectUtils.isEmpty(map)) {
throw new BadRequest("未找到相关电梯.");
}
......@@ -279,7 +279,7 @@ public class AlertCalledController extends BaseController {
Elevator elevator = new Elevator();
elevator.setOriginalId(alertCalled.getEquipmentId());
Map<String,Object> map = iElevatorService.selectElevatorList(elevator);
Map<String,Object> map = iElevatorService.selectElevator(elevator);
alertPaperInfoDto.setArea(map.get("province") + "" + map.get("city") + map.get("district"));
alertPaperInfoDto.setAddress(alertCalled.getAddress());
......
......@@ -257,7 +257,7 @@ public class ElevatorController extends BaseController {
// }
// });
// List<Elevator> elevators = iElevatorService.list(elevatorQueryWrapper);
Map<String,Object> map = iElevatorService.selectElevatorList(elevator);
List<Map<String,Object>> maps = iElevatorService.selectElevatorList(elevator);
// List<ElevatorDto> elevatorDtoList = new ArrayList<>();
// for (Elevator ele : elevators ) {
// ElevatorDto eleDto = new ElevatorDto();
......@@ -273,10 +273,13 @@ public class ElevatorController extends BaseController {
// elevatorDtoList.add(eleDto);
// }
List<LinkedHashMap<String, Object>> streetList = null;
List<LinkedHashMap<String, Object>> streetList;
if (redisUtil.hasKey(STREET)) {
streetList = (List<LinkedHashMap<String, Object>>) redisUtil.get(STREET);
} else {
streetList = null;
}
maps.forEach(map->{
if (!ObjectUtils.isEmpty(map.get("street")) && !ObjectUtils.isEmpty(streetList)) {
List<LinkedHashMap<String, Object>> collect = streetList.stream().filter(item -> item.get("regionCode").toString().equals(map.get("street").toString())).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(collect)) {
......@@ -284,10 +287,8 @@ public class ElevatorController extends BaseController {
}
}
List<Map<String,Object>> list = new ArrayList<>();
list.add(map);
return ResponseHelper.buildResponse(list);
});
return ResponseHelper.buildResponse(maps);
}
/**
......
......@@ -16,19 +16,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlarmStatisticsDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertCalledDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertCalledObjsDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertCalledRecordDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertHandlerDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertHandlerInfoDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertPaperInfoDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.FormValue;
import com.yeejoin.amos.boot.module.elevator.api.dto.TzsCitInfoDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.WechatMyBusinessListDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.WechatMyBussinessDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.*;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.elevator.api.entity.DispatchPaper;
......@@ -67,14 +55,7 @@ import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -157,22 +138,21 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
@Override
public Object selectAlertCalledById(Long id) {
AlertCalled alertCalled = this.getBaseMapper().selectById(id);
if (!ObjectUtils.isEmpty(alertCalled.getFatherAlert())){
id = alertCalled.getFatherAlert();
}
if(redisUtils.hasKey(RedisKey.TZS_ALERTCALLED_ID+id)){
Object obj= redisUtils.get(RedisKey.TZS_ALERTCALLED_ID+id);
return obj;
}else{
AlertCalledFormDto alertCalledFormVo = getAlertCalledFormDto(id);
if (!ObjectUtils.isEmpty(alertCalled.getFatherAlert())){
alertCalledFormVo.getAlertCalledDto().setType(alertCalled.getType());
// AlertCalled alertCalled = this.getBaseMapper().selectById(id);
// if (!ObjectUtils.isEmpty(alertCalled.getFatherAlert())) {
// id = alertCalled.getFatherAlert();
// }
if (redisUtils.hasKey(RedisKey.TZS_ALERTCALLED_ID + id)) {
return redisUtils.get(RedisKey.TZS_ALERTCALLED_ID + id);
}
redisUtils.set(RedisKey.TZS_ALERTCALLED_ID+id, JSON.toJSON(alertCalledFormVo),time);
AlertCalledFormDto alertCalledFormVo = getAlertCalledFormDto(id);
// //归并警情--报警类型显示自身的
// if (alertCalled.getFatherAlert() != null) {
// alertCalledFormVo.getAlertCalledDto().setType(alertCalled.getType());
// }
redisUtils.set(RedisKey.TZS_ALERTCALLED_ID + id, JSON.toJSON(alertCalledFormVo), time);
return alertCalledFormVo;
}
}
public AlertCalledFormDto getAlertCalledFormDto(Long id) {
// 警情基本信息
......@@ -193,7 +173,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
Elevator elevator = new Elevator();
elevator.setRescueCode(Integer.valueOf(alertCalled.getDeviceId()));
elevator.setRegisterCode(alertCalled.getRegistrationCode());
Map<String,Object> map = iElevatorService.selectElevatorList(elevator);
Map<String,Object> map = iElevatorService.selectElevator(elevator);
if(!ObjectUtils.isEmpty(map)){
alertCalledDto.setAddress(String.valueOf(map.get("address")));
alertCalledDto.setProvince(String.valueOf(map.get("province")));
......@@ -567,8 +547,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
if (alertCalled.getFatherAlert() != null) {
// 警情归并,设置当前警情状态为结束。
alertCalled.setAlertStatus(true);
alertCalled.setAlertStage(AlertStageEnums.JJ.getValue());
alertCalled.setAlertStageCode(AlertStageEnums.JJ.getId());
alertCalled.setAlertStage(DispatchPaperEnums.receivedAlert.getValue());
alertCalled.setAlertStageCode(DispatchPaperEnums.receivedAlert.getId());
alertCalled.setType(AlertStageEnums.JQGB.getValue());
alertCalled.setTypeCode(AlertStageEnums.JQGB.getId());
this.save(alertCalled);
......@@ -581,10 +561,12 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
});
// 保存动态表单数据
iAlertFormValueService.saveBatch(alertFormValuelist);
// 警情基本信息
AlertCalled alertCalledFather = this.getById(alertCalled.getFatherAlert());
alertCalledObjsDto.setAlertCalledDto(BeanDtoVoUtils.convert(alertCalledFather,AlertCalledDto.class));
// 返回父警情基本信息和自身alertID
AlertCalled alertCalledFather = this.getById(alertCalled.getFatherAlert());
AlertCalledDto alertCalledDto = BeanDtoVoUtils.convert(alertCalledFather, AlertCalledDto.class);
alertCalledDto.setSelfAlert(alertCalled.getSequenceNbr());
alertCalledObjsDto.setAlertCalledDto(alertCalledDto);
} else {
// 警情报送
// ****************************************************待确认开发
......@@ -596,7 +578,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
alertCalled.setTypeCode(AlertStageEnums.JQCB.getId());
Elevator elevator = new Elevator();
elevator.setRescueCode(Integer.valueOf(alertCalledObjsDto.getAlertCalledDto().getDeviceId()));
Map<String,Object> map = iElevatorService.selectElevatorList(elevator);
Map<String,Object> map = iElevatorService.selectElevator(elevator);
if(!ObjectUtils.isEmpty(map)){
alertCalled.setEquipmentId(map.get("sequenceNbr").toString());
alertCalled.setCity(map.get("city").toString());
......@@ -626,12 +608,9 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
alertCalledObjsDto.setAlertFormValue(alertFormValuelist);
//保存处置记录-接警
repairConsultServiceImpl.saveRepairConsultByAlertIdType(alertCalled.getSequenceNbr(),AlertStageEnums.JJ.getCode(),null, user); //保存接警日志
}
/**
* 同步保存ES
*/
//同步保存ES
eSAlertCalledService.saveAlertCalledToES(alertCalled);
}
return alertCalledObjsDto;
} catch (Exception e) {
......
......@@ -14,6 +14,8 @@ import com.yeejoin.amos.boot.module.elevator.biz.utils.BeanDtoVoUtils;
import lombok.extern.slf4j.Slf4j;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.sort.SortBuilders;
import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.PageRequest;
......@@ -132,10 +134,9 @@ public class ESAlertCalledService {
* @param alertCalledVo 关键字
* @return
*/
@SuppressWarnings({ "rawtypes" })
public Page<ESAlertCalledDto> queryByKeys(ESAlertCalledRequestDto alertCalledVo)
{
Page<ESAlertCalledDto> result = new Page<ESAlertCalledDto>();
@SuppressWarnings({"rawtypes"})
public Page<ESAlertCalledDto> queryByKeys(ESAlertCalledRequestDto alertCalledVo) {
Page<ESAlertCalledDto> result = new Page<>(alertCalledVo.getCurrent(), alertCalledVo.getSize());
String[] alertStatus = alertCalledVo.getAlertStatus();
if (ValidationUtil.isEmpty(alertStatus))
{
......@@ -232,9 +233,9 @@ public class ESAlertCalledService {
// 创建查询构造器
NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder()
// 分页
// .withPageable(PageRequest.of(current, size))
.withPageable(PageRequest.of(alertCalledVo.getCurrent(), alertCalledVo.getSize()))
// 排序
// .withSort(SortBuilders.fieldSort("callTimeLong").order(SortOrder.DESC))
.withSort(SortBuilders.fieldSort("callTimeLong").order(SortOrder.DESC))
//过滤条件
.withQuery(boolMust);
......@@ -258,6 +259,7 @@ public class ESAlertCalledService {
}
result.setRecords(list);
result.setTotal(totle);
result.setCurrent(alertCalledVo.getCurrent());
return result;
}
......
......@@ -245,7 +245,7 @@ public class ElevatorServiceImpl extends BaseService<ElevatorDto, Elevator, Elev
// 目前只有电梯类型
Elevator elevator = new Elevator();
elevator.setOriginalId(deviceId);
Map<String,Object> map = iElevatorService.selectElevatorList(elevator);
Map<String,Object> map = iElevatorService.selectElevator(elevator);
// LambdaQueryWrapper<Elevator> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(Elevator::getSequenceNbr, deviceId);
// Elevator elevator = this.getOne(queryWrapper);
......@@ -302,10 +302,15 @@ public class ElevatorServiceImpl extends BaseService<ElevatorDto, Elevator, Elev
@Override
public Map<String,Object> selectElevatorList(Elevator elevator) {
public List<Map<String,Object>> selectElevatorList(Elevator elevator) {
return elevatorMapper.selectElevatorList(elevator);
}
@Override
public Map<String,Object> selectElevator(Elevator elevator) {
return elevatorMapper.selectElevator(elevator);
}
@Override
public List<Map<String, Object>> selectElevatorEsList(int pageNum,int pageSize) {
......
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