Commit 92744707 authored by xinglei's avatar xinglei

*)修改查询复议诉讼接口

parent bce33775
...@@ -30,6 +30,8 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil; ...@@ -30,6 +30,8 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.*; import java.util.*;
import static java.util.regex.Pattern.compile;
@Service @Service
public class InspectionServiceImpl implements InspectionService { public class InspectionServiceImpl implements InspectionService {
...@@ -171,18 +173,23 @@ public class InspectionServiceImpl implements InspectionService { ...@@ -171,18 +173,23 @@ public class InspectionServiceImpl implements InspectionService {
Object companyId = JsonValueUtils.getValueByKey(JSONObject.parse(JSON.toJSONString(agencyUserModel)), "companys", "companys.0.sequenceNbr"); Object companyId = JsonValueUtils.getValueByKey(JSONObject.parse(JSON.toJSONString(agencyUserModel)), "companys", "companys.0.sequenceNbr");
Collection<CompanyModel> result = Privilege.companyClient.queryAgencyTree(null).getResult(); Collection<CompanyModel> result = Privilege.companyClient.queryAgencyTree(null).getResult();
JSONObject jsonObject = getParentCompanyName(JSONArray.parseArray(JSONArray.toJSONString(result)), companyId);
if (!ValidationUtil.isEmpty(jsonObject)) { JSONObject jsonObject = findParentCompanyById(JSONArray.parseArray(JSONArray.toJSONString(result)), companyId);
String parentCompanyName = jsonObject.getString("companyName"); String parentCompanyName = null;
jsonObject.clear(); String regionName = null;
jsonObject.put("reconsiderOrgName", parentCompanyName + "/" + parentCompanyName.substring(0, parentCompanyName.indexOf("区") + 1) + "人民政府");
jsonObject.put("lawsuitOrgName", parentCompanyName.substring(0, parentCompanyName.indexOf("区") + 1) + "人员法院"); if (!ValidationUtil.isEmpty(jsonObject)) { // 有上级单位
parentCompanyName = jsonObject.getString("companyName");
String selfCompanyName = JsonValueUtils.getValueByKey(JSONObject.parse(JSON.toJSONString(agencyUserModel)), "companys", "companys.0.companyName").toString();
regionName = StringUtils.getStrByPattern(selfCompanyName, compile("(.*?)省|(.*?)市|(.*?)区"));
} else { } else {
jsonObject = new JSONObject(); jsonObject = findCompanyById(JSONArray.parseArray(JSONArray.toJSONString(result)), companyId);
jsonObject.put("reconsiderOrgName", null); parentCompanyName = jsonObject.getString("companyName");
jsonObject.put("lawsuitOrgName", null); regionName = StringUtils.getStrByPattern(parentCompanyName, compile("(.*?)省"));
} }
jsonObject.clear();
jsonObject.put("reconsiderOrgName", parentCompanyName + "/" + regionName + "人民政府");
jsonObject.put("lawsuitOrgName", regionName + "人员法院");
return jsonObject; return jsonObject;
} }
...@@ -229,7 +236,7 @@ public class InspectionServiceImpl implements InspectionService { ...@@ -229,7 +236,7 @@ public class InspectionServiceImpl implements InspectionService {
return sql; return sql;
} }
private static JSONObject getParentCompanyName(JSONArray companyModels, Object companyId) { private static JSONObject findParentCompanyById(JSONArray companyModels, Object companyId) {
for (int i = 0; i < companyModels.size(); i++) { for (int i = 0; i < companyModels.size(); i++) {
JSONObject jsonObject = findCompanyById(companyModels.getJSONObject(i), companyId); JSONObject jsonObject = findCompanyById(companyModels.getJSONObject(i), companyId);
if (!ValidationUtil.isEmpty(jsonObject)) { if (!ValidationUtil.isEmpty(jsonObject)) {
...@@ -239,6 +246,16 @@ public class InspectionServiceImpl implements InspectionService { ...@@ -239,6 +246,16 @@ public class InspectionServiceImpl implements InspectionService {
return null; return null;
} }
private static JSONObject findCompanyById(JSONArray companyModels, Object companyId) {
for (int i = 0; i < companyModels.size(); i++) {
JSONObject jsonObject = findCompanyById(companyModels.getJSONObject(i), companyId);
if (!ValidationUtil.isEmpty(jsonObject)) {
return findCompanyById(companyModels.getJSONObject(i), jsonObject.getString("sequenceNbr"));
}
}
return null;
}
private static JSONObject findCompanyById(JSONObject treeNode, Object companyId) { private static JSONObject findCompanyById(JSONObject treeNode, Object companyId) {
if (treeNode.getString("sequenceNbr").equals(String.valueOf(companyId))) { if (treeNode.getString("sequenceNbr").equals(String.valueOf(companyId))) {
return treeNode; return treeNode;
......
...@@ -2,6 +2,8 @@ package com.yeejoin.amos.boot.module.tzs.biz.utils; ...@@ -2,6 +2,8 @@ package com.yeejoin.amos.boot.module.tzs.biz.utils;
import java.util.Map; import java.util.Map;
import java.util.StringJoiner; import java.util.StringJoiner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* @Author: xl * @Author: xl
...@@ -21,4 +23,12 @@ public class StringUtils { ...@@ -21,4 +23,12 @@ public class StringUtils {
public static String str2sqlValue(String str){ public static String str2sqlValue(String str){
return "'" + str + "'"; return "'" + str + "'";
} }
public static String getStrByPattern(String str, Pattern reg){
Matcher mat = reg.matcher(str);
while (mat.find()) {
return mat.group(0);
}
return "";
}
} }
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