Merge remote-tracking branch 'origin/branch_straw_fire_point_debug' into branch_straw_fire_point

This commit is contained in:
liuchengqian 2023-03-11 11:51:47 +08:00
commit abe7f96d83
2 changed files with 8 additions and 13 deletions

View File

@ -10,10 +10,10 @@ import com.xkrs.model.entity.FirePointOrdinaryEntity;
import com.xkrs.model.qo.AllFirePointQo; import com.xkrs.model.qo.AllFirePointQo;
import com.xkrs.service.DispatchFirePointService; import com.xkrs.service.DispatchFirePointService;
import com.xkrs.service.impl.FirePointServiceImpl; import com.xkrs.service.impl.FirePointServiceImpl;
import org.apache.hc.core5.util.TextUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.data.domain.Sort;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -72,10 +72,11 @@ public class DispatchFirePointController {
// } // }
List<Map<String, String>> maps = streetDao.selectProCityPair(); List<Map<String, String>> maps = streetDao.selectProCityPair();
// List<FirePointOrdinaryEntity> firePointOrdinaryEntityList = firePointOrdinaryDao.findAll(); List<FirePointOrdinaryEntity> firePointOrdinaryEntityList = firePointOrdinaryDao.findAll(Sort.by(Sort.Direction.DESC, "satelliteTime"));
List<FirePointOrdinaryEntity> firePointOrdinaryEntityList = firePointOrdinaryDao.finghjhgfdhjk(); int size = firePointOrdinaryEntityList.size();
List<String> errorList = new ArrayList<>(); List<String> errorList = new ArrayList<>();
for (FirePointOrdinaryEntity firePointOrdinaryEntity : firePointOrdinaryEntityList) { for (int i = 0; i < size; i++) {
FirePointOrdinaryEntity firePointOrdinaryEntity = firePointOrdinaryEntityList.get(i);
String countyCode = firePointOrdinaryEntity.getCountyCode(); String countyCode = firePointOrdinaryEntity.getCountyCode();
String proCode = countyCode.substring(0, 2) + "0000"; String proCode = countyCode.substring(0, 2) + "0000";
firePointOrdinaryEntity.setProCode(proCode); firePointOrdinaryEntity.setProCode(proCode);
@ -83,11 +84,11 @@ public class DispatchFirePointController {
String cityCode = countyCode.substring(0, 4) + "00"; String cityCode = countyCode.substring(0, 4) + "00";
firePointOrdinaryEntity.setCityCode(cityCode); firePointOrdinaryEntity.setCityCode(cityCode);
firePointOrdinaryEntity.setCityName(obtainCityName(maps, cityCode)); firePointOrdinaryEntity.setCityName(obtainCityName(maps, cityCode));
if (TextUtils.isEmpty(firePointOrdinaryEntity.getCountyCode()) || TextUtils.isEmpty(firePointOrdinaryEntity.getCountyName()) || TextUtils.isEmpty(firePointOrdinaryEntity.getCityCode()) || TextUtils.isEmpty(firePointOrdinaryEntity.getCityName()) || TextUtils.isEmpty(firePointOrdinaryEntity.getProCode()) || TextUtils.isEmpty(firePointOrdinaryEntity.getProName())) { firePointOrdinaryDao.save(firePointOrdinaryEntity);
errorList.add(firePointOrdinaryEntity.getFireCode()); if (i % 100 == 0) {
System.out.println(i + "/" + size);
} }
} }
firePointOrdinaryDao.saveAll(firePointOrdinaryEntityList);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, errorList, locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, errorList, locale);
} }

View File

@ -3,14 +3,8 @@ package com.xkrs.dao;
import com.xkrs.model.entity.FirePointOrdinaryEntity; import com.xkrs.model.entity.FirePointOrdinaryEntity;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List;
@Component @Component
public interface FirePointOrdinaryDao extends JpaRepository<FirePointOrdinaryEntity, Long>, JpaSpecificationExecutor<FirePointOrdinaryEntity> { public interface FirePointOrdinaryDao extends JpaRepository<FirePointOrdinaryEntity, Long>, JpaSpecificationExecutor<FirePointOrdinaryEntity> {
@Query(value = "SELECT * FROM fire_point_ordinary ORDER BY satellite_time DESC LIMIT 10000", nativeQuery = true)
List<FirePointOrdinaryEntity> finghjhgfdhjk();
} }