提交代码

dev-discount
胡锐 2 years ago
parent a6ed9cff81
commit aeba88b7b7
  1. 13
      hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java
  2. 6
      hai-service/src/main/java/com/hai/service/HighMerchantAccountMarketingService.java
  3. 6
      hai-service/src/main/java/com/hai/service/impl/HighMerchantAccountMarketingServiceImpl.java
  4. 9
      hai-service/src/main/java/com/hai/service/impl/HighMerchantAccountServiceImpl.java

@ -20,6 +20,7 @@ import com.hai.config.TuanYouConfig;
import com.hai.entity.*;
import com.hai.enum_type.DiscountUseScope;
import com.hai.enum_type.GasClassGroupTaskStatus;
import com.hai.enum_type.MerAccountMarketingType;
import com.hai.enum_type.OrderChildGoodsTypeEnum;
import com.hai.model.GasPayPriceModel;
import com.hai.model.HighMerchantStoreModel;
@ -322,7 +323,7 @@ public class HighOrderController {
}
// 营销减免的金额
BigDecimal marketingPrice = merchantAccountMarketingService.getPrice(store.getMerchantId(), 1, Integer.valueOf(childOrder.getGasOilNo()));
BigDecimal marketingPrice = merchantAccountMarketingService.getPrice(store.getMerchantId(), MerAccountMarketingType.type3.getType(), Integer.valueOf(childOrder.getGasOilNo()));
// 计算价格
GasPayPriceModel priceModel = gasDiscountOilPriceService.oilPriceDiscountCompute(childOrder.getGoodsPrice(), childOrder.getGoodsId(), childOrder.getGasOilNo(), highOrder.getIsTyAgent());
@ -366,11 +367,17 @@ public class HighOrderController {
childOrder.setGoodsImg(store.getStoreLogo());
}
childOrder.setGasPriceCost(priceModel.getPriceGun().subtract(marketingPrice));
childOrder.setGasPriceCostTotal(childOrder.getGasPriceCost().multiply(childOrder.getGasOilLiters()).setScale(2, BigDecimal.ROUND_HALF_DOWN));
childOrder.setGoodsName(store.getStoreName());
childOrder.setGoodsSpecName("默认");
childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString())));
// 成本价 油站价 减 营销策略价
childOrder.setGasPriceCost(priceModel.getPriceGun().subtract(marketingPrice));
if (marketingPrice.compareTo(new BigDecimal("0")) <= 0) {
childOrder.setGasPriceCostTotal(childOrder.getTotalPrice());
} else {
childOrder.setGasPriceCostTotal(childOrder.getGasPriceCost().multiply(childOrder.getGasOilLiters()).setScale(2, BigDecimal.ROUND_HALF_DOWN));
}
}
if (childOrder.getGoodsType() == 7) {

@ -15,6 +15,12 @@ public interface HighMerchantAccountMarketingService {
*/
void insert(HighMerchantAccountMarketing merchantAccountMarketing);
/**
* 修改
* @param merchantAccountMarketing
*/
void update(HighMerchantAccountMarketing merchantAccountMarketing);
/**
* 查询详情
* @param merId

@ -28,6 +28,12 @@ public class HighMerchantAccountMarketingServiceImpl implements HighMerchantAcco
marketingMapper.insert(merchantAccountMarketing);
}
@Override
public void update(HighMerchantAccountMarketing merchantAccountMarketing) {
merchantAccountMarketing.setUpdateTime(new Date());
marketingMapper.updateByPrimaryKeySelective(merchantAccountMarketing);
}
@Override
public HighMerchantAccountMarketing getDetailByMerAndType(Long merId, Integer type) {
HighMerchantAccountMarketingExample example = new HighMerchantAccountMarketingExample();

@ -103,13 +103,20 @@ public class HighMerchantAccountServiceImpl implements HighMerchantAccountServic
}
if (MapUtils.getInteger(marketingParam, "marketingType").equals(MerAccountMarketingType.type3.getType())) {
HighMerchantAccountMarketing accountMarketing = new HighMerchantAccountMarketing();
HighMerchantAccountMarketing accountMarketing = marketingService.getDetailByMerAndType(merId, MerAccountMarketingType.type3.getType());
if (accountMarketing == null) {
accountMarketing = new HighMerchantAccountMarketing();
accountMarketing.setType(MerAccountMarketingType.type3.getType());
accountMarketing.setMerId(merId);
accountMarketing.setMerAccountId(account.getId());
JSONArray oilNoData = (JSONArray) marketingParam.get("marketingOilNoData");
accountMarketing.setOilNoReliefPrice(oilNoData.toJSONString());
marketingService.insert(accountMarketing);
} else {
JSONArray oilNoData = (JSONArray) marketingParam.get("marketingOilNoData");
accountMarketing.setOilNoReliefPrice(oilNoData.toJSONString());
marketingService.update(accountMarketing);
}
}
}

Loading…
Cancel
Save