Commit 4ca22c53 by huluobin

订单 预约版本号

parent b0cca8c5
......@@ -395,7 +395,15 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
orderManage.setChangePrice(updatedOrderServeList.stream().map(OrderServe::getServeChangePrice).reduce(BigDecimal.ZERO, BigDecimal::add));
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());
......@@ -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 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()
.price(wxAmount)
.type(1).build();
......
......@@ -689,8 +689,13 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
this.validSubmit(scheduleManage);
}
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<ScheduleServe> scheduleServeList = scheduleManage.getScheduleServeList();
......
......@@ -266,6 +266,9 @@ public class OrderManage implements Serializable {
@ApiModelProperty("是否朋友代付 1-是 2-否")
private Integer isFriendPay;
@Version
private Integer version;
public void addDiscountPrice(BigDecimal discountPrice) {
this.discountPrice = this.discountPrice.add(discountPrice);
this.totalPaymentAmount = this.totalPaymentAmount.subtract(discountPrice);
......
package com.gogirl.domain.order.serve;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gogirl.domain.user.customer.Customer;
import io.swagger.annotations.ApiModel;
......@@ -175,6 +172,9 @@ public class ScheduleManage implements Serializable {
@ApiModelProperty("预约用户信息")
private Customer customer;
@Version
private Integer version;
public void addScheduleServeList(Collection<ScheduleServe> scheduleServes) {
listScheduleServer.addAll(scheduleServes);
}
......
package com.gogirl.infrastructure.common.config.config;
import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......@@ -29,4 +30,10 @@ public class MybatisPlusConfig {
// 开启 count 的 join 优化,只针对部分 left join
return paginationInterceptor;
}
@Bean
public OptimisticLockerInterceptor optimisticLockerInterceptor() {
return new OptimisticLockerInterceptor();
}
}
package com.gogirl.shared.order;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.Version;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gogirl.domain.user.customer.Customer;
import com.gogirl.shared.market.CouponCustomerRelevanceDTO;
......@@ -148,6 +149,9 @@ public class OrderManageDTO implements Serializable {
@ApiModelProperty("环境评分")
private Integer environmentStar;
@Version
private Integer version;
public void setImages() {
images = orderServeDTOList
.stream()
......
package com.gogirl.shared.order;
import com.baomidou.mybatisplus.annotation.Version;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -105,6 +106,9 @@ public class ScheduleManageDTO implements Serializable {
private Integer orderId;
@Version
private Integer version;
private Set<ScheduleServeDTO> scheduleServeDTOList = new TreeSet<>(Comparator.comparing(o -> o.getServeId() + ";" + o.getSchId()));
}
......
......@@ -21,4 +21,6 @@ public class SubmitScheduleCommand implements Serializable {
//customer technician
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