Commit 86c29321 authored by 朱晨阳's avatar 朱晨阳

修改接口

parent ebbbf57d
......@@ -37,8 +37,9 @@ public interface JpStationMapper extends BaseMapper<JpStation> {
List<JpStation> getJpStationList(@Param("dto") JpStationDto reviewDto);
@UserEmpower(field ={"ORG_CODE"} ,dealerField ={"ORG_CODE"}, fieldConditions ={"in","in"} ,relationship="and",specific=false)
List<DropDown> getRegion(String regionName);
List<DropDown> getRegion(String regionName, String address);
List<String> getRegionAddress();
@UserEmpower(field ={"ORG_CODE"} ,dealerField ={"ORG_CODE"}, fieldConditions ={"in","in"} ,relationship="and",specific=false)
List<DropDown> getRegionByProvince(@Param(value = "ids") List<String> ids);
......@@ -100,4 +101,5 @@ public interface JpStationMapper extends BaseMapper<JpStation> {
List<Map<String, String>> queryUnitInfo();
}
......@@ -254,6 +254,19 @@
<if test="regionName!=null and regionName!=''">
and privilege_company.COMPANY_NAME like concat('%',#{regionName}, '%')
</if>
<if test="address!=null and address!='' and address !='未知省份'">
and privilege_company.ADDRESS like concat('%',#{address}, '%')
</if>
<if test="address!=null and address!='' and address == '未知省份'">
and privilege_company.ADDRESS is null
</if>
</select>
<select id="getRegionAddress" resultType="String">
SELECT DISTINCT IFNULL(privilege_company.address, '未知省份') AS address
FROM privilege_company
WHERE IS_DELETED = 0
and privilege_company.COMPANY_TYPE = 'region'
</select>
<select id="getRegionNode" resultType="string">
......
......@@ -429,9 +429,9 @@ public class JpStationController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "查询当前登录人权限区域公司", notes = "查询当前登录人权限区域公司")
@GetMapping(value = "/getRegion")
@UserLimits
public ResponseModel<List<Map<String, String>>> getRegion(@RequestParam(required = false) String regionName) {
public ResponseModel<List<Map<String, String>>> getRegion(@RequestParam(required = false) String regionName, @RequestParam(required = false) String address) {
List<DropDown> list = jpStationMapper.getRegion(regionName);
List<DropDown> list = jpStationMapper.getRegion(regionName, address);
List<Map<String, String>> result = new ArrayList<>();
list.forEach(dropDown -> {
Map<String, String> item = new HashMap<>();
......@@ -445,45 +445,18 @@ public class JpStationController extends BaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询当前登录人权限区域公司", notes = "查询当前登录人权限区域公司")
@GetMapping(value = "/getRegionGroup")
@ApiOperation(httpMethod = "GET", value = "查询当前登录人权限区域公司地址", notes = "查询当前登录人权限区域公司地址")
@GetMapping(value = "/getRegionAddress")
@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);
public ResponseModel<List<Map<String, String>>> getRegionAddress() {
List<String> list = jpStationMapper.getRegionAddress();
List<Map<String, String>> result = new ArrayList<>();
list.forEach(address -> {
Map<String, String> item = new HashMap<>();
item.put("text", address);
item.put("value", address);
result.add(item);
});
return ResponseHelper.buildResponse(result);
}
//查询当前登录人权限区域公司
......@@ -974,7 +947,7 @@ public class JpStationController extends BaseController {
@UserLimits
public ResponseModel<List<Map<String, Object>>> getRegionStatistics(@RequestParam(required = false) String regionName) {
// 获取区域公司列表
List<DropDown> regionlist = jpStationMapper.getRegion(regionName);
List<DropDown> regionlist = jpStationMapper.getRegion(regionName, null);
List<Map<String, Object>> result = new ArrayList<>();
......
......@@ -241,7 +241,7 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
public void importRepaymentExcel(MultipartFile file) {
//获取当前用户权限的公司
try {
List<DropDown> region = jpStationMapper.getRegion(null);
List<DropDown> region = jpStationMapper.getRegion(null, null);
if (CollectionUtil.isEmpty(region)) {
throw new BadRequest("该用户没有公司");
}
......
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