EsmInsCompanyController.java 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. package com.jzg.controller;
  2. import cn.hutool.core.bean.BeanUtil;
  3. import cn.hutool.core.collection.CollUtil;
  4. import cn.hutool.json.JSONUtil;
  5. import com.alibaba.nacos.client.naming.utils.CollectionUtils;
  6. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  7. import com.jzg.commons.core.base.BaseController;
  8. import com.jzg.commons.core.page.HttpResult;
  9. import com.jzg.commons.entity.dto.EsmInsCompanyAdd;
  10. import com.jzg.commons.entity.dto.EsmInsCompanyEnd;
  11. import com.jzg.commons.entity.po.EsmInsCompany;
  12. import com.jzg.commons.entity.po.SysUploadFiles;
  13. import com.jzg.commons.entity.system.vo.SysSystemBusPermsVo;
  14. import com.jzg.commons.entity.vo.EsmInsCompanyReq;
  15. import com.jzg.commons.entity.vo.EsmInsCompanyResVo;
  16. import com.jzg.commons.entity.vo.EsmInsCompanyVo;
  17. import com.jzg.commons.exception.SystemException;
  18. import com.jzg.commons.request.RequestSingleParam;
  19. import com.jzg.commons.util.AssertionUtils;
  20. import com.jzg.commons.util.ConvertUtils;
  21. import com.jzg.commons.util.MinioUtils;
  22. import com.jzg.commons.util.StringUtils;
  23. import com.jzg.constants.ManagementSourceEnum;
  24. import com.jzg.mapper.SysUploadFilesMapper;
  25. import com.jzg.service.EsmInsCompanyService;
  26. import com.jzg.service.SysSystemService;
  27. import io.swagger.v3.oas.annotations.Operation;
  28. import io.swagger.v3.oas.annotations.tags.Tag;
  29. import org.slf4j.Logger;
  30. import org.slf4j.LoggerFactory;
  31. import org.springframework.beans.factory.annotation.Autowired;
  32. import org.springframework.beans.factory.annotation.Value;
  33. import org.springframework.validation.annotation.Validated;
  34. import org.springframework.web.bind.annotation.*;
  35. import java.text.Collator;
  36. import java.util.*;
  37. import java.util.stream.Collectors;
  38. /**
  39. * ---------------------------
  40. * 保险公司管理 (EsmInsCompanyController)
  41. * ---------------------------
  42. * 作者:
  43. * ---------------------------
  44. */
  45. @Tag(name = "保险公司管理")
  46. @RestController
  47. @RequestMapping("esmInsCompany")
  48. public class EsmInsCompanyController extends BaseController {
  49. private static final Logger log = LoggerFactory.getLogger(EsmInsCompanyController.class);
  50. @Autowired
  51. private EsmInsCompanyService esmInsCompanyService;
  52. @Autowired
  53. private SysUploadFilesMapper sysUploadFilesMapper;
  54. @Autowired
  55. private SysSystemService sysSystemService;
  56. @Autowired
  57. private BaseController baseController;
  58. @Value("${minio.bucket-name}")
  59. private String bucketName;
  60. @PostMapping("leftList")
  61. @Operation(summary = "获取顶级保险公司列表")
  62. public HttpResult<List<EsmInsCompanyResVo>> leftList(@RequestBody EsmInsCompanyReq req) {
  63. List<EsmInsCompanyResVo> list = esmInsCompanyService.leftList(req);
  64. return HttpResult.ok(list);
  65. }
  66. /**
  67. * 通过保险公司id查询下级id及本级id
  68. * @return
  69. */
  70. @GetMapping("getChildCompanyId")
  71. @Operation(summary = "通过保险公司id查询下级id及本级id")
  72. public HttpResult<List<String>> getChildCompanyId(String companyId) {
  73. List<String> list = esmInsCompanyService.getByLowerId(companyId);
  74. return HttpResult.ok(list);
  75. }
  76. @GetMapping("getAllTopCompanyList")
  77. @Operation(summary = "获取订单报价完成的保险公司")
  78. public HttpResult getAllTopCompanyList() {
  79. List<EsmInsCompany> list = esmInsCompanyService.getAllBaseList();
  80. return HttpResult.ok(list);
  81. }
  82. /**
  83. * 查询下级保险公司(列表)
  84. *
  85. * @param req
  86. * @return
  87. */
  88. @Operation(summary = "查询下级保险公司(列表)")
  89. @PostMapping(value = "/selectLevelList")
  90. public HttpResult<List<EsmInsCompanyVo>> selectLevelList(@RequestBody EsmInsCompanyReq req) {
  91. LambdaQueryWrapper<EsmInsCompany> lambdaQueryWrapper = new LambdaQueryWrapper<>();
  92. lambdaQueryWrapper.eq(EsmInsCompany::getParentId, "0");
  93. lambdaQueryWrapper.eq(EsmInsCompany::getIsDelete, 0);
  94. lambdaQueryWrapper.like(StringUtils.isNotEmpty(req.getName()), EsmInsCompany::getName, req.getName());
  95. List<EsmInsCompany> selectList = esmInsCompanyService.list(lambdaQueryWrapper);
  96. List<EsmInsCompanyVo> esmInsCompanyVos = BeanUtil.copyToList(selectList, EsmInsCompanyVo.class);
  97. return HttpResult.ok(esmInsCompanyVos);
  98. }
  99. @PostMapping("/findLeftInsTree")
  100. @Operation(summary = "查询左侧树")
  101. public HttpResult<List<EsmInsCompany>> findLeftInsTree(@RequestSingleParam("type") String type) {
  102. LambdaQueryWrapper<EsmInsCompany> wrapper = new LambdaQueryWrapper<>();
  103. wrapper.eq(StringUtils.isNotEmpty(type), EsmInsCompany::getType, type);
  104. List<EsmInsCompany> lst = esmInsCompanyService.list(wrapper);
  105. return HttpResult.ok(lst);
  106. }
  107. @PostMapping("/findTree")
  108. @Operation(summary = "获取树结构")
  109. public HttpResult<List<EsmInsCompanyVo>> findTree(@RequestBody EsmInsCompanyReq req) {
  110. return HttpResult.ok(esmInsCompanyService.findTree(req));
  111. }
  112. @PostMapping(value = "/saveInsCompany")
  113. @Operation(summary = "保存信息")
  114. public HttpResult<Object> save(@Validated @RequestBody EsmInsCompanyAdd companyAdd) {
  115. ConvertUtils.emptyToNull(companyAdd);
  116. LambdaQueryWrapper<EsmInsCompany> lqw = new LambdaQueryWrapper<>();
  117. lqw.eq(EsmInsCompany::getCompanyCode, companyAdd.getCompanyCode());
  118. AssertionUtils.isFail(esmInsCompanyService.count(lqw) > 0, "供应商编码重复");
  119. AssertionUtils.isFail(esmInsCompanyService.count(
  120. new LambdaQueryWrapper<EsmInsCompany>().eq(EsmInsCompany::getName, companyAdd.getName())) > 0, "保司名称重复");
  121. EsmInsCompany esmInsCompany = BeanUtil.copyProperties(companyAdd, EsmInsCompany.class);
  122. //如果存在父类型则将type
  123. if (!companyAdd.getParentId().equals("0")) {
  124. EsmInsCompany parent = esmInsCompanyService.getById(companyAdd.getParentId());
  125. AssertionUtils.isEmpty(parent, "父级机构不存在");
  126. esmInsCompany.setType(parent.getType());
  127. }
  128. return esmInsCompanyService.save(esmInsCompany) ? HttpResult.ok("保存成功") : HttpResult.error("保存失败");
  129. }
  130. @PostMapping(value = "/editInsCompany")
  131. @Operation(summary = "修改信息")
  132. public HttpResult<Object> update(@Validated @RequestBody EsmInsCompanyEnd companyEnd) {
  133. ConvertUtils.emptyToNull(companyEnd);
  134. LambdaQueryWrapper<EsmInsCompany> lqw = new LambdaQueryWrapper<>();
  135. lqw.eq(EsmInsCompany::getCompanyCode, companyEnd.getCompanyCode());
  136. lqw.ne(EsmInsCompany::getId, companyEnd.getId());
  137. AssertionUtils.isFail(esmInsCompanyService.count(lqw) > 1, "供应商编码重复");
  138. EsmInsCompany esmInsCompany = BeanUtil.copyProperties(companyEnd, EsmInsCompany.class);
  139. return esmInsCompanyService.updateById(esmInsCompany) ? HttpResult.ok("修改成功") : HttpResult.error("修改失败");
  140. }
  141. /**
  142. * 查询下级机构列表
  143. *
  144. * @param parentid
  145. * @return
  146. */
  147. @Operation(summary = "查询下级机构列表")
  148. @PostMapping(value = "/selectList")
  149. public HttpResult<List<EsmInsCompany>> selectList(@RequestParam String parentid) {
  150. parentid = StringUtils.isEmpty(parentid) ? "0" : parentid;
  151. LambdaQueryWrapper<EsmInsCompany> lqw = new LambdaQueryWrapper<>();
  152. lqw.eq(EsmInsCompany::getParentId, parentid);
  153. List<EsmInsCompany> selectList = esmInsCompanyService.list(lqw);
  154. return HttpResult.ok(selectList);
  155. }
  156. /**
  157. * 根据主键查询保险公司信息
  158. *
  159. * @param id
  160. * @return HttpResult<EsmInsCompany>
  161. */
  162. @Operation(summary = "根据主键查询")
  163. @GetMapping(value = "/findById")
  164. public HttpResult<EsmInsCompany> findById(@RequestParam String id) {
  165. log.debug("根据公司id[{}]查询公司信息",id);
  166. return HttpResult.ok(esmInsCompanyService.getById(id));
  167. }
  168. @Operation(summary = "根据主键查询 替换Logo")
  169. @GetMapping(value = "/findLogoById")
  170. public HttpResult<EsmInsCompany> findLogoById(@RequestParam String id) {
  171. EsmInsCompany esmInsCompany = esmInsCompanyService.getById(id);
  172. SysUploadFiles sysUploadFiles = sysUploadFilesMapper.selectById(esmInsCompany.getLogo());
  173. Optional.ofNullable(sysUploadFiles)
  174. .map(SysUploadFiles::getFileName)
  175. .ifPresent(fileName -> {
  176. String presignedObjectUrl = MinioUtils.getPresignedObjectUrl(bucketName, fileName);
  177. esmInsCompany.setLogo(presignedObjectUrl);
  178. });
  179. return HttpResult.ok(esmInsCompany);
  180. }
  181. /**
  182. * 基础分页查询
  183. *
  184. * @param pageRequest
  185. * @return
  186. */
  187. // @PostMapping(value = "/findPage")
  188. // public HttpResult findPage(@RequestBody PageRequest pageRequest) {
  189. //
  190. // String id = PageRequest.getColumnFilterValue(pageRequest, "id");
  191. // String name = PageRequest.getColumnFilterValue(pageRequest, "name");
  192. // String parentId = PageRequest.getColumnFilterValue(pageRequest, "parentId");
  193. //
  194. // Page<EsmInsCompany> p = PageRequest.buildPageRequest(pageRequest);
  195. //
  196. // LambdaQueryWrapper<EsmInsCompany> lqw = new LambdaQueryWrapper<>();
  197. // lqw.eq(StringUtils.isNotEmpty(id), EsmInsCompany::getId, id);
  198. // lqw.like(StringUtils.isNotEmpty(name), EsmInsCompany::getName, name);
  199. // lqw.eq(StringUtils.isNotEmpty(parentId), EsmInsCompany::getParentId, parentId);
  200. //
  201. // IPage<EsmInsCompany> pResult = esmInsCompanyService.page(p, lqw);
  202. // //传入查询条件
  203. // PageResult<EsmInsCompany> pageResult = PageResult.buildPageResult(pResult);
  204. // return HttpResult.ok(pageResult);
  205. //
  206. //
  207. // }
  208. // /**
  209. // * 删除公司信息
  210. // *
  211. // * @param idList
  212. // * @return
  213. // */
  214. // @PostMapping(value = "/deleteInsCompany")
  215. // public HttpResult delete(@RequestParam List<String> idList) {
  216. // Integer result = 0;
  217. // String msg = "删除成功";
  218. //
  219. // if (idList != null && idList.size() > 0) {
  220. //// result = esmInsCompanyService.delete(idList);
  221. // esmInsCompanyService.removeByIds(idList);
  222. //
  223. //// esmInsCompanyService.allowQuote(null,idList);
  224. // return HttpResult.ok(msg);
  225. //
  226. // } else {
  227. // msg = "编码不能为空";
  228. // return HttpResult.ok(msg, result);
  229. // }
  230. // }
  231. /**
  232. * 批量逻辑删除
  233. *
  234. * @author: lig
  235. * @date: 2023年04月14日 0014
  236. */
  237. // @Operation(value = "批量删除操作")
  238. // @DeleteMapping(value = "/idBatch")
  239. // public HttpResult<Object> deleteBatch(@RequestParam List<String> idList) {
  240. //
  241. // LambdaUpdateWrapper<EsmInsCompany> lqw = new LambdaUpdateWrapper<>();
  242. // lqw.in(EsmInsCompany::getId, idList);
  243. // esmInsCompanyService.remove(lqw);
  244. //
  245. // return HttpResult.ok("操作成功");
  246. //
  247. // }
  248. @Operation(summary = "删除操作")
  249. @GetMapping(value = "/{id}")
  250. public HttpResult<Object> delete(@PathVariable("id") String id) {
  251. EsmInsCompany esmInsCompany = esmInsCompanyService.isExists(id);
  252. if ("0".equals(esmInsCompany.getParentId()) && !ManagementSourceEnum.MS_01.getCode()
  253. .equals(esmInsCompany.getType())) {
  254. throw new SystemException("财险,寿险,一级保险公司无法删除");
  255. }
  256. List<EsmInsCompany> list = esmInsCompanyService.list(new LambdaQueryWrapper<EsmInsCompany>().eq(EsmInsCompany::getParentId, id));
  257. AssertionUtils.isSucceed(list.isEmpty(), "此公司还有下级公司无法删除");
  258. esmInsCompanyService.removeById(id);
  259. return HttpResult.ok("操作成功");
  260. }
  261. // @Operation(value = "恢复删除操作")
  262. // @GetMapping(value = "/{id}")
  263. // public HttpResult rollBackDelete(@PathVariable("id") String id) {
  264. //
  265. // EsmInsCompany eic = esmInsCompanyService.getById(id);
  266. // if (null == eic) return HttpResult.error("对象不存在");
  267. //
  268. // eic.setDelFlag(0);
  269. // esmInsCompanyService.updateById(eic);
  270. //
  271. // return HttpResult.ok("操作成功");
  272. //
  273. // }
  274. // @Operation(value = "获取允许报价的保险公司列表")
  275. // @GetMapping(value = "/gainAllowQuoteList")
  276. // public HttpResult gainAllowQuoteList() {
  277. // LambdaQueryWrapper<EsmInsCompany> lqw = new LambdaQueryWrapper<>();
  278. // lqw.eq(EsmInsCompany::getDelFlag, 0);
  279. // lqw.eq(EsmInsCompany::getOpenQuote, 1);
  280. // lqw.eq(EsmInsCompany::getParentId, "0");
  281. // List<EsmInsCompany> list = esmInsCompanyService.list(lqw);
  282. // return HttpResult.ok(list);
  283. //
  284. // }
  285. @Operation(summary = "获取顶级保险公司列表")
  286. @GetMapping(value = "/gainTopList")
  287. public HttpResult<List<EsmInsCompanyResVo>> gainTopList(@RequestParam String type,@RequestParam(required = false) String systemCode) {
  288. LambdaQueryWrapper<EsmInsCompany> lqw = new LambdaQueryWrapper<>();
  289. lqw.eq(EsmInsCompany::getParentId, "0");
  290. lqw.orderByAsc(EsmInsCompany::getOrderNum);
  291. lqw.eq(StringUtils.isNotEmpty(type), EsmInsCompany::getType, type);
  292. List<EsmInsCompany> list = esmInsCompanyService.list(lqw);
  293. if(Objects.nonNull(systemCode)) {
  294. SysSystemBusPermsVo perms = sysSystemService.getBusPerms(systemCode);
  295. if (perms.getQuoteCompany() == 2) {
  296. List<String> quoteCompanyList = perms.getQuoteCompanyList();
  297. if (!CollectionUtils.isEmpty(quoteCompanyList)) {
  298. list = list.stream().filter(r -> quoteCompanyList.contains(r.getId())).collect(Collectors.toList());
  299. }
  300. }
  301. }
  302. List<EsmInsCompanyResVo> esmInsCompanyResVos = BeanUtil.copyToList(list, EsmInsCompanyResVo.class);
  303. // modify by lipf, 2026年4月16日17:44:27 对结果进行优化,按照中文进行排序
  304. // 1. 获取中文 Collator 实例
  305. Collator collator = Collator.getInstance(Locale.CHINA);
  306. // 2. 使用 Comparator.comparing 进行排序
  307. // 升序 (A-Z)
  308. esmInsCompanyResVos.sort(Comparator.comparing(EsmInsCompanyResVo::getNameSimple, collator));
  309. return HttpResult.ok(esmInsCompanyResVos);
  310. }
  311. @Operation(summary = "获取顶级保险公司和协议子集列表")
  312. @GetMapping(value = "/gainTopAgreementList")
  313. public HttpResult<List<EsmInsCompanyResVo>> gainTopAgreementList(@RequestParam String type) {
  314. LambdaQueryWrapper<EsmInsCompany> lqw = new LambdaQueryWrapper<>();
  315. lqw.eq(EsmInsCompany::getParentId, "0");
  316. lqw.orderByAsc(EsmInsCompany::getOrderNum);
  317. lqw.eq(StringUtils.isNotEmpty(type), EsmInsCompany::getType, type);
  318. List<EsmInsCompany> list = esmInsCompanyService.list(lqw);
  319. List<EsmInsCompanyResVo> esmInsCompanyResVos = BeanUtil.copyToList(list, EsmInsCompanyResVo.class);
  320. // for (EsmInsCompanyResVo esmInsCompany : esmInsCompanyResVos) {
  321. // PtlAgreementPageVo ptlAgreementPageVo = new PtlAgreementPageVo();
  322. // ptlAgreementPageVo.setPartnerCompaniesId(esmInsCompany.getId());
  323. // HttpResult<List<PtlAgreement>> agreement = ptlAgreementService.listAgreement(ptlAgreementPageVo);
  324. // List<PtlAgreement> agreementList = agreement.getData();
  325. // for (PtlAgreement ptlAgreement : agreementList) {
  326. // ptlAgreement.setName(ptlAgreement.getAgreementName() +
  327. // (StringUtils.isBlank(ptlAgreement.getJobDescription())? "" : "-"+ptlAgreement.getJobDescription()) +
  328. // (StringUtils.isBlank(ptlAgreement.getBusinessDescription())? "" : "-"+ptlAgreement.getBusinessDescription()));
  329. // }
  330. // esmInsCompany.setAgreementList(agreementList);
  331. // }
  332. return HttpResult.ok(esmInsCompanyResVos);
  333. }
  334. @Operation(summary = "查询保司机构下级")
  335. @GetMapping(value = "/queryListByParentId/{parentId}")
  336. public HttpResult<List<EsmInsCompany>> queryListByParentId(@PathVariable("parentId") String parentId) {
  337. if (parentId == null || "".equals(parentId)) {
  338. return HttpResult.error("parentId父级id不能为空");
  339. }
  340. List<EsmInsCompany> esmInsCompanyList = esmInsCompanyService.queryListByParentId(parentId);
  341. return HttpResult.ok(esmInsCompanyList);
  342. }
  343. /**
  344. * @version
  345. * @author: hxl
  346. * @Date: 2024/9/20 16:22
  347. * @Description: 查询子订单中的保险公司列表
  348. */
  349. @Operation(summary = "查询子订单中的保险公司列表")
  350. @GetMapping(value = "/findOrderCompanyList")
  351. public HttpResult<List<EsmInsCompanyResVo>> findOrderCompanyList() {
  352. List<EsmInsCompanyResVo> esmInsCompanyList = esmInsCompanyService.findOrderCompanyList();
  353. return HttpResult.ok(esmInsCompanyList);
  354. }
  355. /**
  356. * @version
  357. * @author: hxl
  358. * @Date: 2024/12/12 14:29
  359. * @Description: 获取外部协议的保险公司的集合
  360. */
  361. @PostMapping("/getExternalAgreementCompanyList")
  362. @Operation(summary = "获取外部协议的保险公司的集合")
  363. public HttpResult<List<EsmInsCompanyResVo>> getExternalAgreementCompanyList(@RequestSingleParam("name") String name) {
  364. List<EsmInsCompanyResVo> lst = esmInsCompanyService.getExternalAgreementCompanyList(name);
  365. return HttpResult.ok(lst);
  366. }
  367. @Operation(summary = "查找存在协议的保险公司列表")
  368. @GetMapping(value = "/liveCompanyList")
  369. public HttpResult liveCompanyList() {
  370. List<EsmInsCompanyResVo> list = esmInsCompanyService.liveCompanyList();
  371. return HttpResult.ok(list);
  372. }
  373. /**
  374. * @version
  375. * @author: hxl
  376. * @date: 2025/1/18 15:26
  377. * @Description: 查询子订单的合作公司列表
  378. */
  379. @Operation(summary = "查询子订单中的合作公司列表")
  380. @GetMapping(value = "/findOrderPartnerCompanyList")
  381. public HttpResult<List<EsmInsCompanyResVo>> findOrderPartnerCompanyList() {
  382. List<EsmInsCompanyResVo> esmInsCompanyList = esmInsCompanyService.findOrderPartnerCompanyList();
  383. return HttpResult.ok(esmInsCompanyList);
  384. }
  385. @Operation(summary = "根据保险公司id获取保司列表")
  386. @GetMapping(value = "/getCompanyByIds")
  387. public HttpResult<List<EsmInsCompany>> getCompanyByIds(String ids) {
  388. List<String> companyList = Arrays.asList(ids.split(","));
  389. List<EsmInsCompany> esmInsCompanyList = esmInsCompanyService.getCompanyByIds(companyList);
  390. return HttpResult.ok(esmInsCompanyList);
  391. }
  392. @Operation(summary = "获取保司排序信息")
  393. @GetMapping(value = "getCompanySort")
  394. public HttpResult<List<EsmInsCompany>> getCompanySort(){
  395. List<EsmInsCompany> companyByIds = esmInsCompanyService.getCompanySort(baseController.getUserSystemCode());
  396. return HttpResult.ok(companyByIds);
  397. }
  398. @Operation(summary = "更新保司排序信息")
  399. @PostMapping(value = "updateCompanySort")
  400. public HttpResult<String> updateCompanySort(@RequestBody List<EsmInsCompany> esmInsCompanyList){
  401. boolean result = esmInsCompanyService.updateCompanySort(esmInsCompanyList,baseController.getUserSystemCode());
  402. return result ? HttpResult.ok("更新保司排序成功") : HttpResult.error("更新保司排序失败");
  403. }
  404. @Operation(summary = "获取保司的所有下级id")
  405. @PostMapping(value = "getParentIds")
  406. public HttpResult getParentIds(@RequestBody List<String> companyIds){
  407. return HttpResult.ok(esmInsCompanyService.getParentIds(companyIds));
  408. }
  409. @Operation(summary = "查找顶级保司id")
  410. @PostMapping(value = "getTopCompanyId")
  411. public HttpResult getTopCompanyId(@RequestBody String companyId){
  412. return HttpResult.ok(esmInsCompanyService.getTopCompanyId(companyId));
  413. }
  414. /**
  415. * 获取所有保险公司的全路径名称
  416. * Key: 公司ID
  417. * Value: 总公司/分公司/支公司
  418. */
  419. @Operation(summary = "获取所有保险公司的全路径名称")
  420. @GetMapping("getAllCompanyHierarchyPaths")
  421. public Map<String, String> getAllCompanyHierarchyPaths(){
  422. return esmInsCompanyService.getAllCompanyHierarchyPaths();
  423. }
  424. /**
  425. * 获取所有保险公司的对应关系
  426. *
  427. * @return HttpResult<Map<String,EsmInsCompany>> key是保险公司id, value是保险公司对象实体
  428. * @author lipf
  429. * @date 2026年5月23日09:06:47
  430. */
  431. @Operation(summary = "获取所有保险公司的对应关系")
  432. @GetMapping("queryAllCompanyMap")
  433. public HttpResult<Map<String,EsmInsCompany>> queryAllCompanyMap(){
  434. return HttpResult.ok(esmInsCompanyService.queryAllCompanyMap());
  435. }
  436. /**
  437. * 查询保险公司关联的所有子公司和总公司
  438. *
  439. * @param companyId 保险公司的id
  440. * @return HttpResult<List<String>>
  441. * @author lipf
  442. * @date 2026年7月31日09:29:26
  443. */
  444. @Operation(summary = "查询保险公司关联的所有子公司和总公司")
  445. @GetMapping("/queryRelatedCompanyIds")
  446. HttpResult<List<String>> queryRelatedCompanyIds(@RequestParam("companyId") String companyId){
  447. List<String> companyIds = esmInsCompanyService.queryRelatedCompanyIds(companyId);
  448. companyIds = companyIds.stream().distinct().toList();
  449. log.info("查询保险公司关联的所有子公司和总公司: companyId=[{}], companyIds=[{}],companyIds.size=[{}]", companyId, JSONUtil.toJsonStr(companyIds), CollUtil.size(companyIds));
  450. return HttpResult.ok(companyIds);
  451. }
  452. /**
  453. * 查询保险公司的所有子公司(含子子公司)以及保险公司本身
  454. *
  455. * @author lipf
  456. * @date 2026/7/31 9:44
  457. */
  458. @GetMapping("/queryOwnAndSubCompandyIds")
  459. HttpResult<List<String>> queryOwnAndSubCompandyIds(@RequestParam("companyId") String companyId){
  460. List<String> companyIds = esmInsCompanyService.queryOwnAndSubCompandyIds(companyId);
  461. companyIds = companyIds.stream().distinct().toList();
  462. log.info("查询保险公司关联的所有子公司: companyId=[{}], companyIds=[{}],companyIds.size=[{}]", companyId, JSONUtil.toJsonStr(companyIds), CollUtil.size(companyIds));
  463. return HttpResult.ok(companyIds);
  464. }
  465. }