| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- package com.ydtech.modules.order.components;
- import com.alibaba.fastjson.JSON;
- import com.alibaba.fastjson.JSONObject;
- import com.ydtech.modules.order.constants.OrderCacheConstant;
- import com.ydtech.modules.order.entity.InsOrders;
- import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
- import com.ydtech.modules.order.service.InsOrdersService;
- import com.ydtech.modules.protocol.service.PtlAgreementUnderwritingRulesService;
- import org.springframework.context.annotation.Lazy;
- import org.springframework.data.redis.core.StringRedisTemplate;
- import org.springframework.stereotype.Component;
- import org.springframework.util.ObjectUtils;
- @Component
- public class InsOrdersComponents {
- private final InsOrdersService insOrdersService;
- private final StringRedisTemplate redisTemplate;
- private final InsOrdersComponents proxyService;
- private final PtlAgreementUnderwritingRulesService ptlAgreementUnderwritingRulesService;
- public InsOrdersComponents(InsOrdersService insOrdersService, StringRedisTemplate redisTemplate,
- PtlAgreementUnderwritingRulesService ptlAgreementUnderwritingRulesService,
- @Lazy InsOrdersComponents proxyService) {
- this.insOrdersService = insOrdersService;
- this.redisTemplate = redisTemplate;
- this.ptlAgreementUnderwritingRulesService = ptlAgreementUnderwritingRulesService;
- this.proxyService = proxyService;
- }
- /**
- * 通订单号获取报价信息
- *
- * @param orderNo 订单ID
- * @return BaseQuoteInfoVo
- */
- public BaseQuoteInfoVo getQuoteInfo(String orderNo) {
- insOrdersService.existOrder(orderNo);
- String s = redisTemplate.opsForValue().get(OrderCacheConstant.QUOTE_INFO_KEY + orderNo);
- BaseQuoteInfoVo quoteInfoVo = JSON.parseObject(s, BaseQuoteInfoVo.class);
- if (ObjectUtils.isEmpty(quoteInfoVo)) {
- // 缓存中不存在,在数据库中取
- InsOrders insOrders = insOrdersService.getById(orderNo);
- return new BaseQuoteInfoVo(insOrders);
- }
- quoteInfoVo.setOrderNo(orderNo);
- // 核保规则
- return quoteInfoVo;
- }
- /**
- * 通过订单号校验核保规则
- * 通订单号获取报价信息
- *
- * @param orderNo 订单ID
- * @param agreementId 协议id
- * @return BaseQuoteInfoVo
- */
- public BaseQuoteInfoVo getQuoteInfo(String orderNo, String agreementId) {
- // 核保规则
- proxyService.getQuoteRules(orderNo, agreementId);
- return proxyService.getQuoteInfo(orderNo);
- }
- //查询子订单
- /**
- * 通订单号判断核保规则
- *
- * @param orderNo 订单ID
- */
- public void getQuoteRules(String orderNo, String agreementId) {
- String s = redisTemplate.opsForValue().get(OrderCacheConstant.QUOTE_RULES_KEY + orderNo);
- JSONObject jsonObject = JSON.parseObject(s);
- // ptlAgreementUnderwritingRulesService.ruleComparison(jsonObject, agreementId, 0);
- }
- }
|