|
|
@ -33,6 +33,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.yxt.anrui.base.api.basebrandletpricepowimit.BaseBrandMitQuery; |
|
|
|
import com.yxt.anrui.base.api.basebrandletpricepowimit.BaseBrandletpricepowimitFeign; |
|
|
|
import com.yxt.anrui.base.api.basediscountpackage.BaseDiscountpackageFeign; |
|
|
|
import com.yxt.anrui.base.api.basemiddleman.BaseMiddlemanDetailsVo; |
|
|
|
import com.yxt.anrui.base.api.basemiddleman.BaseMiddlemanFeign; |
|
|
|
import com.yxt.anrui.base.api.basemodelconfig.AppCarConfigSummaryVo; |
|
|
@ -308,6 +309,8 @@ public class BusSalesOrderService extends MybatisBaseService<BusSalesOrderMapper |
|
|
|
private LoanSolutionsOtherpolicyFeign loanSolutionsOtherpolicyFeign; |
|
|
|
@Autowired |
|
|
|
private FinUncollectedReceivablesDetailedFeign finUncollectedReceivablesDetailedFeign; |
|
|
|
@Autowired |
|
|
|
private BaseDiscountpackageFeign baseDiscountpackageFeign; |
|
|
|
|
|
|
|
/** |
|
|
|
* 构造查询条件 |
|
|
@ -392,6 +395,21 @@ public class BusSalesOrderService extends MybatisBaseService<BusSalesOrderMapper |
|
|
|
//包含采购系统的车架号
|
|
|
|
List<String> vinList = vinLists.stream().map(v -> v.getVinNo()).collect(Collectors.toList()); |
|
|
|
List<String> orderVinList = busSalesOrderVehicleService.selectList(sid); |
|
|
|
if(!vinList.isEmpty()){ |
|
|
|
for (int i = 0; i < vinLists.size(); i++) { |
|
|
|
VinListsVo vinListsVo = vinLists.get(i); |
|
|
|
BigDecimal initBigDecimalTwo = BigDecimal.ZERO; |
|
|
|
//根据sid去查询销售政策的sid,根据销售政策查询销售政策的金额
|
|
|
|
ResultBean<List<String>> listResultBean = baseDiscountpackageFeign.getMoney(vinListsVo.getVinSid(), entity.getUseOrgSid()); |
|
|
|
if (listResultBean.getSuccess() && !listResultBean.getData().isEmpty()) { |
|
|
|
List<String> stringList = listResultBean.getData(); |
|
|
|
initBigDecimalTwo = initBigDecimalTwo.add(stringList.stream().map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add)); |
|
|
|
} |
|
|
|
if(initBigDecimalTwo.compareTo(BigDecimal.ZERO) != 0){ |
|
|
|
vinList.set(i,vinList.get(i)+"促销("+initBigDecimalTwo.toString()+"元)"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
modelInfo.setVinList(vinList); |
|
|
|
modelInfo.setOrderVinList(orderVinList); |
|
|
|
} else { |
|
|
@ -1271,6 +1289,31 @@ public class BusSalesOrderService extends MybatisBaseService<BusSalesOrderMapper |
|
|
|
} |
|
|
|
//计算总指导价-总成交价-总优惠包的价值
|
|
|
|
bigDecimalOne = guildPriceAll.subtract(finalPriceAll).add(discountPrice); |
|
|
|
List<String> vehicleList = new ArrayList<>(); |
|
|
|
BigDecimal initBigDecimalOne = BigDecimal.ZERO; |
|
|
|
List<String> initBigDecimalOneList = new ArrayList<>(); |
|
|
|
//是否是现车//ToDo:促销政策
|
|
|
|
if ("1".equals(busSalesOrder.getType())) { |
|
|
|
//根据销售订单sid查询现车的sid集合
|
|
|
|
vehicleList = busSalesOrderVehicleService.selectVehicleSid(sid); |
|
|
|
//根据现车去查询销售政策的总促销政策之和
|
|
|
|
if (vehicleList.size() > 0) { |
|
|
|
for (int i = 0; i < vehicleList.size(); i++) { |
|
|
|
BigDecimal initBigDecimalTwo = BigDecimal.ZERO; |
|
|
|
//根据sid去查询销售政策的sid,根据销售政策查询销售政策的金额
|
|
|
|
ResultBean<List<String>> listResultBean = baseDiscountpackageFeign.getMoney(vehicleList.get(i), busSalesOrder.getUseOrgSid()); |
|
|
|
if (listResultBean.getSuccess() && !listResultBean.getData().isEmpty()) { |
|
|
|
List<String> stringList = listResultBean.getData(); |
|
|
|
initBigDecimalTwo = initBigDecimalTwo.add(stringList.stream().map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add)); |
|
|
|
} |
|
|
|
initBigDecimalOneList.add(initBigDecimalTwo.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(!initBigDecimalOneList.isEmpty()){ |
|
|
|
String initOne = Collections.min(initBigDecimalOneList); |
|
|
|
initBigDecimalOne = new BigDecimal(initOne); |
|
|
|
} |
|
|
|
//查询返利金额
|
|
|
|
BusSalesOrderSubmit busSalesOrderSubmit = busSalesOrderSubmitService.selectBySaleOrderSid(sid); |
|
|
|
if (busSalesOrderSubmit != null) { |
|
|
@ -1303,8 +1346,10 @@ public class BusSalesOrderService extends MybatisBaseService<BusSalesOrderMapper |
|
|
|
//ToDo:修改公式计算是否超权限:岗位权限*台数>总指导价-总成交价+总优惠包+总返利
|
|
|
|
//销售支持部经理的岗位权限价格
|
|
|
|
BigDecimal bigDecimal2 = new BigDecimal(price).multiply(new BigDecimal(quantity)); |
|
|
|
//岗位权限价格*台数
|
|
|
|
bigDecimalTwo = bigDecimal2; |
|
|
|
bigDecimalOne = bigDecimalOne.add(initBigDecimal); |
|
|
|
//总指导价-总成交价+总优惠包+总返利
|
|
|
|
bigDecimalOne = bigDecimalOne.add(initBigDecimal).subtract(initBigDecimalOne.multiply(new BigDecimal(quantity))); |
|
|
|
if (bigDecimalTwo.compareTo(bigDecimalOne) < 0) { |
|
|
|
//bigDecimalTwo<bigDecimalOne:超权限
|
|
|
|
isHavePower = true; |
|
|
@ -1335,7 +1380,7 @@ public class BusSalesOrderService extends MybatisBaseService<BusSalesOrderMapper |
|
|
|
bigDecimalTwo = new BigDecimal("0"); |
|
|
|
BigDecimal bigDecimal2 = new BigDecimal(price).multiply(new BigDecimal(quantity)); |
|
|
|
bigDecimalTwo = bigDecimal2; |
|
|
|
bigDecimalOne = bigDecimalOne.add(initBigDecimal); |
|
|
|
bigDecimalOne = bigDecimalOne.add(initBigDecimal).subtract(initBigDecimalOne.multiply(new BigDecimal(quantity))); |
|
|
|
if (bigDecimalTwo.compareTo(bigDecimalOne) < 0) { |
|
|
|
//bigDecimalTwo<bigDecimalOne
|
|
|
|
isPower = true; |
|
|
@ -2220,6 +2265,16 @@ public class BusSalesOrderService extends MybatisBaseService<BusSalesOrderMapper |
|
|
|
//现车信息
|
|
|
|
AppNowCarVo appNowCarVo = new AppNowCarVo(); |
|
|
|
BeanUtil.copyProperties(vehicleOrderVo, appNowCarVo); |
|
|
|
//根据sid去查询销售政策的sid,根据销售政策查询销售政策的金额
|
|
|
|
ResultBean<List<String>> listResultBean = baseDiscountpackageFeign.getMoney(vehicleOrderVo.getCarSid(), busSalesOrder.getUseOrgSid()); |
|
|
|
if (listResultBean.getSuccess()) { |
|
|
|
List<String> stringList = listResultBean.getData(); |
|
|
|
if(stringList.isEmpty()){ |
|
|
|
appNowCarVo.setPromotion(false); |
|
|
|
}else{ |
|
|
|
appNowCarVo.setPromotion(true); |
|
|
|
} |
|
|
|
} |
|
|
|
//将该车型下的所有现车的车架号组合放入集合中
|
|
|
|
vinNoList.add(vehicleOrderVo.getVin()); |
|
|
|
vinNoMap.put(vehicleOrderVo.getVin(), vehicleOrderVo.getTopSid()); |
|
|
@ -2540,6 +2595,16 @@ public class BusSalesOrderService extends MybatisBaseService<BusSalesOrderMapper |
|
|
|
for (AppBaseVehicleOrderVo vehicleOrderVo : voList) { |
|
|
|
AppNowCarVo appNowCarVo = new AppNowCarVo(); |
|
|
|
BeanUtil.copyProperties(vehicleOrderVo, appNowCarVo); |
|
|
|
//根据sid去查询销售政策的sid,根据销售政策查询销售政策的金额
|
|
|
|
ResultBean<List<String>> listResultBean = baseDiscountpackageFeign.getMoney(vehicleOrderVo.getCarSid(), busSalesOrder.getUseOrgSid()); |
|
|
|
if (listResultBean.getSuccess()) { |
|
|
|
List<String> stringList = listResultBean.getData(); |
|
|
|
if(stringList.isEmpty()){ |
|
|
|
appNowCarVo.setPromotion(false); |
|
|
|
}else{ |
|
|
|
appNowCarVo.setPromotion(true); |
|
|
|
} |
|
|
|
} |
|
|
|
//根据车辆sid查询该车架号的采购系统
|
|
|
|
ResultBean<BasePurchSystemVo> vehicleSelectVoResultBean = baseVehicleFeign.getSystem(vehicleOrderVo.getCarSid()); |
|
|
|
if (vehicleSelectVoResultBean.getData() != null) { |
|
|
@ -3317,6 +3382,21 @@ public class BusSalesOrderService extends MybatisBaseService<BusSalesOrderMapper |
|
|
|
//包含采购系统的车架号
|
|
|
|
List<String> vinList = vinLists.stream().map(v -> v.getVinNo()).collect(Collectors.toList()); |
|
|
|
List<String> orderVinList = busSalesOrderVehicleService.selectList(sid); |
|
|
|
if(!vinList.isEmpty()){ |
|
|
|
for (int i = 0; i < vinLists.size(); i++) { |
|
|
|
VinListsVo vinListsVo = vinLists.get(i); |
|
|
|
BigDecimal initBigDecimalTwo = BigDecimal.ZERO; |
|
|
|
//根据sid去查询销售政策的sid,根据销售政策查询销售政策的金额
|
|
|
|
ResultBean<List<String>> listResultBean = baseDiscountpackageFeign.getMoney(vinListsVo.getVinSid(), busSalesOrder.getUseOrgSid()); |
|
|
|
if (listResultBean.getSuccess() && !listResultBean.getData().isEmpty()) { |
|
|
|
List<String> stringList = listResultBean.getData(); |
|
|
|
initBigDecimalTwo = initBigDecimalTwo.add(stringList.stream().map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add)); |
|
|
|
} |
|
|
|
if(initBigDecimalTwo.compareTo(BigDecimal.ZERO) != 0){ |
|
|
|
vinList.set(i,vinList.get(i)+",促销("+initBigDecimalTwo.toString()+"元)"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
modelInfo.setVinList(vinList); |
|
|
|
modelInfo.setOrderVinList(orderVinList); |
|
|
|
} else { |
|
|
|