根据意向区域找大区id
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
package com.cool.store.enums;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 区域类型 0-根;1=大区;2=战区;3=小区(督导区);4=门店
|
||||
* @author wxp
|
||||
*/
|
||||
public enum ThirdRegionTypeEnum {
|
||||
|
||||
ROOT("0","根"),
|
||||
LARGE_REGION("1","大区"),
|
||||
WAR_REGION("2","战区"),
|
||||
COMMUNITY_REGION("3","小区"),
|
||||
STORE("4","门店");
|
||||
|
||||
private String code;
|
||||
private String desc;
|
||||
|
||||
public static final Map<String, ThirdRegionTypeEnum> map = Arrays.stream(values()).collect(
|
||||
Collectors.toMap(ThirdRegionTypeEnum::getCode, Function.identity()));
|
||||
|
||||
ThirdRegionTypeEnum(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public static ThirdRegionTypeEnum getByCode(String code) {
|
||||
return map.get(code);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -68,7 +68,8 @@
|
||||
store_id as storeId,
|
||||
region_type as regionType,
|
||||
is_external_node as isExternalNode,
|
||||
third_dept_id as thirdDeptId
|
||||
third_dept_id as thirdDeptId,
|
||||
third_region_type as thirdRegionType
|
||||
from region_${enterpriseId} where id in
|
||||
<foreach collection="regionIds" index="index" item="regionId"
|
||||
separator="," open="(" close=")">
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.cool.store.dao.RegionAreaConfigDao;
|
||||
import com.cool.store.dao.RegionDao;
|
||||
import com.cool.store.entity.RegionDO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.enums.ThirdRegionTypeEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.mapper.RegionMapper;
|
||||
import com.cool.store.service.RegionService;
|
||||
@@ -110,7 +111,7 @@ public class RegionServiceImpl implements RegionService {
|
||||
String[] warRegionIdArr = warRegionPath.split(Constants.FORWARD_SLASH);
|
||||
List<RegionDO> regionDOList = regionMapper.getRegionByRegionIds(Arrays.asList(warRegionIdArr));
|
||||
for (RegionDO regionDO : regionDOList){
|
||||
if(regionDO.getRegionType().equals("大区")){
|
||||
if(ThirdRegionTypeEnum.LARGE_REGION.getCode().equals(regionDO.getThirdRegionType())){
|
||||
return regionDO.getId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,12 @@ public class RegionController {
|
||||
@Autowired
|
||||
private RegionService regionService;
|
||||
|
||||
@ApiOperation("根据意向区域找大区id")
|
||||
@GetMapping("/getBigRegionIdByAreaId")
|
||||
public ResponseResult<Long> getBigRegionIdByAreaId(@RequestParam(value = "wantShopAreaId", required = true) Long wantShopAreaId) {
|
||||
return ResponseResult.success(regionService.getBigRegionIdByAreaId(wantShopAreaId));
|
||||
}
|
||||
|
||||
@ApiOperation("根据三方区域类型获取区域列表 0-根 1=大区 2=战区 3=小区(督导区 4=门店")
|
||||
@GetMapping("/listByThirdRegionType")
|
||||
public ResponseResult<List<RegionDO>> listByThirdRegionType(@RequestParam(value = "parentId", required = false) Long parentId,
|
||||
|
||||
Reference in New Issue
Block a user