Commit 7350c648 authored by fhj's avatar fhj

模板服务 - 修复代码

parent 7e1b4264
......@@ -6,6 +6,7 @@ import com.ssy.lingxi.platform.manage.api.vo.response.AreaResponse;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
......@@ -18,6 +19,10 @@ import java.util.List;
@FeignClient(value = "platform-manage-service", fallback = AreaControllerFeignFallback.class)
public interface AreaControllerFeign {
@ApiOperation(value = "根据省编码获取所有市编码")
@GetMapping("/manage/area/findCityCodeByProvinceCode")
public Wrapper<List<String>> findCityCodeByProvinceCode(@RequestParam("provinceCodes") List<String> provinceCodes);
@ApiOperation(value = "查询省市区列表")
@GetMapping("/manage/area/all")
Wrapper<List<AreaResponse>> areaAll();
......
......@@ -11,6 +11,11 @@ import java.util.List;
public class AreaControllerFeignFallback implements AreaControllerFeign {
@Override
public Wrapper<List<String>> findCityCodeByProvinceCode(List<String> provinceCodes) {
return Wrapper.failService("服务调用异常");
}
@Override
public Wrapper<List<AreaResponse>> areaAll() {
return Wrapper.failService("服务调用异常");
}
......
......@@ -8,6 +8,7 @@ import com.ssy.lingxi.platform.manage.service.IAreaService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
......@@ -26,6 +27,12 @@ public class AreaController {
@Resource
private IAreaService areaService;
@ApiOperation(value = "根据省编码获取所有市编码")
@GetMapping("/area/findCityCodeByProvinceCode")
public Wrapper<List<String>> findCityCodeByProvinceCode(@RequestParam("provinceCodes") List<String> provinceCodes) {
return areaService.findCityCodeByProvinceCode(provinceCodes);
}
@ApiOperation(value = "获取省市")
@GetMapping("/area/findProvinceCity")
public Wrapper<List<ProvinceResponse>> findProvinceCity() {
......
......@@ -9,6 +9,8 @@ import java.util.List;
@Repository
public interface AreaRepository extends JpaRepository<Area, Long> {
List<Area> findAllByPcodeIn(List<String> pcodes);
List<Area> findAllByPcodeEquals(String pcode);
List<Area> findAllByLevel(Integer level);
......
......@@ -16,24 +16,14 @@ import java.util.List;
*/
public interface IAreaService {
/**
* 获取省市
* */
Wrapper<List<String>> findCityCodeByProvinceCode(List<String> provinceCodes);
Wrapper<List<ProvinceResponse>> findProvinceCity();
/**
* 查询省市区列表
*/
Wrapper<List<AreaResponse>> areaAll();
/**
* 查询省市区列表
*/
Wrapper<List<AreaResponse>> areaList();
/**
* 根据父code查询省市区列表
*/
Wrapper<List<AreaResponse>> areaByPcodeAll(AreaRequest request);
}
package com.ssy.lingxi.platform.manage.serviceimpl;
import cn.hutool.core.collection.CollectionUtil;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.platform.manage.api.vo.request.AreaRequest;
import com.ssy.lingxi.platform.manage.api.vo.response.AreaResponse;
......@@ -30,6 +31,21 @@ public class AreaServiceImpl implements IAreaService {
private AreaRepository areaRepository;
/**
* 根据省编码获取所有市编码
* */
@Override
public Wrapper<List<String>> findCityCodeByProvinceCode(List<String> provinceCodes) {
if(CollectionUtil.isNotEmpty(provinceCodes)) {
return Wrapper.fail("参数校验不通过");
}
List<Area> areas = areaRepository.findAllByPcodeIn(provinceCodes);
return Wrapper.success(
areas.stream().map(Area::getCode).collect(Collectors.toList())
);
}
/**
* 获取省市
* */
@Override
......
......@@ -33,6 +33,7 @@ dependencies {
implementation project(':common')
implementation project(':component-service:redis')
implementation project(':platform-template-service:platform-template-service-api')
implementation project(':platform-manage-service:platform-manage-service-api')
implementation project(':merchant-member-service:merchant-member-service-api')
implementation project(':search-service:search-service-api')
implementation project(':product-service:product-service-api')
......
......@@ -9,6 +9,9 @@ project(':component-service:redis').projectDir = "../component-service/redis" as
include 'platform-template-service:platform-template-service-api'
project(':platform-template-service:platform-template-service-api').projectDir = "$rootDir/platform-template-service-api" as File
include 'platform-manage-service:platform-manage-service-api'
project(':platform-manage-service:platform-manage-service-api').projectDir = "$rootDir/platform-manage-service-api" as File
include 'merchant-member-service:merchant-member-service-api'
project(':merchant-member-service:merchant-member-service-api').projectDir = "../merchant-member-service/merchant-member-service-api" as File
......
package com.ssy.lingxi.platform.template.service.entity.door;
import com.ssy.lingxi.platform.template.service.handler.convert.JpaJsonToAreaBOConverter;
import com.ssy.lingxi.platform.template.service.handler.convert.JpaJsonToStringListConverter;
import com.ssy.lingxi.platform.template.service.handler.convert.JpaStringToArrayConverter;
import com.ssy.lingxi.platform.template.service.model.bo.AreaBO;
import io.swagger.annotations.ApiModelProperty;
......@@ -94,6 +95,16 @@ public class MemberShop {
@ApiModelProperty(value = "地市(冗余)")
private String areas;
@Convert(converter = JpaJsonToStringListConverter.class)
@Column(columnDefinition = "jsonb")
@ApiModelProperty(value = "省编码(冗余)")
private List<String> provincesCodeList;
@Convert(converter = JpaJsonToStringListConverter.class)
@Column(columnDefinition = "jsonb")
@ApiModelProperty(value = "市编码(冗余)")
private List<String> cityCodeList;
@Column(columnDefinition = "varchar(200)")
@ApiModelProperty(value = "会员名称(冗余)")
private String memberName;
......@@ -137,4 +148,6 @@ public class MemberShop {
@Column(columnDefinition = "varchar(255)")
@ApiModelProperty(value = "注册地址(详细地址)(冗余)")
private String registerAddress;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment