删除无用代码
This commit is contained in:
parent
13e81b0a80
commit
7ff3bef2b3
@ -1,8 +1,6 @@
|
|||||||
package com.xkrs.controller;
|
package com.xkrs.controller;
|
||||||
|
|
||||||
import com.xkrs.common.encapsulation.PromptMessageEnum;
|
import com.xkrs.common.encapsulation.PromptMessageEnum;
|
||||||
import com.xkrs.dao.CityDao;
|
|
||||||
import com.xkrs.dao.CountyDao;
|
|
||||||
import com.xkrs.dao.StreetDao;
|
import com.xkrs.dao.StreetDao;
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@ -19,12 +17,6 @@ import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulat
|
|||||||
@RestController
|
@RestController
|
||||||
public class StreetController {
|
public class StreetController {
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CityDao cityDao;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CountyDao countyDao;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private StreetDao streetDao;
|
private StreetDao streetDao;
|
||||||
|
|
||||||
|
@ -1,13 +1,7 @@
|
|||||||
package com.xkrs.controller;
|
package com.xkrs.controller;
|
||||||
|
|
||||||
import cn.hutool.core.io.IoUtil;
|
|
||||||
import com.xkrs.common.encapsulation.PromptMessageEnum;
|
import com.xkrs.common.encapsulation.PromptMessageEnum;
|
||||||
import com.xkrs.dao.CityDao;
|
|
||||||
import com.xkrs.dao.CountyDao;
|
|
||||||
import com.xkrs.dao.StreetDao;
|
import com.xkrs.dao.StreetDao;
|
||||||
import com.xkrs.model.entity.CityEntity;
|
|
||||||
import com.xkrs.model.entity.CountyEntity;
|
|
||||||
import com.xkrs.model.entity.StreetEntity;
|
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@ -15,14 +9,9 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
||||||
|
|
||||||
@ -30,12 +19,6 @@ import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulat
|
|||||||
@RequestMapping(value = "/api/adm")
|
@RequestMapping(value = "/api/adm")
|
||||||
public class StreettController {
|
public class StreettController {
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CityDao cityDao;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CountyDao countyDao;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private StreetDao streetDao;
|
private StreetDao streetDao;
|
||||||
|
|
||||||
@ -92,51 +75,4 @@ public class StreettController {
|
|||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, streetList, locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, streetList, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/formatStreetData")
|
|
||||||
public String formatStreetData() {
|
|
||||||
File file = new File("/Users/liuchengqian/Downloads/Administrative-divisions-of-China-master/dist/streets2.csv");
|
|
||||||
FileInputStream fileInputStream = IoUtil.toStream(file);
|
|
||||||
BufferedReader reader = IoUtil.getReader(fileInputStream, "UTF-8");
|
|
||||||
Stream<String> lines = reader.lines();
|
|
||||||
AtomicInteger count = new AtomicInteger();
|
|
||||||
lines.forEach(content -> {
|
|
||||||
try {
|
|
||||||
content = content.replace("\"", "");
|
|
||||||
String[] split = content.split(",");
|
|
||||||
StreetEntity streetEntity = new StreetEntity();
|
|
||||||
streetEntity.setProCode(split[3] + "0000");
|
|
||||||
List<CityEntity> byProCode1 = cityDao.findByProCode(streetEntity.getProCode());
|
|
||||||
if (byProCode1 == null || byProCode1.isEmpty()) {
|
|
||||||
streetEntity.setProName("");
|
|
||||||
} else {
|
|
||||||
streetEntity.setProName(byProCode1.get(0).getProName());
|
|
||||||
}
|
|
||||||
streetEntity.setCityCode(split[4] + "00");
|
|
||||||
List<CountyEntity> byCityCode1 = countyDao.findByCityCode(streetEntity.getCityCode());
|
|
||||||
if (byCityCode1 == null || byCityCode1.isEmpty()) {
|
|
||||||
streetEntity.setCityName("");
|
|
||||||
} else {
|
|
||||||
streetEntity.setCityName(byCityCode1.get(0).getCityName());
|
|
||||||
}
|
|
||||||
streetEntity.setCountyCode(split[2]);
|
|
||||||
List<CountyEntity> byCountyCode = countyDao.findByCountyCode(streetEntity.getCountyCode());
|
|
||||||
if (byCountyCode == null || byCountyCode.isEmpty()) {
|
|
||||||
streetEntity.setCountyName("");
|
|
||||||
} else {
|
|
||||||
streetEntity.setCountyName(byCountyCode.get(0).getCountyName());
|
|
||||||
}
|
|
||||||
streetEntity.setStreetCode(split[0]);
|
|
||||||
streetEntity.setStreetName(split[1]);
|
|
||||||
streetDao.save(streetEntity);
|
|
||||||
count.getAndIncrement();
|
|
||||||
System.out.println(content + " >>> " + count);
|
|
||||||
System.out.println(streetEntity.toString());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
System.out.println("格式化街道数据时发生异常:" + e.getMessage());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return "666";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
package com.xkrs.dao;
|
|
||||||
|
|
||||||
import com.xkrs.model.entity.CityEntity;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author xkrs
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public interface CityDao extends JpaRepository<CityEntity, Long>, JpaSpecificationExecutor<CityEntity> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询所有市和对应的编码
|
|
||||||
*
|
|
||||||
* @param code
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Query(value = "select city_name cityname,city_code citycode from city where pro_code = :code", nativeQuery = true)
|
|
||||||
List<Map<String, Object>> selectCityName(String code);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据省编码查询信息
|
|
||||||
*
|
|
||||||
* @param proCode
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<CityEntity> findByProCode(String proCode);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据省名称查询信息
|
|
||||||
*
|
|
||||||
* @param proName
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<CityEntity> findByProName(String proName);
|
|
||||||
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
package com.xkrs.dao;
|
|
||||||
|
|
||||||
import com.xkrs.model.entity.CountyEntity;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author XinYi Song
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public interface CountyDao extends JpaRepository<CountyEntity, Long> {
|
|
||||||
/**
|
|
||||||
* 查询市包含的区县和编码
|
|
||||||
*
|
|
||||||
* @param code
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Query(value = "select county_name cityname,county_code citycode from county where city_code = :code", nativeQuery = true)
|
|
||||||
List<Map<String, Object>> selectCountyName(String code);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据市编码查询信息
|
|
||||||
*
|
|
||||||
* @param cityCode
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<CountyEntity> findByCityCode(String cityCode);
|
|
||||||
|
|
||||||
List<CountyEntity> findByCityName(String cityName);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据countyCode查询信息
|
|
||||||
*
|
|
||||||
* @param countyCode
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<CountyEntity> findByCountyCode(String countyCode);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据县名称查询信息
|
|
||||||
*
|
|
||||||
* @param countyName
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<CountyEntity> findByCountyName(String countyName);
|
|
||||||
|
|
||||||
}
|
|
@ -19,17 +19,11 @@ public interface FirePointDao extends JpaRepository<FirePointEntity, Long>, JpaS
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据火点编码查询火点信息
|
* 根据火点编码查询火点信息
|
||||||
*
|
|
||||||
* @param fireCode
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
FirePointEntity findByFireCode(String fireCode);
|
FirePointEntity findByFireCode(String fireCode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据火点编码修改火点状态
|
* 根据火点编码修改火点状态
|
||||||
*
|
|
||||||
* @param fireCode
|
|
||||||
* @param fireType
|
|
||||||
*/
|
*/
|
||||||
@Modifying(clearAutomatically = true)
|
@Modifying(clearAutomatically = true)
|
||||||
@Query(value = "UPDATE fire_point SET fire_type = ?2 WHERE fire_code = ?1", nativeQuery = true)
|
@Query(value = "UPDATE fire_point SET fire_type = ?2 WHERE fire_code = ?1", nativeQuery = true)
|
||||||
@ -37,9 +31,6 @@ public interface FirePointDao extends JpaRepository<FirePointEntity, Long>, JpaS
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据火点编码修改审核火点状态
|
* 根据火点编码修改审核火点状态
|
||||||
*
|
|
||||||
* @param fireCode
|
|
||||||
* @param auditFireType
|
|
||||||
*/
|
*/
|
||||||
@Modifying(clearAutomatically = true)
|
@Modifying(clearAutomatically = true)
|
||||||
@Query(value = "UPDATE fire_point SET audit_fire_type = ?2 WHERE fire_code = ?1", nativeQuery = true)
|
@Query(value = "UPDATE fire_point SET audit_fire_type = ?2 WHERE fire_code = ?1", nativeQuery = true)
|
||||||
@ -47,54 +38,36 @@ public interface FirePointDao extends JpaRepository<FirePointEntity, Long>, JpaS
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询时间段内各植被类型的火点数量
|
* 查询时间段内各植被类型的火点数量
|
||||||
*
|
|
||||||
* @param startTime
|
|
||||||
* @param endTime
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@Query(value = "select la.land_name landname,count(fp.id) as num from land la left join fire_point fp " + "on fp.land_type = la.land_name AND fp.add_time BETWEEN ?1 AND ?2 " + "group by la.land_name", nativeQuery = true)
|
@Query(value = "select la.land_name landname,count(fp.id) as num from land la left join fire_point fp on fp.land_type = la.land_name AND fp.add_time BETWEEN ?1 AND ?2 group by la.land_name", nativeQuery = true)
|
||||||
List<Map<String, Object>> selectNumByLandType(String startTime, String endTime);
|
List<Map<String, Object>> selectNumByLandType(String startTime, String endTime);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询时间段内各地区的火点数量
|
* 查询时间段内各地区的火点数量
|
||||||
*
|
|
||||||
* @param startTime
|
|
||||||
* @param endTime
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@Query(value = "select ci.city_name cityname,count(fp.id) from city ci left join fire_point fp " + "on fp.county_code like concat('%',ci.city_code,'%') AND fp.add_time BETWEEN ?1 AND ?2 " + "group by ci.city_name", nativeQuery = true)
|
@Query(value = "select ci.city_name cityname,count(fp.id) from city ci left join fire_point fp " + "on fp.county_code like concat('%',ci.city_code,'%') AND fp.add_time BETWEEN ?1 AND ?2 " + "group by ci.city_name", nativeQuery = true)
|
||||||
List<Map<String, Object>> selectNumByArea(String startTime, String endTime);
|
List<Map<String, Object>> selectNumByArea(String startTime, String endTime);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询水体类型的id
|
* 查询水体类型的id
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@Query(value = "select id from fire_point where land_type = '水体'", nativeQuery = true)
|
@Query(value = "select id from fire_point where land_type = '水体'", nativeQuery = true)
|
||||||
List<Integer> selectId();
|
List<Integer> selectId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除水体
|
* 批量删除水体
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
*/
|
*/
|
||||||
@Modifying(clearAutomatically = true)
|
@Modifying(clearAutomatically = true)
|
||||||
void deleteByIdIn(List<Integer> id);
|
void deleteByIdIn(List<Integer> id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询北京的火点
|
* 查询北京的火点
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@Query(value = "select * from fire_point fp where fp.fire_point_address like concat('%','北京市','%') and fp.add_time BETWEEN '2021-10-19' AND '2021-11-20'", nativeQuery = true)
|
@Query(value = "select * from fire_point fp where fp.fire_point_address like concat('%','北京市','%') and fp.add_time BETWEEN '2021-10-19' AND '2021-11-20'", nativeQuery = true)
|
||||||
List<FirePointEntity> selectBeijing();
|
List<FirePointEntity> selectBeijing();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据火点编码,修改火点前后图片路径
|
* 根据火点编码,修改火点前后图片路径
|
||||||
*
|
|
||||||
* @param fireCode
|
|
||||||
* @param beforeFireImage
|
|
||||||
* @param afterFireImage
|
|
||||||
*/
|
*/
|
||||||
@Modifying(clearAutomatically = true)
|
@Modifying(clearAutomatically = true)
|
||||||
@Query(value = "update fire_point set before_fire_image = ?2,after_fire_image = ?3 where fire_code = ?1", nativeQuery = true)
|
@Query(value = "update fire_point set before_fire_image = ?2,after_fire_image = ?3 where fire_code = ?1", nativeQuery = true)
|
||||||
|
@ -1,137 +0,0 @@
|
|||||||
package com.xkrs.model.entity;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author xkrs
|
|
||||||
*/
|
|
||||||
@Entity
|
|
||||||
@Table(name = "city")
|
|
||||||
public class CityEntity implements Serializable {
|
|
||||||
/**
|
|
||||||
* 主键id
|
|
||||||
*/
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "city_seq_gen")
|
|
||||||
@SequenceGenerator(name = "city_seq_gen", sequenceName = "city_id_seq",allocationSize = 1)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 省名称
|
|
||||||
*/
|
|
||||||
@Column(length = 65, columnDefinition = "varchar(65)")
|
|
||||||
private String proName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 省编码
|
|
||||||
*/
|
|
||||||
@Column(length = 65, columnDefinition = "varchar(65)")
|
|
||||||
private String proCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 市名称
|
|
||||||
*/
|
|
||||||
@Column(length = 65, columnDefinition = "varchar(65)")
|
|
||||||
private String cityName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 市编码
|
|
||||||
*/
|
|
||||||
@Column(length = 65, columnDefinition = "varchar(65)")
|
|
||||||
private String cityCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 市纬度
|
|
||||||
*/
|
|
||||||
@Column(length = 65, columnDefinition = "varchar(65)")
|
|
||||||
private String cityLatitude;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 市经度
|
|
||||||
*/
|
|
||||||
@Column(length = 65, columnDefinition = "varchar(65)")
|
|
||||||
private String cityLongitude;
|
|
||||||
|
|
||||||
public CityEntity() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public CityEntity(Integer id, String proName, String proCode, String cityName, String cityCode, String cityLatitude, String cityLongitude) {
|
|
||||||
this.id = id;
|
|
||||||
this.proName = proName;
|
|
||||||
this.proCode = proCode;
|
|
||||||
this.cityName = cityName;
|
|
||||||
this.cityCode = cityCode;
|
|
||||||
this.cityLatitude = cityLatitude;
|
|
||||||
this.cityLongitude = cityLongitude;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProName() {
|
|
||||||
return proName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProName(String proName) {
|
|
||||||
this.proName = proName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProCode() {
|
|
||||||
return proCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProCode(String proCode) {
|
|
||||||
this.proCode = proCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCityName() {
|
|
||||||
return cityName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCityName(String cityName) {
|
|
||||||
this.cityName = cityName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCityCode() {
|
|
||||||
return cityCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCityCode(String cityCode) {
|
|
||||||
this.cityCode = cityCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCityLatitude() {
|
|
||||||
return cityLatitude;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCityLatitude(String cityLatitude) {
|
|
||||||
this.cityLatitude = cityLatitude;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCityLongitude() {
|
|
||||||
return cityLongitude;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCityLongitude(String cityLongitude) {
|
|
||||||
this.cityLongitude = cityLongitude;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "City{" +
|
|
||||||
"id=" + id +
|
|
||||||
", proName='" + proName + '\'' +
|
|
||||||
", proCode='" + proCode + '\'' +
|
|
||||||
", cityName='" + cityName + '\'' +
|
|
||||||
", cityCode='" + cityCode + '\'' +
|
|
||||||
", cityLatitude='" + cityLatitude + '\'' +
|
|
||||||
", cityLongitude='" + cityLongitude + '\'' +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,104 +0,0 @@
|
|||||||
package com.xkrs.model.entity;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author XinYi Song
|
|
||||||
*/
|
|
||||||
@Entity
|
|
||||||
@Table(name = "county")
|
|
||||||
public class CountyEntity {
|
|
||||||
/**
|
|
||||||
* 主键id
|
|
||||||
*/
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "county_seq_gen")
|
|
||||||
@SequenceGenerator(name = "county_seq_gen", sequenceName = "county_id_seq",allocationSize = 1)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 区县编码
|
|
||||||
*/
|
|
||||||
@Column(length = 65, columnDefinition = "varchar(65)")
|
|
||||||
private String countyCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 区县名称
|
|
||||||
*/
|
|
||||||
@Column(length = 65, columnDefinition = "varchar(65)")
|
|
||||||
private String countyName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 城市编码
|
|
||||||
*/
|
|
||||||
@Column(length = 65, columnDefinition = "varchar(65)")
|
|
||||||
private String cityCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 城市名称
|
|
||||||
*/
|
|
||||||
@Column(length = 65, columnDefinition = "varchar(65)")
|
|
||||||
private String cityName;
|
|
||||||
|
|
||||||
public CountyEntity() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public CountyEntity(Integer id, String countyCode, String countyName, String cityCode, String cityName) {
|
|
||||||
this.id = id;
|
|
||||||
this.countyCode = countyCode;
|
|
||||||
this.countyName = countyName;
|
|
||||||
this.cityCode = cityCode;
|
|
||||||
this.cityName = cityName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCountyCode() {
|
|
||||||
return countyCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCountyCode(String countyCode) {
|
|
||||||
this.countyCode = countyCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCountyName() {
|
|
||||||
return countyName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCountyName(String countyName) {
|
|
||||||
this.countyName = countyName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCityCode() {
|
|
||||||
return cityCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCityCode(String cityCode) {
|
|
||||||
this.cityCode = cityCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCityName() {
|
|
||||||
return cityName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCityName(String cityName) {
|
|
||||||
this.cityName = cityName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "CountyEntity{" +
|
|
||||||
"id=" + id +
|
|
||||||
", countyCode='" + countyCode + '\'' +
|
|
||||||
", countyName='" + countyName + '\'' +
|
|
||||||
", cityCode='" + cityCode + '\'' +
|
|
||||||
", cityName='" + cityName + '\'' +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
|
@ -10,7 +10,6 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author XinYi Song
|
* @author XinYi Song
|
||||||
@ -106,22 +105,6 @@ public interface FirePointService {
|
|||||||
*/
|
*/
|
||||||
String selectFirePointNumWeek();
|
String selectFirePointNumWeek();
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询该省所有的市
|
|
||||||
*
|
|
||||||
* @param code
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<Map<String, Object>> selectCityName(String code);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询市包含的区县和编码
|
|
||||||
*
|
|
||||||
* @param code
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<Map<String, Object>> selectCountyName(String code);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新火点的街道编号数据
|
* 更新火点的街道编号数据
|
||||||
*
|
*
|
||||||
|
@ -73,12 +73,6 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
@Resource
|
@Resource
|
||||||
private FireTaskPhotoDao fireTaskPhotoDao;
|
private FireTaskPhotoDao fireTaskPhotoDao;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CityDao cityDao;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CountyDao countyDao;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private StreetDao streetDao;
|
private StreetDao streetDao;
|
||||||
|
|
||||||
@ -744,28 +738,6 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, map, locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, map, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询该省所有的市
|
|
||||||
*
|
|
||||||
* @param code
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<Map<String, Object>> selectCityName(String code) {
|
|
||||||
return cityDao.selectCityName(code);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询市包含的区县和编码
|
|
||||||
*
|
|
||||||
* @param code
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<Map<String, Object>> selectCountyName(String code) {
|
|
||||||
return countyDao.selectCountyName(code);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新火点的街道编号数据
|
* 更新火点的街道编号数据
|
||||||
*
|
*
|
||||||
|
@ -51,12 +51,6 @@ public class SysUserServiceImpl implements SysUserService {
|
|||||||
@Resource
|
@Resource
|
||||||
private NationwideDao nationwideDao;
|
private NationwideDao nationwideDao;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CityDao cityDao;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CountyDao countyDao;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private StreetDao streetDao;
|
private StreetDao streetDao;
|
||||||
|
|
||||||
@ -109,47 +103,46 @@ public class SysUserServiceImpl implements SysUserService {
|
|||||||
if (TextUtils.isEmpty(countyName)) {
|
if (TextUtils.isEmpty(countyName)) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "省市区街道名称不能为空!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "省市区街道名称不能为空!", locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (9 == countyCode.length()) {
|
if (9 == countyCode.length()) {
|
||||||
List<StreetEntity> byStreetCode = streetDao.findByStreetCode(countyCode);
|
List<StreetEntity> streetCodeList = streetDao.findByStreetCode(countyCode);
|
||||||
if (byStreetCode == null || byStreetCode.isEmpty()) {
|
if (streetCodeList == null || streetCodeList.isEmpty()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "街道编码不存在!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "街道编码不存在!", locale);
|
||||||
}
|
}
|
||||||
List<StreetEntity> byStreetName = streetDao.findByStreetName(countyName);
|
List<StreetEntity> streetNameList = streetDao.findByStreetName(countyName);
|
||||||
if (byStreetName == null || byStreetName.isEmpty()) {
|
if (streetNameList == null || streetNameList.isEmpty()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
||||||
}
|
}
|
||||||
sysUserEntity.setActiveFlag(0);
|
sysUserEntity.setActiveFlag(0);
|
||||||
sysUserEntity.setAccountType("街道级");
|
sysUserEntity.setAccountType("街道级");
|
||||||
} else if ("0000".equals(countyCode.substring(2))) {
|
} else if ("0000".equals(countyCode.substring(2))) {
|
||||||
List<CityEntity> byProCode = cityDao.findByProCode(countyCode);
|
List<StreetEntity> proCodeList = streetDao.findByProCode(countyCode);
|
||||||
if (byProCode == null || byProCode.size() == 0) {
|
if (proCodeList == null || proCodeList.size() == 0) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "省编码不存在!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "省编码不存在!", locale);
|
||||||
}
|
}
|
||||||
List<CityEntity> byProName = cityDao.findByProName(countyName);
|
List<StreetEntity> proNameList = streetDao.findByProName(countyName);
|
||||||
if (byProName == null || byProName.size() == 0) {
|
if (proNameList == null || proNameList.size() == 0) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
||||||
}
|
}
|
||||||
sysUserEntity.setActiveFlag(1);
|
sysUserEntity.setActiveFlag(1);
|
||||||
sysUserEntity.setAccountType("省级");
|
sysUserEntity.setAccountType("省级");
|
||||||
} else if ("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))) {
|
} else if ("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))) {
|
||||||
List<CountyEntity> byCityCode = countyDao.findByCityCode(countyCode);
|
List<StreetEntity> cityCodeList = streetDao.findByCityCode(countyCode);
|
||||||
if (byCityCode == null || byCityCode.size() == 0) {
|
if (cityCodeList == null || cityCodeList.size() == 0) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "市编码不存在!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "市编码不存在!", locale);
|
||||||
}
|
}
|
||||||
List<CountyEntity> byCityName = countyDao.findByCityName(countyName);
|
List<StreetEntity> cityNameList = streetDao.findByCityName(countyName);
|
||||||
if (byCityName == null || byCityName.size() == 0) {
|
if (cityNameList == null || cityNameList.size() == 0) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
||||||
}
|
}
|
||||||
sysUserEntity.setActiveFlag(1);
|
sysUserEntity.setActiveFlag(1);
|
||||||
sysUserEntity.setAccountType("市级");
|
sysUserEntity.setAccountType("市级");
|
||||||
} else {
|
} else {
|
||||||
List<CountyEntity> byCountyCode = countyDao.findByCountyCode(countyCode);
|
List<StreetEntity> countyCodeList = streetDao.findByCountyCode(countyCode);
|
||||||
if (byCountyCode == null || byCountyCode.isEmpty()) {
|
if (countyCodeList == null || countyCodeList.isEmpty()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "区县编码不存在!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "区县编码不存在!", locale);
|
||||||
}
|
}
|
||||||
List<CountyEntity> byCountyName = countyDao.findByCountyName(countyName);
|
List<StreetEntity> countyNameList = streetDao.findByCountyName(countyName);
|
||||||
if (byCountyName == null || byCountyName.isEmpty()) {
|
if (countyNameList == null || countyNameList.isEmpty()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
||||||
}
|
}
|
||||||
sysUserEntity.setActiveFlag(0);
|
sysUserEntity.setActiveFlag(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user