Commit 81691b1b by huluobin

update

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