Commit 4ca22c53 by huluobin

订单 预约版本号

parent b0cca8c5
...@@ -395,7 +395,15 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order ...@@ -395,7 +395,15 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
orderManage.setChangePrice(updatedOrderServeList.stream().map(OrderServe::getServeChangePrice).reduce(BigDecimal.ZERO, BigDecimal::add)); orderManage.setChangePrice(updatedOrderServeList.stream().map(OrderServe::getServeChangePrice).reduce(BigDecimal.ZERO, BigDecimal::add));
orderManage.setTotalPaymentAmount(orderManage.getTotalPrice().subtract(orderManage.getChangePrice())); orderManage.setTotalPaymentAmount(orderManage.getTotalPrice().subtract(orderManage.getChangePrice()));
orderManageMapper.updateById(orderManage);
orderManage.setVersion(param.getVersion());
//更次预约
int update = orderManageMapper.updateById(orderManage);
if (update == 0) {
throw new RRException("订单已被别人修改,请刷新后重新填写提交")
}
//订单结算 //订单结算
marketService.calcOrderAmount(orderManage.getId()); marketService.calcOrderAmount(orderManage.getId());
...@@ -963,7 +971,7 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order ...@@ -963,7 +971,7 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
// BigDecimal balanceAmount = new BigDecimal(customerBalance.getBalance()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP); // BigDecimal balanceAmount = new BigDecimal(customerBalance.getBalance()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP);
BigDecimal wxAmount = new BigDecimal(result.getCashFee()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP); BigDecimal wxAmount = new BigDecimal(result.getCashFee()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP);
BigDecimal balanceAmount =orderManage.getTotalPaymentAmount().subtract(wxAmount); BigDecimal balanceAmount = orderManage.getTotalPaymentAmount().subtract(wxAmount);
MultiPaymentType wxMultiPaymentType = MultiPaymentType.builder() MultiPaymentType wxMultiPaymentType = MultiPaymentType.builder()
.price(wxAmount) .price(wxAmount)
.type(1).build(); .type(1).build();
......
...@@ -689,8 +689,13 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper, ...@@ -689,8 +689,13 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
this.validSubmit(scheduleManage); this.validSubmit(scheduleManage);
} }
scheduleManage.setLastUpdateTime(new Date()); scheduleManage.setLastUpdateTime(new Date());
scheduleManage.setVersion(cmd.getVersion());
//更次预约 //更次预约
scheduleManageMapper.updateById(scheduleManage); int update = scheduleManageMapper.updateById(scheduleManage);
if (update == 0) {
throw new RRException("预约已被别人修改,请刷新后重新填写提交")
}
List<Integer> oldScheduleServeIds = scheduleServeMapper.selectList(new LambdaQueryWrapper<ScheduleServe>().eq(ScheduleServe::getSchId, scheduleManage.getId())).stream().map(ScheduleServe::getId).collect(Collectors.toList()); List<Integer> oldScheduleServeIds = scheduleServeMapper.selectList(new LambdaQueryWrapper<ScheduleServe>().eq(ScheduleServe::getSchId, scheduleManage.getId())).stream().map(ScheduleServe::getId).collect(Collectors.toList());
List<ScheduleServe> scheduleServeList = scheduleManage.getScheduleServeList(); List<ScheduleServe> scheduleServeList = scheduleManage.getScheduleServeList();
......
...@@ -266,6 +266,9 @@ public class OrderManage implements Serializable { ...@@ -266,6 +266,9 @@ public class OrderManage implements Serializable {
@ApiModelProperty("是否朋友代付 1-是 2-否") @ApiModelProperty("是否朋友代付 1-是 2-否")
private Integer isFriendPay; private Integer isFriendPay;
@Version
private Integer version;
public void addDiscountPrice(BigDecimal discountPrice) { public void addDiscountPrice(BigDecimal discountPrice) {
this.discountPrice = this.discountPrice.add(discountPrice); this.discountPrice = this.discountPrice.add(discountPrice);
this.totalPaymentAmount = this.totalPaymentAmount.subtract(discountPrice); this.totalPaymentAmount = this.totalPaymentAmount.subtract(discountPrice);
......
package com.gogirl.domain.order.serve; package com.gogirl.domain.order.serve;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.gogirl.domain.user.customer.Customer; import com.gogirl.domain.user.customer.Customer;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
...@@ -175,6 +172,9 @@ public class ScheduleManage implements Serializable { ...@@ -175,6 +172,9 @@ public class ScheduleManage implements Serializable {
@ApiModelProperty("预约用户信息") @ApiModelProperty("预约用户信息")
private Customer customer; private Customer customer;
@Version
private Integer version;
public void addScheduleServeList(Collection<ScheduleServe> scheduleServes) { public void addScheduleServeList(Collection<ScheduleServe> scheduleServes) {
listScheduleServer.addAll(scheduleServes); listScheduleServer.addAll(scheduleServes);
} }
......
package com.gogirl.infrastructure.common.config.config; package com.gogirl.infrastructure.common.config.config;
import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -29,4 +30,10 @@ public class MybatisPlusConfig { ...@@ -29,4 +30,10 @@ public class MybatisPlusConfig {
// 开启 count 的 join 优化,只针对部分 left join // 开启 count 的 join 优化,只针对部分 left join
return paginationInterceptor; return paginationInterceptor;
} }
@Bean
public OptimisticLockerInterceptor optimisticLockerInterceptor() {
return new OptimisticLockerInterceptor();
}
} }
package com.gogirl.shared.order; package com.gogirl.shared.order;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.Version;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.gogirl.domain.user.customer.Customer; import com.gogirl.domain.user.customer.Customer;
import com.gogirl.shared.market.CouponCustomerRelevanceDTO; import com.gogirl.shared.market.CouponCustomerRelevanceDTO;
...@@ -148,6 +149,9 @@ public class OrderManageDTO implements Serializable { ...@@ -148,6 +149,9 @@ public class OrderManageDTO implements Serializable {
@ApiModelProperty("环境评分") @ApiModelProperty("环境评分")
private Integer environmentStar; private Integer environmentStar;
@Version
private Integer version;
public void setImages() { public void setImages() {
images = orderServeDTOList images = orderServeDTOList
.stream() .stream()
......
package com.gogirl.shared.order; package com.gogirl.shared.order;
import com.baomidou.mybatisplus.annotation.Version;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
...@@ -105,6 +106,9 @@ public class ScheduleManageDTO implements Serializable { ...@@ -105,6 +106,9 @@ public class ScheduleManageDTO implements Serializable {
private Integer orderId; private Integer orderId;
@Version
private Integer version;
private Set<ScheduleServeDTO> scheduleServeDTOList = new TreeSet<>(Comparator.comparing(o -> o.getServeId() + ";" + o.getSchId())); private Set<ScheduleServeDTO> scheduleServeDTOList = new TreeSet<>(Comparator.comparing(o -> o.getServeId() + ";" + o.getSchId()));
} }
......
...@@ -16,9 +16,11 @@ public class SubmitScheduleCommand implements Serializable { ...@@ -16,9 +16,11 @@ public class SubmitScheduleCommand implements Serializable {
//美甲师方案参数 //美甲师方案参数
private final List<TreeProgram> defaultNodeList; private final List<TreeProgram> defaultNodeList;
//leisure - //leisure -
private String source; private String source;
//customer technician //customer technician
private String sourceFrom; private String sourceFrom;
private Integer version;
} }
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