|
|
@@ -244,7 +244,7 @@ public class UnifyOrderManager {
|
|
|
String systemCode = getSystemCode();
|
|
|
String companyName = CompanyConstants.getCompanyNameByCode(esmInsCompanyHttpResult.getData().getCompanyCode());
|
|
|
|
|
|
-
|
|
|
+ log.info("查询保司配置的协议:systemCode=[{}],companyId=[{}]",systemCode, esmInsCompanyHttpResult.getData().getId());
|
|
|
HttpResult<List<PtlAgreement>> byCompanyId = orgClient.getByCompanyId(esmInsCompanyHttpResult.getData().getId(), systemCode);
|
|
|
if (CollUtil.isEmpty(byCompanyId.getData())) {
|
|
|
AssertionUtils.isFail(true, "保司未配置协议");
|
|
|
@@ -699,7 +699,7 @@ public class UnifyOrderManager {
|
|
|
@Operation(summary = "获取订单状态")
|
|
|
@PostMapping("/getOrderStatus")
|
|
|
public HttpResult getOrderStatus(@RequestBody OrderStatusVo orderStatusVo) throws Exception {
|
|
|
-
|
|
|
+ log.info("更新订单状态:orderStatusVo=[{}]",JSONUtil.toJsonStr(orderStatusVo));
|
|
|
InsOrders insOrders = insOrdersService.getById(orderStatusVo.getOrder().getOrdersNo());
|
|
|
AssertionUtils.isFail(Objects.isNull(insOrders), "订单不存在");
|
|
|
HttpResult<EsmInsCompany> esmInsCompanyHttpResult = platformClient.findById(insOrders.getCompanyId());
|
|
|
@@ -721,7 +721,7 @@ public class UnifyOrderManager {
|
|
|
InsOrdersAccidentalDriving insOrdersAccidentalDriving = insOrdersAccidentalDrivingService.getByOrderId(insOrders.getId());
|
|
|
orderStatusVo.setInsOrdersAccidentalDriving(insOrdersAccidentalDriving);
|
|
|
OrderStatusResultVo orderStatusResultVo = orderStatusService.queryOrderState(orderStatusVo);
|
|
|
-
|
|
|
+ log.info("订单状态orderStatusResultVo=[{}]",JSONUtil.toJsonStr(orderStatusResultVo));
|
|
|
// 保存状态查询结果
|
|
|
insOrdersService.orderAfterUpdateOrderStatus(orderStatusVo.getOrder().getOrdersNo(), orderStatusResultVo);
|
|
|
// 保存支付链接
|
|
|
@@ -729,22 +729,89 @@ public class UnifyOrderManager {
|
|
|
insOrdersQrcodeService.saveQrCode(insOrders);
|
|
|
//////////////////////////////////////////新增营销抽奖活动////////////////////////////////////////////////
|
|
|
// 承保(客户)、出单(业务员)
|
|
|
- if (orderStatusResultVo.getOrderStatus() == InsOrderStatusEnum.UNDERWRITED) {
|
|
|
- // 远程调用活动列表
|
|
|
- // 匹配规则
|
|
|
- // 规则一:累计出单()次,可得()次抽奖机会
|
|
|
- // 规则二:累计出单()次,可得()次抽奖机会
|
|
|
- // 下一个规则的出单次数不能不上一个规则出单次数小
|
|
|
- HttpResult<List<LotteryActivityVO>> result = localLivingClient.queryActivityRules(lotteryScene);
|
|
|
- if (result == null || result.getCode() != 200 || result.getData() == null) {
|
|
|
- log.error("活动列表异常");
|
|
|
- } else {
|
|
|
- for (LotteryActivityVO activity : result.getData()) {
|
|
|
- // 检查活动是否有效
|
|
|
- if (!LocalDate.now().isBefore(activity.getActivityStartTime())
|
|
|
- && !LocalDate.now().isAfter(activity.getActivityEndTime())) {
|
|
|
- continue;
|
|
|
- }
|
|
|
+ if(orderStatusResultVo.getOrderStatus() == InsOrderStatusEnum.UNDERWRITED){
|
|
|
+ doSomethingAfterUnderwited(insOrders);
|
|
|
+ }
|
|
|
+ return HttpResult.ok("状态刷新成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 模拟承保(跳过实际付款操作)
|
|
|
+ *
|
|
|
+ * @author lipf
|
|
|
+ * @date 2026/5/19 12:00
|
|
|
+ */
|
|
|
+ @Operation(summary = "模拟承保(跳过实际付款操作)")
|
|
|
+ @PostMapping("/mockUnderwited")
|
|
|
+ public HttpResult<String> mockUnderwited(@RequestBody OrderStatusVo orderStatusVo) throws Exception {
|
|
|
+ log.info("模拟承保(跳过实际付款操作). orderStatusVo=[{}]", JSONUtil.toJsonStr(orderStatusVo));
|
|
|
+ InsOrders insOrders = insOrdersService.getById(orderStatusVo.getOrder().getOrdersNo());
|
|
|
+ if(!"4".equals(insOrders.getOrderStatus())){
|
|
|
+ return HttpResult.error("只能对待缴费的订单进行模拟承保");
|
|
|
+ }
|
|
|
+ AssertionUtils.isFail(Objects.isNull(insOrders), "订单不存在");
|
|
|
+ HttpResult<EsmInsCompany> esmInsCompanyHttpResult = platformClient.findById(insOrders.getCompanyId());
|
|
|
+ orderStatusVo.getOrder().setAgreementId(insOrders.getAgreementId());
|
|
|
+ orderStatusVo.getOrder().setInsuranceCompanyCode(esmInsCompanyHttpResult.getData().getCompanyCode());
|
|
|
+ orderStatusVo.getOrder().setInsuranceCompanyId(esmInsCompanyHttpResult.getData().getId());
|
|
|
+ orderStatusVo.getOrder().setCompanyOrderNo(insOrders.getCompanyOrderNo());
|
|
|
+ orderStatusVo.getOrder().setApiType(Integer.parseInt(insOrders.getApiType()));
|
|
|
+ orderStatusVo.setInsOrders(insOrders);
|
|
|
+ //获取保司实体
|
|
|
+ QuotationBaseService orderStatusService = companyFactory.getOrderStatusService(orderStatusVo);
|
|
|
+ orderStatusVo.setCarInfo(insOrdersCarInfoService.getByOrderId(insOrders.getId()));
|
|
|
+ InsOrdersPolicy insOrdersPolicy = insOrdersPolicyService.getById(insOrders.getId());
|
|
|
+ orderStatusVo.setInsOrdersPolicy(insOrdersPolicy);
|
|
|
+ List<InsOrdersCarUserInfo> insOrdersCarUserInfos = insOrdersCarUserInfoService.getByOrderId(insOrders.getId());
|
|
|
+ orderStatusVo.setInsOrdersCarUserInfoList(insOrdersCarUserInfos);
|
|
|
+ InsOrdersCosts insOrdersCosts = insOrdersCostsService.getById(insOrders.getId());
|
|
|
+ orderStatusVo.setInsOrdersCosts(insOrdersCosts);
|
|
|
+ InsOrdersAccidentalDriving insOrdersAccidentalDriving = insOrdersAccidentalDrivingService.getByOrderId(insOrders.getId());
|
|
|
+ orderStatusVo.setInsOrdersAccidentalDriving(insOrdersAccidentalDriving);
|
|
|
+ //OrderStatusResultVo orderStatusResultVo = orderStatusService.queryOrderState(orderStatusVo);
|
|
|
+ //log.info("模拟承保订单状态状态查询orderStatusResultVo=[{}]",JSONUtil.toJsonStr(orderStatusResultVo));
|
|
|
+ // 模拟接口请求成功
|
|
|
+ OrderStatusResultVo orderStatusResultVo = new OrderStatusResultVo();
|
|
|
+ orderStatusResultVo.setOrderStatus(InsOrderStatusEnum.UNDERWRITED);
|
|
|
+ // 保存状态查询结果
|
|
|
+ try{
|
|
|
+ // 设置订单状态为 已承保(5)
|
|
|
+ InsOrders insOrdersItem = new InsOrders();
|
|
|
+ insOrdersItem.setOrderStatus("5");
|
|
|
+ insOrdersItem.setAuditStatus(1);
|
|
|
+ insOrdersItem.setId(insOrders.getId());
|
|
|
+ insOrdersService.updateById(insOrdersItem);
|
|
|
+ insOrdersService.orderAfterUpdateOrderStatus(orderStatusVo.getOrder().getOrdersNo(), orderStatusResultVo);
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("承保后,更新状态,进行后续逻辑异常. orderStatusResultVo=[{}]",JSONUtil.toJsonStr(orderStatusResultVo), e);
|
|
|
+ }
|
|
|
+
|
|
|
+ //this.doSomethingAfterUnderwited(insOrders);
|
|
|
+ return HttpResult.ok("模拟承保(跳过实际付款操作)");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 订单承保后执行一些操作
|
|
|
+ *
|
|
|
+ * @author lipf
|
|
|
+ * @date 2026/5/19 11:59
|
|
|
+ */
|
|
|
+ private void doSomethingAfterUnderwited(InsOrders insOrders) {
|
|
|
+ // 远程调用活动列表
|
|
|
+ // 匹配规则
|
|
|
+ // 规则一:累计出单()次,可得()次抽奖机会
|
|
|
+ // 规则二:累计出单()次,可得()次抽奖机会
|
|
|
+ // 下一个规则的出单次数不能不上一个规则出单次数小
|
|
|
+ HttpResult<List<LotteryActivityVO>> result = localLivingClient.queryActivityRules(lotteryScene);
|
|
|
+ if (result == null || result.getCode() != 200 || result.getData() == null) {
|
|
|
+ log.error("活动列表异常");
|
|
|
+ } else {
|
|
|
+ for (LotteryActivityVO activity : result.getData()) {
|
|
|
+ // 检查活动是否有效
|
|
|
+ if (!LocalDate.now().isBefore(activity.getActivityStartTime())
|
|
|
+ && !LocalDate.now().isAfter(activity.getActivityEndTime())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
if (activity.getLocalActivityTables() == null) {
|
|
|
continue;
|
|
|
@@ -844,7 +911,7 @@ public class UnifyOrderManager {
|
|
|
)
|
|
|
@Operation(summary = "获取保单")
|
|
|
@PostMapping("/downloadPolicy")
|
|
|
- public HttpResult downloadPolicy(@RequestBody DownloadPolicyVo downloadPolicyVo) {
|
|
|
+ public HttpResult downloadPolicy(@RequestBody DownloadPolicyVo downloadPolicyVo) throws IOException {
|
|
|
//获取保司实体
|
|
|
InsOrders insOrders = insOrdersService.getById(downloadPolicyVo.getOrder().getOrdersNo());
|
|
|
InsOrdersCarInfo carInfo = insOrdersCarInfoService.getByOrderId(insOrders.getId());
|
|
|
@@ -908,7 +975,7 @@ public class UnifyOrderManager {
|
|
|
return HttpResult.ok(insOrdersPdfUrl);
|
|
|
}
|
|
|
|
|
|
- @PostMapping("test")
|
|
|
+ @PostMapping("login")
|
|
|
@Operation(summary = "登录")
|
|
|
public HttpResult login(@RequestBody LoginBase loginBase) {
|
|
|
zhongMeiCrawlerRequest.login(loginBase);
|