Commit 79677493 by huluobin

update

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