|
|
@@ -9,10 +9,7 @@ import com.ydtech.modules.admin.service.SysUserService;
|
|
|
import com.ydtech.modules.equity.components.EquityApiConfigurationProperties;
|
|
|
import com.ydtech.modules.equity.components.EquityRequestApiComponents;
|
|
|
import com.ydtech.modules.equity.model.InsAreaCompanyEquity;
|
|
|
-import com.ydtech.modules.equity.model.request.ThreeOrderVo;
|
|
|
-import com.ydtech.modules.equity.model.request.ThreePointVo;
|
|
|
-import com.ydtech.modules.equity.model.request.ThreeRightsInfoPageVo;
|
|
|
-import com.ydtech.modules.equity.model.request.ThreeUserOrderVo;
|
|
|
+import com.ydtech.modules.equity.model.request.*;
|
|
|
import com.ydtech.modules.equity.model.response.LocalEquityPackagePage;
|
|
|
import com.ydtech.modules.equity.model.response.PageResultResponse;
|
|
|
import com.ydtech.modules.equity.model.response.PointRatioDto;
|
|
|
@@ -37,10 +34,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Objects;
|
|
|
-import java.util.Optional;
|
|
|
+import java.util.*;
|
|
|
|
|
|
@Service
|
|
|
public class EquityServiceImpl implements EquityService {
|
|
|
@@ -69,6 +63,39 @@ public class EquityServiceImpl implements EquityService {
|
|
|
@Autowired
|
|
|
private EquityApiConfigurationProperties properties;
|
|
|
|
|
|
+ @Override
|
|
|
+ public EquityPageQueryVo equityList(EquityPageQueryVo pageQueryVo) {
|
|
|
+ // 通过订单号获取优惠信息
|
|
|
+ InsFeeOrderNew insFeeOrderNew = insFeeOrderNewService.getOne(new LambdaQueryWrapper<InsFeeOrderNew>()
|
|
|
+ .eq(InsFeeOrderNew::getInsOrderNo, pageQueryVo.getCompanyId()));
|
|
|
+ // 获取费用信息
|
|
|
+ LambdaQueryWrapper<PtlAgreementProductCostsNew> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(PtlAgreementProductCostsNew::getId, insFeeOrderNew.getCostsId());
|
|
|
+ PtlAgreementProductCostsNew agreementProductCostsNew = agreementProductCostsNewService.getOne(wrapper);
|
|
|
+ if(Objects.isNull(agreementProductCostsNew)){
|
|
|
+ throw new SystemException("费用信息异常!");
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(agreementProductCostsNew.getLdProportion())){
|
|
|
+ throw new SystemException("先去设置代理人的留点比例!");
|
|
|
+ }
|
|
|
+
|
|
|
+ FeeOrderNewVo feeOrderNewVo = this.newConvertOrderFeeVoData(insFeeOrderNew,agreementProductCostsNew);
|
|
|
+ // 获取佣金
|
|
|
+ List<FeeOrderNewVo.ExportFee> feeList = feeOrderNewVo.getExportFee();
|
|
|
+ BigDecimal totalAmount = BigDecimal.valueOf(0);
|
|
|
+ for (FeeOrderNewVo.ExportFee fee : feeList) {
|
|
|
+ if(BusinessConstant.FEE_INSURANCE_TYPE_4.equals(fee.getInsuranceType())){
|
|
|
+ totalAmount = fee.getTotalAmount();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ThreeUserOrderListVo threeUserOrderListVo = new ThreeUserOrderListVo( properties.getAppkey(), totalAmount);
|
|
|
+ List<LocalEquityPackagePage> packagePageList = equityRequestApiComponents.equityList(threeUserOrderListVo);
|
|
|
+ Optional<LocalEquityPackagePage> oldestPackage = packagePageList.stream().max(Comparator.comparingDouble(p -> p.getTotalPackagePrice().doubleValue()));
|
|
|
+ pageQueryVo.setAmount(totalAmount);
|
|
|
+ oldestPackage.ifPresent(packages -> pageQueryVo.setMaxPackagePrice(packages.getTotalPackagePrice()));
|
|
|
+ return pageQueryVo;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public EquityPageQueryVo equityInfo(EquityPageQueryVo pageQueryVo) {
|
|
|
|