主管部门单选变多选

limingyu-20240401-app登录曹实业判断修改
liujun 2024-03-19 11:39:46 +08:00
parent cf538631ff
commit a255cf3044
5 changed files with 34 additions and 0 deletions

View File

@ -1,8 +1,12 @@
package com.zcloud.controller.xgf; package com.zcloud.controller.xgf;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import com.zcloud.entity.Page; import com.zcloud.entity.Page;
import com.zcloud.service.bus.CorpInfoService;
import com.zcloud.service.system.DepartmentService;
import com.zcloud.util.ObjectExcelView; import com.zcloud.util.ObjectExcelView;
import net.sf.json.JSONArray; import net.sf.json.JSONArray;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
@ -20,6 +24,8 @@ import com.zcloud.util.HttpClientService;
import com.zcloud.util.Jurisdiction; import com.zcloud.util.Jurisdiction;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
@RestController @RestController
@RequestMapping("/xgf/corp") @RequestMapping("/xgf/corp")
public class XgfCorpController extends BaseController { public class XgfCorpController extends BaseController {
@ -31,6 +37,9 @@ public class XgfCorpController extends BaseController {
@Value("${qa-regulatory-gwj.api.url}") @Value("${qa-regulatory-gwj.api.url}")
private String regulatoryUrl; 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); Map result = HttpClientService.doPost(url + "/api/corpinfo/JiTuanTeShulist", pd);
// created by liu jun (为了不在相关方连表查询,只能在这里这么写,兼容老数据)
List<HashMap> list = (List<HashMap> )result.get("varList");
for (HashMap x : list) {
if (x.get("MAIN_DEPARTMENT") != null && x.get("MAIN_DEPARTMENT").toString().contains("]")) {
List<String> departmentIds = JSONObject.parseObject(x.get("MAIN_DEPARTMENT").toString(),List.class);
List<PageData> departmentList = departmentService.getCorpDepartmentByIds(departmentIds);
x.put("MAIN_DEPARTMENT_NAME", departmentList.stream().map(n -> n.getString("NAME")).collect(Collectors.joining(",")));
}
}
return result; return result;
} }

View File

@ -183,5 +183,7 @@ public interface DepartmentMapper{
PageData findByCorpDepartmentId(PageData condition); PageData findByCorpDepartmentId(PageData condition);
List<PageData> listTreeManageAndCorp(PageData pd); List<PageData> listTreeManageAndCorp(PageData pd);
List<PageData> getCorpDepartmentByIds(List<String> departmentList);
} }

View File

@ -231,5 +231,7 @@ public interface DepartmentService{
List<Department> listAllCorpDepartment(String number) throws Exception; List<Department> listAllCorpDepartment(String number) throws Exception;
PageData getCorpDepartment(PageData condition) throws Exception; PageData getCorpDepartment(PageData condition) throws Exception;
List<PageData> getCorpDepartmentByIds(List<String> departmentList);
} }

View File

@ -441,6 +441,11 @@ public class DepartmentServiceImpl implements DepartmentService{
return departmentMapper.findByCorpDepartmentId(condition); return departmentMapper.findByCorpDepartmentId(condition);
} }
@Override
public List<PageData> getCorpDepartmentByIds(List<String> departmentList) {
return departmentMapper.getCorpDepartmentByIds(departmentList);
}
/** /**
* ID * ID
* @param parentId * @param parentId

View File

@ -627,4 +627,11 @@
(COR_ORDER+0) asc, (COR_ORDER+0) asc,
NAME,DEP_ORDER asc NAME,DEP_ORDER asc
</select> </select>
<select id="getCorpDepartmentByIds" parameterType="List" resultType="pd" >
select * from `qa-gwj-regulatory`.SYS_DEPARTMENT
where DEPARTMENT_ID in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper> </mapper>