This commit is contained in:
liuchengqian 2023-03-03 11:02:46 +08:00
parent 60ed3481e8
commit e5164f4766
3 changed files with 39 additions and 5 deletions

View File

@ -38,4 +38,8 @@ public interface FirePointService {
*/
String selectTodayFirePoint(String token, String countyCode);
/**
* 根据火点编码查询火点信息 (Complete)
*/
String selectFirePointByCode(String fireCode);
}

View File

@ -10,11 +10,15 @@ import com.xkrs.model.qo.FirePointQo;
import com.xkrs.model.vo.GaoDeIgGeocodeVo;
import com.xkrs.service.FirePointService;
import com.xkrs.service.StreetService;
import com.xkrs.straw.dao.FirePointOrdinaryDao;
import com.xkrs.straw.dao.SysUserDao;
import com.xkrs.straw.model.bean.FirePointQueryResultBean;
import com.xkrs.straw.model.entity.FirePointOrdinaryEntity;
import com.xkrs.straw.model.entity.SysUserEntity;
import com.xkrs.straw.model.helper.PushHelper;
import com.xkrs.straw.model.helper.SMSHelper;
import com.xkrs.straw.model.vo.AllFirePointVo;
import com.xkrs.straw.utils.FirePointConvertUtils;
import com.xkrs.straw.utils.FirePointQueryManager;
import com.xkrs.utils.*;
import org.apache.hc.core5.util.TextUtils;
@ -23,9 +27,12 @@ import org.slf4j.LoggerFactory;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.persistence.criteria.Predicate;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@ -79,6 +86,8 @@ public class FirePointServiceImpl implements FirePointService {
@Resource
private FirePointQueryManager firePointQueryManager;
@Resource
private FirePointOrdinaryDao firePointOrdinaryDao;
/**
* 添加火点信息
@ -335,4 +344,27 @@ public class FirePointServiceImpl implements FirePointService {
}
}
/**
* 根据火点编码查询火点信息 (Complete)
*/
@Override
public String selectFirePointByCode(String fireCode) {
if (TextUtils.isEmpty(fireCode)) {
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, null, locale);
}
Specification<FirePointOrdinaryEntity> specification = (root, criteriaQuery, criteriaBuilder) -> {
//查询条件集合
List<Predicate> predicateList = new ArrayList<>();
predicateList.add(criteriaBuilder.equal(root.get("fireCode").as(String.class), fireCode));
Predicate[] predicateArray = new Predicate[predicateList.size()];
return criteriaBuilder.and(predicateList.toArray(predicateArray));
};
List<FirePointOrdinaryEntity> firePointOrdinaryList = firePointOrdinaryDao.findAll(specification, Sort.by(Sort.Direction.DESC, "satelliteTime"));
if (firePointOrdinaryList.size() == 1) {
AllFirePointVo firePointVo = FirePointConvertUtils.convert(firePointOrdinaryList.get(0));
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, firePointVo, locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, null, locale);
}
}

View File

@ -2,7 +2,6 @@ package com.xkrs.straw.controller;
import com.xkrs.common.encapsulation.PromptMessageEnum;
import com.xkrs.dao.FirePointDao;
import com.xkrs.model.entity.FirePointEntity;
import com.xkrs.model.qo.FirePointQo;
import com.xkrs.service.FirePointService;
import com.xkrs.service.StreetService;
@ -151,12 +150,11 @@ public class FirePointController {
}
/**
* 根据火点编码查询火点信息
* 根据火点编码查询火点信息 (Complete)
*/
@GetMapping("/selectFirePointByCode")
public String selectFirePoint(@RequestParam("fireCode") String fireCode) {
FirePointEntity byFireCode = firePointDao.findByFireCode(fireCode);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, byFireCode, locale);
public String selectFirePointByCode(@RequestParam("fireCode") String fireCode) {
return firePointService.selectFirePointByCode(fireCode);
}
}