Commit 1d15bc67 authored by shiyu's avatar shiyu

Merge branch 'quanku_v2.7' into quanku_v2.7.1

parents 1b27516a 0f29f66d
......@@ -248,7 +248,7 @@ public class SysIdentifyOrderServiceImpl implements SysIdentifyOrderService {
try {
DeliveryNoticeMsg deliveryNoticeMsg = new DeliveryNoticeMsg();
deliveryNoticeMsg.setDistributionOrderId(distributionOrderId);
deliveryNoticeMsg.setWaybill(dto.getOutLogisticsCode());
deliveryNoticeMsg.setWaybill(dto.getOutWaybill());
deliveryNoticeMsg.setAddress(distributionOrder.getReceiverName() + " " + distributionOrder.getReceiverPhone() + " " + distributionOrder.getReceiverAddress());
SupplierItem supplierItem = supplierItemDao.findById(distributionOrder.getItemId());
deliveryNoticeMsg.setItemName(supplierItem.getName());
......
......@@ -515,7 +515,7 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
auctionConfig.setState(AuctionEnum.StateEnum.WAIT_ON_SALE.getCode());
auctionConfig.setItemId(newItemId);
auctionConfig.setCreatorId(oldItem.getCreatorId());
auctionConfig.setIsValid(false);
auctionConfig.setIsValid(true);
auctionConfig.setIsDeal(false);
Instant startInstant = now.toInstant().plus(Duration.ofHours(2));
Date startTime = Date.from(startInstant);
......
......@@ -138,6 +138,11 @@ public class SupplierItemRequestDto extends BaseRequestDto implements Entity {
*/
private Integer type;
/**
* 排除的商品类型
*/
private List<Integer> filterType;
/**
* 商品类型1一口价2竞拍3用户上传
*/
......
......@@ -106,7 +106,7 @@ public class AuctionConfigDaoImpl implements AuctionConfigDao {
AuctionConfigExample example = new AuctionConfigExample();
AuctionConfigExample.Criteria criteria = example.createCriteria();
Date now = new Date();
//查询截时间一小时内的拍卖
//查询截时间一小时内的拍卖
Instant instant = now.toInstant().minus(Duration.ofHours(1));
Date time = Date.from(instant);
criteria.andRealEndTimeGreaterThanOrEqualTo(time);
......
......@@ -38,6 +38,7 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
}
JdbcHelper.ifPresent(dto.getTypeList(), criteria::andTypeIn);
JdbcHelper.ifPresent(dto.getType(), criteria::andTypeEqualTo);
JdbcHelper.ifPresent(dto.getFilterType(), criteria::andTypeNotIn);
JdbcHelper.ifPresent(dto.getStatus(), criteria::andStatusEqualTo);
JdbcHelper.ifPresent(dto.getStock(), criteria::andStockGreaterThan);
JdbcHelper.ifPresent(dto.getIsOnSale(), criteria::andIsOnSaleEqualTo);
......@@ -74,6 +75,9 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
SupplierItemExample supplierItemExample = new SupplierItemExample();
SupplierItemExample.Criteria criteria = supplierItemExample.createCriteria();
criteria.andCreatorIdEqualTo(dto.getCreatorId());
JdbcHelper.ifPresent(dto.getTypeList(), criteria::andTypeIn);
JdbcHelper.ifPresent(dto.getType(), criteria::andTypeEqualTo);
JdbcHelper.ifPresent(dto.getFilterType(), criteria::andTypeNotIn);
criteria.andStockEqualTo(0);
supplierItemExample.setOrderByClause(" create_time desc");
PageHelper.startPage(dto.getPage(), dto.getLimit());
......
......@@ -194,12 +194,14 @@ public class CollectionItemsRelationServiceImpl implements CollectionItemsRelati
} else if (dto.getCollectionBookId().longValue() == CollectionBookConstants.DefaultBookEnum.SALEING.getId()) {
//换藏中, 表示上架售卖中
supplierItemRequestDto.setCreatorId(targetUserId);
supplierItemRequestDto.setType(DistributionEnum.DistributionTypeEnum.COLLECT.getCode());
supplierItemRequestDto.setIsOnSale(true);
supplierItemRequestDto.setIsDeleted(false);
supplierItemList = supplierItemDao.findList(supplierItemRequestDto);
pageInfo = new PageInfo<>(supplierItemList);
} else if (dto.getCollectionBookId().longValue() == CollectionBookConstants.DefaultBookEnum.FINISHED.getId()) {
//已结缘, 表示卖完了
supplierItemRequestDto.setType(DistributionEnum.DistributionTypeEnum.COLLECT.getCode());
supplierItemRequestDto.setCreatorId(targetUserId);
supplierItemRequestDto.setStock(0);
supplierItemList = supplierItemDao.findSellOutList(supplierItemRequestDto);
......
......@@ -267,22 +267,46 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
map.put("prepayId", null);
//计算分销商的利润
DistributorProfit distributorProfit = new DistributorProfit();
//利润,该记录在用户未付款时未无效,仅用于在分销商查看订单详情时,计算预计利润
Double profit = distributionOrder.getAmount().doubleValue() * 0.03;
//平台服务费,默认15%
CollectorWhiteList collectorWhiteList = collectorWhiteListDao.findById(auctionConfig.getCreatorId());
double channelCostRebate = 0.15;
if (collectorWhiteList != null) {
BigDecimal channelCost = collectorWhiteList.getChannelCostRebate();
channelCost = PriceUtil.convertToDivide(channelCost);
channelCostRebate = channelCost.doubleValue();
}
logger.info("藏家id:{} 生成新拍卖订单,平台服务费比例:{}", auctionConfig.getCreatorId(), channelCostRebate);
double channelServiceCost = distributionOrder.getAmount().doubleValue() * channelCostRebate;
distributorProfit.setChannelCost(PriceUtil.convertPriceFromStr(PriceUtil.convertDoubleToString(channelServiceCost)));
//查询该用户和藏家的介绍人
FollowFansRecordRequestDto followFansRecordRequestDto = new FollowFansRecordRequestDto();
followFansRecordRequestDto.setFollowerId(auctionConfig.getCreatorId());
followFansRecordRequestDto.setFansId(auctionRecord.getUserId());
double rebate = distributorProfitService.getIntroduceRebate(followFansRecordRequestDto);
double introduceCost = distributionOrder.getAmount().doubleValue() * rebate;
distributorProfit.setIntroduceCost(PriceUtil.convertPriceFromStr(PriceUtil.convertDoubleToString(introduceCost)));
distributorProfit.setDistributionOrderId(distributionOrderId);
distributorProfit.setDistributorId(distributionOrder.getSellerId());
distributorProfit.setItemId(distributionOrder.getItemId());
distributorProfit.setItemNum(distributionOrder.getItemNum());
distributorProfit.setAmount(distributionOrder.getAmount());
distributorProfit.setItemCost(auctionConfig.getStartPrice());
distributorProfit.setProfit((long) Math.floor(profit));
distributorProfit.setChannelCost(PriceUtil.convertPriceFromStr(PriceUtil.convertDoubleToString(channelServiceCost)));
distributorProfit.setIntroduceCost(PriceUtil.convertPriceFromStr(PriceUtil.convertDoubleToString(introduceCost)));
long profit = distributionOrder.getAmount() - distributorProfit.getChannelCost() - distributorProfit.getIntroduceCost();
distributorProfit.setProfit(profit);
distributorProfit.setCreateTime(new Date());
distributorProfit.setType(DistributionEnum.DistributionTypeEnum.AUCTION.getCode());
distributorProfit.setIsValid(false);
distributorProfitDao.insert(distributorProfit);
SupplierItem supplierItem = supplierItemDao.findById(dto.getItemId());
//查询参与出价的所有用户所对应的分销商,可以分成交额的3%的利润
//查询参与出价的所有用户所对应的分销商,可以分成交额的3%的利润
List<AuctionRecord> auctionRecordList = auctionRecordDao.findByItemId(dto.getItemId());
List<AuctionRecord> filterRecordList = auctionRecordList.stream()
.filter(StringUtil.distinctByKey(AuctionRecord::getDistributorId))
......@@ -317,13 +341,13 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
Result result = sendMsgService.auctionSuccessForDistributorsMsg(auctionOfferNoticeMsg);
if (!result.getSuccess()) {
String url = wxAppletApi.getUrlLink(AUCTION_MSG_URL, "itemId=" + supplierItem.getId() + "&shareRecordId=");
String msg = "您分的拍品" + supplierItem.getName() + "已成拍,成交价是" + PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()) +
String msg = "您分的拍品" + supplierItem.getName() + "已成拍,成交价是" + PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()) +
"元,您预计获得利润" + PriceUtil.convertDoubleToString(Math.floor(averageProfit)) + "元。请前往"+ url + "查看";
aliSmsSender.sendSms(record.getDistributorId(), msg);
}
} else {
String url = wxAppletApi.getUrlLink(AUCTION_MSG_URL,"itemId=" + supplierItem.getId() + "&shareRecordId=");
String msg = "您分的拍品" + supplierItem.getName() + "已成拍,成交价是" + PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()) +
String msg = "您分的拍品" + supplierItem.getName() + "已成拍,成交价是" + PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()) +
"元,您预计获得利润" + PriceUtil.convertDoubleToString(Math.floor(averageProfit)) + "元。请前往"+ url + "查看";
aliSmsSender.sendSms(record.getDistributorId(), msg);
}
......
......@@ -73,7 +73,7 @@ public class DistributorShareRecordServiceImpl implements DistributorShareRecord
distributorShareRecord.setItemId(dto.getItemId());
distributorShareRecord.setPrice(PriceUtil.convertPriceFromStr(dto.getPrice()));
distributorShareRecord.setDistributorId(dto.getDistributorId());
distributorShareRecord.setShopId(dto.getShopId());
distributorShareRecord.setShopId(dto.getDistributorId());
distributorShareRecord.setCreateTime(new Date());
distributorShareRecord.setEnabled(true);
distributorShareRecord.setType(DistributionEnum.DistributionTypeEnum.FIXED_PRICE.getCode());
......@@ -107,7 +107,7 @@ public class DistributorShareRecordServiceImpl implements DistributorShareRecord
//商品的起拍价
distributorShareRecord.setPrice(auctionConfig.getStartPrice());
distributorShareRecord.setDistributorId(dto.getDistributorId());
distributorShareRecord.setShopId(dto.getShopId());
distributorShareRecord.setShopId(dto.getDistributorId());
distributorShareRecord.setCreateTime(new Date());
distributorShareRecord.setEnabled(true);
distributorShareRecord.setType(DistributionEnum.DistributionTypeEnum.AUCTION.getCode());
......
......@@ -252,6 +252,7 @@ public class SpecialPerformanceServiceImpl implements SpecialPerformanceService
supplierItemVos.add(supplierItemVo);
});
resultMap.put("dataList", PageSearchResult.of(pageInfo, supplierItemVos));
resultMap.put("startTime", specialPerformance.getStartTime());
resultMap.put("endTime", specialPerformance.getEndTime());
resultMap.put("title", specialPerformance.getTitle());
//当前时间大于专场结束时间则修改专场的状态
......
......@@ -102,6 +102,7 @@ public class AutoCreateAuctionOrderJob {
}
} else {
//没有出价记录,流拍的商品也要更新拍卖配置信息为已处理, 拍品状态更新为"无出价流拍"
logger.info("商品id:{}, 没有出价记录,状态更新为'无出价流拍'");
auctionConfigDao.setDeal(itemId, AuctionEnum.StateEnum.NO_OFFER_TO_PASS.getCode());
}
});
......
......@@ -117,6 +117,12 @@ public class SpecialPerformanceNoticeJob {
logger.info(">>>>>>>>>>>>>>>>>>>>>>> dev环境, 不执行专场即将开始通知任务<<<<<<<<<<<<<<<<<<<<<");
return;
}
//正式环境测试, 不发送消息
/* if (true) {
logger.info(">>>>>>>>>>>>>>>>>>>>>>> 正式环境测试, 不执行专场即将开始通知任务<<<<<<<<<<<<<<<<<<<<<");
return;
}*/
logger.info("当前即将开始的专场id:{}, 名称为 {} ", specialPerformance.getId(), specialPerformance.getTitle());
//发送短信通知
String url = wxAppletApi.getUrlLink(SPECIAL_PERFORMANCE_URL,"specialId=" + specialPerformance.getId());
......
......@@ -37,7 +37,6 @@ public class DistributorShareRecordController {
validator.set("itemId", "商品id").must().number()
.set("price", "商品销售价").must().string()
.set("distributorId", "分销商id").must().number()
.set("shopId", "分销商店铺id").must().number()
.end();
if (!validator.isValid()) {
return Result.failed(validator.getErrorInfo());
......@@ -53,7 +52,6 @@ public class DistributorShareRecordController {
Validator validator = new Validator(FormHandler.ofEntity(dto));
validator.set("itemId", "商品id").must().number()
.set("distributorId", "分销商id").must().number()
.set("shopId", "分销商店铺id").must().number()
.end();
if (!validator.isValid()) {
return Result.failed(validator.getErrorInfo());
......
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