PtlSchemeController.java 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. package com.ydtech.modules.scheme.controller;
  2. import com.alibaba.fastjson.JSONArray;
  3. import com.alibaba.fastjson.JSONObject;
  4. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  5. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  6. import com.ydtech.aop.request.RequestSingleParam;
  7. import com.ydtech.constants.enums.dict.agreement.ProductsType;
  8. import com.ydtech.core.page.HttpResult;
  9. import com.ydtech.core.page.PageResult;
  10. import com.ydtech.exception.SystemException;
  11. import com.ydtech.modules.base.controller.BaseController;
  12. import com.ydtech.modules.order.constants.JqInsuranceType;
  13. import com.ydtech.modules.order.entity.*;
  14. import com.ydtech.modules.order.entity.vo.InsDrivingIntentionInsuranceSonVo;
  15. import com.ydtech.modules.order.entity.vo.InsDrivingIntentionInsuranceVo;
  16. import com.ydtech.modules.order.service.InsBusinessInsuranceService;
  17. import com.ydtech.modules.order.service.InsDrivingIntentionInsuranceService;
  18. import com.ydtech.modules.order.service.InsDrivingIntentionInsuranceTypeService;
  19. import com.ydtech.modules.protocol.service.ITaxSourceService;
  20. import com.ydtech.modules.protocols.service.PtlAgreementUndwrtRulesAttrService;
  21. import com.ydtech.modules.scheme.aop.RuleTrajectory;
  22. import com.ydtech.modules.scheme.entity.po.*;
  23. import com.ydtech.modules.scheme.entity.vo.*;
  24. import com.ydtech.modules.scheme.service.*;
  25. import io.swagger.annotations.Api;
  26. import io.swagger.annotations.ApiModelProperty;
  27. import io.swagger.annotations.ApiOperation;
  28. import org.apache.poi.ss.formula.functions.T;
  29. import org.springframework.beans.factory.annotation.Autowired;
  30. import org.springframework.validation.annotation.Validated;
  31. import org.springframework.web.bind.annotation.*;
  32. import java.util.*;
  33. /**
  34. *@author: tz
  35. *@description: 方案controller
  36. *@create: 2024-7-30 10:12:52
  37. */
  38. @Api(tags = "方案管理")
  39. @RequestMapping("/plt/scheme")
  40. @RestController
  41. public class PtlSchemeController extends BaseController {
  42. @Autowired
  43. private PtlSchemeRulesAttrService ptlSchemeRulesAttrService;
  44. @Autowired
  45. private PtlSchemeService ptlSchemeService;
  46. @Autowired
  47. private PtlSchemeRulesService ptlSchemeRulesService;
  48. @Autowired
  49. private PtlAgreementUndwrtRulesAttrService ptlAgreementUndwrtRulesAttrService;
  50. @Autowired
  51. private InsDrivingIntentionInsuranceService insDrivingIntentionInsuranceService;
  52. @Autowired
  53. private ITaxSourceService taxSourceService;
  54. @Autowired
  55. private InsDrivingIntentionInsuranceTypeService insDrivingIntentionInsuranceTypeService;
  56. @Autowired
  57. private InsBusinessInsuranceService insBusinessInsuranceService;
  58. @Autowired
  59. private PtlOptionalSchemeService ptlOptionalSchemeService;
  60. @ApiOperation(value = "获取保险公司")
  61. @PostMapping("/companyList")
  62. public HttpResult companyList(@RequestBody SchemeQueryVo schemeQueryVo) {
  63. Page page = buildPageRequest(schemeQueryVo.getPageDto());
  64. return HttpResult.ok(ptlSchemeService.getAllCompany(page,schemeQueryVo));
  65. }
  66. //region 规则方法
  67. @ApiOperation(value = "方案规则属性列表")
  68. @GetMapping("/attr/list")
  69. public HttpResult<List<PtlSchemeRulesAttr>> list() {
  70. List<PtlSchemeRulesAttr> undwrtRulesAttrList = ptlSchemeRulesAttrService.getRulesAttrList();
  71. return HttpResult.ok(undwrtRulesAttrList);
  72. }
  73. @ApiOperation(value = "根据保险公司id查询方案规则属性列表")
  74. @GetMapping("/attr/listByCompanyId")
  75. public HttpResult<List<PtlSchemeRulesAttr>> listByCompanyId(String companyId) {
  76. List<PtlSchemeRulesAttr> undwrtRulesAttrList = ptlSchemeRulesAttrService.getRulesAttrList(companyId);
  77. return HttpResult.ok(undwrtRulesAttrList);
  78. }
  79. @ApiOperation(value = "获取规则列表")
  80. @PostMapping("/ruleList")
  81. public HttpResult ruleList(@Validated @RequestBody RuleQueryVo ruleQueryVo) {
  82. Page page = buildPageRequest(ruleQueryVo.getPageDto());
  83. return HttpResult.ok(ptlSchemeRulesService.getRulesPage(page,ruleQueryVo));
  84. }
  85. @ApiOperation(value = "获取规则的详情信息")
  86. @GetMapping("/ruleInfo")
  87. public HttpResult ruleInfo(String ruleId){
  88. List<PtlSchemeRulesAttr> schemeRulesAttrs = ptlSchemeRulesAttrService.getRulesAttrList();
  89. RuleResultVo rulesInfoById = ptlSchemeRulesAttrService.getRulesInfoById(ruleId, schemeRulesAttrs);
  90. return HttpResult.ok(rulesInfoById);
  91. }
  92. @RuleTrajectory(type="C")
  93. @ApiOperation(value = "添加规则")
  94. @PostMapping("/ruleAdd")
  95. public HttpResult ruleAdd(@RequestBody RuleSaveVo ruleSaveVo){
  96. List<PtlSchemeRulesAttrLink> attrs = ruleSaveVo.getAttrs();
  97. List<PtlSchemeRulesAttrLink> newAttrs = new ArrayList<>();
  98. //过滤空的属性
  99. attrs.forEach(item->{
  100. if(item.getDictLabal().isEmpty()) {
  101. if (((!Objects.isNull(item.getMin()) && !item.getMin().equals("") && !item.getMin().equals("0")) ||
  102. (!Objects.isNull(item.getOperator()) && !item.getOperator().equals("") && !item.getOperator().equals("1")) ||
  103. (!Objects.isNull(item.getMax()) && !item.getMax().equals("") && !item.getMax().equals("0")))) {
  104. item.setId(null);
  105. newAttrs.add(item);
  106. }
  107. }else{
  108. if (((!Objects.isNull(item.getMin()) && !item.getMin().equals("")) ||
  109. (!Objects.isNull(item.getOperator()) && !item.getOperator().equals("")) ||
  110. (!Objects.isNull(item.getMax()) && !item.getMax().equals("")))) {
  111. item.setId(null);
  112. newAttrs.add(item);
  113. }
  114. }
  115. });
  116. //添加能源类型
  117. newAttrs.add(PtlSchemeRulesAttrLink.NewEnergy(ruleSaveVo.getRule().getEnergyType()));
  118. //添加车辆类型
  119. newAttrs.add(PtlSchemeRulesAttrLink.CarType(ruleSaveVo.getRule().getVehicleType()));
  120. //添加 使用性质 营业 非营业
  121. if(!Objects.isNull(ruleSaveVo.getRule().getCarnature())){
  122. newAttrs.add(PtlSchemeRulesAttrLink.carNature(ruleSaveVo.getRule().getCarnature()));
  123. }
  124. ruleSaveVo.setAttrs(newAttrs);
  125. int ruleId = ptlSchemeRulesService.addRules(ruleSaveVo);
  126. HttpResult<JSONObject> httpResult;
  127. JSONObject result = new JSONObject();
  128. if(ruleId > 0) {
  129. result.put("ruleId", ruleId);
  130. result.put("msg", "添加规则成功");
  131. httpResult = HttpResult.ok(result);
  132. }else{
  133. result.put("msg","添加规则失败");
  134. httpResult = HttpResult.error(result);
  135. }
  136. return httpResult;
  137. }
  138. @RuleTrajectory(type="U")
  139. @ApiOperation(value = "修改规则")
  140. @PostMapping("/ruleUpdate")
  141. public HttpResult ruleUpdate(@RequestBody RuleSaveVo ruleSaveVo){
  142. PtlSchemeRules ptlSchemeRules = ptlSchemeRulesService.getById(ruleSaveVo.getRule().getId());
  143. if(Objects.isNull(ptlSchemeRules)){
  144. throw new SystemException("规则不存在");
  145. }
  146. List<PtlSchemeRulesAttrLink> attrs = ruleSaveVo.getAttrs();
  147. List<PtlSchemeRulesAttrLink> newAttrs = new ArrayList<>();
  148. //过滤空的属性
  149. attrs.forEach(item->{
  150. if(item.getDictLabal().isEmpty()) {
  151. if (((!Objects.isNull(item.getMin()) && !item.getMin().equals("") && !item.getMin().equals("0")) ||
  152. (!Objects.isNull(item.getOperator()) && !item.getOperator().equals("") && !item.getOperator().equals("1")) ||
  153. (!Objects.isNull(item.getMax()) && !item.getMax().equals("") && !item.getMax().equals("0")))) {
  154. item.setId(null);
  155. newAttrs.add(item);
  156. }
  157. }else{
  158. if(!Objects.isNull(item.getMin())){
  159. if(item.getMin().equals("")) {
  160. item.setMin(String.join(",", item.getMinArray()));
  161. }
  162. }
  163. if (((!Objects.isNull(item.getMin()) && !item.getMin().equals("")) ||
  164. (!Objects.isNull(item.getOperator()) && !item.getOperator().equals("")) ||
  165. (!Objects.isNull(item.getMax()) && !item.getMax().equals("")))) {
  166. item.setId(null);
  167. newAttrs.add(item);
  168. }
  169. }
  170. });
  171. //添加能源类型
  172. newAttrs.add(PtlSchemeRulesAttrLink.NewEnergy(ruleSaveVo.getRule().getEnergyType()));
  173. //添加车辆类型
  174. newAttrs.add(PtlSchemeRulesAttrLink.CarType(ruleSaveVo.getRule().getVehicleType()));
  175. //添加 使用性质 营业 非营业
  176. if(!Objects.isNull(ruleSaveVo.getRule().getCarnature())){
  177. newAttrs.add(PtlSchemeRulesAttrLink.carNature(ruleSaveVo.getRule().getCarnature()));
  178. }
  179. ruleSaveVo.setAttrs(newAttrs);
  180. return ptlSchemeRulesService.updateRules(ruleSaveVo) ?
  181. HttpResult.ok("修改规则成功"):
  182. HttpResult.error("修改规则失败");
  183. }
  184. @RuleTrajectory(type="D")
  185. @ApiOperation(value = "删除规则")
  186. @PostMapping("/ruleDelete")
  187. public HttpResult ruleDelete(@RequestSingleParam("ruleId") String ruleId){
  188. return ptlSchemeRulesService.deleteRules(ruleId) ?
  189. HttpResult.ok("删除规则成功"):
  190. HttpResult.error("删除规则失败");
  191. }
  192. @ApiOperation(value = "规则过滤保险公司")
  193. // @Validated
  194. @PostMapping("/ruleFilterCompany")
  195. public HttpResult ruleFilterCompany(
  196. // @Validated
  197. @RequestBody RuleFilterVo ruleFilterVo){
  198. String userId = getUserId();
  199. if(!Objects.isNull(ruleFilterVo.getUserId()) && !ruleFilterVo.getUserId().equals("")){
  200. userId = ruleFilterVo.getUserId();
  201. }
  202. //如果没有传入险种 则显示用户所有的保险公司
  203. if(Objects.isNull(ruleFilterVo.getProductId()))
  204. {
  205. return HttpResult.ok(taxSourceService.getAllAgreement(getDeptId(), userId));
  206. }
  207. return HttpResult.ok(ptlSchemeRulesService.ruleFilterCompany(userId,ruleFilterVo));
  208. }
  209. //endregion
  210. //region 方案管理
  211. @PostMapping("/getSchemeList")
  212. @ApiOperation("查询方案规则列表")
  213. public PageResult getProduct(@RequestBody SchemeQueryVo schemeQueryVo) {
  214. Page<T> page = buildPageRequest(schemeQueryVo.getPageDto());
  215. Page<PtlScheme> schemeQueryDto = ptlSchemeService.getSchemeList(page,schemeQueryVo);
  216. return buildPageResponse(schemeQueryDto);
  217. }
  218. @ApiOperation(value = "方案添加")
  219. @PostMapping("/shcemeAdd")
  220. public HttpResult shcemeAdd(@RequestBody SchemeSaveVo schemeSaveVo){
  221. List<SchemeResultVo> schemeInfoByCompanyId = ptlSchemeService.getSchemeInfoByCompanyId(
  222. schemeSaveVo.getCompanyId(), schemeSaveVo.getProductId(),
  223. schemeSaveVo.getVehicleType(),schemeSaveVo.getEnergyType(),
  224. schemeSaveVo.getCarnature()
  225. );
  226. if(schemeInfoByCompanyId.size() > 0)
  227. {
  228. throw new SystemException("已存在方案");
  229. }
  230. return ptlSchemeService.addScheme(schemeSaveVo) ? HttpResult.ok("添加成功") : HttpResult.error("添加失败");
  231. }
  232. @ApiOperation(value = "方案列表")
  233. @PostMapping("/schemeList")
  234. public HttpResult schemeList(@Validated @RequestBody SchemeQueryVo schemeQueryVo){
  235. Page page = buildPageRequest(schemeQueryVo.getPageDto());
  236. return HttpResult.ok(ptlSchemeService.getSchemeList(page,schemeQueryVo));
  237. }
  238. @ApiOperation(value = "获取方案详情")
  239. @GetMapping("/schemeInfo")
  240. public HttpResult schemeInfo(String companyId,String productId,String vehicleType,String energyType,String carnature){
  241. return HttpResult.ok(ptlSchemeService.getSchemeInfo(companyId,productId,vehicleType,energyType,carnature));
  242. }
  243. @ApiOperation(value = "更新方案")
  244. @PostMapping("/schemeUpdate")
  245. public HttpResult schemeUpdate(@Validated @RequestBody SchemeSaveVo schemeSaveVo){
  246. return ptlSchemeService.updateScheme(schemeSaveVo) ? HttpResult.ok("修改成功") : HttpResult.error("修改失败");
  247. }
  248. @ApiOperation(value = "删除方案")
  249. @PostMapping("/schemeDelete")
  250. public HttpResult schemeDepete(@RequestBody SchemeQueryVo schemeQueryVo){
  251. return ptlSchemeService.deleteScheme(schemeQueryVo) ? HttpResult.ok("删除成功") : HttpResult.error("删除失败");
  252. }
  253. @ApiOperation(value = "获取方案详情")
  254. @PostMapping(value = "getScheneInfo")
  255. public HttpResult getScheneInfo(@RequestBody SchemeQueryVo schemeQueryVo) {
  256. return HttpResult.ok(ptlSchemeService.getSchemeInfoByCompanyId(
  257. schemeQueryVo.getCompanyId(),schemeQueryVo.getProductId(),
  258. schemeQueryVo.getVehicleType(),schemeQueryVo.getEnergyType(),
  259. schemeQueryVo.getCarnature()));
  260. }
  261. //endregion
  262. //region 驾意险方法
  263. @ApiOperation(value = "获取驾意险分类信息")
  264. @PostMapping(value = "/getDrivingType")
  265. public HttpResult getDrivingType(@RequestBody DrivingIntentionQueryVo drivingIntentionQueryVo) {
  266. return HttpResult.ok(insDrivingIntentionInsuranceTypeService.getDrivingIntentionInsuranceTypeByCompanyId(drivingIntentionQueryVo.getCompanyId()));
  267. }
  268. @ApiOperation(value = "获取驾意险信息")
  269. @PostMapping(value = "/getDriving")
  270. public HttpResult getDriving(@RequestBody DrivingIntentionQueryVo drivingIntentionQueryVo) {
  271. return HttpResult.ok(insDrivingIntentionInsuranceService.getSchemeDrivingIntentionInsurance(drivingIntentionQueryVo));
  272. }
  273. //endregion
  274. @ApiOperation(value = "获取商业险信息")
  275. @PostMapping(value = "getBusinessInsurance")
  276. public HttpResult getBusinessInsurance() {
  277. return HttpResult.ok(insBusinessInsuranceService.getBusinessInsurance());
  278. }
  279. //region 自选方案
  280. @ApiOperation(value = "自选方案添加")
  281. @PostMapping(value = "addOptionalScheme")
  282. public HttpResult addOptionalScheme(@RequestBody OptionalSchemeSaveVo optionalSchemeSaveVo) {
  283. LambdaQueryWrapper<PtlOptionalScheme> eq = new LambdaQueryWrapper<PtlOptionalScheme>()
  284. .eq(PtlOptionalScheme::getCompanyId, optionalSchemeSaveVo.getCompanyId())
  285. .eq(PtlOptionalScheme::getProductId, optionalSchemeSaveVo.getProductId())
  286. .eq(PtlOptionalScheme::getEnergyType, optionalSchemeSaveVo.getEnergyType())
  287. .eq(PtlOptionalScheme::getVehicleType, optionalSchemeSaveVo.getVehicleType())
  288. .eq(!Objects.isNull(optionalSchemeSaveVo.getCarnature()),PtlOptionalScheme::getCarnature,optionalSchemeSaveVo.getCarnature());
  289. List<PtlOptionalScheme> list = ptlOptionalSchemeService.list(eq);
  290. if(list.size() > 0)
  291. {
  292. return HttpResult.error("已存在方案");
  293. }
  294. return HttpResult.ok(ptlOptionalSchemeService.addOptionScheme(optionalSchemeSaveVo)?
  295. "添加成功" :
  296. "添加失败");
  297. }
  298. @ApiOperation(value = "自选方案查询")
  299. @GetMapping(value = "optionalSchemeInfo")
  300. public HttpResult optionalSchemeInfo(String companyId,String productId,String carnature, String vehicleType, String energyType) {
  301. return HttpResult.ok(
  302. ptlOptionalSchemeService.optionalSchemeInfo(companyId,productId,carnature,vehicleType,energyType));
  303. }
  304. @ApiOperation(value = "自选方案修改")
  305. @PostMapping(value = "updateOptionalScheme")
  306. public HttpResult updateOptionalScheme(@RequestBody OptionalSchemeSaveVo optionalSchemeSaveVo) {
  307. return HttpResult.ok(ptlOptionalSchemeService.updateOptionScheme(optionalSchemeSaveVo)?
  308. "修改成功" :
  309. "修改失败");
  310. }
  311. @ApiOperation(value = "自选方案列表")
  312. @PostMapping(value = "optionalShcemeList")
  313. public HttpResult optionalShcemeList( @RequestBody SchemeQueryVo schemeQueryVo) {
  314. List<PtlOptionalScheme> optionalSchemeList = ptlOptionalSchemeService.getOptionalSchemeList(schemeQueryVo);
  315. return HttpResult.ok(optionalSchemeList);
  316. }
  317. @ApiOperation(value = "自选方案删除")
  318. @PostMapping(value = "optionalSchemeDelete")
  319. public HttpResult optionalSchemeDelete(@RequestSingleParam("id") String id) {
  320. return HttpResult.ok(ptlOptionalSchemeService.deleteOptionScheme(id)?
  321. "删除成功" :
  322. "删除失败");
  323. }
  324. @ApiOperation(value = "获取自选方案驾意险信息")
  325. @GetMapping(value = "optionalSchemeDriving")
  326. public HttpResult optionalSchemeDriving(String schemeId , String seatNum){
  327. List<InsDrivingIntentionInsurance> optionalSchemeDrivingList = insDrivingIntentionInsuranceService.getOptionalSchemeDrivingList(schemeId, seatNum);
  328. return HttpResult.ok(optionalSchemeDrivingList);
  329. }
  330. //endregion
  331. //region 前端接口
  332. @ApiOperation(value = "获取保险公司的方案信息")
  333. @PostMapping(value = "getCompanySchemeInfo")
  334. public HttpResult getCompanySchemeInfo(@RequestBody SchemeQueryVo schemeQueryVo) {
  335. List<CompanySchemeVo> companySchemeInfo = ptlSchemeService.getCompanySchemeInfo(schemeQueryVo);
  336. return HttpResult.ok(companySchemeInfo);
  337. }
  338. @ApiOperation(value = "获取自选方案信息")
  339. @PostMapping(value = "getCompanyOptionalSchemeInfo")
  340. public HttpResult getCompanyOptionalSchemeInfo(@RequestBody SchemeQueryVo schemeQueryVo) {
  341. CompanyOptionalSchemeVo companySchemeInfo = ptlOptionalSchemeService.getSchemeInsuranceInfo(schemeQueryVo);
  342. JSONArray jqList = new JSONArray();
  343. Arrays.stream(JqInsuranceType.values()).forEach(item->{
  344. JSONObject tmp = new JSONObject();
  345. tmp.put("name",item.getName());
  346. tmp.put("amount",item.getAmount());
  347. jqList.add(tmp);
  348. });
  349. companySchemeInfo.setJqList(jqList);
  350. return HttpResult.ok(companySchemeInfo);
  351. }
  352. //endregion
  353. //region pc端
  354. @ApiModelProperty(value = "获取方案信息")
  355. @PostMapping(value = "getAllSchemeList")
  356. public HttpResult getAllSchemeList(@RequestBody SchemeQueryVo schemeQueryVo) {
  357. PcSchemeResultVo resultVo = new PcSchemeResultVo();
  358. List<CompanySchemeVo> companySchemeInfo = ptlSchemeService.getCompanySchemeInfo(schemeQueryVo);
  359. List<PcCompanySchemeVo> pcCompanySchemeVos = new ArrayList<>();
  360. //分组 主险 附加险 服务
  361. companySchemeInfo.forEach(item->{
  362. JSONArray main = new JSONArray();
  363. JSONArray additional = new JSONArray();
  364. JSONArray service = new JSONArray();
  365. for(int i=0;i<item.getKinds().size();i++){
  366. switch(InsBusinessInsurance.checkInsurance(item.getKinds().getJSONObject(i).getString("kindCode")))
  367. {
  368. case 1:
  369. main.add(item.getKinds().getJSONObject(i));
  370. break;
  371. case 2:
  372. additional.add(item.getKinds().getJSONObject(i));
  373. break;
  374. case 3:
  375. service.add(item.getKinds().getJSONObject(i));
  376. break;
  377. default:
  378. break;
  379. }
  380. }
  381. PcCompanySchemeVo pcCompanySchemeVo = item.toPc();
  382. JSONObject kinds = new JSONObject();
  383. kinds.put("main",main);
  384. kinds.put("additional",additional);
  385. kinds.put("service",service);
  386. pcCompanySchemeVo.setKinds(kinds);
  387. pcCompanySchemeVos.add(pcCompanySchemeVo);
  388. });
  389. CompanyOptionalSchemeVo pcSchemeInsuranceInfo = ptlOptionalSchemeService.getPcSchemeInsuranceInfo(schemeQueryVo);
  390. if(schemeQueryVo.getProductId().equals(ProductsType.PT_0330.getCode()) ||
  391. schemeQueryVo.getProductId().equals(ProductsType.PT_0330034001.getCode()) ||
  392. schemeQueryVo.getProductId().equals(ProductsType.PT_0330034002.getCode())){
  393. JSONObject jqx = new JSONObject();
  394. jqx.put("name","交通事故强制责任险");
  395. jqx.put("amount","");
  396. pcCompanySchemeVos.forEach(vo->{
  397. vo.setJqx(jqx);
  398. });
  399. if(!Objects.isNull(pcSchemeInsuranceInfo)) {
  400. pcSchemeInsuranceInfo.setJqx(jqx);
  401. }
  402. }
  403. resultVo.setSchemes(pcCompanySchemeVos);
  404. resultVo.setOptionalScheme(pcSchemeInsuranceInfo);
  405. return HttpResult.ok(resultVo);
  406. }
  407. @ApiModelProperty(value = "获取产品信息")
  408. @GetMapping(value = "getProductInfo")
  409. public HttpResult getProductInfo() {
  410. JSONArray array = new JSONArray();
  411. Arrays.stream(ProductsType.values()).forEach(item->{
  412. JSONObject obj = new JSONObject();
  413. obj.put("code",item.getCode());
  414. obj.put("desc",item.getDesc());
  415. array.add(obj);
  416. });
  417. return HttpResult.ok(array);
  418. }
  419. @ApiModelProperty(value = "获取驾意险信息Son")
  420. @GetMapping(value = "getDrivingSon")
  421. public HttpResult getDrivingSon(String companyId,String projectCode) {
  422. List<InsDrivingIntentionInsuranceSon> insDrivingIntentionInsuranceSon = insDrivingIntentionInsuranceService.getInsDrivingIntentionInsuranceSon(companyId, projectCode);
  423. return HttpResult.ok(insDrivingIntentionInsuranceSon);
  424. }
  425. //endregion
  426. //手动新增驾意险
  427. @ApiOperation(value = "手动新增驾意险")
  428. @PostMapping(value = "addDriving")
  429. public HttpResult addDriving(@RequestBody InsDrivingIntentionInsuranceVo insDrivingIntentionInsuranceVo){
  430. return insDrivingIntentionInsuranceService.add(insDrivingIntentionInsuranceVo);
  431. }
  432. @ApiOperation(value = "手动新增驾意险后代")
  433. @PostMapping(value = "addDrivingSon")
  434. public HttpResult addDrivingSon(@RequestBody InsDrivingIntentionInsuranceSonVo insDrivingIntentionInsuranceSonVo){
  435. return insDrivingIntentionInsuranceService.addSon(insDrivingIntentionInsuranceSonVo);
  436. }
  437. @ApiOperation(value = "手动删除驾意险")
  438. @PostMapping(value = "deleteDriving")
  439. public HttpResult deleteDriving(@RequestBody InsDrivingIntentionInsurance insDrivingIntentionInsurance){
  440. return insDrivingIntentionInsuranceService.delete(insDrivingIntentionInsurance);
  441. }
  442. @ApiOperation(value = "手动删除驾意险后代")
  443. @PostMapping(value = "deleteDrivingSon")
  444. public HttpResult deleteDrivingSon(@RequestBody InsDrivingIntentionInsuranceSon insDrivingIntentionInsuranceSon){
  445. return insDrivingIntentionInsuranceService.deleteSon(insDrivingIntentionInsuranceSon);
  446. }
  447. @ApiOperation(value = "手动更新驾意险")
  448. @PostMapping(value = "updateDriving")
  449. public HttpResult updateDriving(@RequestBody InsDrivingIntentionInsurance insDrivingIntentionInsurance){
  450. return insDrivingIntentionInsuranceService.update(insDrivingIntentionInsurance);
  451. }
  452. @ApiOperation(value = "手动更新驾意险后代")
  453. @PostMapping(value = "updateDrivingSon")
  454. public HttpResult updateDrivingSon(@RequestBody InsDrivingIntentionInsuranceSon insDrivingIntentionInsuranceSon){
  455. return insDrivingIntentionInsuranceService.updateSon(insDrivingIntentionInsuranceSon);
  456. }
  457. @ApiOperation(value = "获取驾意险信息")
  458. @PostMapping(value = "getDrivingInfo")
  459. public HttpResult getDrivingInfo(@RequestBody DrivingIntentionQueryVo drivingIntentionQueryVo){
  460. Page page = new Page(drivingIntentionQueryVo.getPageNum(), drivingIntentionQueryVo.getPageSize());
  461. return HttpResult.ok("",insDrivingIntentionInsuranceService.getSchemeDrivingIntentionInsuranceList(page,drivingIntentionQueryVo));
  462. }
  463. /**
  464. * @version
  465. * @author: hxl
  466. * @Date: 2024/10/15 11:27
  467. * @Description: 获取已承保保险公司列表
  468. */
  469. @ApiOperation(value = "获取已承保保险公司列表")
  470. @PostMapping("/allCompanyList")
  471. public HttpResult allCompanyList(@RequestBody SchemeQueryVo schemeQueryVo) {
  472. Page page = buildPageRequest(schemeQueryVo.getPageDto());
  473. return HttpResult.ok(ptlSchemeService.allCompanyList(page,schemeQueryVo));
  474. }
  475. }