diff --git a/src/main/java/com/zcloud/controller/xgf/XgfCorpController.java b/src/main/java/com/zcloud/controller/xgf/XgfCorpController.java index caa660ab..83c27554 100644 --- a/src/main/java/com/zcloud/controller/xgf/XgfCorpController.java +++ b/src/main/java/com/zcloud/controller/xgf/XgfCorpController.java @@ -1,8 +1,12 @@ package com.zcloud.controller.xgf; import java.util.*; +import java.util.stream.Collectors; +import com.alibaba.fastjson.JSONObject; import com.zcloud.entity.Page; +import com.zcloud.service.bus.CorpInfoService; +import com.zcloud.service.system.DepartmentService; import com.zcloud.util.ObjectExcelView; import net.sf.json.JSONArray; import org.apache.shiro.authz.annotation.RequiresPermissions; @@ -20,6 +24,8 @@ import com.zcloud.util.HttpClientService; import com.zcloud.util.Jurisdiction; import org.springframework.web.servlet.ModelAndView; +import javax.annotation.Resource; + @RestController @RequestMapping("/xgf/corp") public class XgfCorpController extends BaseController { @@ -31,6 +37,9 @@ public class XgfCorpController extends BaseController { @Value("${qa-regulatory-gwj.api.url}") private String regulatoryUrl; + @Resource + private DepartmentService departmentService; + /** * 相关方单位账号管理-列表 * @@ -53,6 +62,15 @@ public class XgfCorpController extends BaseController { } } Map result = HttpClientService.doPost(url + "/api/corpinfo/JiTuanTeShulist", pd); + // created by liu jun (为了不在相关方连表查询,只能在这里这么写,兼容老数据) + List list = (List )result.get("varList"); + for (HashMap x : list) { + if (x.get("MAIN_DEPARTMENT") != null && x.get("MAIN_DEPARTMENT").toString().contains("]")) { + List departmentIds = JSONObject.parseObject(x.get("MAIN_DEPARTMENT").toString(),List.class); + List departmentList = departmentService.getCorpDepartmentByIds(departmentIds); + x.put("MAIN_DEPARTMENT_NAME", departmentList.stream().map(n -> n.getString("NAME")).collect(Collectors.joining(","))); + } + } return result; } diff --git a/src/main/java/com/zcloud/mapper/datasource/system/DepartmentMapper.java b/src/main/java/com/zcloud/mapper/datasource/system/DepartmentMapper.java index 60c8ea25..e5e2daaf 100644 --- a/src/main/java/com/zcloud/mapper/datasource/system/DepartmentMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/system/DepartmentMapper.java @@ -183,5 +183,7 @@ public interface DepartmentMapper{ PageData findByCorpDepartmentId(PageData condition); List listTreeManageAndCorp(PageData pd); + + List getCorpDepartmentByIds(List departmentList); } diff --git a/src/main/java/com/zcloud/service/system/DepartmentService.java b/src/main/java/com/zcloud/service/system/DepartmentService.java index 7c30e2a1..12d74d66 100644 --- a/src/main/java/com/zcloud/service/system/DepartmentService.java +++ b/src/main/java/com/zcloud/service/system/DepartmentService.java @@ -231,5 +231,7 @@ public interface DepartmentService{ List listAllCorpDepartment(String number) throws Exception; PageData getCorpDepartment(PageData condition) throws Exception; + + List getCorpDepartmentByIds(List departmentList); } diff --git a/src/main/java/com/zcloud/service/system/impl/DepartmentServiceImpl.java b/src/main/java/com/zcloud/service/system/impl/DepartmentServiceImpl.java index 5be056e3..b87a575b 100644 --- a/src/main/java/com/zcloud/service/system/impl/DepartmentServiceImpl.java +++ b/src/main/java/com/zcloud/service/system/impl/DepartmentServiceImpl.java @@ -441,6 +441,11 @@ public class DepartmentServiceImpl implements DepartmentService{ return departmentMapper.findByCorpDepartmentId(condition); } + @Override + public List getCorpDepartmentByIds(List departmentList) { + return departmentMapper.getCorpDepartmentByIds(departmentList); + } + /** * 通过ID获取其子级列表 * @param parentId diff --git a/src/main/resources/mybatis/datasource/system/DepartmentMapper.xml b/src/main/resources/mybatis/datasource/system/DepartmentMapper.xml index 21c16631..08e10df9 100644 --- a/src/main/resources/mybatis/datasource/system/DepartmentMapper.xml +++ b/src/main/resources/mybatis/datasource/system/DepartmentMapper.xml @@ -627,4 +627,11 @@ (COR_ORDER+0) asc, NAME,DEP_ORDER asc +