Commit e6c67715 authored by 朱晨阳's avatar 朱晨阳

添加区域公司分组接口

parent e3d85782
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.hygf.biz.controller; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.hygf.biz.controller;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
...@@ -27,6 +28,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -27,6 +28,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.security.Key;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -440,6 +442,49 @@ public class JpStationController extends BaseController { ...@@ -440,6 +442,49 @@ public class JpStationController extends BaseController {
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询当前登录人权限区域公司", notes = "查询当前登录人权限区域公司")
@GetMapping(value = "/getRegionGroup")
@UserLimits
public ResponseModel<List<Map<String, Object>>> getRegionGroup(@RequestParam(required = false) String regionName) {
List<DropDown> list = jpStationMapper.getRegion(regionName);
List<Map<String,Object>> resultList= new ArrayList<>();
if(CollectionUtils.isNotEmpty(list)){
list.forEach(item->{
if(StringUtils.isEmpty(item.getAddress())){
item.setAddress("未知省份");
}
});
Map<String, List<DropDown>> map = list.stream().collect(Collectors.groupingBy(DropDown::getAddress));
map.forEach((k,v)->{
Map<String,Object> map1=new HashMap<>();
List<Map<String,Object>> children = new ArrayList<>();
map1.put("value", k);
map1.put("label",k);
map1.put("children",children);
if(CollectionUtils.isNotEmpty(v)){
for (DropDown dropDown : v) {
Map<String,Object> map2=new HashMap<>();
map2.put("value", dropDown.getOrgCode());
map2.put("label",dropDown.getName());
children.add(map2);
}
}
resultList.add(map1);
});
}
List<Map<String, Object>> result = new ArrayList<>();
Map<String, Object> item = new HashMap<>();
item.put("value", "全国");
item.put("label", "全国");
item.put("children", resultList);
result.add(item);
return ResponseHelper.buildResponse(result);
}
//查询当前登录人权限区域公司 //查询当前登录人权限区域公司
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询当前登录人权限区域公司", notes = "查询当前登录人权限区域公司") @ApiOperation(httpMethod = "GET", value = "查询当前登录人权限区域公司", notes = "查询当前登录人权限区域公司")
......
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