修复特殊情况下火点过滤混乱的错误

This commit is contained in:
liuchengqian 2022-09-16 13:59:12 +08:00
parent b1c4bba2aa
commit 19647254f8
6 changed files with 44 additions and 13 deletions

View File

@ -35,6 +35,7 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers(HttpMethod.OPTIONS).permitAll()
.antMatchers("/global/configuration/**").permitAll()
.antMatchers("/push/**").permitAll()
.antMatchers("/queryFirePoint").permitAll()
.antMatchers(HttpMethod.GET, "/selectGlobalConfigDict").permitAll()
.antMatchers(HttpMethod.GET, "/selectGlobalConfigValue").permitAll()
.antMatchers(HttpMethod.GET, "/selectGlobalConfig").permitAll()

View File

@ -178,6 +178,21 @@ public class FirePointController {
return firePointService.downloadVipUserFilePoint(request, response);
}
/**
* 动态多条件查询火点列表
*
* @param code 区划编码可以是省市区县街道任意编码如果传需要至少两位不传代表查询全国火点
* @param startTime 过滤火点开始卫星时间不传代表不指定开始时间后台会有限制
* @param endTime 过滤火点结束卫星时间不传代表不指定结束时间
* @param satelliteType 过滤传感器类型不传代表查询全部类型的传感器
* @param landType 过滤地物类型不传代表查询全部地物类型
* @return 符合条件的火点列表
*/
@GetMapping("/queryFirePoint")
public List<FirePointEntity> queryFirePoint(@RequestParam(value = "code", required = false) String code, @RequestParam(value = "startTime", required = false) String startTime, @RequestParam(value = "endTime", required = false) String endTime, @RequestParam(value = "satelliteType", required = false) String satelliteType, @RequestParam(value = "landType", required = false) String landType) {
return firePointService.queryFirePoint(code, startTime, endTime, satelliteType, landType);
}
/**
* 更新火点的街道编号数据
*

View File

@ -1,7 +1,6 @@
package com.xkrs.service;
import com.xkrs.model.entity.FirePointEntity;
import com.xkrs.model.entity.ShanDongFirePointEntity;
import com.xkrs.model.qo.FirePointQo;
import com.xkrs.model.vo.AppTaskBodyVo;
import org.springframework.web.multipart.MultipartFile;
@ -126,4 +125,7 @@ public interface FirePointService {
* @param response
*/
String downloadVipUserFilePoint(HttpServletRequest request, HttpServletResponse response);
List<FirePointEntity> queryFirePoint(String code, String startTime, String endTime, String satelliteType, String landType);
}

View File

@ -404,8 +404,8 @@ public class FirePointServiceImpl implements FirePointService {
for (CountyCodeWeiXinEntity countyCodeWeiXin : countyCodeWeiXinList) {
try {
if ((countyCodeWeiXin.getSendState() != null) && (countyCodeWeiXin.getSendState() != 0)) {
String codeNotZeroEnd = FirePointCodeUtils.getCodeNotZeroEnd(countyCodeWeiXin.getCountyCode());
if (firePointEntity.getStreetCode().startsWith(codeNotZeroEnd)) {
String formatCutCode = FirePointCodeUtils.getFormatCutCode(countyCodeWeiXin.getCountyCode());
if (firePointEntity.getStreetCode().startsWith(formatCutCode)) {
weixinIdList.add(countyCodeWeiXin.getWeixinId());
}
}
@ -476,6 +476,11 @@ public class FirePointServiceImpl implements FirePointService {
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "ok", locale);
}
@Override
public List<FirePointEntity> queryFirePoint(String code, String startTime, String endTime, String satelliteType, String landType) {
return firePointQueryHelper.queryFirePoint(code, startTime, endTime, satelliteType, landType);
}
/**
* 查询今天的火点信息
*/

View File

@ -3,6 +3,7 @@ package com.xkrs.utils;
import com.xkrs.model.entity.AgentOrgEntity;
import com.xkrs.model.entity.RelRoleAuthorityEntity;
import com.xkrs.model.entity.SysUserEntity;
import org.apache.hc.core5.util.TextUtils;
import java.time.LocalDateTime;
import java.util.ArrayList;
@ -15,12 +16,19 @@ public class FirePointCodeUtils {
private FirePointCodeUtils() {
}
public static String getCodeNotZeroEnd(String code) throws Exception {
String codeNotZeroEnd = code.trim();
while (codeNotZeroEnd.length() > 2 && codeNotZeroEnd.endsWith("0")) {
codeNotZeroEnd = codeNotZeroEnd.substring(0, codeNotZeroEnd.length() - 1);
public static String getFormatCutCode(String code) throws Exception {
String formatCutCode = code.trim();
while ((!TextUtils.isEmpty(formatCutCode)) && (formatCutCode.endsWith("0"))) {
formatCutCode = formatCutCode.substring(0, formatCutCode.length() - 1).trim();
}
return codeNotZeroEnd;
int length = formatCutCode.length();
if (1 == length || 3 == length || 5 == length || 8 == length) {
return formatCutCode + "0";
}
if (7 == length) {
return length + "00";
}
return formatCutCode;
}
/**
@ -40,8 +48,8 @@ public class FirePointCodeUtils {
}
for (SysUserEntity sysUser : sysUserList) {
try {
String codeNotZeroEnd = FirePointCodeUtils.getCodeNotZeroEnd(sysUser.getCountyCode());
if (firePointStreetCode.startsWith(codeNotZeroEnd)) {
String formatCutCode = FirePointCodeUtils.getFormatCutCode(sysUser.getCountyCode());
if (firePointStreetCode.startsWith(formatCutCode)) {
if (sysUser.getDeleteFlag() != 0) {//被删除的用户不发短信
continue;
}

View File

@ -29,9 +29,9 @@ public class FirePointQueryHelper {
//添加区划编码查询条件
if (!TextUtils.isEmpty(code)) {
try {
String codeNotZeroEnd = FirePointCodeUtils.getCodeNotZeroEnd(code);
if (!TextUtils.isEmpty(codeNotZeroEnd)) {
predicateList.add(criteriaBuilder.like(root.get("streetCode").as(String.class), codeNotZeroEnd + "%"));
String formatCutCode = FirePointCodeUtils.getFormatCutCode(code);
if (!TextUtils.isEmpty(formatCutCode)) {
predicateList.add(criteriaBuilder.like(root.get("streetCode").as(String.class), formatCutCode + "%"));
}
} catch (Exception e) {
e.printStackTrace();