|
|
@@ -102,108 +102,97 @@ import java.util.stream.Collectors;
|
|
|
public class UnifyOrderManager {
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(UnifyOrderManager.class);
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private SysQuoteRedisService sysQuoteRedisService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private SysQuoteConfigService sysQuoteConfigService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private PlatformClient platformClient;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private BaseController baseController;
|
|
|
-
|
|
|
+ //本地生活在一账通的固定平台ID
|
|
|
+ private static final String CLIENT_ID = "bdsh-X9yZ1wV3uT5sR7qP9o";
|
|
|
+ private static final String JZG_CLIENT_ID = "jzg-7kP9xL2mN5vQ8zR1jW";
|
|
|
@Autowired
|
|
|
CompanyFactory companyFactory;
|
|
|
-
|
|
|
@Autowired
|
|
|
InsOrdersService insOrdersService;
|
|
|
-
|
|
|
@Autowired
|
|
|
InsOrdersCarInfoService insOrdersCarInfoService;
|
|
|
-
|
|
|
@Autowired
|
|
|
InsOrdersCarUserInfoService insOrdersCarUserInfoService;
|
|
|
-
|
|
|
@Autowired
|
|
|
InsOrdersRiskService insOrdersRiskService;
|
|
|
-
|
|
|
@Autowired
|
|
|
QuoteRuleMappingService quoteRuleMappingService;
|
|
|
-
|
|
|
@Autowired
|
|
|
OrgClient orgClient;
|
|
|
-
|
|
|
@Autowired
|
|
|
AgreementCacheService agreementCacheService;
|
|
|
-
|
|
|
@Autowired
|
|
|
InsOrdersPolicyService insOrdersPolicyService;
|
|
|
-
|
|
|
@Autowired
|
|
|
InsOrdersCostsService insOrdersCostsService;
|
|
|
-
|
|
|
@Autowired
|
|
|
InsOrdersClauseService insOrdersClauseService;
|
|
|
@Autowired
|
|
|
InsTaskImagesService insTaskImagesService;
|
|
|
-
|
|
|
@Autowired
|
|
|
OrderStateListener orderStateListener;
|
|
|
-
|
|
|
@Autowired
|
|
|
InsOrdersPdfUrlService insOrdersPdfUrlService;
|
|
|
-
|
|
|
@Autowired
|
|
|
InsOrdersQrcodeService insOrdersQrcodeService;
|
|
|
-
|
|
|
@Autowired
|
|
|
InsFeeOrdersService insFeeOrdersService;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private SysQuoteRedisService sysQuoteRedisService;
|
|
|
+ @Autowired
|
|
|
+ private SysQuoteConfigService sysQuoteConfigService;
|
|
|
+ @Autowired
|
|
|
+ private PlatformClient platformClient;
|
|
|
+ @Autowired
|
|
|
+ private BaseController baseController;
|
|
|
@Autowired
|
|
|
private GuoRenCrawlerRequest guoRenCrawlerRequest;
|
|
|
-
|
|
|
@Autowired
|
|
|
private ZhongMeiCrawlerRequest zhongMeiCrawlerRequest;
|
|
|
-
|
|
|
@Autowired
|
|
|
private InsOrderRightsInfoService insOrderRightsInfoService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private InsOrdersTaxService insOrdersTaxService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private InsOrdersKindService insOrdersKindService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private InsOrdersAccidentalDrivingService insOrdersAccidentalDrivingService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private AsyncGetPayLink asyncGetPayLink;
|
|
|
-
|
|
|
@Autowired
|
|
|
private LocalLivingClient localLivingClient;
|
|
|
@Autowired
|
|
|
private UnifiedAccountClient unifiedAccountClient;
|
|
|
-
|
|
|
@Autowired
|
|
|
private EsmInsCompanyClient esmInsCompanyClient;
|
|
|
-
|
|
|
@Autowired
|
|
|
private ObjectMapper objectMapper;
|
|
|
-
|
|
|
@Value("${lottery.activity.scene:3}")
|
|
|
private Integer lotteryScene;
|
|
|
-
|
|
|
@Value("${feign.client.jeecg-boot.url}")
|
|
|
private String LocalLivingUrl;
|
|
|
|
|
|
-
|
|
|
- //本地生活在一账通的固定平台ID
|
|
|
- private static final String CLIENT_ID = "bdsh-X9yZ1wV3uT5sR7qP9o";
|
|
|
- private static final String JZG_CLIENT_ID = "jzg-7kP9xL2mN5vQ8zR1jW";
|
|
|
+ /**
|
|
|
+ * 格式化保费字符串:非空判断 + 保留两位小数
|
|
|
+ *
|
|
|
+ * @param premium 原始保费字符串
|
|
|
+ * @return 格式化后两位小数的字符串
|
|
|
+ */
|
|
|
+ public static String formatPremium(String premium) {
|
|
|
+ // 1. 空值直接返回空
|
|
|
+ if (premium == null || premium.isBlank()) {
|
|
|
+ return premium;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ // 2. 转BigDecimal,保留两位小数(HALF_UP 四舍五入)
|
|
|
+ return new BigDecimal(premium.trim())
|
|
|
+ .setScale(2, RoundingMode.HALF_UP)
|
|
|
+ .toPlainString();
|
|
|
+ } catch (Exception e) {
|
|
|
+ // 格式错误直接返回原值,防止报错
|
|
|
+ return premium;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
private String getSystemCode() {
|
|
|
//如果是APP登录的话 则传递SystemCode的头部字段
|
|
|
@@ -270,7 +259,7 @@ public class UnifyOrderManager {
|
|
|
@QuoteVerification
|
|
|
public HttpResult<QuoteResultsVo> quote(@RequestBody QuoteVo quoteVo) throws Exception {
|
|
|
String systemCode = getSystemCode();
|
|
|
- log.info("进行车险报价:systemCode=[{}],quoteVo=[{}]",systemCode, JSONUtil.toJsonStr(quoteVo));
|
|
|
+ log.info("进行车险报价:systemCode=[{}],quoteVo=[{}]", systemCode, JSONUtil.toJsonStr(quoteVo));
|
|
|
HttpResult<EsmInsCompany> esmInsCompanyHttpResult = platformClient.findById(quoteVo.getOrder().getInsuranceCompanyCode());
|
|
|
log.info("车险报价:esmInsCompanyHttpResult=[{}]", JSONUtil.toJsonStr(esmInsCompanyHttpResult));
|
|
|
AssertionUtils.isFail(esmInsCompanyHttpResult.getCode() != 200, esmInsCompanyHttpResult.getMsg());
|
|
|
@@ -295,7 +284,7 @@ public class UnifyOrderManager {
|
|
|
.getApiType(), sysQuoteConfigService, sysQuoteRedisService, platformClient, baseController);
|
|
|
|
|
|
// 生成主订单及子订单 返回子订单id
|
|
|
- String ordersNo = insOrdersService.generateOrders(quoteVo, companyName,systemCode, quoteVo.getOrder().getProductId());
|
|
|
+ String ordersNo = insOrdersService.generateOrders(quoteVo, companyName, systemCode, quoteVo.getOrder().getProductId());
|
|
|
|
|
|
// 添加车辆没有的参数: 车辆明细、
|
|
|
QuoteInfoParameterFilling.setParameterSettings(quoteVo, esmInsCompanyHttpResult.getData().getCompanyCode());
|
|
|
@@ -332,11 +321,11 @@ public class UnifyOrderManager {
|
|
|
costs.setNiPremium(formatPremium(costs.getNiPremium())); // 非车险
|
|
|
costs.setVvTax(formatPremium(costs.getVvTax())); // 车船税
|
|
|
costs.setSumPremium(formatPremium(costs.getSumPremium())); // 总保费
|
|
|
- if (null != costs.getSumPremium() && null != costs.getVvTax()){
|
|
|
+ if (null != costs.getSumPremium() && null != costs.getVvTax()) {
|
|
|
// 总保费,不含车船税
|
|
|
BigDecimal sub = NumberUtil.sub(costs.getSumPremium(), costs.getVvTax());
|
|
|
costs.setTotalAmount(sub.setScale(2, RoundingMode.HALF_UP).toString());
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
costs.setTotalAmount(formatPremium(costs.getSumPremium()));
|
|
|
}
|
|
|
}
|
|
|
@@ -383,7 +372,7 @@ public class UnifyOrderManager {
|
|
|
log.error("更新报价失败状态异常, ordersNo: {}", ordersNo, ex);
|
|
|
}
|
|
|
throw new SystemException(errMsg);
|
|
|
- }finally {
|
|
|
+ } finally {
|
|
|
// 处理营销抽奖活动(报价规则 type=6),异常不影响主报价流程
|
|
|
handleQuoteLotteryActivity(quoteVo);
|
|
|
}
|
|
|
@@ -445,15 +434,15 @@ public class UnifyOrderManager {
|
|
|
* 匹配规则:每报价N次,可得M次抽奖机会
|
|
|
* 1. 查询本地生活活动列表,筛选有效活动 + 本租户的 type=6 报价规则
|
|
|
* 2. 查询用户是否在一账通绑定过本地生活
|
|
|
- * - 未绑定:统计报价次数,满足条件则存本地记录,等绑定后同步
|
|
|
- * - 已绑定:远程调用抽奖次数增加接口,成功后标记已同步
|
|
|
+ * - 未绑定:统计报价次数,满足条件则存本地记录,等绑定后同步
|
|
|
+ * - 已绑定:远程调用抽奖次数增加接口,成功后标记已同步
|
|
|
* <p>
|
|
|
* 该方法异常不影响主报价流程,所有异常均在内部捕获。
|
|
|
*
|
|
|
* @param quoteVo 报价请求参数
|
|
|
*/
|
|
|
private void handleQuoteLotteryActivity(QuoteVo quoteVo) {
|
|
|
- log.info("进入营销活动报价抽奖,参数:{}",JSON.toJSONString(quoteVo));
|
|
|
+ log.info("进入营销活动报价抽奖,参数:{}", JSON.toJSONString(quoteVo));
|
|
|
try {
|
|
|
// 远程调用活动列表
|
|
|
List<LocalLivingLotteryActivityVO> activities = queryLotteryActivities(lotteryScene);
|
|
|
@@ -486,7 +475,7 @@ public class UnifyOrderManager {
|
|
|
}
|
|
|
|
|
|
// 查询用户是否在一账通绑定过本地生活
|
|
|
- HttpResult<UnifiedUserClientVO> bindResult = queryUserBind(userId,quoteUserId, tenantId);
|
|
|
+ HttpResult<UnifiedUserClientVO> bindResult = queryUserBind(userId, quoteUserId, tenantId);
|
|
|
if (bindResult == null || bindResult.getCode() != 0 || bindResult.getData() == null) {
|
|
|
// 未绑定:统计报价次数,满足条件则存本地记录
|
|
|
handleUnboundQuoteRule(tenantId, quoteUserId, activity, table);
|
|
|
@@ -526,7 +515,7 @@ public class UnifyOrderManager {
|
|
|
/**
|
|
|
* 查询用户在一账通的绑定状态
|
|
|
*/
|
|
|
- private HttpResult<UnifiedUserClientVO> queryUserBind(String userId,String userPhone, String tenantId) {
|
|
|
+ private HttpResult<UnifiedUserClientVO> queryUserBind(String userId, String userPhone, String tenantId) {
|
|
|
UnifiedUserCenterDTO dto = new UnifiedUserCenterDTO();
|
|
|
dto.setUserId(userId);
|
|
|
dto.setClientId(JZG_CLIENT_ID);
|
|
|
@@ -548,7 +537,7 @@ public class UnifyOrderManager {
|
|
|
* count=1 时本次新增1次;count=2 时本次新增1次;count>=3 时达到上限,不再新增。
|
|
|
*/
|
|
|
private void handleUnboundQuoteRule(String tenantId, String userId,
|
|
|
- LocalLivingLotteryActivityVO activity, LocalLivingActivityTableVO table) {
|
|
|
+ LocalLivingLotteryActivityVO activity, LocalLivingActivityTableVO table) {
|
|
|
int count = insOrdersService.countQuoteNum(tenantId, userId,
|
|
|
LocalDate.now(), LocalDate.now());
|
|
|
int currentGrantNum = calculateCurrentQuoteLotteryNum(count, table);
|
|
|
@@ -566,7 +555,7 @@ public class UnifyOrderManager {
|
|
|
userId, CLIENT_ID, tenantId, count, currentGrantNum);
|
|
|
|
|
|
// 发送抽奖次数下发通知消息,未绑定用户等绑定后再同步发放。
|
|
|
- HttpResult<SysUserJzgInfo> sysUser = orgClient.queryUserByUserId(userId,tenantId);
|
|
|
+ HttpResult<SysUserJzgInfo> sysUser = orgClient.queryUserByUserId(userId, tenantId);
|
|
|
|
|
|
MessageAddParam param = new MessageAddParam();
|
|
|
param.setTitle("抽奖次数下发通知消息");
|
|
|
@@ -621,8 +610,8 @@ public class UnifyOrderManager {
|
|
|
* 处理已绑定用户的报价规则:先判断是否满足规则条件,满足后再远程同步抽奖次数并标记已同步
|
|
|
*/
|
|
|
private void handleBoundQuoteRule(String tenantId, String userId,
|
|
|
- LocalLivingLotteryActivityVO activity, LocalLivingActivityTableVO table,
|
|
|
- UnifiedUserClientVO bindData) {
|
|
|
+ LocalLivingLotteryActivityVO activity, LocalLivingActivityTableVO table,
|
|
|
+ UnifiedUserClientVO bindData) {
|
|
|
Map<String, List<UnifiedUserClientVO>> clientGroupMap = bindData.getUserClients()
|
|
|
.stream()
|
|
|
.collect(Collectors.groupingBy(UnifiedUserClientVO::getClientId));
|
|
|
@@ -677,7 +666,6 @@ public class UnifyOrderManager {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@OrderOperationLog(
|
|
|
module = "车险订单",
|
|
|
subModule = "订单详情",
|
|
|
@@ -719,6 +707,8 @@ public class UnifyOrderManager {
|
|
|
//核保之前更新订单为待核保
|
|
|
insOrders.setOrderStatus(String.valueOf(stateResult.getCurrentState()));
|
|
|
insOrdersService.updateById(insOrders);
|
|
|
+ // 根据从订单报价状态按优先级更新主订单状态
|
|
|
+ insOrdersService.updateMainOrderStatus(insOrders.getParentId());
|
|
|
// 发送订单状态变更消息
|
|
|
insOrdersService.orderStatusMessage(insOrders,
|
|
|
insOrdersCarInfo, insOrdersCosts,
|
|
|
@@ -790,15 +780,19 @@ public class UnifyOrderManager {
|
|
|
StateResult stateFailResult = orderStateListener.statusChange(InsOrderStatusEnum.AUDIT_FAIL, insOrders.getOrderStatus());
|
|
|
insOrders.setOrderStatus(String.valueOf(stateFailResult.getCurrentState()));
|
|
|
insOrdersService.updateById(insOrders);
|
|
|
+ // 根据从订单报价状态按优先级更新主订单状态
|
|
|
+ insOrdersService.updateMainOrderStatus(insOrders.getParentId());
|
|
|
// 发送订单状态变更消息
|
|
|
insOrdersService.orderStatusMessage(insOrders,
|
|
|
insOrdersCarInfo, insOrdersCosts,
|
|
|
baseController.getToken(), MessageCodeEnum.TEMPLATE_4);
|
|
|
- }else if (underwritingResultsVo.getUnderwritingStatus().equals(InsOrderStatusEnum.STAFF_PROCESS)) {
|
|
|
+ } else if (underwritingResultsVo.getUnderwritingStatus().equals(InsOrderStatusEnum.STAFF_PROCESS)) {
|
|
|
//核保之前更新订单为待核保
|
|
|
StateResult stateFailResult = orderStateListener.statusChange(InsOrderStatusEnum.STAFF_PROCESS, insOrders.getOrderStatus());
|
|
|
insOrders.setOrderStatus(String.valueOf(stateFailResult.getCurrentState()));
|
|
|
insOrdersService.updateById(insOrders);
|
|
|
+ // 根据从订单报价状态按优先级更新主订单状态
|
|
|
+ insOrdersService.updateMainOrderStatus(insOrders.getParentId());
|
|
|
// 发送订单状态变更消息
|
|
|
insOrdersService.orderStatusMessage(insOrders,
|
|
|
insOrdersCarInfo, insOrdersCosts,
|
|
|
@@ -808,7 +802,6 @@ public class UnifyOrderManager {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 获取支付连接
|
|
|
*
|
|
|
@@ -855,7 +848,6 @@ public class UnifyOrderManager {
|
|
|
return HttpResult.ok(insOrders);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Operation(summary = "影像上传")
|
|
|
@PostMapping("/imagesUpload")
|
|
|
public HttpResult imagesUpload(@RequestBody InsuranceUploadImageVo insuranceUploadImageVo) {
|
|
|
@@ -885,13 +877,12 @@ public class UnifyOrderManager {
|
|
|
QuotationBaseService quoteService = companyFactory.getImageUploadService(insuranceUploadImageVo);
|
|
|
try {
|
|
|
quoteService.uploadImage(insuranceUploadImageVo);
|
|
|
- }catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
throw new SystemException("影像上传异常,请检查影像是否上传或影像是否清晰");
|
|
|
}
|
|
|
return HttpResult.ok();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Operation(summary = "特约查询")
|
|
|
@PostMapping("/queryClauseData")
|
|
|
public HttpResult queryClauseData(@RequestBody ClauseDataVo clauseDataVo) {
|
|
|
@@ -933,7 +924,6 @@ public class UnifyOrderManager {
|
|
|
return HttpResult.ok(clauseInfoDtoList);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@OrderOperationLog(
|
|
|
module = "车险订单",
|
|
|
subModule = "订单详情",
|
|
|
@@ -1001,6 +991,13 @@ public class UnifyOrderManager {
|
|
|
return HttpResult.ok("状态刷新成功");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 订单承保后执行一些操作
|
|
|
+ *
|
|
|
+ * @author lipf
|
|
|
+ * @date 2026/5/19 11:59
|
|
|
+ */
|
|
|
+
|
|
|
/**
|
|
|
* 模拟承保(跳过实际付款操作)
|
|
|
*
|
|
|
@@ -1056,12 +1053,6 @@ public class UnifyOrderManager {
|
|
|
return HttpResult.ok("模拟承保(跳过实际付款操作)");
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 订单承保后执行一些操作
|
|
|
- *
|
|
|
- * @author lipf
|
|
|
- * @date 2026/5/19 11:59
|
|
|
- */
|
|
|
/**
|
|
|
* 订单承保后处理营销抽奖活动(type=8 出单规则 + type=9 承保规则)
|
|
|
* <p>
|
|
|
@@ -1092,7 +1083,7 @@ public class UnifyOrderManager {
|
|
|
|
|
|
for (LocalLivingActivityTableVO table : activity.getLocalActivityTables()) {
|
|
|
if ("8".equals(table.getType())) {
|
|
|
- handleOrderRule(tenantId, userId,quoteUserId, activity, table);
|
|
|
+ handleOrderRule(tenantId, userId, quoteUserId, activity, table);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1110,7 +1101,7 @@ public class UnifyOrderManager {
|
|
|
|
|
|
for (LocalLivingActivityTableVO table : activity.getLocalActivityTables()) {
|
|
|
if ("9".equals(table.getType())) {
|
|
|
- handleUnderwritingRule(tenantId, userId,quoteUserId, insOrders, activity,table);
|
|
|
+ handleUnderwritingRule(tenantId, userId, quoteUserId, insOrders, activity, table);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1124,7 +1115,7 @@ public class UnifyOrderManager {
|
|
|
/**
|
|
|
* 处理 type=9 承保规则:按保费区间匹配,满足条件则存本地记录
|
|
|
*/
|
|
|
- private void handleUnderwritingRule(String tenantId,String userId,String quoteUserId,InsOrders insOrders, LocalLivingLotteryActivityVO activity, LocalLivingActivityTableVO table) {
|
|
|
+ private void handleUnderwritingRule(String tenantId, String userId, String quoteUserId, InsOrders insOrders, LocalLivingLotteryActivityVO activity, LocalLivingActivityTableVO table) {
|
|
|
Double totalFee = insOrdersService.queryTotalFee(insOrders.getId());
|
|
|
String userPhone = insOrdersService.queryCustomerPhone(insOrders.getId());
|
|
|
for (LocalLivingActivityTableVO.UnderwritingRule rule : table.getUnderwritingRules()) {
|
|
|
@@ -1139,13 +1130,13 @@ public class UnifyOrderManager {
|
|
|
qparam.setActivityId(activity.getId());
|
|
|
qparam.setPhone(quoteUserId);
|
|
|
qparam.setNumber(rule.getUwLotteryNum());
|
|
|
- qparam.setQuery("i="+activity.getId()+"&t=1&n="+rule.getUwLotteryNum());
|
|
|
+ qparam.setQuery("i=" + activity.getId() + "&t=1&n=" + rule.getUwLotteryNum());
|
|
|
Result<String> stringResult = localLivingClient.generateQrcode(qparam);
|
|
|
- if(stringResult.isSuccess() && !stringResult.getResult().isEmpty()){
|
|
|
+ if (stringResult.isSuccess() && !stringResult.getResult().isEmpty()) {
|
|
|
|
|
|
MessageAddParam param = new MessageAddParam();
|
|
|
param.setTitle("抽奖次数下发通知消息");
|
|
|
- param.setContent("{\"qrcode\":\"" + LocalLivingUrl+stringResult.getResult() + "\",\"eventId\":\"" + activity.getId() + "\",\"localActivityTableId\":\"" + table.getId() + "\",\"message\":\"投保客户投保已获取奖励,点击为客户发放奖励\"}");
|
|
|
+ param.setContent("{\"qrcode\":\"" + LocalLivingUrl + stringResult.getResult() + "\",\"eventId\":\"" + activity.getId() + "\",\"localActivityTableId\":\"" + table.getId() + "\",\"message\":\"投保客户投保已获取奖励,点击为客户发放奖励\"}");
|
|
|
param.setTplCode("template_14");
|
|
|
param.setReceive(List.of(quoteUserId));
|
|
|
orgClient.messageAdd(param);
|
|
|
@@ -1162,13 +1153,13 @@ public class UnifyOrderManager {
|
|
|
* 2. 已绑定:远程同步抽奖次数,成功后标记已同步
|
|
|
*/
|
|
|
private void handleOrderRule(String tenantId, String userId, String quoteUserId,
|
|
|
- LocalLivingLotteryActivityVO activity, LocalLivingActivityTableVO table) {
|
|
|
+ LocalLivingLotteryActivityVO activity, LocalLivingActivityTableVO table) {
|
|
|
// 只处理本租户的出单规则
|
|
|
if (!tenantId.equals(table.getTenantId())) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- HttpResult<UnifiedUserClientVO> bindResult = queryUserBind(userId,quoteUserId, tenantId);
|
|
|
+ HttpResult<UnifiedUserClientVO> bindResult = queryUserBind(userId, quoteUserId, tenantId);
|
|
|
if (bindResult == null || bindResult.getCode() != 200 || bindResult.getData() == null) {
|
|
|
// 未绑定:统计出单次数,满足条件则存本地记录
|
|
|
handleUnboundOrderRule(tenantId, quoteUserId, activity, table);
|
|
|
@@ -1182,7 +1173,7 @@ public class UnifyOrderManager {
|
|
|
* 处理未绑定用户的出单规则
|
|
|
*/
|
|
|
private void handleUnboundOrderRule(String tenantId, String userId,
|
|
|
- LocalLivingLotteryActivityVO activity, LocalLivingActivityTableVO table) {
|
|
|
+ LocalLivingLotteryActivityVO activity, LocalLivingActivityTableVO table) {
|
|
|
int count = insOrdersService.countOrderNum(tenantId, userId,
|
|
|
activity.getActivityStartTime(), activity.getActivityEndTime());
|
|
|
for (LocalLivingActivityTableVO.OrderRule orderRule : table.getOrderRules()) {
|
|
|
@@ -1191,7 +1182,7 @@ public class UnifyOrderManager {
|
|
|
table.getId(), orderRule.getOrdNum(),
|
|
|
String.valueOf(orderRule.getOrdLotteryNum()), null,
|
|
|
YesNoEnum.NO.getCode(), 8);
|
|
|
- if(!inserted){
|
|
|
+ if (!inserted) {
|
|
|
break;
|
|
|
}
|
|
|
log.info("业务员出单,满足条件插入记录,userId:{},clientId:{},tenantId:{}",
|
|
|
@@ -1207,13 +1198,14 @@ public class UnifyOrderManager {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //return HttpResult.ok("状态刷新成功");
|
|
|
|
|
|
/**
|
|
|
* 处理已绑定用户的出单规则:先判断是否满足规则条件,满足后再远程同步抽奖次数并标记已同步
|
|
|
*/
|
|
|
private void handleBoundOrderRule(String tenantId, String userId,
|
|
|
- LocalLivingLotteryActivityVO activity, LocalLivingActivityTableVO table,
|
|
|
- UnifiedUserClientVO bindData) {
|
|
|
+ LocalLivingLotteryActivityVO activity, LocalLivingActivityTableVO table,
|
|
|
+ UnifiedUserClientVO bindData) {
|
|
|
Map<String, List<UnifiedUserClientVO>> clientGroupMap = bindData.getUserClients()
|
|
|
.stream()
|
|
|
.collect(Collectors.groupingBy(UnifiedUserClientVO::getClientId));
|
|
|
@@ -1238,7 +1230,7 @@ public class UnifyOrderManager {
|
|
|
}
|
|
|
}
|
|
|
// 已完成的出单任务不走奖励
|
|
|
- if(!instare){
|
|
|
+ if (!instare) {
|
|
|
return;
|
|
|
}
|
|
|
if (!anyMatch) {
|
|
|
@@ -1260,7 +1252,7 @@ public class UnifyOrderManager {
|
|
|
userId, table.getQutLotteryNum(), tenantId);
|
|
|
log.error("业务员出单,远程调用本地生活抽奖次数增加异常", e);
|
|
|
}
|
|
|
- if (lotteryResult != null ) {
|
|
|
+ if (lotteryResult != null) {
|
|
|
MessageAddParam param = new MessageAddParam();
|
|
|
param.setTitle("抽奖次数下发通知消息");
|
|
|
param.setContent("{\"eventId\":\"" + activity.getId() + "\",\"localActivityTableId\":\"" + table.getId() + "\",\"message\":\"出单活动:抽奖次数奖励下发\"}");
|
|
|
@@ -1269,8 +1261,6 @@ public class UnifyOrderManager {
|
|
|
orgClient.messageAdd(param);
|
|
|
}
|
|
|
}
|
|
|
- //return HttpResult.ok("状态刷新成功");
|
|
|
-
|
|
|
|
|
|
@OrderOperationLog(
|
|
|
module = "车险订单",
|
|
|
@@ -1421,26 +1411,4 @@ public class UnifyOrderManager {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 格式化保费字符串:非空判断 + 保留两位小数
|
|
|
- *
|
|
|
- * @param premium 原始保费字符串
|
|
|
- * @return 格式化后两位小数的字符串
|
|
|
- */
|
|
|
- public static String formatPremium(String premium) {
|
|
|
- // 1. 空值直接返回空
|
|
|
- if (premium == null || premium.isBlank()) {
|
|
|
- return premium;
|
|
|
- }
|
|
|
- try {
|
|
|
- // 2. 转BigDecimal,保留两位小数(HALF_UP 四舍五入)
|
|
|
- return new BigDecimal(premium.trim())
|
|
|
- .setScale(2, RoundingMode.HALF_UP)
|
|
|
- .toPlainString();
|
|
|
- } catch (Exception e) {
|
|
|
- // 格式错误直接返回原值,防止报错
|
|
|
- return premium;
|
|
|
- }
|
|
|
- }
|
|
|
}
|