Commit 81691b1b by huluobin

update

parent 79677493
...@@ -28,7 +28,7 @@ public interface MarketService { ...@@ -28,7 +28,7 @@ public interface MarketService {
void setTimesCard(SetTimesCardCommand cmd); void setTimesCard(SetTimesCardCommand cmd);
/** /**
* 设置订单卡券状态 * 更新订单卡券状态已使用
* *
* @param orderId * @param orderId
*/ */
......
...@@ -70,7 +70,7 @@ public class MarketServiceImpl implements MarketService { ...@@ -70,7 +70,7 @@ public class MarketServiceImpl implements MarketService {
throw new RRException(); throw new RRException();
} }
//清除之前设置的卡券关联 //将订单之前绑定的内部券设置为未使用
List<CouponCustomerRelevance> setterCouponCustomerRelevanceList = couponCustomerRelevanceService List<CouponCustomerRelevance> setterCouponCustomerRelevanceList = couponCustomerRelevanceService
.list(new LambdaQueryWrapper<CouponCustomerRelevance>() .list(new LambdaQueryWrapper<CouponCustomerRelevance>()
.eq(CouponCustomerRelevance::getOrderId, cmd.getOrderId()) .eq(CouponCustomerRelevance::getOrderId, cmd.getOrderId())
...@@ -78,26 +78,29 @@ public class MarketServiceImpl implements MarketService { ...@@ -78,26 +78,29 @@ public class MarketServiceImpl implements MarketService {
setterCouponCustomerRelevanceList.forEach(couponCustomerRelevance -> { setterCouponCustomerRelevanceList.forEach(couponCustomerRelevance -> {
couponCustomerRelevance.setOrderId(null); couponCustomerRelevance.setOrderId(null);
couponCustomerRelevance.setState(null); couponCustomerRelevance.setState(1);
}); });
if (ListUtil.isNotEmpty(setterCouponCustomerRelevanceList)) { if (ListUtil.isNotEmpty(setterCouponCustomerRelevanceList)) {
couponCustomerRelevanceService.saveOrUpdateBatch(setterCouponCustomerRelevanceList); couponCustomerRelevanceService.updateBatchById(setterCouponCustomerRelevanceList);
}
couponOrderRelevanceService.remove(new LambdaQueryWrapper<CouponOrderRelevance>() //删除这些卡券对应的卡券订单折扣详情
.eq(CouponOrderRelevance::getOrderId, cmd.getOrderId()) couponOrderRelevanceService.remove(new LambdaQueryWrapper<CouponOrderRelevance>()
.in(CouponOrderRelevance::getCouponCustomerRelevanceId, setterCouponCustomerRelevanceList.stream().map(CouponCustomerRelevance::getId).collect(Collectors.toList()))); .eq(CouponOrderRelevance::getOrderId, cmd.getOrderId())
.in(CouponOrderRelevance::getCouponCustomerRelevanceId, setterCouponCustomerRelevanceList.stream().map(CouponCustomerRelevance::getId).collect(Collectors.toList())));
//set }
List<CouponCustomerRelevance> couponCustomerRelevanceList = (List<CouponCustomerRelevance>) couponCustomerRelevanceService.listByIds(cmd.getInnerCouponCustomerRelevanceIds());
couponCustomerRelevanceList.forEach(couponCustomerRelevance -> {
couponCustomerRelevance.setOrderId(cmd.getOrderId());
//选择使用
couponCustomerRelevance.setState(CouponCustomerRelevance.STATE_CHOSE);
});
couponCustomerRelevanceService.saveOrUpdateBatch(couponCustomerRelevanceList);
//设置卡券关联
List<CouponCustomerRelevance> couponCustomerRelevanceList = (List<CouponCustomerRelevance>) couponCustomerRelevanceService.listByIds(cmd.getInnerCouponCustomerRelevanceIds());
if (ListUtil.isNotEmpty(couponCustomerRelevanceList)) {
couponCustomerRelevanceList.forEach(couponCustomerRelevance -> {
couponCustomerRelevance.setOrderId(cmd.getOrderId());
//选择使用
couponCustomerRelevance.setState(CouponCustomerRelevance.STATE_CHOSE);
});
couponCustomerRelevanceService.updateBatchById(couponCustomerRelevanceList);
}
} }
@Override @Override
...@@ -106,7 +109,7 @@ public class MarketServiceImpl implements MarketService { ...@@ -106,7 +109,7 @@ public class MarketServiceImpl implements MarketService {
if (cmd.getOrderId() == null) { if (cmd.getOrderId() == null) {
throw new RRException(); throw new RRException();
} }
//删除之前设置的外部券 //删除订单的外部卡券关联
couponCustomerRelevanceService.remove( couponCustomerRelevanceService.remove(
new LambdaQueryWrapper<CouponCustomerRelevance>() new LambdaQueryWrapper<CouponCustomerRelevance>()
.eq(CouponCustomerRelevance::getOrderId, cmd.getOrderId()) .eq(CouponCustomerRelevance::getOrderId, cmd.getOrderId())
...@@ -137,8 +140,7 @@ public class MarketServiceImpl implements MarketService { ...@@ -137,8 +140,7 @@ public class MarketServiceImpl implements MarketService {
if (cmd.getOrderId() == null) { if (cmd.getOrderId() == null) {
throw new RRException(); throw new RRException();
} }
//删除订单已经绑定的次卡
//删除已经绑定的次卡
timesCardUsedRecordService.remove(new LambdaQueryWrapper<TimesCardUsedRecord>() timesCardUsedRecordService.remove(new LambdaQueryWrapper<TimesCardUsedRecord>()
.eq(TimesCardUsedRecord::getOrderId, cmd.getOrderId())); .eq(TimesCardUsedRecord::getOrderId, cmd.getOrderId()));
...@@ -146,8 +148,10 @@ public class MarketServiceImpl implements MarketService { ...@@ -146,8 +148,10 @@ public class MarketServiceImpl implements MarketService {
//用户次卡 //用户次卡
TimesCardCustomerRelevance cardCustomerRelevance = timesCardCustomerRelevanceService.getById(id); TimesCardCustomerRelevance cardCustomerRelevance = timesCardCustomerRelevanceService.getById(id);
//当前次卡所有使用记录 //当前次卡所有使用记录
List<TimesCardUsedRecord> timesCardUsedRecordList = timesCardUsedRecordService.list(new LambdaQueryWrapper<TimesCardUsedRecord>().eq(TimesCardUsedRecord::getCardRelevanceCustomerId, cardCustomerRelevance.getId())); List<TimesCardUsedRecord> timesCardUsedRecordList = timesCardUsedRecordService.list(
new LambdaQueryWrapper<TimesCardUsedRecord>().eq(TimesCardUsedRecord::getCardRelevanceCustomerId, cardCustomerRelevance.getId()));
//如果次卡已使用记录等于次卡总次数
if (timesCardUsedRecordList if (timesCardUsedRecordList
.stream() .stream()
.filter(record -> record.getStatus().equals(TimesCardUsedRecord.STATUS_USED)) .filter(record -> record.getStatus().equals(TimesCardUsedRecord.STATUS_USED))
...@@ -155,31 +159,43 @@ public class MarketServiceImpl implements MarketService { ...@@ -155,31 +159,43 @@ public class MarketServiceImpl implements MarketService {
throw new RRException("次卡已经用完"); throw new RRException("次卡已经用完");
} }
//如果次卡还有次数就新建关联 //如果次卡还有未绑定的次数就新建关联
if (cardCustomerRelevance.getSumTimes() > timesCardUsedRecordList.size()) { if (cardCustomerRelevance.getSumTimes() > timesCardUsedRecordList.size()) {
TimesCardUsedRecord timesCardUsedRecord = TimesCardUsedRecord.builder() TimesCardUsedRecord timesCardUsedRecord = TimesCardUsedRecord.builder()
//订单id
.orderId(cmd.getOrderId()) .orderId(cmd.getOrderId())
//次卡类型id
.cardTypeId(cardCustomerRelevance.getCardTypeId()) .cardTypeId(cardCustomerRelevance.getCardTypeId())
//次卡名称
.name(cardCustomerRelevance.getName()) .name(cardCustomerRelevance.getName())
//次卡id
.cardRelevanceCustomerId(cardCustomerRelevance.getId()) .cardRelevanceCustomerId(cardCustomerRelevance.getId())
//绑定时间
.time(new Date()) .time(new Date())
//选择使用 //选择使用
.status(TimesCardUsedRecord.STATUS_CHOSE) .status(TimesCardUsedRecord.STATUS_CHOSE)
//次卡用户id
.customerId(cardCustomerRelevance.getCustomerId()) .customerId(cardCustomerRelevance.getCustomerId())
//次卡当次能抵扣的金额
.discountAmount(cardCustomerRelevance.getDiscountAmount()) .discountAmount(cardCustomerRelevance.getDiscountAmount())
//次卡当次实际支付金额
.payAmount(cardCustomerRelevance.getPayAmount()) .payAmount(cardCustomerRelevance.getPayAmount())
.type(1) .type(1)
.build(); .build();
timesCardUsedRecordService.saveOrUpdate(timesCardUsedRecord);
//新增一条次卡选择使用记录
timesCardUsedRecordService.save(timesCardUsedRecord);
} }
//替换 //替换
else { else {
//从所有的次卡记录中过滤出一条次卡选择记录
TimesCardUsedRecord timesCardUsedRecord = timesCardUsedRecordList TimesCardUsedRecord timesCardUsedRecord = timesCardUsedRecordList
.stream() .stream()
.filter(record -> record.getStatus().equals(TimesCardUsedRecord.STATUS_CHOSE)) .filter(record -> record.getStatus().equals(TimesCardUsedRecord.STATUS_CHOSE))
.findAny() .findAny()
.orElseThrow(RRException::new); .orElseThrow(RRException::new);
//更新次卡选择记录对应的订单
timesCardUsedRecord.setOrderId(cmd.getOrderId()); timesCardUsedRecord.setOrderId(cmd.getOrderId());
timesCardUsedRecord.setTime(new Date()); timesCardUsedRecord.setTime(new Date());
timesCardUsedRecordService.saveOrUpdate(timesCardUsedRecord); timesCardUsedRecordService.saveOrUpdate(timesCardUsedRecord);
......
...@@ -80,8 +80,10 @@ public class CouponCustomerRelevance implements Serializable { ...@@ -80,8 +80,10 @@ public class CouponCustomerRelevance implements Serializable {
private BigDecimal payAmount; private BigDecimal payAmount;
@ApiModelProperty("卡券来源") @ApiModelProperty("卡券来源")
private String sourceFrom; private String sourceFrom;
@ApiModelProperty("卡券来源id") @ApiModelProperty("卡券来源id")
private String sourceFromId; private String sourceFromId;
private Integer orderId; private Integer orderId;
@ApiModelProperty("1-计算 2-不计算") @ApiModelProperty("1-计算 2-不计算")
......
...@@ -23,27 +23,39 @@ public class TimesCardCustomerRelevance { ...@@ -23,27 +23,39 @@ public class TimesCardCustomerRelevance {
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
private Integer id; private Integer id;
@ApiModelProperty("次卡种类id") @ApiModelProperty("次卡种类id")
private Integer cardTypeId; private Integer cardTypeId;
@ApiModelProperty("次卡名字")
private String name; private String name;
@ApiModelProperty("次卡持有人id") @ApiModelProperty("次卡持有人id")
private Integer customerId; private Integer customerId;
@ApiModelProperty("单次优惠价格") @ApiModelProperty("单次优惠价格")
private BigDecimal discountAmount; private BigDecimal discountAmount;
@ApiModelProperty("单次算业绩价格")
@ApiModelProperty("单次支付价格")
private BigDecimal payAmount; private BigDecimal payAmount;
@ApiModelProperty("购卡时间") @ApiModelProperty("购卡时间")
private Date createTime; private Date createTime;
@ApiModelProperty("已使用次数") @ApiModelProperty("已使用次数")
private Integer usedTimes; private Integer usedTimes;
@ApiModelProperty("总共使用次数") @ApiModelProperty("总共使用次数")
private Integer sumTimes; private Integer sumTimes;
@ApiModelProperty("有效期,开始时间") @ApiModelProperty("有效期,开始时间")
private Date validStartTime; private Date validStartTime;
@ApiModelProperty("有效期,截止时间") @ApiModelProperty("有效期,截止时间")
private Date validEndTime; private Date validEndTime;
@ApiModelProperty("购卡推荐人") @ApiModelProperty("购卡推荐人")
private String refereeId; private String refereeId;
@ApiModelProperty("1正常使用;2.次数用完;3.已过期;") @ApiModelProperty("1正常使用;2.次数用完;3.已过期;")
private Integer status; private Integer status;
...@@ -53,8 +65,13 @@ public class TimesCardCustomerRelevance { ...@@ -53,8 +65,13 @@ public class TimesCardCustomerRelevance {
@TableField(exist = false) @TableField(exist = false)
private List<TimesCardUsedRecord> timesCardUsedRecordList; private List<TimesCardUsedRecord> timesCardUsedRecordList;
//状态-正常
public static Integer STATUS_NORMAL = 1; public static Integer STATUS_NORMAL = 1;
//状态-次数用完
public static Integer STATUS_END = 2; public static Integer STATUS_END = 2;
//状态-已过期
public static Integer STATUS_OVER_TIME = 3; public static Integer STATUS_OVER_TIME = 3;
/** /**
......
package com.gogirl.domain.market.timescard;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import java.math.BigDecimal;
/**
* 次卡次数详情使用情况
*/
@Data
@AllArgsConstructor
@Builder
@TableName("times_card_order_serve_detail")
public class TimesCardOrderServeDetail {
@TableId(type = IdType.AUTO)
private Integer id;
/**
* 该次次卡使用记录在对应服务上折扣的金额
*/
private BigDecimal discountAmount;
/**
* 该次次卡使用记录在对应服务
*/
@ApiModelProperty("订单服务id")
private Integer orderServeId;
/**
* 该次次卡使用记录在对应服务上的实付金额
*/
@ApiModelProperty("支付")
private BigDecimal payForOrderServe;
/**
* 该次次卡使用记录id
*/
private Integer timesCardUserRecordId;
}
...@@ -27,33 +27,62 @@ public class TimesCardUsedRecord { ...@@ -27,33 +27,62 @@ public class TimesCardUsedRecord {
public static Integer STATUS_USED = 2; public static Integer STATUS_USED = 2;
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
private Integer id; private Integer id;
@ApiModelProperty("次卡类型id")
private Integer cardTypeId; private Integer cardTypeId;
@ApiModelProperty("用户id")
private Integer customerId; private Integer customerId;
@ApiModelProperty("次卡id")
private Integer cardRelevanceCustomerId; private Integer cardRelevanceCustomerId;
@ApiModelProperty("生成记录时间") @ApiModelProperty("生成记录时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date time; private Date time;
@ApiModelProperty("1.购卡记录;2;用卡记录") @ApiModelProperty("1.购卡记录;2;用卡记录")
private Integer type; private Integer type;
@ApiModelProperty("订单id") @ApiModelProperty("订单id")
private Integer orderId; private Integer orderId;
@ApiModelProperty("美甲服务id") @ApiModelProperty("美甲服务id")
private Integer serveId; private Integer serveId;
@ApiModelProperty("订单服务的id") @ApiModelProperty("订单服务的id")
private Integer orderServeId; private Integer orderServeId;
@ApiModelProperty("美甲师id,store_technician表id") @ApiModelProperty("美甲师id,store_technician表id")
private Integer technicianId; private Integer technicianId;
@ApiModelProperty("店铺id") @ApiModelProperty("店铺id")
private Integer departmentId; private Integer departmentId;
@ApiModelProperty("服务名称?")
private String serveName; private String serveName;
@ApiModelProperty("美甲师名称?")
private String technicianName; private String technicianName;
@ApiModelProperty("店铺名称?")
private String departmentName; private String departmentName;
@ApiModelProperty("1.已选择次卡,待付款;2.已使用;3.已取消选择") @ApiModelProperty("1.已选择次卡,待付款;2.已使用;3.已取消选择")
private Integer status; private Integer status;
@ApiModelProperty("次卡名称?")
private String name; private String name;
@ApiModelProperty("能抵扣的金额")
private BigDecimal discountAmount; private BigDecimal discountAmount;
@ApiModelProperty("支付金额")
private BigDecimal payAmount; private BigDecimal payAmount;
@ApiModelProperty("实际抵扣的金额")
private BigDecimal actualDiscountAmount;
/** /**
* 非数据库字段 * 非数据库字段
*/ */
......
...@@ -15,10 +15,7 @@ import lombok.NoArgsConstructor; ...@@ -15,10 +15,7 @@ import lombok.NoArgsConstructor;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Comparator; import java.util.*;
import java.util.Date;
import java.util.Set;
import java.util.TreeSet;
/** /**
* Created by yinyong on 2018/9/28. * Created by yinyong on 2018/9/28.
...@@ -137,14 +134,21 @@ public class ScheduleManage implements Serializable { ...@@ -137,14 +134,21 @@ public class ScheduleManage implements Serializable {
private String scheduleDate; private String scheduleDate;
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty("预约下服务列表") @ApiModelProperty("预约下服务列表去重")
private Set<ScheduleServe> listScheduleServer = new TreeSet<>(Comparator.comparing(o -> o.getSchId() + ";" + o.getServeId())); private Set<ScheduleServe> listScheduleServer = new TreeSet<>(Comparator.comparing(o -> o.getSchId() + ";" + o.getServeId()));
@TableField(exist = false) @TableField(exist = false)
private List<ScheduleServe> scheduleServeList;
@TableField(exist = false)
@ApiModelProperty("预约用户信息") @ApiModelProperty("预约用户信息")
private Customer customer; private Customer customer;
// public ScheduleManage() { public void setRemark(String remark) {
// listScheduleServer = new TreeSet<>(Comparator.comparing(o -> o.getSchId() + ";" + o.getServeId())); this.remark = remark + "," + remark;
// } }
public void addScheduleServeList(Collection<ScheduleServe> scheduleServes) {
listScheduleServer.addAll(scheduleServes);
}
} }
...@@ -113,16 +113,16 @@ public class ScheduleServe implements Serializable { ...@@ -113,16 +113,16 @@ public class ScheduleServe implements Serializable {
private String servePicturePath; private String servePicturePath;
@ApiModelProperty("服务价格") @ApiModelProperty("服务价格")
private BigDecimal servePrice; private BigDecimal servePrice = BigDecimal.ZERO;
@ApiModelProperty("服务分类") @ApiModelProperty("服务分类")
private String serveType; private String serveType;
@ApiModelProperty("服务价格") @ApiModelProperty("服务价格")
private BigDecimal price; private BigDecimal price = BigDecimal.ZERO;
@ApiModelProperty("服务状态 1-已预约 2-服务中 3-已完成") @ApiModelProperty("服务状态 1-已预约 2-服务中 3-已完成")
private Integer status; private Integer status = 1;
@TableField(value = "`explain`") @TableField(value = "`explain`")
@ApiModelProperty("售后说明") @ApiModelProperty("售后说明")
...@@ -166,11 +166,6 @@ public class ScheduleServe implements Serializable { ...@@ -166,11 +166,6 @@ public class ScheduleServe implements Serializable {
@ApiModelProperty("") @ApiModelProperty("")
private List<LinkedHashMap> listTechnician; private List<LinkedHashMap> listTechnician;
@TableField(exist = false)
@ApiModelProperty("")
private BigDecimal serveChangePrice;
@ApiModelProperty("实际开始时间") @ApiModelProperty("实际开始时间")
private Date actualStartTime; private Date actualStartTime;
...@@ -180,4 +175,9 @@ public class ScheduleServe implements Serializable { ...@@ -180,4 +175,9 @@ public class ScheduleServe implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private Integer actualServeDuration; private Integer actualServeDuration;
private BigDecimal promotionPrice;
private Integer producePromotionTimeId;
} }
...@@ -20,9 +20,7 @@ public class CloneUtil { ...@@ -20,9 +20,7 @@ public class CloneUtil {
objectInputStream = new ObjectInputStream(byteArrayInputStream); objectInputStream = new ObjectInputStream(byteArrayInputStream);
Object targetOjb = objectInputStream.readObject(); Object targetOjb = objectInputStream.readObject();
return (T) targetOjb; return (T) targetOjb;
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException | IOException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
// 关闭流 // 关闭流
......
...@@ -15,7 +15,5 @@ public class SetTimesCardCommand { ...@@ -15,7 +15,5 @@ public class SetTimesCardCommand {
private Integer orderId; private Integer orderId;
// private OrderManageDTO orderManageDTO;
private List<Integer> timesCardIds; private List<Integer> timesCardIds;
} }
...@@ -47,5 +47,7 @@ public class ScheduleManageCommand implements Serializable { ...@@ -47,5 +47,7 @@ public class ScheduleManageCommand implements Serializable {
@ApiModelProperty("下单店铺名称") @ApiModelProperty("下单店铺名称")
private String departmentName; private String departmentName;
private Integer activityId;
private List<ScheduleServeCommand> scheduleServeDTOList; private List<ScheduleServeCommand> scheduleServeDTOList;
} }
...@@ -89,4 +89,6 @@ public class ScheduleServeCommand implements Serializable { ...@@ -89,4 +89,6 @@ public class ScheduleServeCommand implements Serializable {
private Integer status; private Integer status;
private Boolean isCustomerPick; private Boolean isCustomerPick;
private Integer leisureDiscountConfigId;
} }
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