|
|
@@ -0,0 +1,324 @@
|
|
|
+package com.jzg.controller;
|
|
|
+
|
|
|
+
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.jzg.commons.core.page.HttpResult;
|
|
|
+import com.jzg.commons.entity.dto.EsmInsCompanyAdd;
|
|
|
+import com.jzg.commons.entity.dto.EsmInsCompanyEnd;
|
|
|
+import com.jzg.commons.entity.vo.EsmInsCompanyReq;
|
|
|
+import com.jzg.commons.entity.vo.EsmInsCompanyResVo;
|
|
|
+import com.jzg.commons.entity.vo.EsmInsCompanyVo;
|
|
|
+import com.jzg.commons.exception.SystemException;
|
|
|
+import com.jzg.commons.util.AssertionUtils;
|
|
|
+import com.jzg.commons.util.ConvertUtils;
|
|
|
+import com.jzg.commons.util.StringUtils;
|
|
|
+import com.jzg.constants.ManagementSourceEnum;
|
|
|
+import com.jzg.service.EsmInsCompanyService;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import com.jzg.commons.core.base.BaseController;
|
|
|
+import com.jzg.commons.entity.po.EsmInsCompany;
|
|
|
+import com.jzg.commons.request.RequestSingleParam;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * ---------------------------
|
|
|
+ * 保险公司管理 (EsmInsCompanyController)
|
|
|
+ * ---------------------------
|
|
|
+ * 作者:
|
|
|
+ * ---------------------------
|
|
|
+ */
|
|
|
+@Tag(name = "保险公司管理")
|
|
|
+@RestController
|
|
|
+@RequestMapping("esmInsCompany")
|
|
|
+public class EsmInsCompanyController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private EsmInsCompanyService esmInsCompanyService;
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("leftList")
|
|
|
+ @Operation(summary = "获取顶级保险公司列表")
|
|
|
+ public HttpResult<List<EsmInsCompanyResVo>> leftList(@RequestBody EsmInsCompanyReq req) {
|
|
|
+ List<EsmInsCompanyResVo> list = esmInsCompanyService.leftList(req);
|
|
|
+ return HttpResult.ok(list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("/findLeftInsTree")
|
|
|
+ @Operation(summary = "查询左侧树")
|
|
|
+ public HttpResult<List<EsmInsCompany>> findLeftInsTree(@RequestSingleParam("type") String type) {
|
|
|
+ LambdaQueryWrapper<EsmInsCompany> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(StringUtils.isNotEmpty(type), EsmInsCompany::getType, type);
|
|
|
+ List<EsmInsCompany> lst = esmInsCompanyService.list(wrapper);
|
|
|
+ return HttpResult.ok(lst);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/findTree")
|
|
|
+ @Operation(summary = "获取树结构")
|
|
|
+ public HttpResult<List<EsmInsCompanyVo>> findTree(@RequestBody EsmInsCompanyReq req) {
|
|
|
+ return HttpResult.ok(esmInsCompanyService.findTree(req));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping(value = "/saveInsCompany")
|
|
|
+ @Operation(summary = "保存信息")
|
|
|
+ public HttpResult<Object> save(@Validated @RequestBody EsmInsCompanyAdd companyAdd) {
|
|
|
+ ConvertUtils.emptyToNull(companyAdd);
|
|
|
+ LambdaQueryWrapper<EsmInsCompany> lqw = new LambdaQueryWrapper<>();
|
|
|
+ lqw.eq(EsmInsCompany::getCompanyCode, companyAdd.getCompanyCode());
|
|
|
+ AssertionUtils.isFail(esmInsCompanyService.count(lqw) > 0, "供应商编码重复");
|
|
|
+ EsmInsCompany esmInsCompany = BeanUtil.copyProperties(companyAdd, EsmInsCompany.class);
|
|
|
+ return esmInsCompanyService.save(esmInsCompany) ?HttpResult.ok("保存成功") : HttpResult.error("保存失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping(value = "/editInsCompany")
|
|
|
+ @Operation(summary = "修改信息")
|
|
|
+ public HttpResult<Object> update(@Validated @RequestBody EsmInsCompanyEnd companyEnd) {
|
|
|
+ ConvertUtils.emptyToNull(companyEnd);
|
|
|
+ LambdaQueryWrapper<EsmInsCompany> lqw = new LambdaQueryWrapper<>();
|
|
|
+ lqw.eq(EsmInsCompany::getCompanyCode, companyEnd.getCompanyCode());
|
|
|
+ lqw.ne(EsmInsCompany::getId, companyEnd.getId());
|
|
|
+ AssertionUtils.isFail(esmInsCompanyService.count(lqw) > 1, "供应商编码重复");
|
|
|
+ EsmInsCompany esmInsCompany = BeanUtil.copyProperties(companyEnd, EsmInsCompany.class);
|
|
|
+ return esmInsCompanyService.updateById(esmInsCompany) ? HttpResult.ok("修改成功") : HttpResult.error("修改失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询下级机构列表
|
|
|
+ *
|
|
|
+ * @param parentid
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Operation(summary = "查询下级机构列表")
|
|
|
+ @PostMapping(value = "/selectList")
|
|
|
+ public HttpResult<List<EsmInsCompany>> selectList(@RequestParam String parentid) {
|
|
|
+ if (StringUtils.isEmpty(parentid)) parentid = "0";
|
|
|
+ LambdaQueryWrapper<EsmInsCompany> lqw = new LambdaQueryWrapper<>();
|
|
|
+ lqw.eq(EsmInsCompany::getParentId, parentid);
|
|
|
+ List<EsmInsCompany> selectList = esmInsCompanyService.list(lqw);
|
|
|
+ return HttpResult.ok(selectList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据主键查询
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Operation(summary = "根据主键查询")
|
|
|
+ @GetMapping(value = "/findById")
|
|
|
+ public HttpResult<EsmInsCompany> findById(@RequestParam String id) {
|
|
|
+ return HttpResult.ok(esmInsCompanyService.getById(id));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 基础分页查询
|
|
|
+ *
|
|
|
+ * @param pageRequest
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+// @PostMapping(value = "/findPage")
|
|
|
+// public HttpResult findPage(@RequestBody PageRequest pageRequest) {
|
|
|
+//
|
|
|
+// String id = PageRequest.getColumnFilterValue(pageRequest, "id");
|
|
|
+// String name = PageRequest.getColumnFilterValue(pageRequest, "name");
|
|
|
+// String parentId = PageRequest.getColumnFilterValue(pageRequest, "parentId");
|
|
|
+//
|
|
|
+// Page<EsmInsCompany> p = PageRequest.buildPageRequest(pageRequest);
|
|
|
+//
|
|
|
+// LambdaQueryWrapper<EsmInsCompany> lqw = new LambdaQueryWrapper<>();
|
|
|
+// lqw.eq(StringUtils.isNotEmpty(id), EsmInsCompany::getId, id);
|
|
|
+// lqw.like(StringUtils.isNotEmpty(name), EsmInsCompany::getName, name);
|
|
|
+// lqw.eq(StringUtils.isNotEmpty(parentId), EsmInsCompany::getParentId, parentId);
|
|
|
+//
|
|
|
+// IPage<EsmInsCompany> pResult = esmInsCompanyService.page(p, lqw);
|
|
|
+// //传入查询条件
|
|
|
+// PageResult<EsmInsCompany> pageResult = PageResult.buildPageResult(pResult);
|
|
|
+// return HttpResult.ok(pageResult);
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+
|
|
|
+// /**
|
|
|
+// * 删除公司信息
|
|
|
+// *
|
|
|
+// * @param idList
|
|
|
+// * @return
|
|
|
+// */
|
|
|
+// @PostMapping(value = "/deleteInsCompany")
|
|
|
+// public HttpResult delete(@RequestParam List<String> idList) {
|
|
|
+// Integer result = 0;
|
|
|
+// String msg = "删除成功";
|
|
|
+//
|
|
|
+// if (idList != null && idList.size() > 0) {
|
|
|
+//// result = esmInsCompanyService.delete(idList);
|
|
|
+// esmInsCompanyService.removeByIds(idList);
|
|
|
+//
|
|
|
+//// esmInsCompanyService.allowQuote(null,idList);
|
|
|
+// return HttpResult.ok(msg);
|
|
|
+//
|
|
|
+// } else {
|
|
|
+// msg = "编码不能为空";
|
|
|
+// return HttpResult.ok(msg, result);
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量逻辑删除
|
|
|
+ *
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023年04月14日 0014
|
|
|
+ */
|
|
|
+// @Operation(value = "批量删除操作")
|
|
|
+// @DeleteMapping(value = "/idBatch")
|
|
|
+// public HttpResult<Object> deleteBatch(@RequestParam List<String> idList) {
|
|
|
+//
|
|
|
+// LambdaUpdateWrapper<EsmInsCompany> lqw = new LambdaUpdateWrapper<>();
|
|
|
+// lqw.in(EsmInsCompany::getId, idList);
|
|
|
+// esmInsCompanyService.remove(lqw);
|
|
|
+//
|
|
|
+// return HttpResult.ok("操作成功");
|
|
|
+//
|
|
|
+// }
|
|
|
+ @Operation(summary = "删除操作")
|
|
|
+ @GetMapping(value = "/{id}")
|
|
|
+ public HttpResult<Object> delete(@PathVariable("id") String id) {
|
|
|
+ EsmInsCompany esmInsCompany = esmInsCompanyService.isExists(id);
|
|
|
+ if ("0".equals(esmInsCompany.getParentId()) && !ManagementSourceEnum.MS_01.getCode().equals(esmInsCompany.getType())) {
|
|
|
+ throw new SystemException("财险,寿险,一级保险公司无法删除");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<EsmInsCompany> list = esmInsCompanyService.list(new LambdaQueryWrapper<EsmInsCompany>().eq(EsmInsCompany::getParentId, id));
|
|
|
+ AssertionUtils.isSucceed(list.isEmpty(), "此公司还有下级公司无法删除");
|
|
|
+
|
|
|
+ esmInsCompanyService.removeById(id);
|
|
|
+ return HttpResult.ok("操作成功");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+// @Operation(value = "恢复删除操作")
|
|
|
+// @GetMapping(value = "/{id}")
|
|
|
+// public HttpResult rollBackDelete(@PathVariable("id") String id) {
|
|
|
+//
|
|
|
+// EsmInsCompany eic = esmInsCompanyService.getById(id);
|
|
|
+// if (null == eic) return HttpResult.error("对象不存在");
|
|
|
+//
|
|
|
+// eic.setDelFlag(0);
|
|
|
+// esmInsCompanyService.updateById(eic);
|
|
|
+//
|
|
|
+// return HttpResult.ok("操作成功");
|
|
|
+//
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+// @Operation(value = "获取允许报价的保险公司列表")
|
|
|
+// @GetMapping(value = "/gainAllowQuoteList")
|
|
|
+// public HttpResult gainAllowQuoteList() {
|
|
|
+// LambdaQueryWrapper<EsmInsCompany> lqw = new LambdaQueryWrapper<>();
|
|
|
+// lqw.eq(EsmInsCompany::getDelFlag, 0);
|
|
|
+// lqw.eq(EsmInsCompany::getOpenQuote, 1);
|
|
|
+// lqw.eq(EsmInsCompany::getParentId, "0");
|
|
|
+// List<EsmInsCompany> list = esmInsCompanyService.list(lqw);
|
|
|
+// return HttpResult.ok(list);
|
|
|
+//
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+ @Operation(summary = "获取顶级保险公司列表")
|
|
|
+ @GetMapping(value = "/gainTopList")
|
|
|
+ public HttpResult<List<EsmInsCompanyResVo>> gainTopList(@RequestParam String type) {
|
|
|
+ LambdaQueryWrapper<EsmInsCompany> lqw = new LambdaQueryWrapper<>();
|
|
|
+ lqw.eq(EsmInsCompany::getParentId, "0");
|
|
|
+ lqw.orderByAsc(EsmInsCompany::getOrderNum);
|
|
|
+ lqw.eq(StringUtils.isNotEmpty(type), EsmInsCompany::getType, type);
|
|
|
+ List<EsmInsCompany> list = esmInsCompanyService.list(lqw);
|
|
|
+ List<EsmInsCompanyResVo> esmInsCompanyResVos = BeanUtil.copyToList(list, EsmInsCompanyResVo.class);
|
|
|
+ return HttpResult.ok(esmInsCompanyResVos);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "获取顶级保险公司和协议子集列表")
|
|
|
+ @GetMapping(value = "/gainTopAgreementList")
|
|
|
+ public HttpResult<List<EsmInsCompanyResVo>> gainTopAgreementList(@RequestParam String type) {
|
|
|
+ LambdaQueryWrapper<EsmInsCompany> lqw = new LambdaQueryWrapper<>();
|
|
|
+ lqw.eq(EsmInsCompany::getParentId, "0");
|
|
|
+ lqw.orderByAsc(EsmInsCompany::getOrderNum);
|
|
|
+ lqw.eq(StringUtils.isNotEmpty(type), EsmInsCompany::getType, type);
|
|
|
+ List<EsmInsCompany> list = esmInsCompanyService.list(lqw);
|
|
|
+ List<EsmInsCompanyResVo> esmInsCompanyResVos = BeanUtil.copyToList(list, EsmInsCompanyResVo.class);
|
|
|
+// for (EsmInsCompanyResVo esmInsCompany : esmInsCompanyResVos) {
|
|
|
+// PtlAgreementPageVo ptlAgreementPageVo = new PtlAgreementPageVo();
|
|
|
+// ptlAgreementPageVo.setPartnerCompaniesId(esmInsCompany.getId());
|
|
|
+// HttpResult<List<PtlAgreement>> agreement = ptlAgreementService.listAgreement(ptlAgreementPageVo);
|
|
|
+// List<PtlAgreement> agreementList = agreement.getData();
|
|
|
+// for (PtlAgreement ptlAgreement : agreementList) {
|
|
|
+// ptlAgreement.setName(ptlAgreement.getAgreementName() +
|
|
|
+// (StringUtils.isBlank(ptlAgreement.getJobDescription())? "" : "-"+ptlAgreement.getJobDescription()) +
|
|
|
+// (StringUtils.isBlank(ptlAgreement.getBusinessDescription())? "" : "-"+ptlAgreement.getBusinessDescription()));
|
|
|
+// }
|
|
|
+// esmInsCompany.setAgreementList(agreementList);
|
|
|
+// }
|
|
|
+ return HttpResult.ok(esmInsCompanyResVos);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "查询保司机构下级")
|
|
|
+ @GetMapping(value = "/queryListByParentId/{parentId}")
|
|
|
+ public HttpResult<List<EsmInsCompany>> queryListByParentId(@PathVariable("parentId") String parentId) {
|
|
|
+ if(parentId==null || "".equals(parentId)) {
|
|
|
+ return HttpResult.error("parentId父级id不能为空");
|
|
|
+ }
|
|
|
+ List<EsmInsCompany> esmInsCompanyList = esmInsCompanyService.queryListByParentId(parentId);
|
|
|
+ return HttpResult.ok(esmInsCompanyList);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/9/20 16:22
|
|
|
+ * @Description: 查询子订单中的保险公司列表
|
|
|
+ */
|
|
|
+ @Operation(summary = "查询子订单中的保险公司列表")
|
|
|
+ @GetMapping(value = "/findOrderCompanyList")
|
|
|
+ public HttpResult<List<EsmInsCompanyResVo>> findOrderCompanyList() {
|
|
|
+ List<EsmInsCompanyResVo> esmInsCompanyList = esmInsCompanyService.findOrderCompanyList();
|
|
|
+ return HttpResult.ok(esmInsCompanyList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/12/12 14:29
|
|
|
+ * @Description: 获取外部协议的保险公司的集合
|
|
|
+ */
|
|
|
+ @PostMapping("/getExternalAgreementCompanyList")
|
|
|
+ @Operation(summary= "获取外部协议的保险公司的集合")
|
|
|
+ public HttpResult<List<EsmInsCompanyResVo>> getExternalAgreementCompanyList(@RequestSingleParam("name") String name) {
|
|
|
+ List<EsmInsCompanyResVo> lst = esmInsCompanyService.getExternalAgreementCompanyList(name);
|
|
|
+ return HttpResult.ok(lst);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Operation(summary = "查找存在协议的保险公司列表")
|
|
|
+ @GetMapping(value = "/liveCompanyList")
|
|
|
+ public HttpResult liveCompanyList(){
|
|
|
+ List<EsmInsCompanyResVo> list = esmInsCompanyService.liveCompanyList();
|
|
|
+ return HttpResult.ok(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2025/1/18 15:26
|
|
|
+ * @Description: 查询子订单的合作公司列表
|
|
|
+ */
|
|
|
+ @Operation(summary = "查询子订单中的合作公司列表")
|
|
|
+ @GetMapping(value = "/findOrderPartnerCompanyList")
|
|
|
+ public HttpResult<List<EsmInsCompanyResVo>> findOrderPartnerCompanyList() {
|
|
|
+ List<EsmInsCompanyResVo> esmInsCompanyList = esmInsCompanyService.findOrderPartnerCompanyList();
|
|
|
+ return HttpResult.ok(esmInsCompanyList);
|
|
|
+ }
|
|
|
+}
|