PtlNewAgreementController.java 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. package com.ydtech.modules.protocols.controller;
  2. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  3. import com.ydtech.constants.enums.InsuranceRisk;
  4. import com.ydtech.core.page.HttpResult;
  5. import com.ydtech.core.page.PageResult;
  6. import com.ydtech.modules.base.controller.BaseController;
  7. import com.ydtech.modules.order.entity.vo.FeeOrderNewRecordVo;
  8. import com.ydtech.modules.protocol.entity.po.PtlAgreement;
  9. import com.ydtech.modules.protocol.service.PtlAgreementService;
  10. import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsNew;
  11. import com.ydtech.modules.protocols.entity.po.PtlAgreementUndwrtRulesAttr;
  12. import com.ydtech.modules.protocols.entity.vo.*;
  13. import com.ydtech.modules.protocols.service.PtlAgreementProductCostsNewService;
  14. import com.ydtech.modules.protocols.service.PtlAgreementProductCostsTrajectoryService;
  15. import com.ydtech.modules.protocols.service.PtlAgreementUndwrtRulesAttrService;
  16. import com.ydtech.modules.protocols.service.PtlAgreementUndwrtRulesNewService;
  17. import io.swagger.annotations.Api;
  18. import io.swagger.annotations.ApiOperation;
  19. import org.apache.poi.ss.formula.functions.T;
  20. import org.springframework.beans.factory.annotation.Autowired;
  21. import org.springframework.web.bind.annotation.*;
  22. import java.util.List;
  23. /**
  24. *@author: tz
  25. *@description: 协议controller
  26. *@create: 2024-2-22 15:44:29
  27. */
  28. @Api(tags = "新版协议")
  29. @RequestMapping("/plt/new/agreement")
  30. @RestController
  31. public class PtlNewAgreementController extends BaseController {
  32. @Autowired
  33. private PtlAgreementUndwrtRulesAttrService ptlAgreementUndwrtRulesAttrService;
  34. @Autowired
  35. private PtlAgreementProductCostsNewService ptlAgreementProductCostsNewService;
  36. @Autowired
  37. private PtlAgreementUndwrtRulesNewService ptlAgreementUndwrtRulesNewService;
  38. @Autowired
  39. private PtlAgreementProductCostsTrajectoryService ptlAgreementProductCostsTrajectoryService;
  40. @Autowired
  41. private PtlAgreementService ptlAgreementService;
  42. @ApiOperation(value = "协议承保规则属性列表")
  43. @GetMapping("/attr/list")
  44. public HttpResult<List<PtlAgreementUndwrtRulesAttr>> list() {
  45. List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList = ptlAgreementUndwrtRulesAttrService.getUndwrtRulesAttrList();
  46. return HttpResult.ok(undwrtRulesAttrList);
  47. }
  48. @ApiOperation(value = "协议承保规则属性列表")
  49. @GetMapping("/attr/listByCompanyId")
  50. public HttpResult<List<PtlAgreementUndwrtRulesAttr>> listByCompanyId(String companyId) {
  51. List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList = ptlAgreementUndwrtRulesAttrService.getUndwrtRulesAttrList(companyId);
  52. return HttpResult.ok(undwrtRulesAttrList);
  53. }
  54. @ApiOperation(value = "查询保险公司所有协议列表")
  55. @GetMapping("/companyAgreementList")
  56. public HttpResult<List<PtlAgreement>> companyAgreementList(String agreementId){
  57. return HttpResult.ok(ptlAgreementService.getCurrentAgreementList(agreementId));
  58. }
  59. @PostMapping("/getProduct")
  60. @ApiOperation("查询协议产品费用列表")
  61. public PageResult getProduct(@RequestBody AgreementProductQueryVo agreementProductQueryVo) {
  62. Page<T> page = buildPageRequest(agreementProductQueryVo.getPageDto());
  63. Page<PtlAgreementProductCostsNew> schemeQueryDto = ptlAgreementProductCostsNewService.getByAgreementId(page,agreementProductQueryVo);
  64. return buildPageResponse(schemeQueryDto);
  65. }
  66. @ApiOperation("获取费用审核列表")
  67. @PostMapping("/getCostsAuditList")
  68. public HttpResult<PageResult> getCostsAuditList(@RequestBody AgreementProductQueryVo agreementProductQueryVo){
  69. Page<T> page = buildPageRequest(agreementProductQueryVo.getPageDto());
  70. Page<PtlAgreementProductCostsNew> schemeQueryDto = ptlAgreementProductCostsNewService.getCostsAuditList(page,agreementProductQueryVo);
  71. return HttpResult.ok(buildPageResponse(schemeQueryDto));
  72. }
  73. @ApiOperation(value = "获取协议费用")
  74. @GetMapping("/costs/get")
  75. public HttpResult costsGet(String costsId) {
  76. //获取保险公司
  77. PtlAgreementProductCostsNew ptlAgreementProductCostsNew = ptlAgreementProductCostsNewService.getById(costsId);
  78. String companyId = ptlAgreementService.getById(ptlAgreementProductCostsNew.getAgreementId()).getPartnerCompaniesId();
  79. List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList = ptlAgreementUndwrtRulesAttrService.getUndwrtRulesAttrList(companyId);
  80. AgreementProductCostsSave agreementProductCosts = ptlAgreementProductCostsNewService.costsGet(costsId,undwrtRulesAttrList);
  81. return HttpResult.ok(agreementProductCosts);
  82. }
  83. @ApiOperation(value = "添加协议费用")
  84. @PostMapping("/costs/add")
  85. public HttpResult costsAdd(@RequestBody AgreementProductCosts agreementProductCostsList) {
  86. return ptlAgreementProductCostsNewService.costsAdd(agreementProductCostsList) ? HttpResult.ok("添加协议费用成功") : HttpResult.error("添加协议费用失败");
  87. }
  88. @ApiOperation(value = "更新协议费用")
  89. @PostMapping("/costs/update")
  90. public HttpResult costsUpdate(@RequestBody AgreementProductCosts agreementProductCosts){
  91. return ptlAgreementProductCostsNewService.costsUpdate(agreementProductCosts) ? HttpResult.ok("更新协议费用成功") : HttpResult.error("更新协议费用失败");
  92. }
  93. @ApiOperation(value = "通过id禁用费用")
  94. @PostMapping("/costs/disable/{costsId}")
  95. public HttpResult costsDisable(@PathVariable String costsId) {
  96. return ptlAgreementProductCostsNewService.costsDisable(costsId);
  97. }
  98. @ApiOperation(value = "禁用费用")
  99. @PostMapping("/costs/batchDisable")
  100. public HttpResult costsBatchDisable(@RequestBody CostsBatchDisableVo costsBatchDisableVo) {
  101. return ptlAgreementProductCostsNewService.costsBatchDisable(costsBatchDisableVo.getCostsIdList());
  102. }
  103. @ApiOperation(value = "删除协议费用")
  104. @PostMapping("/costs/delete")
  105. public HttpResult costsDelete(String costsId){
  106. return ptlAgreementProductCostsNewService.costsDelete(costsId) ? HttpResult.ok("删除协议费用成功") : HttpResult.error("删除协议费用失败");
  107. }
  108. @ApiOperation(value = "复制协议费用")
  109. @PostMapping("/costs/copy")
  110. public HttpResult costsCopy(@RequestBody AgreementProductCostsCopyVo agreementProductCostsCopyVo){
  111. //orgCostsId:原协议费用id
  112. //newAgreementId:新协议id
  113. return ptlAgreementProductCostsNewService.costsCopy(agreementProductCostsCopyVo) ? HttpResult.ok("复制协议费用成功") : HttpResult.error("复制协议费用失败");
  114. }
  115. @ApiOperation(value = "批量复制协议费用")
  116. @PostMapping("/costs/copyBatch")
  117. public HttpResult costsCopyBatch(@RequestBody AgreementProductCostsCopyVo agreementProductCostsCopyVo){
  118. //orgCostsId:原协议费用id
  119. //newAgreementId:新协议id
  120. return ptlAgreementProductCostsNewService.costsCopyBatch(agreementProductCostsCopyVo) ? HttpResult.ok("复制协议费用成功") : HttpResult.error("复制协议费用失败");
  121. }
  122. @ApiOperation(value = "调整费用")
  123. @PostMapping("/costs/adjust")
  124. public HttpResult costsAdjust(@RequestBody FeeOrderNewRecordVo feeOrderNewRecordVo){
  125. return HttpResult.ok("调整费用成功", ptlAgreementProductCostsNewService.costsAdjust(feeOrderNewRecordVo));
  126. }
  127. @ApiOperation(value = "费用审核")
  128. @PostMapping("/costs/audit")
  129. public HttpResult costsAudit(@RequestBody CostsAuditVo costsAuditVo){
  130. return ptlAgreementProductCostsNewService.costsAudit(costsAuditVo) ? HttpResult.ok("费用审核成功") : HttpResult.error("费用审核失败");
  131. }
  132. @ApiOperation(value = "费用批量审核")
  133. @PostMapping("/costs/auditBatch")
  134. public HttpResult costsAuditBatch(@RequestBody CostsAuditVo costsAuditVo){
  135. return ptlAgreementProductCostsNewService.costsAuditBatch(costsAuditVo) ? HttpResult.ok("费用批量审核成功") : HttpResult.error("费用批量审核失败");
  136. }
  137. @ApiOperation(value = "费用批量修改起止期")
  138. @PostMapping("/costs/costsDateBatch")
  139. public HttpResult costsDateBatch(@RequestBody AgreementProductCostsVo agreementProductCostsVo){
  140. return ptlAgreementProductCostsNewService.costsDateBatch(agreementProductCostsVo) ? HttpResult.ok("费用批量修改起止期成功") : HttpResult.error("费用批量修改起止期失败");
  141. }
  142. @ApiOperation(value = "费用批量修改")
  143. @PostMapping("/costs/costsBatch")
  144. public HttpResult costsBatch(@RequestBody AgreementProductCostsVo agreementProductCostsVo){
  145. return ptlAgreementProductCostsNewService.costsBatch(agreementProductCostsVo) ? HttpResult.ok("费用批量修改成功") : HttpResult.error("费用批量修改失败");
  146. }
  147. @ApiOperation("费用批量删除")
  148. @PostMapping("/costs/deleteBatch")
  149. public HttpResult costsDeleteBatch(@RequestBody String[] ids) {
  150. Boolean b = ptlAgreementProductCostsNewService.costsDeleteBatch(ids);
  151. return b ? HttpResult.ok("删除成功") : HttpResult.error("删除失败");
  152. }
  153. @ApiOperation(value = "获取承保规则列表")
  154. @PostMapping("/undwrt/rules/list")
  155. public PageResult getRulesList(@RequestBody AgreementUndwrtRulesQueryVo agreementUndwrtRulesQueryVo){
  156. Page<T> page = buildPageRequest(agreementUndwrtRulesQueryVo.getPageDto());
  157. Page rulesPage = ptlAgreementUndwrtRulesNewService.rulesPage(page,agreementUndwrtRulesQueryVo.getAgreementId());
  158. return buildPageResponse(rulesPage);
  159. }
  160. @ApiOperation(value = "获取承保规则")
  161. @GetMapping("/undwrt/rules/get")
  162. public HttpResult get(String ruleId) {
  163. List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList = ptlAgreementUndwrtRulesAttrService.getUndwrtRulesAttrList();
  164. AgreementUndwrtRulesSave agreementUndwrtRulesSave = ptlAgreementUndwrtRulesNewService.rulesGet(ruleId, undwrtRulesAttrList);
  165. return HttpResult.ok(agreementUndwrtRulesSave);
  166. }
  167. @ApiOperation(value = "添加承保规则")
  168. @PostMapping("/undwrt/rules/add")
  169. public HttpResult rulesAdd(@RequestBody AgreementUndwrtRules agreementUndwrtRules) {
  170. return ptlAgreementUndwrtRulesNewService.rulesAdd(agreementUndwrtRules) ? HttpResult.ok("添加承保规则成功") : HttpResult.error("添加承保规则失败");
  171. }
  172. @ApiOperation(value = "更新承保规则")
  173. @PostMapping("/undwrt/rules/update")
  174. public HttpResult rulesUpdate(@RequestBody AgreementUndwrtRules agreementUndwrtRules){
  175. return ptlAgreementUndwrtRulesNewService.rulesUpdate(agreementUndwrtRules) ? HttpResult.ok("更新承保规则成功") : HttpResult.error("更新承保规则失败");
  176. }
  177. @ApiOperation(value = "删除承保规则")
  178. @PostMapping("/undwrt/rules/delete")
  179. public HttpResult rulesDelete(String ruleId){
  180. return ptlAgreementUndwrtRulesNewService.rulesDelete(ruleId) ? HttpResult.ok("删除承保规则成功") : HttpResult.error("删除承保规则失败");
  181. }
  182. @ApiOperation(value = "费用轨迹查询")
  183. @GetMapping("/costs/trajectory/get")
  184. public HttpResult getTrajectory(String costsId){
  185. return HttpResult.ok(ptlAgreementProductCostsTrajectoryService.getTrajectory(costsId));
  186. }
  187. @ApiOperation("获取现询费用")
  188. @PostMapping("getInquiryNowFee")
  189. public HttpResult getInquiryNowFee(@RequestBody InquiryNowFeeQueryVo inquiryNowFeeQueryVo) {
  190. return HttpResult.ok(ptlAgreementProductCostsNewService.getInquiryNowFee(inquiryNowFeeQueryVo));
  191. }
  192. @ApiOperation("获取产品id")
  193. @PostMapping("getProductId")
  194. public HttpResult getProductId(@RequestBody ProductQueryVo productQueryVo){
  195. return HttpResult.ok("",InsuranceRisk.determineInsuranceInformation(productQueryVo.getKindList(), productQueryVo.getRiskList()).getCode());
  196. }
  197. @ApiOperation("复制承保规则")
  198. @PostMapping("/undwrt/copyRules")
  199. public HttpResult copyRules(@RequestBody AgreementUndwrtRules agreementUndwrtRules){
  200. return ptlAgreementUndwrtRulesNewService.copyRules(agreementUndwrtRules) ? HttpResult.ok("复制承保规则成功") : HttpResult.error("复制承保规则失败");
  201. }
  202. @ApiOperation("复制承保规则查询同保险公司协议")
  203. @GetMapping("/getAllAgreement")
  204. public HttpResult<List<PtlAgreement>> getAllAgreement(String companyCode){
  205. return HttpResult.ok(ptlAgreementService.getByCompanyCode(companyCode));
  206. }
  207. }