|
|
@@ -34,6 +34,8 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -613,8 +615,15 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
|
|
|
isTransfer = "1";
|
|
|
}
|
|
|
feeSchemeReqDto.setIsTransfer(isTransfer);//是否过户 1是 0否"
|
|
|
- if(!carInfoVo.isUsedCar()){
|
|
|
- isNewCar = "1";
|
|
|
+
|
|
|
+ //新旧车判断逻辑,初登日期小于当前日期加9个月
|
|
|
+ if(StringUtils.isNotEmpty(carInfoVo.getRegisterDate())){
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
+ LocalDate registerDate = LocalDate.parse(carInfoVo.getRegisterDate(), formatter).plusMonths(9);
|
|
|
+ LocalDate currentDate = LocalDate.now();
|
|
|
+ if(currentDate.isBefore(registerDate)){
|
|
|
+ isNewCar = "1";
|
|
|
+ }
|
|
|
}
|
|
|
feeSchemeReqDto.setIsNewCar(isNewCar);//是否新车 1是 0否
|
|
|
if("1".equals(carInfoVo.getPowertype())||"2".equals(carInfoVo.getPowertype())||"3".equals(carInfoVo.getPowertype())){
|
|
|
@@ -714,41 +723,47 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
|
|
|
* 9914010501 营销服务部 五级
|
|
|
* 1团队 无机构层级
|
|
|
*/
|
|
|
- SysDept sysDept = sysDeptService.getById(sysUser.getDeptId());
|
|
|
- if(StringUtils.isNotEmpty(sysDept.getComlevel())){
|
|
|
- throw new SystemException("当前出单员归属团队有误,请检查机构层级配置!");
|
|
|
- }
|
|
|
- //得到五级机构
|
|
|
- SysDept sysDeptFifth = sysDeptService.getById(sysDept.getParentId());
|
|
|
- SysDept sysDeptForth = sysDeptService.getById(sysDeptFifth.getParentId());
|
|
|
- SysDept sysDeptThird = sysDeptService.getById(sysDeptForth.getParentId());
|
|
|
- SysDept sysDeptSecond = sysDeptService.getById(sysDeptThird.getParentId());
|
|
|
- SysDept sysDeptFirst = sysDeptService.getById(sysDeptSecond.getParentId());
|
|
|
- //五级机构管理费用比例
|
|
|
- if(sysDeptFifth!=null && "5".equals(sysDeptFifth.getComlevel())){
|
|
|
- insFeeOrder.setFifthDeptProportion(new BigDecimal(sysDeptFifth.getManagementFee()));
|
|
|
- insFeeOrder.setFifthDeptPremiums(getPremium(totalNoTaxPremium,insFeeOrder.getFifthDeptProportion()));
|
|
|
- }
|
|
|
- //四级机构管理费用比例
|
|
|
- if(sysDeptForth!=null && "4".equals(sysDeptForth.getComlevel())){
|
|
|
- insFeeOrder.setForthDeptProportion(new BigDecimal(sysDeptForth.getManagementFee()));
|
|
|
- insFeeOrder.setForthDeptPremiums(getPremium(totalNoTaxPremium,insFeeOrder.getForthDeptProportion()));
|
|
|
- }
|
|
|
- //三级机构管理费用比例
|
|
|
- if(sysDeptThird!=null && "3".equals(sysDeptThird.getComlevel())){
|
|
|
- insFeeOrder.setThirdDeptProportion(new BigDecimal(sysDeptThird.getManagementFee()));
|
|
|
- insFeeOrder.setThirdDeptPremiums(getPremium(totalNoTaxPremium,insFeeOrder.getThirdDeptProportion()));
|
|
|
- }
|
|
|
- //二级机构管理费用比例
|
|
|
- if(sysDeptSecond!=null && "2".equals(sysDeptSecond.getComlevel())){
|
|
|
- insFeeOrder.setSecondDeptProportion(new BigDecimal(sysDeptSecond.getManagementFee()));
|
|
|
- insFeeOrder.setSecondDeptPremiums(getPremium(totalNoTaxPremium,insFeeOrder.getSecondDeptProportion()));
|
|
|
- }
|
|
|
- //一级机构管理费用比例
|
|
|
- if(sysDeptFirst!=null && "1".equals(sysDeptFirst.getComlevel())){
|
|
|
- insFeeOrder.setFirstDeptProportion(new BigDecimal(sysDeptFirst.getManagementFee()));
|
|
|
- insFeeOrder.setFirstDeptPremiums(getPremium(totalNoTaxPremium,insFeeOrder.getFirstDeptProportion()));
|
|
|
- }
|
|
|
+
|
|
|
+ //判断出单员归属机构层级
|
|
|
+ String parentId = sysUser.getDeptId();
|
|
|
+ String comlevel = "";
|
|
|
+ do{//循环操作
|
|
|
+ SysDept sysDeptTemp = sysDeptService.getById(parentId);
|
|
|
+ parentId = sysDeptTemp.getParentId();
|
|
|
+ if(StringUtils.isEmpty(sysDeptTemp.getComlevel())){
|
|
|
+ continue;
|
|
|
+ }else {
|
|
|
+ comlevel = sysDeptTemp.getComlevel();
|
|
|
+ }
|
|
|
+ //五级机构管理费用比例
|
|
|
+ if(sysDeptTemp!=null && "5".equals(sysDeptTemp.getComlevel())){
|
|
|
+ insFeeOrder.setFifthDeptProportion(new BigDecimal(sysDeptTemp.getManagementFee()));
|
|
|
+ insFeeOrder.setFifthDeptPremiums(getPremium(totalNoTaxPremium,insFeeOrder.getFifthDeptProportion()));
|
|
|
+ }
|
|
|
+ //四级机构管理费用比例
|
|
|
+ if(sysDeptTemp!=null && "4".equals(sysDeptTemp.getComlevel())){
|
|
|
+ insFeeOrder.setForthDeptProportion(new BigDecimal(sysDeptTemp.getManagementFee()));
|
|
|
+ insFeeOrder.setForthDeptPremiums(getPremium(totalNoTaxPremium,insFeeOrder.getForthDeptProportion()));
|
|
|
+ }
|
|
|
+ //三级机构管理费用比例
|
|
|
+ if(sysDeptTemp!=null && "3".equals(sysDeptTemp.getComlevel())){
|
|
|
+ insFeeOrder.setThirdDeptProportion(new BigDecimal(sysDeptTemp.getManagementFee()));
|
|
|
+ insFeeOrder.setThirdDeptPremiums(getPremium(totalNoTaxPremium,insFeeOrder.getThirdDeptProportion()));
|
|
|
+ }
|
|
|
+ //二级机构管理费用比例
|
|
|
+ if(sysDeptTemp!=null && "2".equals(sysDeptTemp.getComlevel())){
|
|
|
+ insFeeOrder.setSecondDeptProportion(new BigDecimal(sysDeptTemp.getManagementFee()));
|
|
|
+ insFeeOrder.setSecondDeptPremiums(getPremium(totalNoTaxPremium,insFeeOrder.getSecondDeptProportion()));
|
|
|
+ }
|
|
|
+ //一级机构管理费用比例
|
|
|
+ if(sysDeptTemp!=null && "1".equals(sysDeptTemp.getComlevel())){
|
|
|
+ insFeeOrder.setFirstDeptProportion(new BigDecimal(sysDeptTemp.getManagementFee()));
|
|
|
+ insFeeOrder.setFirstDeptPremiums(getPremium(totalNoTaxPremium,insFeeOrder.getFirstDeptProportion()));
|
|
|
+ //取到第一层级时结束
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }while (!"1".equals(comlevel));
|
|
|
+
|
|
|
//一级分销比例 推荐人
|
|
|
//二级分销比例
|
|
|
//三级分销比例
|