优化查询接口
This commit is contained in:
parent
c3c96456c4
commit
2721cb2326
@ -8,11 +8,11 @@ import com.xkrs.model.entity.FirePointOrdinaryEntity;
|
||||
import com.xkrs.model.entity.FirePointPreciseEntity;
|
||||
import com.xkrs.model.entity.SysUserEntity;
|
||||
import com.xkrs.model.vo.AllFirePointVo;
|
||||
import com.xkrs.utilsnew.DateTimeUtils;
|
||||
import com.xkrs.utilsnew.FirePointCodeUtils;
|
||||
import com.xkrs.utilsnew.FirePointConvertUtils;
|
||||
import com.xkrs.utilsnew.JsonUtils;
|
||||
import com.xkrs.utilsold.DateTimeUtil;
|
||||
import com.xkrs.utilsnew.DateTimeUtils;
|
||||
import com.xkrs.utilsnew.FirePointCodeUtils;
|
||||
import org.apache.hc.core5.util.TextUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -57,35 +57,19 @@ public class FirePointQueryManager {
|
||||
}
|
||||
|
||||
public FirePointQueryResultBean queryFirePointBelongToUser(SysUserEntity sysUserEntity, String userSubAreaCountyCode, String startTime, String endTime, String satelliteType, String landType) {
|
||||
String countyCode = sysUserEntity.getCountyCode();
|
||||
String countyCode = ("管理员".equals(sysUserEntity.getAccountType())) ? null : sysUserEntity.getCountyCode();
|
||||
String vipTimeRangeJson = sysUserEntity.getVipTimeRangeJson();
|
||||
return queryFirePointBelongToUser(countyCode, vipTimeRangeJson, userSubAreaCountyCode, startTime, endTime, satelliteType, landType);
|
||||
}
|
||||
|
||||
public FirePointQueryResultBean queryFirePointBelongToUser(String userCode, String vipTimeRangeJson, String userSubAreaCountyCode, String startTime, String endTime, String satelliteType, String landType) {
|
||||
|
||||
String mNoRedundantUserCode = null;
|
||||
String noRedundantUserCode = null;
|
||||
String userSubAreaCutCountyCode = null;
|
||||
final List<VipTimeRangeBean.VipTimeRangeItemBean> mVipTimeRangeItemList = new ArrayList<>();
|
||||
String mUserSubAreaCutCountyCode = null;
|
||||
try {
|
||||
//如果用户注册的区划编码是空,就返回失败
|
||||
if (TextUtils.isEmpty(userCode)) {
|
||||
return new FirePointQueryResultBean("User CountyCode Error 1, userCode = " + userCode);
|
||||
}
|
||||
//对用户区划编码进行格式化,获得没有冗余数据的区划编码
|
||||
mNoRedundantUserCode = FirePointCodeUtils.getFormatCutCode(userCode);
|
||||
//如果格式化后的用户区划编码是空,就返回失败
|
||||
if (TextUtils.isEmpty(mNoRedundantUserCode)) {
|
||||
return new FirePointQueryResultBean("User CountyCode Error 2, userCode = " + userCode + ", noRedundantUserCode = " + mNoRedundantUserCode);
|
||||
}
|
||||
if (!TextUtils.isEmpty(userSubAreaCountyCode)) {
|
||||
mUserSubAreaCutCountyCode = FirePointCodeUtils.getFormatCutCode(userSubAreaCountyCode);
|
||||
if (!TextUtils.isEmpty(mUserSubAreaCutCountyCode)) {
|
||||
if (!mUserSubAreaCutCountyCode.startsWith(mNoRedundantUserCode)) {
|
||||
return new FirePointQueryResultBean("User SubArea CountyCode 出现错误");
|
||||
}
|
||||
}
|
||||
}
|
||||
noRedundantUserCode = (TextUtils.isEmpty(userCode)) ? null : FirePointCodeUtils.getFormatCutCode(userCode);
|
||||
userSubAreaCutCountyCode = (TextUtils.isEmpty(userSubAreaCountyCode)) ? null : FirePointCodeUtils.getFormatCutCode(userSubAreaCountyCode);
|
||||
//如果用户的VIP时间范围数据是空,就返回失败
|
||||
if (TextUtils.isEmpty(vipTimeRangeJson)) {
|
||||
return new FirePointQueryResultBean("User VipTimeRangeJson Error 1, vipTimeRangeJson = " + vipTimeRangeJson);
|
||||
@ -139,23 +123,14 @@ public class FirePointQueryManager {
|
||||
return new FirePointQueryResultBean(e.getMessage());
|
||||
}
|
||||
|
||||
return queryFirePointBelongToUser(mNoRedundantUserCode, mVipTimeRangeItemList, mUserSubAreaCutCountyCode, startTime, endTime, satelliteType, landType);
|
||||
return queryFirePointBelongToUser(noRedundantUserCode, mVipTimeRangeItemList, userSubAreaCutCountyCode, startTime, endTime, satelliteType, landType);
|
||||
}
|
||||
|
||||
public FirePointQueryResultBean queryFirePointBelongToUser(String noRedundantUserCode, List<VipTimeRangeBean.VipTimeRangeItemBean> vipTimeRangeItemList, String userSubAreaCutCountyCode, String startTime, String endTime, String satelliteType, String landType) {
|
||||
//如果格式化后的用户区划编码是空,就返回失败
|
||||
if (TextUtils.isEmpty(noRedundantUserCode)) {
|
||||
return new FirePointQueryResultBean("User CountyCode Error 2, noRedundantUserCode = " + noRedundantUserCode);
|
||||
}
|
||||
//VIP时间范围发生了异常,返回失败
|
||||
if (vipTimeRangeItemList == null || vipTimeRangeItemList.size() == 0) {
|
||||
return new FirePointQueryResultBean("User VipTimeRangeJson Error 2, 已保存的VIP时间范围出现错误");
|
||||
}
|
||||
if (!TextUtils.isEmpty(userSubAreaCutCountyCode)) {
|
||||
if (!userSubAreaCutCountyCode.startsWith(noRedundantUserCode)) {
|
||||
return new FirePointQueryResultBean("User SubArea CountyCode 出现错误");
|
||||
}
|
||||
}
|
||||
//查询未审核的普通火点
|
||||
Specification<FirePointOrdinaryEntity> specificationOrdinary = (root, criteriaQuery, criteriaBuilder) -> {
|
||||
List<Predicate> predicateList = new ArrayList<>();
|
||||
|
Loading…
Reference in New Issue
Block a user