Commit 87dd255a by huluobin

卡券修改

parent a12da1a4
......@@ -7,6 +7,7 @@ import com.gogirl.domain.market.coupon.Coupon;
import com.gogirl.domain.market.coupon.CouponCustomerRelevance;
import com.gogirl.domain.market.coupon.CouponOrderRelevance;
import com.gogirl.domain.market.timescard.TimesCardCustomerRelevance;
import com.gogirl.domain.market.timescard.TimesCardOrderServeDetail;
import com.gogirl.domain.market.timescard.TimesCardUsedRecord;
import com.gogirl.domain.order.serve.OrderManage;
import com.gogirl.domain.order.serve.OrderServe;
......@@ -15,6 +16,7 @@ import com.gogirl.infrastructure.common.util.ListUtil;
import com.gogirl.infrastructure.mapper.market.coupon.CouponCustomerRelevanceMapper;
import com.gogirl.infrastructure.mapper.market.coupon.CouponMapper;
import com.gogirl.infrastructure.mapper.market.timescard.TimesCardCustomerRelevanceMapper;
import com.gogirl.infrastructure.mapper.market.timescard.TimesCardOrderServeDetailMapper;
import com.gogirl.infrastructure.mapper.order.serve.OrderManageMapper;
import com.gogirl.infrastructure.mapper.order.serve.OrderServeMapper;
import com.gogirl.shared.market.command.SetTimesCardCommand;
......@@ -240,6 +242,9 @@ public class MarketServiceImpl implements MarketService {
}
}
@Resource
TimesCardOrderServeDetailMapper timesCardOrderServeDetailMapper;
/**
* 更新订单 使用次卡 使用外部券 使用内部券之后需要调用这个方法
* 结算订单
......@@ -275,23 +280,31 @@ public class MarketServiceImpl implements MarketService {
OrderManage orderManage = orderManageMapper.selectById(orderId);
List<OrderServe> orderServeList = orderServeMapper.selectList(new LambdaQueryWrapper<OrderServe>().eq(OrderServe::getOrderId, orderId));
orderManage.setListOrderServer(orderServeList);
orderServeList.forEach(orderServe -> orderServe.setBindCoupon(2));
//1.改价结算
//总支付金额等于 总价格+总改价
orderManage.setTotalPaymentAmount(orderManage.getTotalPrice().add(orderManage.getChangePrice()));
//总折扣金额
orderManage.setDiscountPrice(BigDecimal.ZERO);
orderManage.getListOrderServer().forEach(orderServe -> {
//服务实际支付金额=服务价格+服务改价
orderServe.setPayPrice(orderServe.getPrice().add(orderServe.getServeChangePrice()));
//服务折金额=0
orderServe.setDiscountPrice(BigDecimal.ZERO);
//业绩的实际支付金额
orderServe.setAchievement(orderServe.getPrice().add(orderServe.getServeChangePrice()));
});
//2.闲时折扣结算
orderManage.getListOrderServer().forEach(orderServe -> {
//服务折扣金额等于闲时折扣金额
orderServe.setDiscountPrice(orderServe.getLeisureDiscountPrice());
//服务支付金额-闲时折扣金额
orderServe.setPayPrice(orderServe.getPayPrice().subtract(orderServe.getLeisureDiscountPrice()));
//总支付金额
//总支付金额- 闲时折扣基恩
orderManage.setTotalPaymentAmount(orderManage.getTotalPaymentAmount().subtract(orderServe.getLeisureDiscountPrice()));
//总折扣金额 + = 闲时折扣金额
orderManage.setDiscountPrice(orderManage.getDiscountPrice().add(orderServe.getLeisureDiscountPrice()));
......@@ -300,29 +313,71 @@ public class MarketServiceImpl implements MarketService {
//3.次卡
if (ListUtil.isNotEmpty(timesCardUsedRecordList)) {
//次卡使用记录
timesCardUsedRecordList.forEach(timesCardUsedRecord -> timesCardUsedRecord.setStatus(TimesCardUsedRecord.STATUS_CHOSE));
timesCardUsedRecordList.stream()
.sorted(Comparator.comparing(TimesCardUsedRecord::getDiscountAmount))
.forEach(timesCardUsedRecord -> {
timesCardOrderServeDetailMapper.delete(new LambdaQueryWrapper<TimesCardOrderServeDetail>().eq(TimesCardOrderServeDetail::getOrderId, orderId));
//次卡能用的服务id
List<Integer> serveIds = timesCardCustomerRelevanceMapper.queryTimesCardServeIds(timesCardUsedRecord.getCardTypeId());
//抵扣的服务为 作用范围内支付金额最高的服务
OrderServe orderServe = this.queryMaxPayPrice(orderManage, serveIds);
//如果有属于这个服务的辅助服务 就查出来一起折扣
OrderServe supportServe = this.querySupportServe(orderManage, orderServe);
//更新次卡记录 已使用
timesCardUsedRecord.setStatus(TimesCardUsedRecord.STATUS_USED);
//次卡对应订单服务的美甲师
timesCardUsedRecord.setTechnicianName(orderServe.getTechnicianName());
//次卡店铺名称
timesCardUsedRecord.setDepartmentName(orderManage.getDepartmentName());
//次卡店铺id
timesCardUsedRecord.setDepartmentId(orderManage.getDepartmentId());
//次卡折扣的
timesCardUsedRecord.setServeName(orderServe.getServeName());
//次卡作用的服务id
timesCardUsedRecord.setOrderServeId(orderServe.getServeId());
timesCardUsedRecordService.updateById(timesCardUsedRecord);
//在主服务上折扣的钱
TimesCardOrderServeDetail timesCardOrderServeDetail = new TimesCardOrderServeDetail();
BigDecimal serveDiscountAmount = orderServe.getPayPrice().min(timesCardUsedRecord.getDiscountAmount());
timesCardOrderServeDetail.setDiscountAmount(serveDiscountAmount);
timesCardOrderServeDetail.setOrderServeId(orderServe.getId());
timesCardOrderServeDetail.setOrderId(orderId);
timesCardOrderServeDetail.setTimesCardUserRecordId(timesCardUsedRecord.getOrderServeId());
//业绩
timesCardOrderServeDetail.setAchievement(timesCardUsedRecord.getPayAmount());
timesCardOrderServeDetailMapper.insert(timesCardOrderServeDetail);
//订单折扣金额更新
orderServe.setBindCoupon(1);
orderServe.addDiscountPrice(serveDiscountAmount);
orderManage.addDiscountPrice(serveDiscountAmount);
//在从服务上折扣的钱
BigDecimal leftServeDiscountAmount = timesCardUsedRecord.getDiscountAmount().subtract(serveDiscountAmount);
BigDecimal actualSupportServeDiscountAmount = leftServeDiscountAmount.min(supportServe.getPayPrice());
if (supportServe != null && leftServeDiscountAmount.compareTo(BigDecimal.ZERO) > 0) {
TimesCardOrderServeDetail supportTimesCardOrderServeDetail = new TimesCardOrderServeDetail();
supportTimesCardOrderServeDetail.setDiscountAmount(actualSupportServeDiscountAmount);
supportTimesCardOrderServeDetail.setOrderServeId(supportServe.getId());
supportTimesCardOrderServeDetail.setOrderId(orderId);
supportTimesCardOrderServeDetail.setTimesCardUserRecordId(timesCardUsedRecord.getOrderServeId());
//业绩
supportTimesCardOrderServeDetail.setAchievement(BigDecimal.ZERO);
timesCardOrderServeDetailMapper.insert(supportTimesCardOrderServeDetail);
//订单折扣金额更新
supportServe.setBindCoupon(1);
supportServe.addDiscountPrice(actualSupportServeDiscountAmount);
orderManage.addDiscountPrice(actualSupportServeDiscountAmount);
}
//更新使用次数
TimesCardCustomerRelevance timesCardCustomerRelevance = timesCardCustomerRelevanceService.getById(timesCardUsedRecord.getCardRelevanceCustomerId());
timesCardCustomerRelevance.setUsedTimes(timesCardCustomerRelevance.getUsedTimes() + 1);
......@@ -332,17 +387,6 @@ public class MarketServiceImpl implements MarketService {
}
timesCardCustomerRelevanceService.updateById(timesCardCustomerRelevance);
//金额 业绩计算
BigDecimal minDiscountAmount = orderServe.getPayPrice().min(timesCardUsedRecord.getDiscountAmount());
orderServe.setDiscountPrice(orderServe.getDiscountPrice().add(minDiscountAmount));
orderServe.setPayPrice(orderServe.getPayPrice().subtract(minDiscountAmount));
orderServe.setAchievement(orderServe.getAchievement().subtract(minDiscountAmount));
orderManage.setDiscountPrice(orderManage.getDiscountPrice().add(minDiscountAmount));
orderManage.setTotalPaymentAmount(orderManage.getTotalPaymentAmount().subtract(minDiscountAmount));
});
}
......@@ -370,6 +414,11 @@ public class MarketServiceImpl implements MarketService {
//抵扣的服务为 作用范围内支付金额最高的服务
OrderServe orderServe = this.queryMaxPayPrice(orderManage, serveIds);
//如果有属于这个服务的辅助服务 就查出来一起折扣
OrderServe supportServe = this.querySupportServe(orderManage, orderServe);
BigDecimal serveDiscountAmount = orderServe.getPayPrice().min(couponCustomerRelevance.getDiscountAmount());
//新增外部券抵扣情况记录
CouponOrderRelevance couponOrderRelevance = CouponOrderRelevance.builder()
.couponCustomerRelevanceId(couponCustomerRelevance.getId())
......@@ -381,29 +430,54 @@ public class MarketServiceImpl implements MarketService {
//支付金额
.payForOrderServe(couponCustomerRelevance.getPayAmount())
//折扣金额
.discountAmount(couponCustomerRelevance.getDiscountAmount().min(orderServe.getPayPrice()))
.discountAmount(serveDiscountAmount)
.createTime(new Date())
.confirmTime(new Date())
.message(orderServe.getServeName())
.customerId(orderManage.getOrderUser())
.status(2)
.build();
couponOrderRelevanceService.save(couponOrderRelevance);
//金额 业绩计算
BigDecimal minDiscountAmount = orderServe.getPayPrice().min(couponCustomerRelevance.getDiscountAmount());
orderServe.setDiscountPrice(orderServe.getDiscountPrice().add(minDiscountAmount));
orderServe.setPayPrice(orderServe.getPayPrice().subtract(minDiscountAmount));
//如果计算业绩
if (couponCustomerRelevance.getIsCalcAchievement() == 1) {
orderServe.setAchievement(orderServe.getAchievement().subtract(minDiscountAmount).add(couponCustomerRelevance.getPayAmount()));
couponOrderRelevance.setAchievement(couponCustomerRelevance.getPayAmount());
} else {
couponOrderRelevance.setAchievement(couponOrderRelevance.getDiscountAmount());
}
orderServe.addDiscountPrice(serveDiscountAmount);
orderManage.addDiscountPrice(serveDiscountAmount);
orderServe.setBindCoupon(1);
couponOrderRelevanceService.save(couponOrderRelevance);
orderManage.setDiscountPrice(orderManage.getDiscountPrice().add(minDiscountAmount));
orderManage.setTotalPaymentAmount(orderManage.getTotalPaymentAmount().subtract(minDiscountAmount));
//在从服务上折扣的钱
BigDecimal leftServeDiscountAmount = couponCustomerRelevance.getDiscountAmount().subtract(serveDiscountAmount);
if (supportServe != null && leftServeDiscountAmount.compareTo(BigDecimal.ZERO) > 0) {
BigDecimal actualSupportServeDiscountAmount = leftServeDiscountAmount.min(supportServe.getPayPrice());
//新增外部券抵扣情况记录
CouponOrderRelevance supportCouponOrderRelevance = CouponOrderRelevance.builder()
.couponCustomerRelevanceId(couponCustomerRelevance.getId())
.couponId(couponCustomerRelevance.getCouponId())
.couponName(couponCustomerRelevance.getCouponName())
.orderServeId(supportServe.getId())
.serveName(supportServe.getServeName())
.orderId(orderManage.getId())
//支付金额
.payForOrderServe(BigDecimal.ZERO)
//折扣金额
.discountAmount(actualSupportServeDiscountAmount)
.createTime(new Date())
.confirmTime(new Date())
.message(supportServe.getServeName())
.customerId(orderManage.getOrderUser())
.achievement(BigDecimal.ZERO)
//确认可用
.status(2)
.build();
couponOrderRelevanceService.save(supportCouponOrderRelevance);
supportServe.addDiscountPrice(actualSupportServeDiscountAmount);
orderManage.addDiscountPrice(actualSupportServeDiscountAmount);
orderServe.setBindCoupon(1);
}
});
}
//5.内部券
......@@ -460,26 +534,23 @@ public class MarketServiceImpl implements MarketService {
.orderId(orderManage.getId())
.couponId(couponCustomerRelevance.getCouponId())
.couponCustomerRelevanceId(couponCustomerRelevance.getId())
.confirmTime(new Date())
.message(orderServe.getServeName())
.customerId(orderManage.getOrderUser())
.status(2)
.build();
//保存卡券在订单服务上的使用请款
couponOrderRelevanceService.save(couponOrderRelevance);
orderServe.setDiscountPrice(orderServe.getDiscountPrice().add(discountAmount));
orderServe.setPayPrice(orderServe.getPayPrice().subtract(payAmount));
//如果计算业绩
if (couponCustomerRelevance.getIsCalcAchievement() == 1) {
orderServe.setAchievement(orderServe.getAchievement().subtract(discountAmount).add(payAmount));
couponOrderRelevance.setAchievement(couponCustomerRelevance.getPayAmount());
} else {
couponOrderRelevance.setAchievement(couponOrderRelevance.getDiscountAmount());
}
orderManage.setDiscountPrice(orderManage.getDiscountPrice().add(discountAmount));
orderManage.setTotalPaymentAmount(orderManage.getTotalPaymentAmount().subtract(payAmount));
//保存卡券在订单服务上的使用请款
couponOrderRelevanceService.save(couponOrderRelevance);
orderServe.addDiscountPrice(discountAmount);
orderManage.addDiscountPrice(discountAmount);
discountCalc = discountCalc.add(discountAmount);
......@@ -496,10 +567,14 @@ public class MarketServiceImpl implements MarketService {
}
orderManageMapper.updateById(orderManage);
orderServeService.saveOrUpdateBatch(orderServeList);
orderServeService.updateBatchById(orderServeList);
}
private OrderServe querySupportServe(OrderManage orderManage, OrderServe orderServe) {
return null;
}
/**
* serviceIds 中支付金额最多的订单服务
*
......@@ -510,8 +585,11 @@ public class MarketServiceImpl implements MarketService {
private OrderServe queryMaxPayPrice(OrderManage orderManage, List<Integer> serveIds) {
return orderManage.getListOrderServer()
.stream()
.filter(dto -> serveIds.contains(dto.getServeId()))
.filter(orderServe -> serveIds.contains(orderServe.getServeId()))
.filter(orderServe -> orderServe.getBindCoupon() != 1)
.max(Comparator.comparing(OrderServe::getPayPrice))
.orElseThrow(RRException::new);
}
}
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