Commit 864af93b authored by chenzhao's avatar chenzhao

修改bug

parent 89f6c3b6
...@@ -166,4 +166,12 @@ public class AlertCalled extends BaseEntity { ...@@ -166,4 +166,12 @@ public class AlertCalled extends BaseEntity {
@TableField(exist=false) @TableField(exist=false)
@ApiModelProperty(value = "落地时间") @ApiModelProperty(value = "落地时间")
private String landingTime; private String landingTime;
@TableField(exist=false)
@ApiModelProperty(value = "任务时间")
private String taskTime;
@TableField(exist=false)
@ApiModelProperty(value = "任务时间")
private String seat;
} }
...@@ -115,5 +115,11 @@ public class ESAlertCalled { ...@@ -115,5 +115,11 @@ public class ESAlertCalled {
@Field(type = FieldType.Text) @Field(type = FieldType.Text)
private String flightNumber; private String flightNumber;
/**
* 落地时间
*/
@Field(type = FieldType.Long)
private Long taskTime;
} }
...@@ -327,14 +327,14 @@ ...@@ -327,14 +327,14 @@
</where>) b </where>) b
</select> </select>
<!--bug 8954 历史警情数据缺失 过滤了经纬度导致-->
<select id="alertCalledListByAlertStatusCount" resultType="Integer"> <select id="alertCalledListByAlertStatusCount" resultType="Integer">
SELECT SELECT
COUNT(*) COUNT(*)
FROM jc_alert_called a FROM jc_alert_called a
where a.is_delete=0 and a.alert_type_code <![CDATA[ <> ]]> 1214 where a.is_delete=0 and a.alert_type_code <![CDATA[ <> ]]> 1214
AND a.coordinate_x IS NOT NULL /* AND a.coordinate_x IS NOT NULL
AND a.coordinate_y IS NOT NULL AND a.coordinate_y IS NOT NULL*/
<if test='par.status==0'> <if test='par.status==0'>
and a.alert_status =0 and a.alert_status =0
</if> </if>
......
...@@ -580,9 +580,17 @@ public class DutyCommonServiceImpl implements IDutyCommonService { ...@@ -580,9 +580,17 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
Map<Date, Long> dutyPersonShiftMap = dutyPersonShiftsDb.stream() Map<Date, Long> dutyPersonShiftMap = dutyPersonShiftsDb.stream()
.collect(Collectors.toMap(DutyPersonShift::getDutyDate, DutyPersonShift::getSequenceNbr)); .collect(Collectors.toMap(DutyPersonShift::getDutyDate, DutyPersonShift::getSequenceNbr));
// todo: 只更新当天及值班之后数据 // todo: 只更新当天及值班之后数据
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
String format = simpleDateFormat.format(new Date());
Date date = null;
try {
date = simpleDateFormat.parse(format);
} catch (ParseException e) {
e.printStackTrace();
}
Date finalDate = date;
Set<DutyPersonShift> needToDb = shiftDtos.stream() Set<DutyPersonShift> needToDb = shiftDtos.stream()
.filter(s -> DateUtils.dateCompare(s.getDutyDate(), new Date()) >= 0).map(shiftDto -> { .filter(s -> DateUtils.dateCompare(s.getDutyDate(), finalDate) >= 0).map(shiftDto -> { DutyPersonShift dutyPersonShift = new DutyPersonShift();
DutyPersonShift dutyPersonShift = new DutyPersonShift();
Bean.copyExistPropertis(shiftDto, dutyPersonShift); Bean.copyExistPropertis(shiftDto, dutyPersonShift);
dutyPersonShift.setInstanceId(finalInstanceId); dutyPersonShift.setInstanceId(finalInstanceId);
dutyPersonShift.setAppKey(RequestContext.getAppKey()); dutyPersonShift.setAppKey(RequestContext.getAppKey());
......
...@@ -128,12 +128,17 @@ public class LinkageUnitServiceImpl extends BaseService<LinkageUnitDto, LinkageU ...@@ -128,12 +128,17 @@ public class LinkageUnitServiceImpl extends BaseService<LinkageUnitDto, LinkageU
*/ */
@Transactional @Transactional
public LinkageUnitDto saveModel(LinkageUnitDto linkageUnitDto) { public LinkageUnitDto saveModel(LinkageUnitDto linkageUnitDto) {
if (linkageUnitDto.getAddress() != null) { if (linkageUnitDto.getAddress() != null) {
JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(linkageUnitDto.getAddress()); JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(linkageUnitDto.getAddress());
linkageUnitDto.setAddress(address.getString(BizConstant.ADDRESS)); linkageUnitDto.setAddress(address.getString(BizConstant.ADDRESS));
linkageUnitDto.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE))); String[] addressArr = linkageUnitDto.getAddress().split("@address@");
linkageUnitDto.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE))); JSONObject jsonObject = JSONObject.parseObject(addressArr[1]);
if (StringUtils.isNotEmpty(jsonObject.getString(BizConstant.LONGITUDE))) {
linkageUnitDto.setLongitude(Double.valueOf(jsonObject.getString(BizConstant.LONGITUDE)));
}
if (StringUtils.isNotEmpty(jsonObject.getString(BizConstant.LATITUDE))) {
linkageUnitDto.setLatitude(Double.valueOf(jsonObject.getString(BizConstant.LATITUDE)));
}
} }
// 1.保存行数据 // 1.保存行数据
String groupCode = this.getGroupCode(); String groupCode = this.getGroupCode();
......
...@@ -104,6 +104,9 @@ public class ShiftChangeController extends BaseController { ...@@ -104,6 +104,9 @@ public class ShiftChangeController extends BaseController {
public ResponseModel queryForPage( public ResponseModel queryForPage(
@RequestParam(value = "current") int current, @RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) { @RequestParam(value = "size") int size) {
if (current >= 1){
current = (current-1)*size;
}
return ResponseHelper.buildResponse(iShiftChangeService.queryForShiftChangePage(current, size)); return ResponseHelper.buildResponse(iShiftChangeService.queryForShiftChangePage(current, size));
} }
......
...@@ -310,7 +310,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal ...@@ -310,7 +310,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
}); });
Map<String, Integer> statusCountMap = alertCalledMapper.queryAlertStatusCount(beginDate, endDate); Map<String, Integer> statusCountMap = alertCalledMapper.queryAlertStatusCount(beginDate, endDate);
Integer unFinishedCount = this Integer unFinishedCount = this
.count(new LambdaQueryWrapper<AlertCalled>().eq(AlertCalled::getAlertStatus, false));// bug2532 .count(new LambdaQueryWrapper<AlertCalled>().eq(AlertCalled::getAlertStatus, false).eq(AlertCalled::getAlertTypeCode,"1214"));// bug2532
// 未结案警情统计错误 // 未结案警情统计错误
// bykongfm // bykongfm
...@@ -540,6 +540,17 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal ...@@ -540,6 +540,17 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
}); });
} }
if (AlertStageEnums.LYXC.getCode().equals(alertCalled.getAlertTypeCode()) ||AlertStageEnums.ZJBZ.getCode().equals(alertCalled.getAlertTypeCode()) ) {
alertFormValuelist.stream().forEach(alertFormValue -> {
if (alertFormValue.getFieldCode().equals("taskTime")) {
alertCalled.setTaskTime(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("seat")) {
alertCalled.setSeat(alertFormValue.getFieldValue());
}
});
}
// 判断是否归并警情 // 判断是否归并警情
if (alertCalled.getFatherAlert() != null) { if (alertCalled.getFatherAlert() != null) {
// 警情归并,设置当前警情状态为结束。 // 警情归并,设置当前警情状态为结束。
...@@ -752,7 +763,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal ...@@ -752,7 +763,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
}); });
Map<String, Integer> statusCountMap = alertCalledMapper.queryAlertStatusCount(beginDate, endDate); Map<String, Integer> statusCountMap = alertCalledMapper.queryAlertStatusCount(beginDate, endDate);
Integer unFinishedCount = this Integer unFinishedCount = this
.count(new LambdaQueryWrapper<AlertCalled>().eq(AlertCalled::getAlertStatus, false));// bug2532 .count(new LambdaQueryWrapper<AlertCalled>().eq(AlertCalled::getAlertStatus, false).notIn(AlertCalled::getAlertTypeCode,"1214"));// bug2532
// 未结案警情统计错误 // 未结案警情统计错误
// bykongfm // bykongfm
......
...@@ -302,7 +302,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -302,7 +302,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
definitions.put("$casualtiesNum",ValidationUtil.isEmpty(alertCalled.getCasualtiesNum()) ? "" : String.valueOf(alertCalled.getCasualtiesNum())); definitions.put("$casualtiesNum",ValidationUtil.isEmpty(alertCalled.getCasualtiesNum()) ? "" : String.valueOf(alertCalled.getCasualtiesNum()));
definitions.put("$contactPhone",ValidationUtil.isEmpty(alertCalled.getContactPhone()) ? "" : alertCalled.getContactPhone()); definitions.put("$contactPhone",ValidationUtil.isEmpty(alertCalled.getContactPhone()) ? "" : alertCalled.getContactPhone());
String companyName = JSONObject.parseObject(alertSubmittedExtDto.getSubmissionContent()).getString("$companyName") ; String companyName = JSONObject.parseObject(alertSubmittedExtDto.getSubmissionContent()).getString("companyName") ;
JSONObject jsonObject = null; JSONObject jsonObject = null;
if(!ValidationUtil.isEmpty(alertCalled.getUpdateTime())) { if(!ValidationUtil.isEmpty(alertCalled.getUpdateTime())) {
......
...@@ -9,6 +9,7 @@ import java.util.List; ...@@ -9,6 +9,7 @@ import java.util.List;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
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.enums.AlertStageEnums;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.sort.SortBuilders; import org.elasticsearch.search.sort.SortBuilders;
...@@ -59,8 +60,7 @@ public class ESAlertCalledService { ...@@ -59,8 +60,7 @@ public class ESAlertCalledService {
@PostConstruct @PostConstruct
public void init() throws Exception public void init() throws Exception {
{
//初始化ES,重建索引 //初始化ES,重建索引
initEs(); initEs();
} }
...@@ -75,22 +75,20 @@ public class ESAlertCalledService { ...@@ -75,22 +75,20 @@ public class ESAlertCalledService {
*/ */
QueryWrapper<AlertCalled> wrapper = new QueryWrapper<>(); QueryWrapper<AlertCalled> wrapper = new QueryWrapper<>();
long currentTime = System.currentTimeMillis() ; long currentTime = System.currentTimeMillis();
if (ValidationUtil.isEmpty(time)) //默认为同步48小时 if (ValidationUtil.isEmpty(time)) //默认为同步48小时
{ {
currentTime = currentTime - 48*60*60*1000; currentTime = currentTime - 48 * 60 * 60 * 1000;
}else } else {
{ currentTime = currentTime - time * 60 * 60 * 1000;
currentTime = currentTime - time*60*60*1000;
} }
Date date=new Date(currentTime); Date date = new Date(currentTime);
wrapper.ge("call_time", date); wrapper.ge("call_time", date);
wrapper.isNull("father_alert"); wrapper.isNull("father_alert");
List<AlertCalled> alertCalleds = alertCalledService.list(wrapper); List<AlertCalled> alertCalleds = alertCalledService.list(wrapper);
if (!ValidationUtil.isEmpty(alertCalleds)) if (!ValidationUtil.isEmpty(alertCalleds)) {
{
// for (AlertCalled alertCalled : alertCalleds) // for (AlertCalled alertCalled : alertCalleds)
// { // {
// saveAlertCalledToES(alertCalled); // saveAlertCalledToES(alertCalled);
...@@ -103,40 +101,35 @@ public class ESAlertCalledService { ...@@ -103,40 +101,35 @@ public class ESAlertCalledService {
} }
/** /**
*
* <pre> * <pre>
* 批量保存 * 批量保存
* </pre> * </pre>
* *
* @param list 警情信息列表 * @param list 警情信息列表
*/ */
public void saveAll(List<AlertCalled> alertCalleds) throws Exception{ public void saveAll(List<AlertCalled> alertCalleds) throws Exception {
if (!ValidationUtil.isEmpty(alertCalleds)) if (!ValidationUtil.isEmpty(alertCalleds)) {
{ for (AlertCalled alertCalled : alertCalleds) {
for (AlertCalled alertCalled : alertCalleds)
{
this.saveAlertCalledToES(alertCalled); this.saveAlertCalledToES(alertCalled);
} }
} }
} }
/** /**
*
* <pre> * <pre>
* 根据警情记录批量保存 * 根据警情记录批量保存
* </pre> * </pre>
* *
* @param alertCalleds 警情信息列表 * @param alertCalleds 警情信息列表
*/ */
public ESAlertCalled saveAlertCalledToES(AlertCalled alertCalled) throws Exception public ESAlertCalled saveAlertCalledToES(AlertCalled alertCalled) throws Exception {
{
ESAlertCalled esAlertCalled = new ESAlertCalled(); ESAlertCalled esAlertCalled = new ESAlertCalled();
esAlertCalled.setSequenceNbr(alertCalled.getSequenceNbr()); esAlertCalled.setSequenceNbr(alertCalled.getSequenceNbr());
esAlertCalled.setAlertType(alertCalled.getAlertType()); esAlertCalled.setAlertType(alertCalled.getAlertType());
esAlertCalled.setAlertTypeCode(alertCalled.getAlertTypeCode()); esAlertCalled.setAlertTypeCode(alertCalled.getAlertTypeCode());
esAlertCalled.setCallTime(alertCalled.getCallTime()); esAlertCalled.setCallTime(alertCalled.getCallTime());
esAlertCalled.setCallTimeLong(alertCalled.getCallTime()!=null?alertCalled.getCallTime().getTime():null); esAlertCalled.setCallTimeLong(alertCalled.getCallTime() != null ? alertCalled.getCallTime().getTime() : null);
esAlertCalled.setContactUser(alertCalled.getContactUser()); esAlertCalled.setContactUser(alertCalled.getContactUser());
esAlertCalled.setContactPhone(alertCalled.getContactPhone()); esAlertCalled.setContactPhone(alertCalled.getContactPhone());
esAlertCalled.setAddress(alertCalled.getAddress()); esAlertCalled.setAddress(alertCalled.getAddress());
...@@ -144,16 +137,17 @@ public class ESAlertCalledService { ...@@ -144,16 +137,17 @@ public class ESAlertCalledService {
esAlertCalled.setAlertStatus(alertCalled.getAlertStatus()); esAlertCalled.setAlertStatus(alertCalled.getAlertStatus());
esAlertCalled.setForcedLandingTrack(alertCalled.getForcedLandingTrack()); esAlertCalled.setForcedLandingTrack(alertCalled.getForcedLandingTrack());
esAlertCalled.setFlightNumber(alertCalled.getFlightNumber()); esAlertCalled.setFlightNumber(alertCalled.getFlightNumber());
if(alertCalled.getLandingTime() != null ){ if (alertCalled.getLandingTime() != null) {
Date date = new Date(); long time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(alertCalled.getLandingTime()).getTime();
date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(alertCalled.getLandingTime()); esAlertCalled.setLandingTime(time);
esAlertCalled.setLandingTime(date.getTime());
} }
if (alertCalled.getAlertStatus()) if (alertCalled.getTaskTime() != null) {
{ long time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(alertCalled.getLandingTime()).getTime();
esAlertCalled.setTaskTime(time);
}
if (alertCalled.getAlertStatus()) {
esAlertCalled.setAlertStatusStr(AlertStatusEnum.CLOSED.getCode()); esAlertCalled.setAlertStatusStr(AlertStatusEnum.CLOSED.getCode());
}else } else {
{
esAlertCalled.setAlertStatusStr(AlertStatusEnum.UNCLOSED.getCode()); esAlertCalled.setAlertStatusStr(AlertStatusEnum.UNCLOSED.getCode());
} }
esAlertCalled.setResponseLevelCode(alertCalled.getResponseLevelCode()); esAlertCalled.setResponseLevelCode(alertCalled.getResponseLevelCode());
...@@ -167,27 +161,23 @@ public class ESAlertCalledService { ...@@ -167,27 +161,23 @@ public class ESAlertCalledService {
} }
public List<ESAlertCalled> saveAlertCalledToES(List<AlertCalled> alertCalleds) throws Exception public List<ESAlertCalled> saveAlertCalledToES(List<AlertCalled> alertCalleds) throws Exception {
{ List<ESAlertCalled> list1 = new ArrayList<>();
List<ESAlertCalled> list1=new ArrayList<>(); for (AlertCalled alertCalled : alertCalleds) {
for (AlertCalled alertCalled : alertCalleds)
{
ESAlertCalled esAlertCalled = new ESAlertCalled(); ESAlertCalled esAlertCalled = new ESAlertCalled();
esAlertCalled.setSequenceNbr(alertCalled.getSequenceNbr()); esAlertCalled.setSequenceNbr(alertCalled.getSequenceNbr());
esAlertCalled.setAlertType(alertCalled.getAlertType()); esAlertCalled.setAlertType(alertCalled.getAlertType());
esAlertCalled.setAlertTypeCode(alertCalled.getAlertTypeCode()); esAlertCalled.setAlertTypeCode(alertCalled.getAlertTypeCode());
esAlertCalled.setCallTime(alertCalled.getCallTime()); esAlertCalled.setCallTime(alertCalled.getCallTime());
esAlertCalled.setCallTimeLong(alertCalled.getCallTime()!=null?alertCalled.getCallTime().getTime():null); esAlertCalled.setCallTimeLong(alertCalled.getCallTime() != null ? alertCalled.getCallTime().getTime() : null);
esAlertCalled.setContactUser(alertCalled.getContactUser()); esAlertCalled.setContactUser(alertCalled.getContactUser());
esAlertCalled.setContactPhone(alertCalled.getContactPhone()); esAlertCalled.setContactPhone(alertCalled.getContactPhone());
esAlertCalled.setAddress(alertCalled.getAddress()); esAlertCalled.setAddress(alertCalled.getAddress());
esAlertCalled.setAlertStage(alertCalled.getAlertStage()); esAlertCalled.setAlertStage(alertCalled.getAlertStage());
esAlertCalled.setAlertStatus(alertCalled.getAlertStatus()); esAlertCalled.setAlertStatus(alertCalled.getAlertStatus());
if (alertCalled.getAlertStatus()) if (alertCalled.getAlertStatus()) {
{
esAlertCalled.setAlertStatusStr(AlertStatusEnum.CLOSED.getCode()); esAlertCalled.setAlertStatusStr(AlertStatusEnum.CLOSED.getCode());
}else } else {
{
esAlertCalled.setAlertStatusStr(AlertStatusEnum.UNCLOSED.getCode()); esAlertCalled.setAlertStatusStr(AlertStatusEnum.UNCLOSED.getCode());
} }
esAlertCalled.setResponseLevelCode(alertCalled.getResponseLevelCode()); esAlertCalled.setResponseLevelCode(alertCalled.getResponseLevelCode());
...@@ -202,10 +192,7 @@ public class ESAlertCalledService { ...@@ -202,10 +192,7 @@ public class ESAlertCalledService {
} }
/** /**
*
* <pre> * <pre>
* 从ES库批量删除 * 从ES库批量删除
* </pre> * </pre>
...@@ -214,7 +201,7 @@ public class ESAlertCalledService { ...@@ -214,7 +201,7 @@ public class ESAlertCalledService {
* @return * @return
* @throws Exception * @throws Exception
*/ */
public Boolean deleteById(List<Long> ids) throws Exception{ public Boolean deleteById(List<Long> ids) throws Exception {
if (!ValidationUtil.isEmpty(ids)) { if (!ValidationUtil.isEmpty(ids)) {
for (Long sequenceNbr : ids) { for (Long sequenceNbr : ids) {
if (esAlertCalledRepository.existsById(sequenceNbr)) { if (esAlertCalledRepository.existsById(sequenceNbr)) {
...@@ -244,20 +231,17 @@ public class ESAlertCalledService { ...@@ -244,20 +231,17 @@ public class ESAlertCalledService {
* @param size 页面大小 * @param size 页面大小
* @return * @return
*/ */
@SuppressWarnings({ "rawtypes" }) @SuppressWarnings({"rawtypes"})
public Page<ESAlertCalledDto> queryByKeys(ESAlertCalledRequestDto alertCalledVo, int current, int size) public Page<ESAlertCalledDto> queryByKeys(ESAlertCalledRequestDto alertCalledVo, int current, int size) {
{
Page<ESAlertCalledDto> result = new Page<ESAlertCalledDto>(current, size); Page<ESAlertCalledDto> result = new Page<ESAlertCalledDto>(current, size);
String[] alertStatus = alertCalledVo.getAlertStatus(); String[] alertStatus = alertCalledVo.getAlertStatus();
if (ValidationUtil.isEmpty(alertStatus)) if (ValidationUtil.isEmpty(alertStatus)) {
{
return result; return result;
} }
AlertCalled alertCalled = alertCalledVo.getAlertCalled(); AlertCalled alertCalled = alertCalledVo.getAlertCalled();
if (ValidationUtil.isEmpty(alertCalled)) if (ValidationUtil.isEmpty(alertCalled)) {
{
return result; return result;
} }
/** /**
...@@ -266,34 +250,33 @@ public class ESAlertCalledService { ...@@ -266,34 +250,33 @@ public class ESAlertCalledService {
BoolQueryBuilder boolMustAll = QueryBuilders.boolQuery(); BoolQueryBuilder boolMustAll = QueryBuilders.boolQuery();
//警情状态 //警情状态
BoolQueryBuilder qb0 = QueryBuilders.boolQuery(); BoolQueryBuilder qb0 = QueryBuilders.boolQuery();
for (String status : alertStatus) if (alertStatus.length > 1) {
{ } else {
for (String status : alertStatus) {
AlertStatusEnum alertStatusEnum = AlertStatusEnum.getEnum(status); AlertStatusEnum alertStatusEnum = AlertStatusEnum.getEnum(status);
if (!ValidationUtil.isEmpty(alertStatusEnum)) if (!ValidationUtil.isEmpty(alertStatusEnum)) {
{ qb0.must(QueryBuilders.termQuery("alertStatusStr.keyword", alertStatusEnum.getCode()));
qb0.should(QueryBuilders.termQuery("alertStatusStr.keyword", alertStatusEnum.getCode()));
} }
} }
boolMustAll.must(qb0); boolMustAll.must(qb0);
}
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
//接警时间,距离当前时间不超过半小时的 //接警时间,距离当前时间不超过半小时的
long currentTime = System.currentTimeMillis() ; long currentTime = System.currentTimeMillis();
currentTime = currentTime - 30*60*1000; currentTime = currentTime - 30 * 60 * 1000;
BoolQueryBuilder qb1 = QueryBuilders.boolQuery() BoolQueryBuilder qb1 = QueryBuilders.boolQuery()
.must(QueryBuilders.rangeQuery("callTimeLong").gte(currentTime)); .must(QueryBuilders.rangeQuery("callTimeLong").gte(currentTime));
boolMust.should(qb1); boolMust.should(qb1);
//报警人及报警电话一致 //报警人及报警电话一致
if (!ValidationUtil.isEmpty(alertCalled.getContactUser()) && !ValidationUtil.isEmpty(alertCalled.getContactPhone())) if (!ValidationUtil.isEmpty(alertCalled.getContactUser()) && !ValidationUtil.isEmpty(alertCalled.getContactPhone())) {
{
BoolQueryBuilder qb2 = QueryBuilders.boolQuery() BoolQueryBuilder qb2 = QueryBuilders.boolQuery()
.must(QueryBuilders.termQuery("contactUser.keyword", alertCalled.getContactUser())) .must(QueryBuilders.termQuery("contactUser.keyword", alertCalled.getContactUser()))
.must(QueryBuilders.termQuery("contactPhone.keyword", alertCalled.getContactPhone())); .must(QueryBuilders.termQuery("contactPhone.keyword", alertCalled.getContactPhone()));
boolMust.should(qb2); boolMust.should(qb2);
} }
//事发地点一致,或相距不超过200米的 //事发地点一致,或相距不超过200米的
if (!ValidationUtil.isEmpty(alertCalled.getAddress())) if (!ValidationUtil.isEmpty(alertCalled.getAddress())) {
{
BoolQueryBuilder qb3 = QueryBuilders.boolQuery() BoolQueryBuilder qb3 = QueryBuilders.boolQuery()
.should(QueryBuilders.matchQuery("address", alertCalled.getAddress())); .should(QueryBuilders.matchQuery("address", alertCalled.getAddress()));
boolMust.should(qb3); boolMust.should(qb3);
...@@ -303,39 +286,55 @@ public class ESAlertCalledService { ...@@ -303,39 +286,55 @@ public class ESAlertCalledService {
.must(QueryBuilders.termQuery("alertTypeCode.keyword", alertCalled.getAlertTypeCode())); .must(QueryBuilders.termQuery("alertTypeCode.keyword", alertCalled.getAlertTypeCode()));
boolMust.should(qb4); boolMust.should(qb4);
//事发单位名称一致 //事发单位名称一致
if (!ValidationUtil.isEmpty(alertCalled.getUnitInvolved())) if (!ValidationUtil.isEmpty(alertCalled.getUnitInvolved())) {
{
BoolQueryBuilder qb5 = QueryBuilders.boolQuery() BoolQueryBuilder qb5 = QueryBuilders.boolQuery()
.must(QueryBuilders.matchQuery("unitInvolved", alertCalled.getUnitInvolved())); .must(QueryBuilders.termQuery("unitInvolved.keyword", alertCalled.getUnitInvolved()));
boolMust.should(qb5); boolMust.should(qb5);
} }
//过滤120警情 //过滤120警情
BoolQueryBuilder qb6 = QueryBuilders.boolQuery() BoolQueryBuilder qb6 = QueryBuilders.boolQuery()
.mustNot(QueryBuilders.termQuery("alertTypeCode", "1214")); .mustNot(QueryBuilders.termQuery("alertTypeCode", "1214"));
if (!ValidationUtil.isEmpty(alertCalledVo.getAlertFormValue())){ //航空器救援规则
if (!ValidationUtil.isEmpty(alertCalledVo.getAlertFormValue()) && AlertStageEnums.HKJY.getCode().equals(alertCalled.getAlertTypeCode())) {
List<AlertFormValue> alertFormValue = alertCalledVo.getAlertFormValue(); List<AlertFormValue> alertFormValue = alertCalledVo.getAlertFormValue();
for (AlertFormValue formValue : alertFormValue) { for (AlertFormValue formValue : alertFormValue) {
if (formValue.getFieldCode().equals("forcedLandingTrack")&& formValue.getFieldValue() != null){ if (formValue.getFieldCode().equals("forcedLandingTrack") && formValue.getFieldValue() != null) {
BoolQueryBuilder qb7 = QueryBuilders.boolQuery() BoolQueryBuilder qb7 = QueryBuilders.boolQuery()
.must(QueryBuilders.termQuery("forcedLandingTrack.keyword", formValue.getFieldValue())); .must(QueryBuilders.termQuery("forcedLandingTrack.keyword", formValue.getFieldValue()));
boolMust.must(qb7); boolMust.must(qb7);
} }
if (formValue.getFieldCode().equals("flightNumber") && formValue.getFieldValue() != null){ if (formValue.getFieldCode().equals("flightNumber") && formValue.getFieldValue() != null) {
BoolQueryBuilder qb8 = QueryBuilders.boolQuery() BoolQueryBuilder qb8 = QueryBuilders.boolQuery()
.must(QueryBuilders.termQuery("flightNumber.keyword", formValue.getFieldValue())); .must(QueryBuilders.termQuery("flightNumber.keyword", formValue.getFieldValue()));
boolMust.must(qb8); boolMust.must(qb8);
} }
if (formValue.getFieldCode().equals("landingTime")&& formValue.getFieldValue() != null){ if (formValue.getFieldCode().equals("landingTime") && formValue.getFieldValue() != null) {
BoolQueryBuilder qb9 = QueryBuilders.boolQuery().must(QueryBuilders.rangeQuery("landingTime").gte(currentTime)); BoolQueryBuilder qb9 = QueryBuilders.boolQuery().must(QueryBuilders.rangeQuery("landingTime").gte(currentTime));
boolMust.must(qb9); boolMust.must(qb9);
} }
} }
} }
//漏油保障规则和专机保障规则
if (!ValidationUtil.isEmpty(alertCalledVo.getAlertFormValue()) &&AlertStageEnums.LYXC.getCode().equals(alertCalled.getAlertTypeCode()) ||AlertStageEnums.ZJBZ.getCode().equals(alertCalled.getAlertTypeCode()) ) {
List<AlertFormValue> alertFormValue = alertCalledVo.getAlertFormValue();
for (AlertFormValue formValue : alertFormValue) {
if (formValue.getFieldCode().equals("taskTime") && formValue.getFieldValue() != null) {
currentTime= currentTime - 30 * 60 * 1000*2;
BoolQueryBuilder qb10 = QueryBuilders.boolQuery()
.must(QueryBuilders.rangeQuery("taskTime").gte(currentTime));
boolMust.must(qb10);
}
if (formValue.getFieldCode().equals("seat") && formValue.getFieldValue() != null) {
BoolQueryBuilder qb11 = QueryBuilders.boolQuery()
.must(QueryBuilders.termQuery("seat.keyword", formValue.getFieldValue()));
boolMust.must(qb11);
}
}
}
/** /**
* 一般火灾,条件构造 * 一般火灾,条件构造
...@@ -343,12 +342,11 @@ public class ESAlertCalledService { ...@@ -343,12 +342,11 @@ public class ESAlertCalledService {
boolMust.minimumShouldMatch(1);//至少满足一个 boolMust.minimumShouldMatch(1);//至少满足一个
boolMustAll.must(boolMust); boolMustAll.must(boolMust);
boolMustAll.must(qb6); boolMustAll.must(qb6);
// 创建查询构造器 // 创建查询构造器
NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder() NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder()
//过滤条件 //过滤条件
...@@ -356,25 +354,21 @@ public class ESAlertCalledService { ...@@ -356,25 +354,21 @@ public class ESAlertCalledService {
// 排序 // 排序
.withSort(SortBuilders.fieldSort("callTimeLong").order(SortOrder.DESC)) .withSort(SortBuilders.fieldSort("callTimeLong").order(SortOrder.DESC))
// 分页 // 分页
.withPageable(PageRequest.of(current, size)) .withPageable(PageRequest.of(current, size));
;
List<ESAlertCalledDto> list = new LinkedList<>(); List<ESAlertCalledDto> list = new LinkedList<>();
long totle = 0; long totle = 0;
try try {
{ SearchHits<ESAlertCalled> searchHits = elasticsearchTemplate.search(queryBuilder.build(), ESAlertCalled.class);
SearchHits<ESAlertCalled> searchHits =elasticsearchTemplate.search(queryBuilder.build(), ESAlertCalled.class);
for (SearchHit searchHit : searchHits.getSearchHits()) for (SearchHit searchHit : searchHits.getSearchHits()) {
{
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(searchHit.getContent()); JSONObject jsonObject = (JSONObject) JSONObject.toJSON(searchHit.getContent());
ESAlertCalledDto eSAlertCalled =JSONObject.toJavaObject(jsonObject, ESAlertCalledDto.class); ESAlertCalledDto eSAlertCalled = JSONObject.toJavaObject(jsonObject, ESAlertCalledDto.class);
list.add(eSAlertCalled); list.add(eSAlertCalled);
} }
totle =searchHits.getTotalHits(); totle = searchHits.getTotalHits();
} } catch (Exception e) {
catch (Exception e)
{
// TODO: handle exception // TODO: handle exception
} }
result.setRecords(list); result.setRecords(list);
...@@ -382,20 +376,18 @@ public class ESAlertCalledService { ...@@ -382,20 +376,18 @@ public class ESAlertCalledService {
return result; return result;
} }
@SuppressWarnings({ "rawtypes" })
public Page<ESAlertCalledDto> queryByKeys(ESAlertCalledRequestDto alertCalledVo, int current, int size,String type) @SuppressWarnings({"rawtypes"})
{ public Page<ESAlertCalledDto> queryByKeys(ESAlertCalledRequestDto alertCalledVo, int current, int size, String type) {
Page<ESAlertCalledDto> result = new Page<ESAlertCalledDto>(current, size); Page<ESAlertCalledDto> result = new Page<ESAlertCalledDto>(current, size);
String[] alertStatus = alertCalledVo.getAlertStatus(); String[] alertStatus = alertCalledVo.getAlertStatus();
if (ValidationUtil.isEmpty(alertStatus)) if (ValidationUtil.isEmpty(alertStatus)) {
{
return result; return result;
} }
AlertCalled alertCalled = alertCalledVo.getAlertCalled(); AlertCalled alertCalled = alertCalledVo.getAlertCalled();
if (ValidationUtil.isEmpty(alertCalled)) if (ValidationUtil.isEmpty(alertCalled)) {
{
return result; return result;
} }
/** /**
...@@ -404,11 +396,9 @@ public class ESAlertCalledService { ...@@ -404,11 +396,9 @@ public class ESAlertCalledService {
BoolQueryBuilder boolMustAll = QueryBuilders.boolQuery(); BoolQueryBuilder boolMustAll = QueryBuilders.boolQuery();
//警情状态 //警情状态
BoolQueryBuilder qb0 = QueryBuilders.boolQuery(); BoolQueryBuilder qb0 = QueryBuilders.boolQuery();
for (String status : alertStatus) for (String status : alertStatus) {
{
AlertStatusEnum alertStatusEnum = AlertStatusEnum.getEnum(status); AlertStatusEnum alertStatusEnum = AlertStatusEnum.getEnum(status);
if (!ValidationUtil.isEmpty(alertStatusEnum)) if (!ValidationUtil.isEmpty(alertStatusEnum)) {
{
qb0.should(QueryBuilders.termQuery("alertStatusStr.keyword", alertStatusEnum.getCode())); qb0.should(QueryBuilders.termQuery("alertStatusStr.keyword", alertStatusEnum.getCode()));
} }
} }
...@@ -416,22 +406,20 @@ public class ESAlertCalledService { ...@@ -416,22 +406,20 @@ public class ESAlertCalledService {
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
//接警时间,距离当前时间不超过半小时的 //接警时间,距离当前时间不超过半小时的
long currentTime = System.currentTimeMillis() ; long currentTime = System.currentTimeMillis();
currentTime = currentTime - 30*60*1000; currentTime = currentTime - 30 * 60 * 1000;
BoolQueryBuilder qb1 = QueryBuilders.boolQuery() BoolQueryBuilder qb1 = QueryBuilders.boolQuery()
.must(QueryBuilders.rangeQuery("callTimeLong").gte(currentTime)); .must(QueryBuilders.rangeQuery("callTimeLong").gte(currentTime));
boolMust.should(qb1); boolMust.should(qb1);
//报警人及报警电话一致 //报警人及报警电话一致
if (!ValidationUtil.isEmpty(alertCalled.getContactUser()) && !ValidationUtil.isEmpty(alertCalled.getContactPhone())) if (!ValidationUtil.isEmpty(alertCalled.getContactUser()) && !ValidationUtil.isEmpty(alertCalled.getContactPhone())) {
{
BoolQueryBuilder qb2 = QueryBuilders.boolQuery() BoolQueryBuilder qb2 = QueryBuilders.boolQuery()
.must(QueryBuilders.termQuery("contactUser.keyword", alertCalled.getContactUser())) .must(QueryBuilders.termQuery("contactUser.keyword", alertCalled.getContactUser()))
.must(QueryBuilders.termQuery("contactPhone.keyword", alertCalled.getContactPhone())); .must(QueryBuilders.termQuery("contactPhone.keyword", alertCalled.getContactPhone()));
boolMust.should(qb2); boolMust.should(qb2);
} }
//事发地点一致,或相距不超过200米的 //事发地点一致,或相距不超过200米的
if (!ValidationUtil.isEmpty(alertCalled.getAddress())) if (!ValidationUtil.isEmpty(alertCalled.getAddress())) {
{
BoolQueryBuilder qb3 = QueryBuilders.boolQuery() BoolQueryBuilder qb3 = QueryBuilders.boolQuery()
.should(QueryBuilders.matchQuery("address", alertCalled.getAddress())); .should(QueryBuilders.matchQuery("address", alertCalled.getAddress()));
boolMust.should(qb3); boolMust.should(qb3);
...@@ -441,8 +429,7 @@ public class ESAlertCalledService { ...@@ -441,8 +429,7 @@ public class ESAlertCalledService {
.must(QueryBuilders.termQuery("alertTypeCode.keyword", alertCalled.getAlertTypeCode())); .must(QueryBuilders.termQuery("alertTypeCode.keyword", alertCalled.getAlertTypeCode()));
//boolMust.should(qb4); //boolMust.should(qb4);
//事发单位名称一致 //事发单位名称一致
if (!ValidationUtil.isEmpty(alertCalled.getUnitInvolved())) if (!ValidationUtil.isEmpty(alertCalled.getUnitInvolved())) {
{
BoolQueryBuilder qb5 = QueryBuilders.boolQuery() BoolQueryBuilder qb5 = QueryBuilders.boolQuery()
.must(QueryBuilders.matchQuery("unitInvolved", alertCalled.getUnitInvolved())); .must(QueryBuilders.matchQuery("unitInvolved", alertCalled.getUnitInvolved()));
boolMust.should(qb5); boolMust.should(qb5);
...@@ -459,34 +446,28 @@ public class ESAlertCalledService { ...@@ -459,34 +446,28 @@ public class ESAlertCalledService {
boolMustAll.must(qb4); boolMustAll.must(qb4);
// 创建查询构造器 // 创建查询构造器
NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder() NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder()
//过滤条件
.withQuery(boolMustAll)
// 分页 // 分页
.withPageable(PageRequest.of(current, size)) .withPageable(PageRequest.of(current, size))
// 排序 // 排序
.withSort(SortBuilders.fieldSort("callTimeLong").order(SortOrder.DESC)) .withSort(SortBuilders.fieldSort("callTimeLong").order(SortOrder.DESC));
//过滤条件
.withQuery(boolMustAll)
;
List<ESAlertCalledDto> list = new LinkedList<>(); List<ESAlertCalledDto> list = new LinkedList<>();
long totle = 0; long totle = 0;
try try {
{ SearchHits<ESAlertCalled> searchHits = elasticsearchTemplate.search(queryBuilder.build(), ESAlertCalled.class);
SearchHits<ESAlertCalled> searchHits =elasticsearchTemplate.search(queryBuilder.build(), ESAlertCalled.class);
for (SearchHit searchHit : searchHits.getSearchHits()) for (SearchHit searchHit : searchHits.getSearchHits()) {
{
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(searchHit.getContent()); JSONObject jsonObject = (JSONObject) JSONObject.toJSON(searchHit.getContent());
ESAlertCalledDto eSAlertCalled =JSONObject.toJavaObject(jsonObject, ESAlertCalledDto.class); ESAlertCalledDto eSAlertCalled = JSONObject.toJavaObject(jsonObject, ESAlertCalledDto.class);
list.add(eSAlertCalled); list.add(eSAlertCalled);
} }
totle =searchHits.getTotalHits(); totle = searchHits.getTotalHits();
} } catch (Exception e) {
catch (Exception e)
{
// TODO: handle exception // TODO: handle exception
} }
result.setRecords(list); result.setRecords(list);
...@@ -494,5 +475,4 @@ public class ESAlertCalledService { ...@@ -494,5 +475,4 @@ public class ESAlertCalledService {
return result; return result;
} }
} }
\ No newline at end of file
...@@ -21,6 +21,8 @@ public interface CheckMapper extends BaseMapper { ...@@ -21,6 +21,8 @@ public interface CheckMapper extends BaseMapper {
List<CheckInfoVo> getCheckInfo(CheckInfoPageParam param); List<CheckInfoVo> getCheckInfo(CheckInfoPageParam param);
List<Check> getCheckByTaskId(String taskId);
List<Map> queryUnqualifiedInputItem(@Param(value = "checkId") int checkId); List<Map> queryUnqualifiedInputItem(@Param(value = "checkId") int checkId);
List<Map> queryCheckPointInputItem(@Param(value = "planTaskId") int planTaskId, @Param(value = "pointId") int pointId); List<Map> queryCheckPointInputItem(@Param(value = "planTaskId") int planTaskId, @Param(value = "pointId") int pointId);
......
...@@ -25,6 +25,7 @@ import com.yeejoin.amos.supervision.business.feign.DangerFeignClient; ...@@ -25,6 +25,7 @@ import com.yeejoin.amos.supervision.business.feign.DangerFeignClient;
import com.yeejoin.amos.supervision.business.feign.JCSFeignClient; import com.yeejoin.amos.supervision.business.feign.JCSFeignClient;
import com.yeejoin.amos.supervision.business.service.intfc.ICheckReportService; import com.yeejoin.amos.supervision.business.service.intfc.ICheckReportService;
import com.yeejoin.amos.supervision.business.service.intfc.IPlanService; import com.yeejoin.amos.supervision.business.service.intfc.IPlanService;
import com.yeejoin.amos.supervision.business.service.intfc.IPlanTaskService;
import com.yeejoin.amos.supervision.common.enums.DangerCheckTypeLevelEnum; import com.yeejoin.amos.supervision.common.enums.DangerCheckTypeLevelEnum;
import com.yeejoin.amos.supervision.common.enums.PlanCheckLevelEnum; import com.yeejoin.amos.supervision.common.enums.PlanCheckLevelEnum;
import com.yeejoin.amos.supervision.common.enums.PlanFrequencyEnum; import com.yeejoin.amos.supervision.common.enums.PlanFrequencyEnum;
...@@ -84,6 +85,9 @@ public class CheckReportServiceImpl extends BaseService<CheckReportDto, CheckRep ...@@ -84,6 +85,9 @@ public class CheckReportServiceImpl extends BaseService<CheckReportDto, CheckRep
HiddenDangerMapper hiddenDangerMapper; HiddenDangerMapper hiddenDangerMapper;
@Autowired @Autowired
CheckMapper checkMapper;
@Autowired
IPlanDao planDao; IPlanDao planDao;
@Autowired @Autowired
...@@ -142,6 +146,14 @@ public class CheckReportServiceImpl extends BaseService<CheckReportDto, CheckRep ...@@ -142,6 +146,14 @@ public class CheckReportServiceImpl extends BaseService<CheckReportDto, CheckRep
// 获取复查信息 // 获取复查信息
getReviewInfo(checkReport); getReviewInfo(checkReport);
List<Check> list = checkMapper.getCheckByTaskId(String.valueOf(planTask.getId()));
//拿去第一条和最后一条检查记录给检查时间赋值
if (list != null){
Check check = list.get(0);
Check check1 = list.get(list.size() - 1);
checkReport.setEndCheckDate(check.getCheckTime());
checkReport.setStartCheckDate(check1.getCheckTime());
}
checkReportMapper.insert(checkReport); checkReportMapper.insert(checkReport);
} }
} }
......
...@@ -149,6 +149,11 @@ ...@@ -149,6 +149,11 @@
</choose> </choose>
</select> </select>
<select id="getCheckByTaskId" resultType="com.yeejoin.amos.supervision.dao.entity.Check">
select * from p_check where plan_task_id = #{taskId} order by check_time DESC
</select>
<select id="queryUnqualifiedInputItem" resultType="Map" parameterType="int"> <select id="queryUnqualifiedInputItem" resultType="Map" parameterType="int">
SELECT SELECT
ii.name, ii.name,
......
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