Commit 79677493 by huluobin

update

parent 32cfb030
......@@ -272,12 +272,13 @@ public class MarketServiceImpl implements MarketService {
//2.闲时折扣结算
orderManage.getListOrderServer().forEach(orderServeDTO -> {
orderServeDTO.setDiscountPrice(orderServeDTO.getLeisureDiscountPrice());
orderServeDTO.setPayPrice(orderServeDTO.getPayPrice().subtract(orderServeDTO.getLeisureDiscountPrice()));
orderManage.setTotalPaymentAmount(orderManage.getTotalPaymentAmount().subtract(orderServeDTO.getLeisureDiscountPrice()));
orderManage.setDiscountPrice(orderManage.getDiscountPrice().add(orderServeDTO.getLeisureDiscountPrice()));
orderManage.getListOrderServer().forEach(orderServe -> {
orderServe.setDiscountPrice(orderServe.getLeisureDiscountPrice());
orderServe.setPayPrice(orderServe.getPayPrice().subtract(orderServe.getLeisureDiscountPrice()));
//总支付金额
orderManage.setTotalPaymentAmount(orderManage.getTotalPaymentAmount().subtract(orderServe.getLeisureDiscountPrice()));
//总折扣金额 + = 闲时折扣金额
orderManage.setDiscountPrice(orderManage.getDiscountPrice().add(orderServe.getLeisureDiscountPrice()));
});
......@@ -286,7 +287,6 @@ public class MarketServiceImpl implements MarketService {
timesCardUsedRecordList.forEach(timesCardUsedRecord -> timesCardUsedRecord.setStatus(TimesCardUsedRecord.STATUS_CHOSE));
timesCardUsedRecordList.stream()
.sorted(Comparator.comparing(TimesCardUsedRecord::getDiscountAmount))
.forEach(timesCardUsedRecord -> {
......@@ -469,9 +469,6 @@ public class MarketServiceImpl implements MarketService {
discountCalc = discountCalc.add(discountAmount);
payCalc = payCalc.add(payAmount);
}
// //更新卡券使用情况 已使用
// couponCustomerRelevance.setState(CouponCustomerRelevance.STATE_USED);
// couponCustomerRelevanceService.updateById(couponCustomerRelevance);
}
//内部券抵扣不了
else {
......
......@@ -20,6 +20,11 @@ import java.util.Map;
public interface OrderManageService extends IService<OrderManage> {
/**
* @param customerId
* @param departmentId
* @return
*/
BigDecimal countSumPay(@Param("customerId") Integer customerId, @Param("departmentId") Integer departmentId);
/**
......@@ -122,6 +127,7 @@ public interface OrderManageService extends IService<OrderManage> {
/**
* 朋友代付
*
* @param orderId
* @param phone
*/
......
......@@ -131,12 +131,16 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
//更新订单服务、新增订单服务
param.getListOrderServer().forEach(orderServeParam -> {
BaseServe baseServe = baseServeMapper.selectById(orderServeParam.getServeId());
BaseType baseType = baseTypeMapper.selectById(baseServe.getTypeId());
if (StringUtils.isEmpty(orderServeParam.getTechnicianId())) {
throw new RRException("请选择美甲师");
}
//1.新增订单服务
if (orderServeParam.getId() == null) {
OrderServe.OrderServeBuilder builder = OrderServe.builder()
//创建时间
.createTime(new Date())
......@@ -145,8 +149,6 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
//订单服务改价
.serveChangePrice(BigDecimal.ZERO);
BaseServe baseServe = baseServeMapper.selectById(orderServeParam.getServeId());
BaseType baseType = baseTypeMapper.selectById(baseServe.getTypeId());
//服务信息
builder.serveChangePrice(BigDecimal.ZERO)
......@@ -174,7 +176,8 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
//有款式就设置价格为款式价格
.price(baseProduce.getCurrentPrice())
.payPrice(baseProduce.getCurrentPrice())
.achievement(baseProduce.getCurrentPrice());
.achievement(baseProduce.getCurrentPrice())
.serveDuration(baseProduce.getServiceDuration());
}
//
else {
......@@ -182,7 +185,8 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
.produceBargainPrice(null)
.produceCurrentPrice(null)
.produceId(null)
.produceName(null);
.produceName(null)
.serveDuration(baseServe.getServiceDuration());
}
//价格
......@@ -197,80 +201,93 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
.commentStatus(1)
.remark(orderServeParam.getRemark());
//时间
builder.startTime(orderServeParam.getStartTime())
.endTime(orderServeParam.getEndTime())
//新增服务开始时间当前时间
builder.startTime(new Date())
//新增服务开始时间结束时间
.endTime(new Date())
.scheduledTime(scheduleManage.getScheduledTime());
if (orderServeParam.getServeChangePrice() != null) {
builder.serveChangePrice(orderServeParam.getServeChangePrice());
}
OrderServe orderServe = builder.build();
orderServe.setPayPrice(orderServe.getPrice().add(orderServe.getServeChangePrice().subtract(orderServe.getDiscountPrice())));
orderServeMapper.insert(orderServe);
}
//2.更新订单服务
else {
OrderServe orderServe = orderServeMapper.selectById(orderServeParam.getId());
BaseServe baseServe = baseServeMapper.selectById(orderServeParam.getServeId());
BaseType baseType = baseTypeMapper.selectById(baseServe.getTypeId());
//服务改价
orderServe.setServeChangePrice(orderServeParam.getServeChangePrice());
//服务id
orderServe.setServeId(orderServeParam.getServeId());
//服务名称
orderServe.setServeName(baseServe.getName());
//服务数量
orderServe.setServeNumber(1);
//服务图片路径
orderServe.setServePicturePath(baseServe.getPicturePath());
//服务价格
orderServe.setServePrice(baseServe.getPrice());
//服务类型
orderServe.setServeType(baseType.getName());
//服务类型id
orderServe.setServeTypeId(baseType.getId());
//服务价格
orderServe.setPrice(baseServe.getPrice());
//服务业绩
orderServe.setAchievement(baseServe.getPrice());
orderServe.setDiscountPrice(BigDecimal.ZERO);
if (orderServeParam.getProduceId() != null) {
BaseProduce baseProduce = baseProduceMapper.selectById(orderServeParam.getProduceId());
//款式原价
orderServe.setProduceBargainPrice(baseProduce.getBargainPrice());
//款式现价
orderServe.setProduceCurrentPrice(baseProduce.getCurrentPrice());
//款式Id
orderServe.setProduceId(baseProduce.getId());
//款式名称
orderServe.setProduceName(baseProduce.getName());
//款式图片
orderServe.setProducePicturePath(baseProduce.getPicturePath());
//价格
orderServe.setPrice(baseProduce.getCurrentPrice());
//实际支付金额
orderServe.setPayPrice(baseProduce.getCurrentPrice());
//业绩
orderServe.setAchievement(baseProduce.getCurrentPrice());
//服务时长=款式时长
orderServe.setServeDuration(baseProduce.getServiceDuration());
}
//
else {
orderServe.setProducePicturePath(null);
orderServe.setProduceBargainPrice(null);
orderServe.setProduceCurrentPrice(null);
orderServe.setProduceId(null);
orderServe.setProduceName(null);
//服务时长=服务时长
orderServe.setServeDuration(baseServe.getServiceDuration());
}
orderServe.setDiscountPrice(BigDecimal.ZERO);
if (orderServeParam.getServeChangePrice() != null) {
//订单服务改价
orderServe.setServeChangePrice(orderServeParam.getServeChangePrice());
}
List<StoreTechnician> storeTechnicianList = storeTechnicianMapper.selectList(
new LambdaQueryWrapper<StoreTechnician>().in(StoreTechnician::getId, Lists.newArrayList(orderServeParam.getTechnicianId().split(",")))
);
//美甲师id
orderServe.setTechnicianId(orderServeParam.getTechnicianId());
//美甲师姓名
orderServe.setTechnicianName(storeTechnicianList.stream().map(StoreTechnician::getName).collect(Collectors.joining()));
//订单服务评论状态
orderServe.setCommentStatus(orderServeParam.getCommentStatus());
//订单服务备注
orderServe.setRemark(orderServeParam.getRemark());
//时间
orderServe.setStartTime(orderServeParam.getStartTime());
orderServe.setEndTime(orderServeParam.getEndTime());
//订单服务支付金额
orderServe.setPayPrice(orderServe.getPrice().add(orderServe.getServeChangePrice().subtract(orderServe.getDiscountPrice())));
orderServeMapper.updateById(orderServe);
}
......@@ -288,9 +305,15 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
orderServeMapper.deleteBatchIds(deleteOrderServeIdList);
}
orderManage.setChangePrice(orderServeList.stream().map(OrderServe::getServeChangePrice).reduce(BigDecimal.ZERO, BigDecimal::add));
List<OrderServe> updatedOrderServeList = orderServeMapper.selectList(new LambdaQueryWrapper<OrderServe>().eq(OrderServe::getOrderId, orderManage.getId()));
orderManage.setTotalPrice(updatedOrderServeList.stream().map(OrderServe::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add));
orderManage.setChangePrice(updatedOrderServeList.stream().map(OrderServe::getServeChangePrice).reduce(BigDecimal.ZERO, BigDecimal::add));
orderManage.setTotalPaymentAmount(orderManage.getTotalPrice().subtract(orderManage.getChangePrice()));
orderManageMapper.updateById(orderManage);
//订单结算
marketService.setterOrder(orderManage.getId());
}
......@@ -952,8 +975,11 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
});
orderManage.getListOrderServer().forEach(orderServe -> {
if (orderServe.getEndTime() != null && orderServe.getStartTime() != null) {
orderServe.setActualServeDuration((int) (orderServe.getEndTime().getTime() -
orderServe.getStartTime().getTime()) / 1000 / 60);
}
});
return orderManage;
}
......
......@@ -36,7 +36,11 @@ public class CouponCustomerRelevance implements Serializable {
private Integer customerId;
@ApiModelProperty("卡券id")
private Integer couponId;
@ApiModelProperty("该优惠券使用状态1.正常,2.已使用,3.已过期")
private Integer state;
@ApiModelProperty("领奖码")
private String code;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
......
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