package com.ydtech.modules.protocols.controller; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ydtech.constants.enums.InsuranceRisk; import com.ydtech.core.page.HttpResult; import com.ydtech.core.page.PageResult; import com.ydtech.modules.base.controller.BaseController; import com.ydtech.modules.order.entity.vo.FeeOrderNewRecordVo; import com.ydtech.modules.protocol.entity.po.PtlAgreement; import com.ydtech.modules.protocol.service.PtlAgreementService; import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsNew; import com.ydtech.modules.protocols.entity.po.PtlAgreementUndwrtRulesAttr; import com.ydtech.modules.protocols.entity.vo.*; import com.ydtech.modules.protocols.service.PtlAgreementProductCostsNewService; import com.ydtech.modules.protocols.service.PtlAgreementProductCostsTrajectoryService; import com.ydtech.modules.protocols.service.PtlAgreementUndwrtRulesAttrService; import com.ydtech.modules.protocols.service.PtlAgreementUndwrtRulesNewService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.poi.ss.formula.functions.T; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; /** * @author: tz * @description: 协议controller * @create: 2024-2-22 15:44:29 */ @Api(tags = "新版协议") @RequestMapping("/plt/new/agreement") @RestController public class PtlNewAgreementController extends BaseController { @Autowired private PtlAgreementUndwrtRulesAttrService ptlAgreementUndwrtRulesAttrService; @Autowired private PtlAgreementProductCostsNewService ptlAgreementProductCostsNewService; @Autowired private PtlAgreementUndwrtRulesNewService ptlAgreementUndwrtRulesNewService; @Autowired private PtlAgreementProductCostsTrajectoryService ptlAgreementProductCostsTrajectoryService; @Autowired private PtlAgreementService ptlAgreementService; @ApiOperation(value = "协议承保规则属性列表") @GetMapping("/attr/list") public HttpResult> list() { List undwrtRulesAttrList = ptlAgreementUndwrtRulesAttrService.getUndwrtRulesAttrList(); return HttpResult.ok(undwrtRulesAttrList); } @ApiOperation(value = "协议承保规则属性列表") @GetMapping("/attr/listByCompanyId") public HttpResult> listByCompanyId(String companyId) { List undwrtRulesAttrList = ptlAgreementUndwrtRulesAttrService.getUndwrtRulesAttrList(companyId); return HttpResult.ok(undwrtRulesAttrList); } @ApiOperation(value = "查询保险公司所有协议列表") @GetMapping("/companyAgreementList") public HttpResult> companyAgreementList(String agreementId) { return HttpResult.ok(ptlAgreementService.getCurrentAgreementList(agreementId)); } @PostMapping("/getProduct") @ApiOperation("查询协议产品费用列表") public PageResult getProduct(@RequestBody AgreementProductQueryVo agreementProductQueryVo) { Page page = buildPageRequest(agreementProductQueryVo.getPageDto()); Page schemeQueryDto = ptlAgreementProductCostsNewService.getByAgreementId(page, agreementProductQueryVo); return buildPageResponse(schemeQueryDto); } @ApiOperation("获取费用审核列表") @PostMapping("/getCostsAuditList") public HttpResult getCostsAuditList(@RequestBody AgreementProductQueryVo agreementProductQueryVo) { Page page = buildPageRequest(agreementProductQueryVo.getPageDto()); Page schemeQueryDto = ptlAgreementProductCostsNewService.getCostsAuditList(page, agreementProductQueryVo); return HttpResult.ok(buildPageResponse(schemeQueryDto)); } @ApiOperation(value = "获取协议费用") @GetMapping("/costs/get") public HttpResult costsGet(String costsId) { //获取保险公司 PtlAgreementProductCostsNew ptlAgreementProductCostsNew = ptlAgreementProductCostsNewService.getById(costsId); String companyId = ptlAgreementService.getById(ptlAgreementProductCostsNew.getAgreementId()).getPartnerCompaniesId(); List undwrtRulesAttrList = ptlAgreementUndwrtRulesAttrService.getUndwrtRulesAttrList(companyId); AgreementProductCostsSave agreementProductCosts = ptlAgreementProductCostsNewService.costsGet(costsId, undwrtRulesAttrList); return HttpResult.ok(agreementProductCosts); } @ApiOperation(value = "添加协议费用") @PostMapping("/costs/add") public HttpResult costsAdd(@RequestBody AgreementProductCosts agreementProductCostsList) { return ptlAgreementProductCostsNewService.costsAdd(agreementProductCostsList) ? HttpResult.ok("添加协议费用成功") : HttpResult.error("添加协议费用失败"); } @ApiOperation(value = "更新协议费用") @PostMapping("/costs/update") public HttpResult costsUpdate(@RequestBody AgreementProductCosts agreementProductCosts) { return ptlAgreementProductCostsNewService.costsUpdate(agreementProductCosts) ? HttpResult.ok("更新协议费用成功") : HttpResult.error("更新协议费用失败"); } @ApiOperation(value = "通过id禁用费用") @PostMapping("/costs/disable/{costsId}") public HttpResult costsDisable(@PathVariable String costsId) { return ptlAgreementProductCostsNewService.costsDisable(costsId); } @ApiOperation(value = "禁用费用") @PostMapping("/costs/batchDisable") public HttpResult costsBatchDisable(@RequestBody CostsBatchDisableVo costsBatchDisableVo) { return ptlAgreementProductCostsNewService.costsBatchDisable(costsBatchDisableVo.getCostsIdList()); } @ApiOperation(value = "删除协议费用") @PostMapping("/costs/delete") public HttpResult costsDelete(String costsId) { return ptlAgreementProductCostsNewService.costsDelete(costsId) ? HttpResult.ok("删除协议费用成功") : HttpResult.error("删除协议费用失败"); } @ApiOperation(value = "复制协议费用") @PostMapping("/costs/copy") public HttpResult costsCopy(@RequestBody AgreementProductCostsCopyVo agreementProductCostsCopyVo) { //orgCostsId:原协议费用id //newAgreementId:新协议id return ptlAgreementProductCostsNewService.costsCopy(agreementProductCostsCopyVo) ? HttpResult.ok("复制协议费用成功") : HttpResult.error("复制协议费用失败"); } @ApiOperation(value = "批量复制协议费用") @PostMapping("/costs/copyBatch") public HttpResult costsCopyBatch(@RequestBody AgreementProductCostsCopyVo agreementProductCostsCopyVo) { //orgCostsId:原协议费用id //newAgreementId:新协议id return ptlAgreementProductCostsNewService.costsCopyBatch(agreementProductCostsCopyVo) ? HttpResult.ok("复制协议费用成功") : HttpResult.error("复制协议费用失败"); } @ApiOperation(value = "调整费用") @PostMapping("/costs/adjust") public HttpResult costsAdjust(@RequestBody FeeOrderNewRecordVo feeOrderNewRecordVo) { return HttpResult.ok("调整费用成功", ptlAgreementProductCostsNewService.costsAdjust(feeOrderNewRecordVo)); } @ApiOperation(value = "费用审核") @PostMapping("/costs/audit") public HttpResult costsAudit(@RequestBody CostsAuditVo costsAuditVo) { return ptlAgreementProductCostsNewService.costsAudit(costsAuditVo) ? HttpResult.ok("费用审核成功") : HttpResult.error("费用审核失败"); } @ApiOperation(value = "费用批量审核") @PostMapping("/costs/auditBatch") public HttpResult costsAuditBatch(@RequestBody CostsAuditVo costsAuditVo) { return ptlAgreementProductCostsNewService.costsAuditBatch(costsAuditVo) ? HttpResult.ok("费用批量审核成功") : HttpResult.error("费用批量审核失败"); } @ApiOperation(value = "费用批量修改起止期") @PostMapping("/costs/costsDateBatch") public HttpResult costsDateBatch(@RequestBody AgreementProductCostsVo agreementProductCostsVo) { return ptlAgreementProductCostsNewService.costsDateBatch(agreementProductCostsVo) ? HttpResult.ok("费用批量修改起止期成功") : HttpResult.error("费用批量修改起止期失败"); } @ApiOperation(value = "费用批量修改") @PostMapping("/costs/costsBatch") public HttpResult costsBatch(@RequestBody AgreementProductCostsVo agreementProductCostsVo) { return ptlAgreementProductCostsNewService.costsBatch(agreementProductCostsVo) ? HttpResult.ok("费用批量修改成功") : HttpResult.error("费用批量修改失败"); } @ApiOperation("费用批量删除") @PostMapping("/costs/deleteBatch") public HttpResult costsDeleteBatch(@RequestBody String[] ids) { Boolean b = ptlAgreementProductCostsNewService.costsDeleteBatch(ids); return b ? HttpResult.ok("删除成功") : HttpResult.error("删除失败"); } @ApiOperation(value = "获取承保规则列表") @PostMapping("/undwrt/rules/list") public PageResult getRulesList(@RequestBody AgreementUndwrtRulesQueryVo agreementUndwrtRulesQueryVo) { Page page = buildPageRequest(agreementUndwrtRulesQueryVo.getPageDto()); Page rulesPage = ptlAgreementUndwrtRulesNewService.rulesPage(page, agreementUndwrtRulesQueryVo.getAgreementId()); return buildPageResponse(rulesPage); } @ApiOperation(value = "获取承保规则") @GetMapping("/undwrt/rules/get") public HttpResult get(String ruleId) { List undwrtRulesAttrList = ptlAgreementUndwrtRulesAttrService.getUndwrtRulesAttrList(); AgreementUndwrtRulesSave agreementUndwrtRulesSave = ptlAgreementUndwrtRulesNewService.rulesGet(ruleId, undwrtRulesAttrList); return HttpResult.ok(agreementUndwrtRulesSave); } @ApiOperation(value = "添加承保规则") @PostMapping("/undwrt/rules/add") public HttpResult rulesAdd(@RequestBody AgreementUndwrtRules agreementUndwrtRules) { return ptlAgreementUndwrtRulesNewService.rulesAdd(agreementUndwrtRules) ? HttpResult.ok("添加承保规则成功") : HttpResult.error("添加承保规则失败"); } @ApiOperation(value = "更新承保规则") @PostMapping("/undwrt/rules/update") public HttpResult rulesUpdate(@RequestBody AgreementUndwrtRules agreementUndwrtRules) { return ptlAgreementUndwrtRulesNewService.rulesUpdate(agreementUndwrtRules) ? HttpResult.ok("更新承保规则成功") : HttpResult.error("更新承保规则失败"); } @ApiOperation(value = "删除承保规则") @PostMapping("/undwrt/rules/delete") public HttpResult rulesDelete(String ruleId) { return ptlAgreementUndwrtRulesNewService.rulesDelete(ruleId) ? HttpResult.ok("删除承保规则成功") : HttpResult.error("删除承保规则失败"); } @ApiOperation(value = "费用轨迹查询") @GetMapping("/costs/trajectory/get") public HttpResult getTrajectory(String costsId) { return HttpResult.ok(ptlAgreementProductCostsTrajectoryService.getTrajectory(costsId)); } @ApiOperation("获取非现询费用") @PostMapping("getInquiryNowFee") public HttpResult getInquiryNowFee(@RequestBody InquiryNowFeeQueryVo inquiryNowFeeQueryVo) { return HttpResult.ok(ptlAgreementProductCostsNewService.getInquiryNowFee(inquiryNowFeeQueryVo)); } @ApiOperation("获取产品id") @PostMapping("getProductId") public HttpResult getProductId(@RequestBody ProductQueryVo productQueryVo) { return HttpResult.ok("", InsuranceRisk.determineInsuranceInformation(productQueryVo.getKindList(), productQueryVo.getRiskList()).getCode()); } @ApiOperation("复制承保规则") @PostMapping("/undwrt/copyRules") public HttpResult copyRules(@RequestBody AgreementUndwrtRules agreementUndwrtRules) { return ptlAgreementUndwrtRulesNewService.copyRules(agreementUndwrtRules) ? HttpResult.ok("复制承保规则成功") : HttpResult.error("复制承保规则失败"); } @ApiOperation("复制承保规则查询同保险公司协议") @GetMapping("/getAllAgreement") public HttpResult> getAllAgreement(String companyCode) { return HttpResult.ok(ptlAgreementService.getByCompanyCode(companyCode)); } @ApiOperation("复制协议费用承保规则") @PostMapping("/copyAgreementAllInformation") public HttpResult copyAgreementAllInformation(@RequestBody AgreementAllInformationCopyVo agreementAllInformationCopyVo) { ptlAgreementService.agreementAllInformationCopyVo(agreementAllInformationCopyVo); return HttpResult.ok("复制成功"); } }