Commit 87dd255a by huluobin

卡券修改

parent a12da1a4
package com.gogirl.application.market.timescard;
import com.gogirl.domain.market.timescard.TimesCardOrderServeDetail;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author robbendev
* @since 2020-03-15
*/
public interface ITimesCardOrderServeDetailService extends IService<TimesCardOrderServeDetail> {
}
package com.gogirl.application.market.timescard.impl;
import com.gogirl.domain.market.timescard.TimesCardOrderServeDetail;
import com.gogirl.infrastructure.mapper.market.timescard.TimesCardOrderServeDetailMapper;
import com.gogirl.application.market.timescard.ITimesCardOrderServeDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author robbendev
* @since 2020-03-15
*/
@Service
public class TimesCardOrderServeDetailServiceImpl extends ServiceImpl<TimesCardOrderServeDetailMapper, TimesCardOrderServeDetail> implements ITimesCardOrderServeDetailService {
}
......@@ -72,7 +72,7 @@ public interface ScheduleManageService extends IService<ScheduleManage> {
* @param scheduleServeId 预约服务id
* @param status 状态
*/
void updateScheduledServeStatus(Integer scheduleServeId, Integer status);
void updateScheduledServeStatus(Integer scheduleServeId, Integer status,Integer forceLeisureConfig);
/**
......
......@@ -599,7 +599,7 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
}
@Override
public void updateScheduledServeStatus(Integer scheduleServeId, Integer status) {
public void updateScheduledServeStatus(Integer scheduleServeId, Integer status, Integer forceLeisureConfig) {
ScheduleServe scheduleServe = scheduleServeMapper.selectById(scheduleServeId);
//所有需要更新的服务
......@@ -645,7 +645,14 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
updateList.forEach(val -> {
val.setStatus(status);
val.setActualStartTime(new Date());
scheduleServeMapper.updateById(val);
//1-是 2-否
if (forceLeisureConfig != null && forceLeisureConfig != 1) {
Integer result = this.getScheduledServeLeisure(val.getId());
if (result == 2) {
val.setLeisureDiscountConfigId(null);
val.setDiscountRate(BigDecimal.ZERO);
}
}
});
List<ScheduleServe> scheduleServeList = scheduleServeMapper.selectList(new LambdaQueryWrapper<ScheduleServe>().eq(ScheduleServe::getSchId, scheduleServe.getSchId()));
//去重之后的set
......@@ -1380,7 +1387,7 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
int weekday = DateUtils.getWeek(orderServe.getStartTime());
//订单实际对应的折扣
LeisureDiscountConfig leisureDiscountConfig = leisureDiscountConfigMapper.selectLeisureDiscount(orderServe.getServeId(), new SimpleDateFormat("HH:mm").format(orderServe.getStartTime()), weekday);
LeisureDiscountConfig leisureDiscountConfig = leisureDiscountConfigMapper.selectById(scheduleServeVar.getLeisureDiscountConfigId());
if (leisureDiscountConfig != null) {
//折扣金额
......
......@@ -87,7 +87,7 @@ public class CouponCustomerRelevance implements Serializable {
private Integer orderId;
@ApiModelProperty("1-计算 2-不计算")
private Integer isCalcAchievement;
private Integer isCalcAchievement = 1;
/**
* 根据优惠券配置构造一张优惠券
......
......@@ -68,5 +68,7 @@ public class CouponOrderRelevance {
@TableField(exist = false)
private Coupon coupon;
private BigDecimal achievement;
}
package com.gogirl.domain.market.timescard;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020-03-15
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "TimesCardOrderServeDetail对象", description = "")
public class TimesCardOrderServeDetail implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO)
private Integer id;
private Integer orderId;
private BigDecimal discountAmount;
private Integer orderServeId;
private Integer timesCardUserRecordId;
private BigDecimal achievement;
}
......@@ -119,16 +119,16 @@ public class OrderManage implements Serializable {
private Date finishTime;
@ApiModelProperty("总价")
private BigDecimal totalPrice;
private BigDecimal totalPrice = BigDecimal.ZERO;
@ApiModelProperty("总的改价(有正负)")
private BigDecimal changePrice;
private BigDecimal changePrice = BigDecimal.ZERO;
@ApiModelProperty("打折抵扣价格")
private BigDecimal discountPrice;
private BigDecimal discountPrice = BigDecimal.ZERO;
@ApiModelProperty("总支付金额")
private BigDecimal totalPaymentAmount;
private BigDecimal totalPaymentAmount = BigDecimal.ZERO;
@ApiModelProperty("备注")
private String remark;
......@@ -262,4 +262,8 @@ public class OrderManage implements Serializable {
@ApiModelProperty("支付时间")
private Date payTime;
public void addDiscountPrice(BigDecimal discountPrice) {
this.discountPrice = this.discountPrice.add(discountPrice);
this.totalPaymentAmount = this.totalPaymentAmount.subtract(discountPrice);
}
}
......@@ -52,15 +52,15 @@ public class OrderServe implements Serializable {
* 价格信息
*/
@ApiModelProperty("服务改价(有正负)")
private BigDecimal serveChangePrice;
private BigDecimal serveChangePrice = BigDecimal.ZERO;
@ApiModelProperty("价格")
private BigDecimal price;
private BigDecimal price = BigDecimal.ZERO;
@ApiModelProperty("优惠券折扣金额")
private BigDecimal discountPrice;
private BigDecimal discountPrice = BigDecimal.ZERO;
@ApiModelProperty("支付金额")
private BigDecimal payPrice;
private BigDecimal payPrice = BigDecimal.ZERO;
@ApiModelProperty("闲时折扣减免的金额")
private BigDecimal leisureDiscountPrice;
private BigDecimal leisureDiscountPrice = BigDecimal.ZERO;
/**
* 预约服务vo
*/
......@@ -188,4 +188,11 @@ public class OrderServe implements Serializable {
@ApiModelProperty("服务配置时长")
private Integer serveDuration;
@ApiModelProperty("是否已经被卡券或者次卡折扣过 1-已经绑定了次卡或者优惠券 2-未绑定")
private Integer bindCoupon = 2;
public void addDiscountPrice(BigDecimal discountPrice) {
this.discountPrice = this.discountPrice.add(discountPrice);
this.payPrice = this.price.subtract(discountPrice);
}
}
package com.gogirl.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gogirl.domain.store.store.StoreTechnician;
import lombok.Data;
......@@ -18,8 +19,10 @@ public class LeisureScheduleServe {
private Integer departmentId;
@JsonFormat(pattern = "HH:mm:ss")
private LocalTime timeNode;
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate weekDate;
private Integer serveId;
......@@ -34,6 +37,7 @@ public class LeisureScheduleServe {
private Double distance;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime dateTime;
private List<StoreTechnician> storeTechnicianList;
......
package com.gogirl.infrastructure.mapper.market.timescard;
import com.gogirl.domain.market.timescard.TimesCardOrderServeDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author robbendev
* @since 2020-03-15
*/
public interface TimesCardOrderServeDetailMapper extends BaseMapper<TimesCardOrderServeDetail> {
}
......@@ -18,6 +18,7 @@ import com.gogirl.domain.store.store.StoreManage;
import com.gogirl.domain.store.store.StoreTechnician;
import com.gogirl.domain.user.customer.Customer;
import com.gogirl.domain.user.customer.CustomerBalanceRecord;
import com.gogirl.domain.xcx.WeekConfig;
import com.gogirl.infrastructure.common.util.ListUtil;
import com.gogirl.infrastructure.mapper.market.coupon.CouponCustomerRelevanceMapper;
import com.gogirl.infrastructure.mapper.order.mall.MallOrderMapper;
......@@ -28,13 +29,16 @@ import com.gogirl.infrastructure.mapper.product.serve.BaseFeaturesMapper;
import com.gogirl.infrastructure.mapper.product.serve.FeaturesMappingMapper;
import com.gogirl.infrastructure.mapper.product.serve.ProduceSalesMapper;
import com.gogirl.infrastructure.mapper.user.customer.CustomerBalanceRecordMapper;
import com.gogirl.infrastructure.mapper.xcx.WeekConfigMapper;
import com.gogirl.infrastructure.subscribe.SubscribeService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
......@@ -280,4 +284,22 @@ public class Schedule {
orderServeMapper.syncOrderServeTimes();
}
private final WeekConfigMapper weekConfigMapper;
@Scheduled(cron = "0 0/15 * * * *")
public void weekTest() throws ParseException {
weekConfigMapper.delete(new LambdaQueryWrapper<>());
LocalDate localDate = LocalDate.now();
for (int i = 0; i < 7; i++) {
WeekConfig weekConfig = new WeekConfig();
weekConfig.setWeek(localDate.getDayOfWeek().getValue());
weekConfig.setWeekStr(localDate.getDayOfWeek().toString());
weekConfig.setWeekDate(localDate);
weekConfigMapper.insert(weekConfig);
localDate = localDate.plusDays(1);
}
}
}
package com.gogirl.interfaces.market.timescard;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 前端控制器
* </p>
*
* @author robbendev
* @since 2020-03-15
*/
@RestController
@RequestMapping("/times-card-order-serve-detail")
public class TimesCardOrderServeDetailController {
}
......@@ -212,7 +212,7 @@ public class ScheduleManageController {
@RequestParam Integer scheduleServeId,
@RequestParam Integer status,
@RequestParam Integer forceLeisureConfig) {
scheduleManageService.updateScheduledServeStatus(scheduleServeId, status);
scheduleManageService.updateScheduledServeStatus(scheduleServeId, status, forceLeisureConfig);
return JsonResult.success();
}
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gogirl.infrastructure.mapper.market.timescard.TimesCardOrderServeDetailMapper">
</mapper>
......@@ -50,11 +50,11 @@ public class CodeGenerator {
// 数据源配置
DataSourceConfig dsc = new DataSourceConfig();
dsc.setUrl("jdbc:mysql://localhost:3306/gogril_dev?useUnicode=true&useSSL=false&characterEncoding=utf8");
dsc.setUrl("jdbc:mysql://gz-cdb-c0sq6eax.sql.tencentcdb.com:60779/gogirl_pre?useUnicode=true&characterEncoding=utf-8&useSSL=false&&zeroDateTimeBehavior=convertToNull");
// dsc.setSchemaName("public");
dsc.setDriverName("com.mysql.jdbc.Driver");
dsc.setUsername("root");
dsc.setPassword("123456");
dsc.setPassword("#7kfnymAM$Y9-Ntf");
mpg.setDataSource(dsc);
// 包配置
......
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