重写用户获取火点数据的接口
This commit is contained in:
parent
cac53e215f
commit
243d90d031
@ -4,29 +4,28 @@ import com.xkrs.straw.dao.FirePointOrdinaryDao;
|
|||||||
import com.xkrs.straw.dao.FirePointPreciseDao;
|
import com.xkrs.straw.dao.FirePointPreciseDao;
|
||||||
import com.xkrs.straw.model.bean.FirePointQueryResultBean;
|
import com.xkrs.straw.model.bean.FirePointQueryResultBean;
|
||||||
import com.xkrs.straw.model.bean.VipTimeRangeBean;
|
import com.xkrs.straw.model.bean.VipTimeRangeBean;
|
||||||
import com.xkrs.straw.model.entity.FirePointOrdinaryEntity;
|
|
||||||
import com.xkrs.straw.model.entity.FirePointPreciseEntity;
|
|
||||||
import com.xkrs.straw.model.entity.SysUserEntity;
|
import com.xkrs.straw.model.entity.SysUserEntity;
|
||||||
import com.xkrs.straw.model.vo.AllFirePointVo;
|
import com.xkrs.straw.model.vo.AllFirePointVo;
|
||||||
import com.xkrs.utils.DateTimeUtil;
|
import com.xkrs.utils.DateTimeUtil;
|
||||||
import com.xkrs.utils.DateTimeUtils;
|
import com.xkrs.utils.DateTimeUtils;
|
||||||
import com.xkrs.utils.FirePointCodeUtils;
|
import com.xkrs.utils.FirePointCodeUtils;
|
||||||
import org.apache.hc.core5.util.TextUtils;
|
import org.apache.hc.core5.util.TextUtils;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.slf4j.Logger;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.persistence.criteria.Predicate;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class FirePointQueryManager {
|
public class FirePointQueryManager {
|
||||||
|
|
||||||
|
public static Logger log = LoggerFactory.getLogger(FirePointQueryManager.class);
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private FirePointOrdinaryDao firePointOrdinaryDao;
|
private FirePointOrdinaryDao firePointOrdinaryDao;
|
||||||
|
|
||||||
@ -106,14 +105,11 @@ public class FirePointQueryManager {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return new FirePointQueryResultBean(false, e.getMessage(), null);
|
return new FirePointQueryResultBean(false, e.getMessage(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
final String finalMNoRedundantUserCode = mNoRedundantUserCode;
|
|
||||||
|
|
||||||
final String commonSql = "SELECT t.id AS id, t.fire_code AS fireCode, t.county_code AS countyCode, t.county_name AS countyName, t.satellite_time AS satelliteTime, t.longitude AS longitude, t.latitude AS latitude, t.satellite_type AS satelliteType, t.land_type AS landType, t.confidence AS confidence, t.fire_image AS fireImage, t.satellite_image AS satelliteImage, t.town_code AS townCode, t.town_name AS townName, t.add_time AS addTime, t.fire_point_address AS firePointAddress, t.remark AS remark";
|
final String commonSql = "SELECT t.id AS id, t.fire_code AS fireCode, t.county_code AS countyCode, t.county_name AS countyName, t.satellite_time AS satelliteTime, t.longitude AS longitude, t.latitude AS latitude, t.satellite_type AS satelliteType, t.land_type AS landType, t.confidence AS confidence, t.fire_image AS fireImage, t.satellite_image AS satelliteImage, t.town_code AS townCode, t.town_name AS townName, t.add_time AS addTime, t.fire_point_address AS firePointAddress, t.remark AS remark";
|
||||||
|
|
||||||
StringBuilder ordinaryBuilder = new StringBuilder(commonSql);
|
StringBuilder ordinaryBuilder = new StringBuilder(commonSql);
|
||||||
ordinaryBuilder.append(" FROM fire_point_ordinary AS t");
|
ordinaryBuilder.append(" FROM fire_point_ordinary AS t");
|
||||||
ordinaryBuilder.append(" WHERE (t.town_code LIKE '" + finalMNoRedundantUserCode + "%')");
|
ordinaryBuilder.append(" WHERE (t.town_code LIKE '" + mNoRedundantUserCode + "%')");
|
||||||
ordinaryBuilder.append(" AND (");
|
ordinaryBuilder.append(" AND (");
|
||||||
for (int i = 0; i < mVipTimeRangeItemList.size(); i++) {
|
for (int i = 0; i < mVipTimeRangeItemList.size(); i++) {
|
||||||
VipTimeRangeBean.VipTimeRangeItemBean vipTimeRangeItem = mVipTimeRangeItemList.get(i);
|
VipTimeRangeBean.VipTimeRangeItemBean vipTimeRangeItem = mVipTimeRangeItemList.get(i);
|
||||||
@ -128,11 +124,12 @@ public class FirePointQueryManager {
|
|||||||
ordinaryBuilder.append(")");
|
ordinaryBuilder.append(")");
|
||||||
ordinaryBuilder.append(" ORDER BY t.satellite_time DESC");
|
ordinaryBuilder.append(" ORDER BY t.satellite_time DESC");
|
||||||
String ordinarySql = ordinaryBuilder.toString();
|
String ordinarySql = ordinaryBuilder.toString();
|
||||||
System.out.println("ordinarySql = " + ordinarySql);
|
log.info(sysUserEntity.getCountyName() + ":ordinarySql:" + ordinarySql);
|
||||||
|
// List<AllFirePointVo> voList1 = firePointOrdinaryDao.customQuery(ordinarySql);
|
||||||
|
|
||||||
StringBuilder preciseBuilder = new StringBuilder(commonSql);
|
StringBuilder preciseBuilder = new StringBuilder(commonSql);
|
||||||
preciseBuilder.append(" FROM fire_point_precise AS t");
|
preciseBuilder.append(" FROM fire_point_precise AS t");
|
||||||
preciseBuilder.append(" WHERE (t.town_code LIKE '" + finalMNoRedundantUserCode + "%')");
|
preciseBuilder.append(" WHERE (t.town_code LIKE '" + mNoRedundantUserCode + "%')");
|
||||||
preciseBuilder.append(" AND (");
|
preciseBuilder.append(" AND (");
|
||||||
for (int i = 0; i < mVipTimeRangeItemList.size(); i++) {
|
for (int i = 0; i < mVipTimeRangeItemList.size(); i++) {
|
||||||
VipTimeRangeBean.VipTimeRangeItemBean vipTimeRangeItem = mVipTimeRangeItemList.get(i);
|
VipTimeRangeBean.VipTimeRangeItemBean vipTimeRangeItem = mVipTimeRangeItemList.get(i);
|
||||||
@ -147,9 +144,17 @@ public class FirePointQueryManager {
|
|||||||
preciseBuilder.append(")");
|
preciseBuilder.append(")");
|
||||||
preciseBuilder.append(" ORDER BY t.satellite_time DESC");
|
preciseBuilder.append(" ORDER BY t.satellite_time DESC");
|
||||||
String preciseSql = preciseBuilder.toString();
|
String preciseSql = preciseBuilder.toString();
|
||||||
System.out.println("preciseSql = " + preciseSql);
|
log.info(sysUserEntity.getCountyName() + ":preciseSql:" + preciseSql);
|
||||||
|
// List<AllFirePointVo> voList2 = firePointPreciseDao.customQuery(preciseSql);
|
||||||
return new FirePointQueryResultBean(true, "", null);
|
//
|
||||||
|
// //将两种数据来源的火点合并到一起
|
||||||
|
// List<AllFirePointVo> resultList = new ArrayList<>();
|
||||||
|
// resultList.addAll(voList1);
|
||||||
|
// resultList.addAll(voList2);
|
||||||
|
// //对合并后的结果进行排序
|
||||||
|
// resultList.sort(Comparator.comparing(AllFirePointVo::getSatelliteTime));
|
||||||
|
//
|
||||||
|
// return new FirePointQueryResultBean(true, "", resultList);
|
||||||
|
|
||||||
// //查询未审核的普通火点
|
// //查询未审核的普通火点
|
||||||
// Specification<FirePointOrdinaryEntity> specificationOrdinary = (root, criteriaQuery, criteriaBuilder) -> {
|
// Specification<FirePointOrdinaryEntity> specificationOrdinary = (root, criteriaQuery, criteriaBuilder) -> {
|
||||||
|
Loading…
Reference in New Issue
Block a user