Commit 1b49aabc authored by shiyu's avatar shiyu

查询商品服务费和佣金接口2

parent 9212f263
......@@ -2,8 +2,10 @@ package com.wwdz.ch.wx.impl.distribution;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.core.util.PriceUtil;
import com.wwdz.ch.db.dao.CollectorWhiteListDao;
import com.wwdz.ch.db.dao.FollowFansRecordDao;
import com.wwdz.ch.db.dao.distribution.DistributorProfitDao;
import com.wwdz.ch.db.domain.CollectorWhiteList;
import com.wwdz.ch.db.domain.FollowFansRecord;
import com.wwdz.ch.db.dto.request.FollowFansRecordRequestDto;
import com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto;
......@@ -30,6 +32,9 @@ public class DistributorProfitServiceImpl implements DistributorProfitService {
@Autowired
FollowFansRecordDao followFansRecordDao;
@Autowired
CollectorWhiteListDao collectorWhiteListDao;
@Override
public Double getIntroduceRebate(FollowFansRecordRequestDto dto) {
double rebate = 0.3;
......@@ -69,11 +74,20 @@ public class DistributorProfitServiceImpl implements DistributorProfitService {
@Override
public Result getExpectAmount(SupplierItemRequestDto supplierItemRequestDto) {
try {
Map<String, String> map = new HashMap<>();
map.put("introduceRebate", "3%");
double channelServiceRebate = 0.15;
CollectorWhiteList collectorWhiteList = collectorWhiteListDao.findById(supplierItemRequestDto.getUserId());
if (collectorWhiteList != null) {
channelServiceRebate = PriceUtil.convertToDivide(collectorWhiteList.getChannelCostRebate()).doubleValue();
map.put("channelServiceRebate", collectorWhiteList.getChannelCostRebate().intValue() + "%");
} else {
map.put("channelServiceRebate", "15%");
}
Long itemPrice = PriceUtil.convertPriceFromStr(supplierItemRequestDto.getDistributionPrice());
long channelServiceCost = PriceUtil.convertPriceFromStr(PriceUtil.convertDoubleToString(itemPrice.doubleValue() * 0.05));
long channelServiceCost = PriceUtil.convertPriceFromStr(PriceUtil.convertDoubleToString(itemPrice.doubleValue() * channelServiceRebate));
long introduceCost = PriceUtil.convertPriceFromStr(PriceUtil.convertDoubleToString(itemPrice.doubleValue() * 0.03));
long profit = itemPrice - channelServiceCost - introduceCost;
Map<String, String> map = new HashMap<>();
map.put("channelServiceCost", PriceUtil.convertPriceFenToYuan(channelServiceCost));
map.put("introduceCost", PriceUtil.convertPriceFenToYuan(introduceCost));
map.put("profit", PriceUtil.convertPriceFenToYuan(profit));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment