@@ -143,8 +143,8 @@ public class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseEntity> exte | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult deleteById(Integer id) { | |||
if (id == null || id == 0) { | |||
public JsonResult deleteById(String id) { | |||
if (StringUtils.isEmpty(id)) { | |||
return JsonResult.error("记录ID不能为空"); | |||
} | |||
// 设置Mark=0 |
@@ -81,7 +81,7 @@ public interface IBaseService<T> extends IService<T> { | |||
* @param id 记录ID | |||
* @return | |||
*/ | |||
JsonResult deleteById(Integer id); | |||
JsonResult deleteById(String id); | |||
/** | |||
* 根据ID删除记录 |
@@ -13,6 +13,7 @@ | |||
<packaging>pom</packaging> | |||
<modules> | |||
<module>tuoheng-system-api</module> | |||
<module>tuoheng-task-api</module> | |||
</modules> | |||
</project> |
@@ -0,0 +1,43 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
<parent> | |||
<artifactId>tuoheng-service-api</artifactId> | |||
<groupId>com.tuoheng</groupId> | |||
<version>1.0.0</version> | |||
</parent> | |||
<modelVersion>4.0.0</modelVersion> | |||
<artifactId>tuoheng-task-api</artifactId> | |||
<dependencies> | |||
<!-- 核心基类依赖 --> | |||
<dependency> | |||
<groupId>com.tuoheng</groupId> | |||
<artifactId>tuoheng-common-core</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.springframework.cloud</groupId> | |||
<artifactId>spring-cloud-starter-openfeign</artifactId> | |||
</dependency> | |||
<!--mybatis-plus 起始依赖 --> | |||
<dependency> | |||
<groupId>com.baomidou</groupId> | |||
<artifactId>mybatis-plus-boot-starter</artifactId> | |||
<version>3.2.0</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.projectlombok</groupId> | |||
<artifactId>lombok</artifactId> | |||
<optional>true</optional> | |||
</dependency> | |||
<!-- JSON工具类 --> | |||
<dependency> | |||
<groupId>com.fasterxml.jackson.core</groupId> | |||
<artifactId>jackson-databind</artifactId> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -0,0 +1,21 @@ | |||
package com.tuoheng.task.api.fegin; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.task.api.fegin.vo.CityVo; | |||
import org.springframework.cloud.openfeign.FeignClient; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.PathVariable; | |||
@FeignClient("tuoheng-system") // 要调用服务的名字 | |||
public interface ICityService { | |||
/** | |||
* 根据城市编码获取城市信息 | |||
* | |||
* @param cityCode 城市编码 | |||
* @return | |||
*/ | |||
@GetMapping("/city/getCityInfoByCode") | |||
JsonResult<CityVo> getCityInfoByCode(@PathVariable("cityCode") String cityCode); | |||
} |
@@ -0,0 +1,88 @@ | |||
package com.tuoheng.task.api.fegin.entity; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.tuoheng.common.core.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
* 高德城市表 | |||
* </p> | |||
* | |||
* @author 拓恒 | |||
* @since 2020-11-03 | |||
*/ | |||
@Data | |||
public class City { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 主键 | |||
*/ | |||
private String id; | |||
/** | |||
* 父级编号 | |||
*/ | |||
private String pid; | |||
/** | |||
* 城市级别(1省;2市;3区;4街道;5村;) | |||
*/ | |||
private Integer level; | |||
/** | |||
* 城市名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 城市编号(区号) | |||
*/ | |||
private String citycode; | |||
/** | |||
* 父级地理编号 | |||
*/ | |||
private String pAdcode; | |||
/** | |||
* 地理编号 | |||
*/ | |||
private String adcode; | |||
/** | |||
* 城市坐标中心点经度(* 1e6):如果是中国,此值是 1e7 | |||
*/ | |||
private Integer lng; | |||
/** | |||
* 城市坐标中心点纬度(* 1e6) | |||
*/ | |||
private Integer lat; | |||
/** | |||
* 排序号 | |||
*/ | |||
private Integer sort; | |||
/** | |||
* 是否含有子级 | |||
*/ | |||
@TableField(exist = false) | |||
private boolean hasChildren; | |||
/** | |||
* 行政区 子集 | |||
*/ | |||
@TableField(exist = false) | |||
List<City> itemList; | |||
} |
@@ -0,0 +1,24 @@ | |||
package com.tuoheng.task.api.fegin.fallback; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.task.api.fegin.ICityService; | |||
import com.tuoheng.task.api.fegin.vo.CityVo; | |||
import org.springframework.stereotype.Component; | |||
/** | |||
* 城市服务处理回调处理 | |||
*/ | |||
@Component | |||
public class CityClientFallback implements ICityService { | |||
/** | |||
* 根据城市编码获取城市信息 | |||
* | |||
* @param cityCode 城市编码 | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult<CityVo> getCityInfoByCode(String cityCode) { | |||
return JsonResult.error("城市服务调用失败"); | |||
} | |||
} |
@@ -0,0 +1,144 @@ | |||
package com.tuoheng.task.api.fegin.vo; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import lombok.Data; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.util.Date; | |||
/** | |||
* <p> | |||
* 高德城市表表单Vo | |||
* </p> | |||
* | |||
* @author 拓恒 | |||
* @since 2021-01-07 | |||
*/ | |||
@Data | |||
public class CityVo { | |||
/** | |||
* 高德城市表ID | |||
*/ | |||
private Integer id; | |||
/** | |||
* ID | |||
*/ | |||
private Integer cityId; | |||
/** | |||
* 父级ID | |||
*/ | |||
private Integer pid; | |||
/** | |||
* 层级:1省 2市 3区 | |||
*/ | |||
private Integer level; | |||
/** | |||
* 省市区名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 简称 | |||
*/ | |||
private String simple; | |||
/** | |||
* 拼音 | |||
*/ | |||
private String pinyin; | |||
/** | |||
* 简拼 | |||
*/ | |||
private String code; | |||
/** | |||
* 首字母 | |||
*/ | |||
private String firstChar; | |||
/** | |||
* 原城市ID | |||
*/ | |||
private Integer oldCityId; | |||
/** | |||
* 有无子级:1有 2无 | |||
*/ | |||
private Integer hasChild; | |||
/** | |||
* 显示顺序 | |||
*/ | |||
private Integer sort; | |||
/** | |||
* 1-有效 2-无效 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 创建人 | |||
*/ | |||
private String createUser; | |||
/** | |||
* 更新人 | |||
*/ | |||
private String updateUser; | |||
/** | |||
* 创建时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
private Date createTime; | |||
/** | |||
* 更新时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
private Date updateTime; | |||
/** | |||
* 是否删除 1未删除 0已删除 | |||
*/ | |||
private Integer mark; | |||
/** | |||
* 城市名称(省市区街道村拼接) | |||
*/ | |||
private String cityArea; | |||
/** | |||
* 省份名称 | |||
*/ | |||
private String provinceName; | |||
/** | |||
* 城市名称 | |||
*/ | |||
private String cityName; | |||
/** | |||
* 区县名称 | |||
*/ | |||
private String districtName; | |||
/** | |||
* 街道名称 | |||
*/ | |||
private String streetName; | |||
/** | |||
* 村名称 | |||
*/ | |||
private String villageName; | |||
} |
@@ -0,0 +1,2 @@ | |||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ | |||
com.tuoheng.system.api.feign.fallback.UserClientFallback |
@@ -0,0 +1,116 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> | |||
<component name="FacetManager"> | |||
<facet type="Spring" name="Spring"> | |||
<configuration /> | |||
</facet> | |||
</component> | |||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> | |||
<output url="file://$MODULE_DIR$/target/classes" /> | |||
<output-test url="file://$MODULE_DIR$/target/test-classes" /> | |||
<content url="file://$MODULE_DIR$"> | |||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> | |||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> | |||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> | |||
<excludeFolder url="file://$MODULE_DIR$/target" /> | |||
</content> | |||
<orderEntry type="inheritedJdk" /> | |||
<orderEntry type="sourceFolder" forTests="false" /> | |||
<orderEntry type="module" module-name="tuoheng-common-core" /> | |||
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.76" level="project" /> | |||
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.1.10" level="project" /> | |||
<orderEntry type="library" name="Maven: com.alibaba:druid:1.1.10" level="project" /> | |||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.36" level="project" /> | |||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.12.0" level="project" /> | |||
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.11.1" level="project" /> | |||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.5" level="project" /> | |||
<orderEntry type="library" name="Maven: com.alibaba:easyexcel:1.1.2-beat1" level="project" /> | |||
<orderEntry type="library" name="Maven: org.apache.poi:poi:3.17" level="project" /> | |||
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.15" level="project" /> | |||
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.4" level="project" /> | |||
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:3.17" level="project" /> | |||
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-schemas:3.17" level="project" /> | |||
<orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:2.6.0" level="project" /> | |||
<orderEntry type="library" name="Maven: stax:stax-api:1.0.1" level="project" /> | |||
<orderEntry type="library" name="Maven: com.github.virtuald:curvesapi:1.04" level="project" /> | |||
<orderEntry type="library" name="Maven: cglib:cglib:3.1" level="project" /> | |||
<orderEntry type="library" name="Maven: org.ow2.asm:asm:4.2" level="project" /> | |||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-openfeign:3.1.3" level="project" /> | |||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter:3.1.3" level="project" /> | |||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-context:3.1.3" level="project" /> | |||
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-rsa:1.0.10.RELEASE" level="project" /> | |||
<orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.68" level="project" /> | |||
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.68" level="project" /> | |||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-openfeign-core:3.1.3" level="project" /> | |||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.7.0" level="project" /> | |||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.3.20" level="project" /> | |||
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.7" level="project" /> | |||
<orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form-spring:3.8.0" level="project" /> | |||
<orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form:3.8.0" level="project" /> | |||
<orderEntry type="library" name="Maven: commons-fileupload:commons-fileupload:1.4" level="project" /> | |||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.3.20" level="project" /> | |||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.3.20" level="project" /> | |||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-commons:3.1.3" level="project" /> | |||
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-crypto:5.7.1" level="project" /> | |||
<orderEntry type="library" name="Maven: io.github.openfeign:feign-core:11.8" level="project" /> | |||
<orderEntry type="library" name="Maven: io.github.openfeign:feign-slf4j:11.8" level="project" /> | |||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.2.0" level="project" /> | |||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.2.0" level="project" /> | |||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.2.0" level="project" /> | |||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.2.0" level="project" /> | |||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.2.0" level="project" /> | |||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:2.1" level="project" /> | |||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.2" level="project" /> | |||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.2" level="project" /> | |||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.7.0" level="project" /> | |||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.7.0" level="project" /> | |||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.3.20" level="project" /> | |||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.3.20" level="project" /> | |||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.7.0" level="project" /> | |||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:4.0.3" level="project" /> | |||
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.3.20" level="project" /> | |||
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.3.20" level="project" /> | |||
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.24" level="project" /> | |||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.13.3" level="project" /> | |||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.13.3" level="project" /> | |||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.13.3" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.7.0" level="project" /> | |||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.7.0" level="project" /> | |||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.7.0" level="project" /> | |||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.11" level="project" /> | |||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.11" level="project" /> | |||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.17.2" level="project" /> | |||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.17.2" level="project" /> | |||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.36" level="project" /> | |||
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" /> | |||
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.30" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.7.0" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.7.0" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.7.0" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.4.8" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:2.4.8" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:2.3.3" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: jakarta.activation:jakarta.activation-api:1.2.2" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.22.0" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest:2.2" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter:5.8.2" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.8.2" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.8.2" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.2" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-params:5.8.2" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.8.2" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.8.2" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:4.5.1" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy:1.12.10" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.12.10" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:3.2" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-junit-jupiter:4.5.1" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" /> | |||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.3.20" level="project" /> | |||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.3.20" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.3.20" level="project" /> | |||
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.9.0" level="project" /> | |||
</component> | |||
</module> |
@@ -0,0 +1,41 @@ | |||
package com.tuoheng.system.controller; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.system.api.vo.UserInfo; | |||
import com.tuoheng.system.entity.City; | |||
import com.tuoheng.system.query.CityQuery; | |||
import com.tuoheng.system.service.ICityService; | |||
import com.tuoheng.system.vo.CityInfoVo; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
* 高德城市表 前端控制器 | |||
* </p> | |||
* | |||
* @author 拓恒 | |||
* @since 2020-11-03 | |||
*/ | |||
@RestController | |||
@RequestMapping("/city") | |||
public class CityController { | |||
@Autowired | |||
private ICityService cityService; | |||
/** | |||
* 根据城市编码获取城市信息 | |||
* | |||
* @param cityCode 城市编码 | |||
* @return | |||
*/ | |||
@GetMapping("/getCityInfoByCode") | |||
public JsonResult<CityInfoVo> getCityInfoByCode(String cityCode){ | |||
return cityService.getCityInfoByCode(cityCode); | |||
} | |||
} |
@@ -1,6 +1,7 @@ | |||
package com.tuoheng.system.service; | |||
import com.tuoheng.common.core.common.IBaseService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.system.entity.City; | |||
import com.tuoheng.system.vo.CityInfoVo; | |||
@@ -29,10 +30,9 @@ public interface ICityService extends IBaseService<City> { | |||
* 根据城市编码获取城市信息 | |||
* | |||
* @param cityCode 城市编码 | |||
* @param delimiter 分隔符号 | |||
* @return | |||
*/ | |||
CityInfoVo getCityInfoByCode(String cityCode, String delimiter); | |||
JsonResult<CityInfoVo> getCityInfoByCode(String cityCode); | |||
/** | |||
* 获取行政区列表 |
@@ -159,7 +159,7 @@ public class CityServiceImpl extends BaseServiceImpl<CityMapper, City> implement | |||
} | |||
@Override | |||
public CityInfoVo getCityInfoByCode(String cityCode, String delimiter) { | |||
public JsonResult<CityInfoVo> getCityInfoByCode(String cityCode) { | |||
CityInfoVo cityInfoVo = new CityInfoVo(); | |||
List<String> nameList = new ArrayList<>(); | |||
QueryWrapper<City> queryWrapper = new QueryWrapper<>(); | |||
@@ -182,7 +182,7 @@ public class CityServiceImpl extends BaseServiceImpl<CityMapper, City> implement | |||
} | |||
// 使用集合工具实现数组翻转 | |||
Collections.reverse(nameList); | |||
String cityArea = org.apache.commons.lang3.StringUtils.join(nameList.toArray(), delimiter); | |||
String cityArea = org.apache.commons.lang3.StringUtils.join(nameList.toArray(), ""); | |||
cityInfoVo.setCityArea(cityArea); | |||
if (StringUtils.isNotEmpty(nameList) && nameList.size() > 0) { | |||
cityInfoVo.setProvinceName(nameList.get(0)); | |||
@@ -199,7 +199,7 @@ public class CityServiceImpl extends BaseServiceImpl<CityMapper, City> implement | |||
if (StringUtils.isNotEmpty(nameList) && nameList.size() > 4) { | |||
cityInfoVo.setVillageName(nameList.get(4)); | |||
} | |||
return cityInfoVo; | |||
return JsonResult.success(cityInfoVo); | |||
} | |||
} |
@@ -47,23 +47,11 @@ | |||
<!-- 依赖声明 --> | |||
<dependencies> | |||
<!-- 安全认证依赖 --> | |||
<dependency> | |||
<groupId>com.tuoheng</groupId> | |||
<artifactId>tuoheng-common-security</artifactId> | |||
</dependency> | |||
<!-- 系统API接口模块依赖 --> | |||
<dependency> | |||
<groupId>com.tuoheng</groupId> | |||
<artifactId>tuoheng-system-api</artifactId> | |||
</dependency> | |||
<!-- Spring Security Oauth2 依赖 --> | |||
<dependency> | |||
<groupId>org.springframework.cloud</groupId> | |||
<artifactId>spring-cloud-starter-oauth2</artifactId> | |||
<!-- 此处需要加版本号 --> | |||
<version>2.2.5.RELEASE</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.springframework.cloud</groupId> | |||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> | |||
@@ -95,7 +83,7 @@ | |||
</dependency> | |||
<dependency> | |||
<groupId>com.tuoheng</groupId> | |||
<artifactId>tuoheng-system</artifactId> | |||
<artifactId>tuoheng-task-api</artifactId> | |||
<version>1.0.0</version> | |||
<scope>compile</scope> | |||
</dependency> |
@@ -1,7 +1,11 @@ | |||
package com.tuoheng.task.controller; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.task.entity.CloudBox; | |||
import com.tuoheng.task.query.CloudBoxQuery; | |||
import com.tuoheng.task.service.ICloudBoxService; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* 云盒表 前端控制器 | |||
@@ -12,4 +16,61 @@ import org.springframework.web.bind.annotation.RestController; | |||
@RestController | |||
@RequestMapping("/cloudBox") | |||
public class CloudBoxController { | |||
@Autowired | |||
private ICloudBoxService cloudBoxService; | |||
/** | |||
* 获取云盒分页列表 | |||
* | |||
* @param cloudBoxQuery 查询条件 | |||
* @return | |||
*/ | |||
@GetMapping("/index") | |||
public JsonResult index(CloudBoxQuery cloudBoxQuery) { | |||
return cloudBoxService.getList(cloudBoxQuery); | |||
} | |||
/** | |||
* 添加云盒 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
@PostMapping("/add") | |||
public JsonResult add(@RequestBody CloudBox entity) { | |||
return cloudBoxService.add(entity); | |||
} | |||
/** | |||
* 更新云盒 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
@PutMapping("/edit") | |||
public JsonResult edit(@RequestBody CloudBox entity) { | |||
return cloudBoxService.edit(entity); | |||
} | |||
/** | |||
* 删除云盒 | |||
* | |||
* @param cloudBoxId 云盒ID | |||
* @return | |||
*/ | |||
@DeleteMapping("/delete/{cloudBoxId}") | |||
public JsonResult delete(@PathVariable("cloudBoxId") String cloudBoxId) { | |||
return cloudBoxService.deleteById(cloudBoxId); | |||
} | |||
/** | |||
* 获取云盒列表 | |||
* | |||
* @return | |||
*/ | |||
@GetMapping("/getCloudBoxList") | |||
public JsonResult getCloudBoxList() { | |||
return cloudBoxService.getCloudBoxList(); | |||
} | |||
} |
@@ -0,0 +1,67 @@ | |||
package com.tuoheng.task.controller; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.task.entity.Equipment; | |||
import com.tuoheng.task.query.EquipmentQuery; | |||
import com.tuoheng.task.service.IEquipmentService; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* 飞行设备表 前端控制器 | |||
* | |||
* @author WangHaoran | |||
* @since 2022-06-29 | |||
*/ | |||
@RestController | |||
@RequestMapping("/equipment") | |||
public class EquipmentController { | |||
@Autowired | |||
private IEquipmentService equipmentService; | |||
/** | |||
* 获取飞行设备分页列表 | |||
* | |||
* @param equipmentQuery 查询条件 | |||
* @return | |||
*/ | |||
@GetMapping("/index") | |||
public JsonResult index(EquipmentQuery equipmentQuery) { | |||
return equipmentService.getList(equipmentQuery); | |||
} | |||
/** | |||
* 添加飞行设备 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
@PostMapping("/add") | |||
public JsonResult add(@RequestBody Equipment entity) { | |||
return equipmentService.add(entity); | |||
} | |||
/** | |||
* 更新飞行设备 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
@PutMapping("/edit") | |||
public JsonResult edit(@RequestBody Equipment entity) { | |||
return equipmentService.edit(entity); | |||
} | |||
/** | |||
* 删除飞行设备 | |||
* | |||
* @param equipmentId 飞行设备ID | |||
* @return | |||
*/ | |||
@DeleteMapping("/delete/{equipmentId}") | |||
public JsonResult delete(@PathVariable("equipmentId") String equipmentId) { | |||
return equipmentService.deleteById(equipmentId); | |||
} | |||
} |
@@ -0,0 +1,66 @@ | |||
package com.tuoheng.task.controller; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.task.entity.EquipmentMount; | |||
import com.tuoheng.task.query.EquipmentMountQuery; | |||
import com.tuoheng.task.service.IEquipmentMountService; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* 挂载设备表 前端控制器 | |||
* | |||
* @author WangHaoran | |||
* @since 2022-06-29 | |||
*/ | |||
@RestController | |||
@RequestMapping("/equipmentMount") | |||
public class EquipmentMountController { | |||
@Autowired | |||
private IEquipmentMountService equipmentMountService; | |||
/** | |||
* 获取挂载设备分页列表 | |||
* | |||
* @param equipmentMountQuery 查询条件 | |||
* @return | |||
*/ | |||
@GetMapping("/index") | |||
public JsonResult index(EquipmentMountQuery equipmentMountQuery) { | |||
return equipmentMountService.getList(equipmentMountQuery); | |||
} | |||
/** | |||
* 添加挂载设备 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
@PostMapping("/add") | |||
public JsonResult add(@RequestBody EquipmentMount entity) { | |||
return equipmentMountService.add(entity); | |||
} | |||
/** | |||
* 更新挂载设备 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
@PutMapping("/edit") | |||
public JsonResult edit(@RequestBody EquipmentMount entity) { | |||
return equipmentMountService.edit(entity); | |||
} | |||
/** | |||
* 删除挂载设备 | |||
* | |||
* @param equipmentMountId 挂载设备ID | |||
* @return | |||
*/ | |||
@DeleteMapping("/delete/{equipmentMountId}") | |||
public JsonResult delete(@PathVariable("equipmentMountId") String equipmentMountId) { | |||
return equipmentMountService.deleteById(equipmentMountId); | |||
} | |||
} |
@@ -0,0 +1,66 @@ | |||
package com.tuoheng.task.controller; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.task.entity.Stream; | |||
import com.tuoheng.task.query.StreamQuery; | |||
import com.tuoheng.task.service.IStreamService; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* 河流表 前端控制器 | |||
* | |||
* @author WangHaoran | |||
* @since 2022-06-29 | |||
*/ | |||
@RestController | |||
@RequestMapping("/stream") | |||
public class StreamController { | |||
@Autowired | |||
private IStreamService streamService; | |||
/** | |||
* 获取河流分页列表 | |||
* | |||
* @param streamQuery 查询条件 | |||
* @return | |||
*/ | |||
@GetMapping("/index") | |||
public JsonResult index(StreamQuery streamQuery) { | |||
return streamService.getList(streamQuery); | |||
} | |||
/** | |||
* 添加河流 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
@PostMapping("/add") | |||
public JsonResult add(@RequestBody Stream entity) { | |||
return streamService.add(entity); | |||
} | |||
/** | |||
* 更新河流 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
@PutMapping("/edit") | |||
public JsonResult edit(@RequestBody Stream entity) { | |||
return streamService.edit(entity); | |||
} | |||
/** | |||
* 删除河流 | |||
* | |||
* @param streamId 河流ID | |||
* @return | |||
*/ | |||
@DeleteMapping("/delete/{streamId}") | |||
public JsonResult delete(@PathVariable("streamId") String streamId) { | |||
return streamService.deleteById(streamId); | |||
} | |||
} |
@@ -35,16 +35,6 @@ public class CloudBox extends BaseEntity implements Serializable { | |||
@NotBlank(message = "云盒名称不能为空!") | |||
private String boxName; | |||
/** | |||
* 启用状态:1已启用 2未启用 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 排序 | |||
*/ | |||
private Integer sort; | |||
/** | |||
* 备注 | |||
*/ | |||
@@ -55,9 +45,4 @@ public class CloudBox extends BaseEntity implements Serializable { | |||
*/ | |||
private String createUserName; | |||
/** | |||
* 更新人名称 | |||
*/ | |||
private String updateUserName; | |||
} |
@@ -87,18 +87,9 @@ public class Equipment extends BaseEntity implements Serializable { | |||
*/ | |||
private Integer lifeTime; | |||
/** | |||
* 状态:1正常 2停用 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 添加人名称 | |||
*/ | |||
private String createUserName; | |||
/** | |||
* 更新人名称 | |||
*/ | |||
private String updateUserName; | |||
} |
@@ -48,19 +48,9 @@ public class EquipmentMount extends BaseEntity implements Serializable { | |||
*/ | |||
private String note; | |||
/** | |||
* 状态:1在用 2停用 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 添加人名称 | |||
*/ | |||
private String createUserName; | |||
/** | |||
* 更新人名称 | |||
*/ | |||
private String updateUserName; | |||
} |
@@ -50,6 +50,12 @@ public class Stream extends BaseEntity implements Serializable { | |||
*/ | |||
private String streetCode; | |||
/** | |||
* 河湖长ID | |||
*/ | |||
@NotBlank(message = "河湖长不能为空!") | |||
private String adminId; | |||
/** | |||
* 河流长度 | |||
*/ | |||
@@ -61,19 +67,9 @@ public class Stream extends BaseEntity implements Serializable { | |||
*/ | |||
private String note; | |||
/** | |||
* 状态:1正常 2停用 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 添加人名称 | |||
*/ | |||
private String createUserName; | |||
/** | |||
* 更新人名称 | |||
*/ | |||
private String updateUserName; | |||
} |
@@ -1,10 +1,17 @@ | |||
package com.tuoheng.task.query; | |||
import com.tuoheng.common.core.common.BaseQuery; | |||
import lombok.Data; | |||
/** | |||
* 云盒查询条件 | |||
*/ | |||
@Data | |||
public class CloudBoxQuery { | |||
public class CloudBoxQuery extends BaseQuery { | |||
/** | |||
* 云盒名称 | |||
*/ | |||
private String boxName; | |||
} |
@@ -0,0 +1,24 @@ | |||
package com.tuoheng.task.query; | |||
import com.tuoheng.common.core.common.BaseQuery; | |||
import lombok.Data; | |||
@Data | |||
public class EquipmentMountQuery extends BaseQuery { | |||
/** | |||
* 设备编号 | |||
*/ | |||
private String code; | |||
/** | |||
* 设备名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 类型:1高清相机 2多光谱相机 3空中喊话 4大功率照明 5双光热成像相机 6抛投钩 | |||
* 7抛投绳 8无人机喷火枪 9灭火弹抛投器 10气体采集盒 11无人机取水器 12其他 | |||
*/ | |||
private Integer type; | |||
} |
@@ -0,0 +1,24 @@ | |||
package com.tuoheng.task.query; | |||
import com.tuoheng.common.core.common.BaseQuery; | |||
import lombok.Data; | |||
@Data | |||
public class EquipmentQuery extends BaseQuery { | |||
/** | |||
* 设备名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 动力类型:1电动 2油动 3混合 | |||
*/ | |||
private Integer powerType; | |||
/** | |||
* 生产厂家 | |||
*/ | |||
private String manufacturer; | |||
} |
@@ -0,0 +1,40 @@ | |||
package com.tuoheng.task.query; | |||
import com.tuoheng.common.core.common.BaseQuery; | |||
import lombok.Data; | |||
@Data | |||
public class StreamQuery extends BaseQuery { | |||
/** | |||
* 河流名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 省份编码 | |||
*/ | |||
private String provinceCode; | |||
/** | |||
* 城市编码 | |||
*/ | |||
private String cityCode; | |||
/** | |||
* 区县编码 | |||
*/ | |||
private String districtCode; | |||
/** | |||
* 街道编码 | |||
*/ | |||
private String streetCode; | |||
/** | |||
* 河湖长ID | |||
*/ | |||
private String adminId; | |||
} |
@@ -1,6 +1,7 @@ | |||
package com.tuoheng.task.service; | |||
import com.tuoheng.common.core.common.IBaseService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.task.entity.CloudBox; | |||
/** | |||
@@ -11,4 +12,10 @@ import com.tuoheng.task.entity.CloudBox; | |||
*/ | |||
public interface ICloudBoxService extends IBaseService<CloudBox> { | |||
/** | |||
* 获取云盒列表 | |||
* | |||
* @return | |||
*/ | |||
JsonResult getCloudBoxList(); | |||
} |
@@ -1,13 +1,24 @@ | |||
package com.tuoheng.task.service.impl; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.common.core.common.BaseQuery; | |||
import com.tuoheng.common.core.common.BaseServiceImpl; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import com.tuoheng.task.entity.CloudBox; | |||
import com.tuoheng.task.mapper.CloudBoxMapper; | |||
import com.tuoheng.task.query.CloudBoxQuery; | |||
import com.tuoheng.task.service.ICloudBoxService; | |||
import com.tuoheng.task.vo.CloudBoxVo; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
/** | |||
@@ -22,7 +33,38 @@ public class CloudBoxServiceImpl extends BaseServiceImpl<CloudBoxMapper, CloudBo | |||
@Autowired | |||
private CloudBoxMapper cloudBoxMapper; | |||
/** | |||
* 获取云盒分页列表 | |||
* | |||
* @param query 查询条件 | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getList(BaseQuery query) { | |||
CloudBoxQuery cloudBoxQuery = (CloudBoxQuery) query; | |||
// 分页查询条件 | |||
IPage<CloudBox> page = new Page<>(cloudBoxQuery.getPage(), cloudBoxQuery.getLimit()); | |||
IPage<CloudBox> pageData = cloudBoxMapper.selectPage(page, new LambdaQueryWrapper<CloudBox>() | |||
.like(StringUtils.isNotEmpty(cloudBoxQuery.getBoxName()), CloudBox::getBoxName, cloudBoxQuery.getBoxName()) | |||
.eq(CloudBox::getMark, 1) | |||
.orderByDesc(CloudBox::getCreateTime)); | |||
return JsonResult.success(pageData); | |||
} | |||
@Override | |||
public JsonResult getCloudBoxList() { | |||
List<CloudBox> cloudBoxList = cloudBoxMapper.selectList(new LambdaQueryWrapper<CloudBox>() | |||
.eq(CloudBox::getMark, 1) | |||
.orderByDesc(CloudBox::getCreateTime)); | |||
List<CloudBoxVo> cloudBoxVoList = new ArrayList<>(); | |||
cloudBoxList.forEach(item -> { | |||
CloudBoxVo cloudBoxVo = new CloudBoxVo(); | |||
BeanUtils.copyProperties(item, cloudBoxVo); | |||
cloudBoxVoList.add(cloudBoxVo); | |||
}); | |||
return JsonResult.success(cloudBoxVoList); | |||
} | |||
} |
@@ -1,8 +1,17 @@ | |||
package com.tuoheng.task.service.impl; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.common.core.common.BaseQuery; | |||
import com.tuoheng.common.core.common.BaseServiceImpl; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import com.tuoheng.task.entity.CloudBox; | |||
import com.tuoheng.task.entity.EquipmentMount; | |||
import com.tuoheng.task.mapper.EquipmentMountMapper; | |||
import com.tuoheng.task.query.CloudBoxQuery; | |||
import com.tuoheng.task.query.EquipmentMountQuery; | |||
import com.tuoheng.task.service.IEquipmentMountService; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@@ -19,4 +28,24 @@ public class EquipmentMountServiceImpl extends BaseServiceImpl<EquipmentMountMap | |||
@Autowired | |||
private EquipmentMountMapper equipmentMountMapper; | |||
/** | |||
* 获取云盒分页列表 | |||
* | |||
* @param query 查询条件 | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getList(BaseQuery query) { | |||
EquipmentMountQuery equipmentMountQuery = (EquipmentMountQuery) query; | |||
// 分页查询条件 | |||
IPage<EquipmentMount> page = new Page<>(equipmentMountQuery.getPage(), equipmentMountQuery.getLimit()); | |||
IPage<EquipmentMount> pageData = equipmentMountMapper.selectPage(page, new LambdaQueryWrapper<EquipmentMount>() | |||
.like(StringUtils.isNotEmpty(equipmentMountQuery.getCode()), EquipmentMount::getCode, equipmentMountQuery.getCode()) | |||
.like(StringUtils.isNotEmpty(equipmentMountQuery.getName()), EquipmentMount::getName, equipmentMountQuery.getName()) | |||
.eq(equipmentMountQuery.getType() != null, EquipmentMount::getType, equipmentMountQuery.getType()) | |||
.eq(EquipmentMount::getMark, 1)); | |||
return JsonResult.success(pageData); | |||
} | |||
} |
@@ -1,8 +1,17 @@ | |||
package com.tuoheng.task.service.impl; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.common.core.common.BaseQuery; | |||
import com.tuoheng.common.core.common.BaseServiceImpl; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import com.tuoheng.task.entity.CloudBox; | |||
import com.tuoheng.task.entity.Equipment; | |||
import com.tuoheng.task.mapper.EquipmentMapper; | |||
import com.tuoheng.task.query.CloudBoxQuery; | |||
import com.tuoheng.task.query.EquipmentQuery; | |||
import com.tuoheng.task.service.IEquipmentService; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@@ -21,4 +30,24 @@ public class EquipmentServiceImpl extends BaseServiceImpl<EquipmentMapper, Equip | |||
private EquipmentMapper equipmentMapper; | |||
/** | |||
* 获取飞行设备分页列表 | |||
* | |||
* @param query 查询条件 | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getList(BaseQuery query) { | |||
EquipmentQuery equipmentQuery = (EquipmentQuery) query; | |||
// 分页查询条件 | |||
IPage<Equipment> page = new Page<>(equipmentQuery.getPage(), equipmentQuery.getLimit()); | |||
IPage<Equipment> pageData = equipmentMapper.selectPage(page, new LambdaQueryWrapper<Equipment>() | |||
.like(StringUtils.isNotEmpty(equipmentQuery.getName()), Equipment::getName, equipmentQuery.getName()) | |||
.like(StringUtils.isNotEmpty(equipmentQuery.getManufacturer()), Equipment::getManufacturer, equipmentQuery.getManufacturer()) | |||
.eq(equipmentQuery.getPowerType() != null, Equipment::getPowerType, equipmentQuery.getPowerType()) | |||
.eq(Equipment::getMark, 1)); | |||
return JsonResult.success(pageData); | |||
} | |||
} |
@@ -1,10 +1,21 @@ | |||
package com.tuoheng.task.service.impl; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.common.core.common.BaseQuery; | |||
import com.tuoheng.common.core.common.BaseServiceImpl; | |||
import com.tuoheng.system.service.ICityService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import com.tuoheng.task.api.fegin.ICityService; | |||
import com.tuoheng.task.api.fegin.vo.CityVo; | |||
import com.tuoheng.task.entity.Stream; | |||
import com.tuoheng.task.mapper.StreamMapper; | |||
import com.tuoheng.task.query.StreamQuery; | |||
import com.tuoheng.task.service.IStreamService; | |||
import com.tuoheng.task.vo.CityInfoVo; | |||
import com.tuoheng.task.vo.StreamInfoVo; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@@ -24,6 +35,55 @@ public class StreamServiceImpl extends BaseServiceImpl<StreamMapper, Stream> imp | |||
@Autowired | |||
private ICityService cityService; | |||
/** | |||
* 获取河道分页列表 | |||
* | |||
* @param query 查询条件 | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getList(BaseQuery query) { | |||
StreamQuery streamQuery = (StreamQuery) query; | |||
// 分页查询条件 | |||
IPage<Stream> page = new Page<>(streamQuery.getPage(), streamQuery.getLimit()); | |||
IPage<Stream> pageData = streamMapper.selectPage(page, new LambdaQueryWrapper<Stream>() | |||
.like(StringUtils.isNotEmpty(streamQuery.getName()), Stream::getName, streamQuery.getName()) | |||
.eq(StringUtils.isNotEmpty(streamQuery.getProvinceCode()), Stream::getProvinceCode, streamQuery.getProvinceCode()) | |||
.eq(StringUtils.isNotEmpty(streamQuery.getCityCode()), Stream::getCityCode, streamQuery.getCityCode()) | |||
.eq(StringUtils.isNotEmpty(streamQuery.getDistrictCode()), Stream::getDistrictCode, streamQuery.getDistrictCode()) | |||
.eq(StringUtils.isNotEmpty(streamQuery.getStreetCode()), Stream::getStreetCode, streamQuery.getStreetCode()) | |||
.eq(StringUtils.isNotEmpty(streamQuery.getAdminId()), Stream::getAdminId, streamQuery.getAdminId()) | |||
.eq(Stream::getMark, 1)); | |||
pageData.convert(x -> { | |||
StreamInfoVo streamInfoVo = new StreamInfoVo(); | |||
BeanUtils.copyProperties(x, streamInfoVo); | |||
CityVo cityVo = null; | |||
if (StringUtils.isNotEmpty(x.getStreetCode())) { | |||
// 最后一级到街道 | |||
cityVo = cityService.getCityInfoByCode(x.getStreetCode()).getData(); | |||
}else if (StringUtils.isEmpty(x.getStreetCode()) && StringUtils.isNotEmpty(x.getDistrictCode())) { | |||
// 最后一级到区 | |||
cityVo = cityService.getCityInfoByCode(x.getDistrictCode()).getData(); | |||
}else if (StringUtils.isEmpty(x.getDistrictCode()) && StringUtils.isNotEmpty(x.getCityCode())) { | |||
// 最后一级到市 | |||
cityVo = cityService.getCityInfoByCode(x.getCityCode()).getData(); | |||
}else if (StringUtils.isEmpty(x.getCityCode()) && StringUtils.isNotEmpty(x.getProvinceCode())) { | |||
// 最后一级到省 | |||
cityVo = cityService.getCityInfoByCode(x.getProvinceCode()).getData(); | |||
} | |||
if(cityVo != null){ | |||
streamInfoVo.setCityArea(cityVo.getCityArea()); | |||
streamInfoVo.setProvinceName(cityVo.getProvinceName()); | |||
streamInfoVo.setCityName(cityVo.getCityName()); | |||
streamInfoVo.setDistrictName(cityVo.getDistrictName()); | |||
streamInfoVo.setStreetName(cityVo.getStreetName()); | |||
} | |||
return streamInfoVo; | |||
}); | |||
return JsonResult.success(pageData); | |||
} | |||
} |
@@ -0,0 +1,144 @@ | |||
package com.tuoheng.task.vo; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import lombok.Data; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.util.Date; | |||
/** | |||
* <p> | |||
* 高德城市表表单Vo | |||
* </p> | |||
* | |||
* @author 拓恒 | |||
* @since 2021-01-07 | |||
*/ | |||
@Data | |||
public class CityInfoVo { | |||
/** | |||
* 高德城市表ID | |||
*/ | |||
private Integer id; | |||
/** | |||
* ID | |||
*/ | |||
private Integer cityId; | |||
/** | |||
* 父级ID | |||
*/ | |||
private Integer pid; | |||
/** | |||
* 层级:1省 2市 3区 | |||
*/ | |||
private Integer level; | |||
/** | |||
* 省市区名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 简称 | |||
*/ | |||
private String simple; | |||
/** | |||
* 拼音 | |||
*/ | |||
private String pinyin; | |||
/** | |||
* 简拼 | |||
*/ | |||
private String code; | |||
/** | |||
* 首字母 | |||
*/ | |||
private String firstChar; | |||
/** | |||
* 原城市ID | |||
*/ | |||
private Integer oldCityId; | |||
/** | |||
* 有无子级:1有 2无 | |||
*/ | |||
private Integer hasChild; | |||
/** | |||
* 显示顺序 | |||
*/ | |||
private Integer sort; | |||
/** | |||
* 1-有效 2-无效 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 创建人 | |||
*/ | |||
private String createUser; | |||
/** | |||
* 更新人 | |||
*/ | |||
private String updateUser; | |||
/** | |||
* 创建时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
private Date createTime; | |||
/** | |||
* 更新时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
private Date updateTime; | |||
/** | |||
* 是否删除 1未删除 0已删除 | |||
*/ | |||
private Integer mark; | |||
/** | |||
* 城市名称(省市区街道村拼接) | |||
*/ | |||
private String cityArea; | |||
/** | |||
* 省份名称 | |||
*/ | |||
private String provinceName; | |||
/** | |||
* 城市名称 | |||
*/ | |||
private String cityName; | |||
/** | |||
* 区县名称 | |||
*/ | |||
private String districtName; | |||
/** | |||
* 街道名称 | |||
*/ | |||
private String streetName; | |||
/** | |||
* 村名称 | |||
*/ | |||
private String villageName; | |||
} |
@@ -0,0 +1,41 @@ | |||
package com.tuoheng.task.vo; | |||
import lombok.Data; | |||
/** | |||
* 云盒列表Vo | |||
*/ | |||
@Data | |||
public class CloudBoxVo { | |||
/** | |||
* 主键ID | |||
*/ | |||
private String id; | |||
/** | |||
* 云盒SN号 | |||
*/ | |||
private String boxSn; | |||
/** | |||
* 云盒名称 | |||
*/ | |||
private String boxName; | |||
/** | |||
* 启用状态:1已启用 2未启用 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 备注 | |||
*/ | |||
private String note; | |||
/** | |||
* 添加人名称 | |||
*/ | |||
private String createUserName; | |||
} |
@@ -0,0 +1,153 @@ | |||
package com.tuoheng.task.vo; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import lombok.Data; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.util.Date; | |||
/** | |||
* 河流信息Vo | |||
*/ | |||
@Data | |||
public class StreamInfoVo { | |||
/** | |||
* 主键 | |||
*/ | |||
private Integer id; | |||
/** | |||
* 河流编码 | |||
*/ | |||
private String code; | |||
/** | |||
* 河流名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 省份编码 | |||
*/ | |||
private String provinceCode; | |||
/** | |||
* 城市编码 | |||
*/ | |||
private String cityCode; | |||
/** | |||
* 区县编码 | |||
*/ | |||
private String districtCode; | |||
/** | |||
* 街道编码 | |||
*/ | |||
private String streetCode; | |||
/** | |||
* 村编码 | |||
*/ | |||
private String villageCode; | |||
/** | |||
* 经度 | |||
*/ | |||
private String longitude; | |||
/** | |||
* 纬度 | |||
*/ | |||
private String latitude; | |||
/** | |||
* 起止位置 | |||
*/ | |||
private String location; | |||
/** | |||
* 河流长度 | |||
*/ | |||
private String length; | |||
/** | |||
* 备注 | |||
*/ | |||
private String note; | |||
/** | |||
* 添加人名称 | |||
*/ | |||
private String createUserName; | |||
/** | |||
* 更新人名称 | |||
*/ | |||
private String updateUserName; | |||
/** | |||
* 城市名称(省市区街道村拼接) | |||
*/ | |||
private String cityArea; | |||
/** | |||
* 省份名称 | |||
*/ | |||
private String provinceName; | |||
/** | |||
* 城市名称 | |||
*/ | |||
private String cityName; | |||
/** | |||
* 区县名称 | |||
*/ | |||
private String districtName; | |||
/** | |||
* 街道名称 | |||
*/ | |||
private String streetName; | |||
/** | |||
* 添加人 | |||
*/ | |||
private Integer createUser; | |||
/** | |||
* 创建时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date createTime; | |||
/** | |||
* 更新人 | |||
*/ | |||
private Integer updateUser; | |||
/** | |||
* 更新时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date updateTime; | |||
/** | |||
* 有效标识 | |||
*/ | |||
private Integer mark; | |||
/** | |||
* 头像地址 | |||
*/ | |||
private String image; | |||
/** | |||
* 巡检河流数量 | |||
*/ | |||
private Integer streamGisNumber; | |||
} |