新增功能
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
# 数据库配置
|
||||
spring.datasource.url=jdbc:mysql://localhost:3306/fuint-db?useUnicode=true&characterEncoding=UTF8&useSSL=false
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=root
|
||||
spring.datasource.url=jdbc:mysql://124.222.210.125:3306/fuint-db?useUnicode=true&characterEncoding=UTF8&useSSL=false&allowPublicKeyRetrieval=true
|
||||
spring.datasource.username=fuint
|
||||
spring.datasource.password=YMGNWk6sZSeyYKWe
|
||||
|
||||
# Redis配置
|
||||
spring.session.store-type=redis
|
||||
@ -62,6 +62,9 @@ commission.job.time = 0 0/1 * * * ?
|
||||
uploadShippingInfoJob.job.switch = 1
|
||||
uploadShippingInfoJob.job.time = 0 0/1 * * * ?
|
||||
|
||||
grow.job.switch = 1
|
||||
grow.job.time = 0 0 1 * * ?
|
||||
|
||||
################## 阿里云短信配置 #######################
|
||||
# 短信接口模式[0-关闭 1-打开]
|
||||
aliyun.sms.mode = 0
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
# 数据库配置
|
||||
spring.datasource.url=jdbc:mysql://localhost:3306/fuint-db?useUnicode=true&characterEncoding=UTF8&useSSL=false
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=root
|
||||
spring.datasource.url=jdbc:mysql://124.222.210.125:3306/fuint-db?useUnicode=true&characterEncoding=UTF8&useSSL=false
|
||||
spring.datasource.username=fuint
|
||||
spring.datasource.password=YMGNWk6sZSeyYKWe
|
||||
|
||||
# Redis配置
|
||||
spring.session.store-type=redis
|
||||
@ -62,6 +62,9 @@ commission.job.time = 0 0/1 * * * ?
|
||||
uploadShippingInfoJob.job.switch = 1
|
||||
uploadShippingInfoJob.job.time = 0 0/1 * * * ?
|
||||
|
||||
grow.job.switch = 1
|
||||
grow.job.time = 0 0 1 * * ?
|
||||
|
||||
################## 阿里云短信配置 #######################
|
||||
# 短信接口模式[0-关闭 1-打开]
|
||||
aliyun.sms.mode = 0
|
||||
|
||||
6571
db/fuint-db.sql
6571
db/fuint-db.sql
File diff suppressed because it is too large
Load Diff
@ -1,4 +0,0 @@
|
||||
ALTER TABLE `mt_order`
|
||||
ADD COLUMN `CONFIRM_STATUS` CHAR (1) DEFAULT 'N' NULL COMMENT '核销状态' AFTER `STAFF_ID`,
|
||||
ADD COLUMN `CONFIRM_TIME` DATETIME NULL COMMENT '核销时间' AFTER `CONFIRM_STATUS`,
|
||||
ADD COLUMN `CONFIRM_REMARK` VARCHAR (500) NULL COMMENT '核销备注' AFTER `CONFIRM_TIME`;
|
||||
@ -1,2 +0,0 @@
|
||||
ALTER TABLE `fuint-db`.`mt_user`
|
||||
ADD COLUMN `IP` VARCHAR (20) DEFAULT '' NULL COMMENT '注册IP' AFTER `DESCRIPTION`;
|
||||
@ -1,14 +0,0 @@
|
||||
ALTER TABLE `fuint-db`.`mt_cart`
|
||||
CHANGE `NUM` `NUM` DOUBLE (10, 2) DEFAULT 1 NULL COMMENT '数量';
|
||||
|
||||
ALTER TABLE `fuint-db`.`mt_goods`
|
||||
CHANGE `STOCK` `STOCK` DOUBLE (10, 2) UNSIGNED DEFAULT 0 NULL COMMENT '库存';
|
||||
|
||||
ALTER TABLE `fuint-db`.`mt_goods`
|
||||
CHANGE `INIT_SALE` `INIT_SALE` DOUBLE (10, 2) DEFAULT 0 NULL COMMENT '初始销量';
|
||||
|
||||
ALTER TABLE `fuint-db`.`mt_goods_sku`
|
||||
CHANGE `STOCK` `STOCK` DOUBLE (10, 2) DEFAULT 0 NOT NULL COMMENT '库存';
|
||||
|
||||
ALTER TABLE `fuint-db`.`mt_order_goods`
|
||||
CHANGE `NUM` `NUM` DOUBLE (10, 2) DEFAULT 0 NOT NULL COMMENT '商品数量';
|
||||
@ -1,5 +0,0 @@
|
||||
ALTER TABLE `mt_goods`
|
||||
ADD COLUMN `COST_PRICE` DECIMAL (10, 2) DEFAULT 0.00 NULL COMMENT '成本价格' AFTER `LINE_PRICE`;
|
||||
|
||||
ALTER TABLE `mt_goods_sku`
|
||||
ADD COLUMN `COST_PRICE` DECIMAL (10, 2) DEFAULT 0.00 NULL COMMENT '成本价格' AFTER `LINE_PRICE`;
|
||||
@ -1,2 +0,0 @@
|
||||
ALTER TABLE `mt_goods`
|
||||
ADD COLUMN `PLATFORM` INT (1) DEFAULT 0 NULL COMMENT '可用平台,0:不限,1:仅会员端(小程序和h5);2:仅收银端' AFTER `GOODS_NO`;
|
||||
@ -1,2 +0,0 @@
|
||||
ALTER TABLE `mt_setting`
|
||||
CHANGE `VALUE` `VALUE` LONGTEXT NOT NULL COMMENT '配置值';
|
||||
@ -1,2 +0,0 @@
|
||||
ALTER TABLE `mt_coupon`
|
||||
ADD COLUMN `CONTENT` INT DEFAULT 1 NULL COMMENT '内容,如:1表示满减券、2表示折扣券' AFTER `TYPE`;
|
||||
@ -1,5 +0,0 @@
|
||||
ALTER TABLE `mt_merchant`
|
||||
ADD COLUMN `SETTLE_RATE` DECIMAL NULL COMMENT '结算比例' AFTER `WX_OFFICIAL_APP_SECRET`;
|
||||
|
||||
ALTER TABLE `mt_settlement`
|
||||
ADD COLUMN `SETTLE_RATE` DECIMAL NULL COMMENT '结算比例' AFTER `STORE_ID`;
|
||||
@ -1,2 +0,0 @@
|
||||
ALTER TABLE `mt_stock_item`
|
||||
CHANGE `NUM` `NUM` DOUBLE (10, 2) DEFAULT 0 NOT NULL COMMENT '数量';
|
||||
@ -1,2 +0,0 @@
|
||||
ALTER TABLE `mt_goods`
|
||||
ADD COLUMN `BOOK_ID` INT DEFAULT 0 NULL COMMENT '预约项目ID' AFTER `CATE_ID`;
|
||||
@ -65,6 +65,9 @@ public class BookDto implements Serializable {
|
||||
@ApiModelProperty("描述")
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty("预约费用规则(JSON)")
|
||||
private String priceRules;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.fuint.common.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fuint.repository.model.MtStore;
|
||||
@ -69,6 +70,18 @@ public class BookItemDto implements Serializable {
|
||||
@ApiModelProperty("预约员工ID")
|
||||
private Integer serviceStaffId;
|
||||
|
||||
@ApiModelProperty("签到开始时间")
|
||||
private Date checkinStartTime;
|
||||
|
||||
@ApiModelProperty("签到结束时间")
|
||||
private Date checkinEndTime;
|
||||
|
||||
@ApiModelProperty("签到时长(小时)")
|
||||
private BigDecimal checkinDurationHours;
|
||||
|
||||
@ApiModelProperty("预约支付订单ID")
|
||||
private Integer orderId;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
@ -16,6 +16,9 @@ public class NavigationDto implements Serializable {
|
||||
@ApiModelProperty("导航名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("原导航名称(编辑时用于定位原记录)")
|
||||
private String oldName;
|
||||
|
||||
@ApiModelProperty("导航提示")
|
||||
private String tips;
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
public enum BookStatusEnum {
|
||||
CREATED("A", "待确认"),
|
||||
CONFIRM("B", "确认通过"),
|
||||
CONFIRM("B", "待签到"),
|
||||
FAIL("F", "预约失败"),
|
||||
CANCEL("C", "已取消"),
|
||||
DELETE("D", "已删除"),
|
||||
|
||||
@ -39,6 +39,9 @@ public class SettlementParam implements Serializable {
|
||||
@ApiModelProperty(value="支付类型,CASH:现金支付,JSAPI:微信支付,MICROPAY:微信扫码支付,BALANCE:余额支付,ALISCAN:支付宝扫码", name="payType")
|
||||
private String payType;
|
||||
|
||||
@ApiModelProperty(value="余额抵扣金额", name="balanceAmount")
|
||||
private String balanceAmount;
|
||||
|
||||
@ApiModelProperty(value="PC端扫码支付的二维码", name="authCode")
|
||||
private String authCode;
|
||||
|
||||
@ -69,6 +72,9 @@ public class SettlementParam implements Serializable {
|
||||
@ApiModelProperty(value="订单ID", name="orderId")
|
||||
private Integer orderId;
|
||||
|
||||
@ApiModelProperty(value="预约记录ID", name="bookItemId")
|
||||
private Integer bookItemId;
|
||||
|
||||
@ApiModelProperty(value="是否微信客户端", name="isWechat")
|
||||
private String isWechat;
|
||||
|
||||
|
||||
@ -7,9 +7,11 @@ import com.fuint.common.param.BookableParam;
|
||||
import com.fuint.framework.exception.BusinessCheckException;
|
||||
import com.fuint.framework.pagination.PaginationResponse;
|
||||
import com.fuint.repository.model.MtBook;
|
||||
import com.fuint.repository.model.MtBookItem;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 预约业务接口
|
||||
@ -64,6 +66,11 @@ public interface BookService extends IService<MtBook> {
|
||||
* */
|
||||
List<String> isBookable(BookableParam param) throws BusinessCheckException, ParseException;
|
||||
|
||||
/**
|
||||
* 获取可预约时段剩余名额
|
||||
*/
|
||||
List<Map<String, Object>> getBookableRemain(BookableParam param) throws BusinessCheckException, ParseException;
|
||||
|
||||
/**
|
||||
* 获取预约项目列表
|
||||
*
|
||||
@ -73,4 +80,12 @@ public interface BookService extends IService<MtBook> {
|
||||
* */
|
||||
List<MtBook> getBookList(Integer merchantId, Integer storeId);
|
||||
|
||||
/**
|
||||
* 计算预约应付金额
|
||||
*
|
||||
* @param bookItem 预约记录
|
||||
* @return
|
||||
*/
|
||||
java.math.BigDecimal calculateBookingPayAmount(MtBookItem bookItem) throws BusinessCheckException;
|
||||
|
||||
}
|
||||
|
||||
@ -5,11 +5,14 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.common.dto.BookItemDto;
|
||||
import com.fuint.common.enums.BookStatusEnum;
|
||||
import com.fuint.common.enums.OrderStatusEnum;
|
||||
import com.fuint.common.dto.OrderDto;
|
||||
import com.fuint.common.param.BookItemPage;
|
||||
import com.fuint.common.param.BookableParam;
|
||||
import com.fuint.common.service.BookItemService;
|
||||
import com.fuint.common.service.BookService;
|
||||
import com.fuint.common.service.StoreService;
|
||||
import com.fuint.common.service.OrderService;
|
||||
import com.fuint.common.util.SeqUtil;
|
||||
import com.fuint.framework.annoation.OperationServiceLog;
|
||||
import com.fuint.framework.exception.BusinessCheckException;
|
||||
@ -66,6 +69,11 @@ public class BookItemServiceImpl extends ServiceImpl<MtBookItemMapper, MtBookIte
|
||||
* */
|
||||
private BookService bookService;
|
||||
|
||||
/**
|
||||
* 订单服务接口
|
||||
*/
|
||||
private OrderService orderService;
|
||||
|
||||
/**
|
||||
* 分页查询预约订单列表
|
||||
*
|
||||
@ -167,21 +175,23 @@ public class BookItemServiceImpl extends ServiceImpl<MtBookItemMapper, MtBookIte
|
||||
throw new BusinessCheckException("当前时间段不可预约,请重新选择!");
|
||||
}
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("merchantId", mtBookItem.getMerchantId());
|
||||
params.put("storeId", mtBookItem.getMerchantId());
|
||||
params.put("bookId", mtBookItem.getBookId());
|
||||
params.put("mobile", mtBookItem.getMobile());
|
||||
LambdaQueryWrapper<MtBookItem> queryWrapper = Wrappers.lambdaQuery();
|
||||
queryWrapper.eq(MtBookItem::getMerchantId, mtBookItem.getMerchantId());
|
||||
queryWrapper.eq(MtBookItem::getStoreId, mtBookItem.getStoreId());
|
||||
queryWrapper.eq(MtBookItem::getBookId, mtBookItem.getBookId());
|
||||
queryWrapper.eq(MtBookItem::getMobile, mtBookItem.getMobile());
|
||||
queryWrapper.eq(MtBookItem::getServiceDate, mtBookItem.getServiceDate());
|
||||
queryWrapper.eq(MtBookItem::getServiceTime, mtBookItem.getServiceTime());
|
||||
if (mtBookItem.getGoodsId() != null && mtBookItem.getGoodsId() > 0) {
|
||||
params.put("goodsId", mtBookItem.getGoodsId());
|
||||
queryWrapper.eq(MtBookItem::getGoodsId, mtBookItem.getGoodsId());
|
||||
}
|
||||
params.put("status", BookStatusEnum.CREATED.getKey());
|
||||
List<MtBookItem> data = queryBookItemListByParams(params);
|
||||
queryWrapper.in(MtBookItem::getStatus, BookStatusEnum.CREATED.getKey(), BookStatusEnum.CONFIRM.getKey());
|
||||
List<MtBookItem> data = mtBookItemMapper.selectList(queryWrapper);
|
||||
if (data != null && data.size() > 0) {
|
||||
throw new BusinessCheckException("您已提交预约,请等待确认!");
|
||||
throw new BusinessCheckException("您在该时段已有预约,请勿重复提交!");
|
||||
}
|
||||
|
||||
mtBookItem.setStatus(BookStatusEnum.CREATED.getKey());
|
||||
mtBookItem.setStatus(BookStatusEnum.CONFIRM.getKey());
|
||||
mtBookItem.setUpdateTime(new Date());
|
||||
mtBookItem.setCreateTime(new Date());
|
||||
mtBookItem.setVerifyCode(SeqUtil.getRandomNumber(4));
|
||||
@ -288,9 +298,24 @@ public class BookItemServiceImpl extends ServiceImpl<MtBookItemMapper, MtBookIte
|
||||
if (mtBookItem.getStatus() != null) {
|
||||
bookItem.setStatus(mtBookItem.getStatus());
|
||||
}
|
||||
if (mtBookItem.getContact() != null) {
|
||||
bookItem.setContact(mtBookItem.getContact());
|
||||
}
|
||||
if (mtBookItem.getMobile() != null) {
|
||||
bookItem.setMobile(mtBookItem.getMobile());
|
||||
}
|
||||
if (mtBookItem.getCheckinStartTime() != null) {
|
||||
bookItem.setCheckinStartTime(mtBookItem.getCheckinStartTime());
|
||||
}
|
||||
if (mtBookItem.getCheckinEndTime() != null) {
|
||||
bookItem.setCheckinEndTime(mtBookItem.getCheckinEndTime());
|
||||
}
|
||||
if (mtBookItem.getCheckinDurationHours() != null) {
|
||||
bookItem.setCheckinDurationHours(mtBookItem.getCheckinDurationHours());
|
||||
}
|
||||
if (mtBookItem.getOrderId() != null) {
|
||||
bookItem.setOrderId(mtBookItem.getOrderId());
|
||||
}
|
||||
|
||||
bookItem.setUpdateTime(new Date());
|
||||
mtBookItemMapper.updateById(bookItem);
|
||||
@ -364,6 +389,12 @@ public class BookItemServiceImpl extends ServiceImpl<MtBookItemMapper, MtBookIte
|
||||
}
|
||||
mtBookItem.setStatus(BookStatusEnum.CANCEL.getKey());
|
||||
mtBookItemMapper.updateById(mtBookItem);
|
||||
if (mtBookItem.getOrderId() != null && mtBookItem.getOrderId() > 0) {
|
||||
OrderDto orderDto = new OrderDto();
|
||||
orderDto.setId(mtBookItem.getOrderId());
|
||||
orderDto.setStatus(OrderStatusEnum.CANCEL.getKey());
|
||||
orderService.updateOrder(orderDto);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.fuint.common.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -20,6 +22,7 @@ import com.fuint.repository.mapper.MtBookItemMapper;
|
||||
import com.fuint.repository.mapper.MtBookMapper;
|
||||
import com.fuint.repository.model.MtBanner;
|
||||
import com.fuint.repository.model.MtBook;
|
||||
import com.fuint.repository.model.MtBookItem;
|
||||
import com.fuint.repository.model.MtStore;
|
||||
import com.fuint.utils.StringUtil;
|
||||
import com.github.pagehelper.Page;
|
||||
@ -35,6 +38,8 @@ import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
@ -67,6 +72,16 @@ public class BookServiceImpl extends ServiceImpl<MtBookMapper, MtBook> implement
|
||||
*/
|
||||
private StoreService storeService;
|
||||
|
||||
private static class BookingPriceRule {
|
||||
private final BigDecimal hours;
|
||||
private final BigDecimal price;
|
||||
|
||||
private BookingPriceRule(BigDecimal hours, BigDecimal price) {
|
||||
this.hours = hours;
|
||||
this.price = price;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询预约列表
|
||||
*
|
||||
@ -229,7 +244,32 @@ public class BookServiceImpl extends ServiceImpl<MtBookMapper, MtBook> implement
|
||||
|
||||
if (StringUtil.isNotEmpty(serviceTimes) && bookDto.getDateList().size() > 0) {
|
||||
List<String> times = Arrays.asList(serviceTimes.split(",").clone());
|
||||
if (times.size() > 0) {
|
||||
if (times.size() == 1) {
|
||||
String[] range = times.get(0).split("-");
|
||||
if (range.length >= 2) {
|
||||
String startTime = range[0];
|
||||
String endTime = range[1];
|
||||
int startMinutes = 0;
|
||||
int endMinutes = 0;
|
||||
if (startTime.contains(":")) {
|
||||
String[] arr = startTime.split(":");
|
||||
startMinutes = Integer.parseInt(arr[0]) * 60 + Integer.parseInt(arr[1]);
|
||||
}
|
||||
if (endTime.contains(":")) {
|
||||
String[] arr = endTime.split(":");
|
||||
endMinutes = Integer.parseInt(arr[0]) * 60 + Integer.parseInt(arr[1]);
|
||||
}
|
||||
for (int t = startMinutes; t + 60 <= endMinutes; t += 60) {
|
||||
int h = t / 60;
|
||||
int m = t % 60;
|
||||
String timeStr = String.format("%02d:%02d", h, m);
|
||||
TimeDto timeDto = new TimeDto();
|
||||
timeDto.setTime(timeStr);
|
||||
timeDto.setEnable(true);
|
||||
timeList.add(timeDto);
|
||||
}
|
||||
}
|
||||
} else if (times.size() > 0) {
|
||||
for (String time : times) {
|
||||
TimeDto timeDto = new TimeDto();
|
||||
String arr[] = time.split("-");
|
||||
@ -295,6 +335,9 @@ public class BookServiceImpl extends ServiceImpl<MtBookMapper, MtBook> implement
|
||||
if (mtBook.getServiceStaffIds() != null) {
|
||||
book.setServiceStaffIds(mtBook.getServiceStaffIds());
|
||||
}
|
||||
if (mtBook.getPriceRules() != null) {
|
||||
book.setPriceRules(mtBook.getPriceRules());
|
||||
}
|
||||
book.setUpdateTime(new Date());
|
||||
mtBookMapper.updateById(book);
|
||||
return book;
|
||||
@ -316,58 +359,102 @@ public class BookServiceImpl extends ServiceImpl<MtBookMapper, MtBook> implement
|
||||
}
|
||||
|
||||
List<String> bookList = new ArrayList<>();
|
||||
Integer limit = 0;
|
||||
String serviceTime = mtBook.getServiceTimes();
|
||||
|
||||
if (StringUtil.isEmpty(serviceTime)) {
|
||||
serviceTime = "08:30-12:00-1";
|
||||
}
|
||||
|
||||
String[] ranges = serviceTime.split(",");
|
||||
String[] rangeArr = ranges[0].split("-");
|
||||
String rangeStart = rangeArr.length > 0 ? rangeArr[0] : "";
|
||||
String rangeEnd = rangeArr.length > 1 ? rangeArr[1] : "";
|
||||
if (rangeArr.length > 2) {
|
||||
limit = Integer.parseInt(rangeArr[2]);
|
||||
} else {
|
||||
limit = 1;
|
||||
}
|
||||
|
||||
Date now = new Date();
|
||||
if (StringUtil.isNotEmpty(param.getTime())) {
|
||||
if (StringUtil.isNotEmpty(param.getDate())) {
|
||||
bookList = mtBookItemMapper.getBookList(param.getBookId(), param.getDate(), param.getTime());
|
||||
}
|
||||
Integer bookNum = bookList.size();
|
||||
|
||||
Integer limit = 0;
|
||||
String serviceTime = mtBook.getServiceTimes();
|
||||
|
||||
// 未填写时段,则未来
|
||||
if (StringUtil.isEmpty(serviceTime)) {
|
||||
serviceTime = "08:30-12:00-1,14:00-18:00-1";
|
||||
}
|
||||
|
||||
if (StringUtil.isNotEmpty(serviceTime)) {
|
||||
String[] times = serviceTime.split(",");
|
||||
if (times.length > 0) {
|
||||
for (String str : times) {
|
||||
if (str.indexOf(param.getTime()) >= 0) {
|
||||
String[] timeArr = str.split("-");
|
||||
if (timeArr.length > 2) {
|
||||
limit = Integer.parseInt(timeArr[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Date now = new Date();
|
||||
if (bookNum < limit) {
|
||||
if (StringUtil.isNotEmpty(param.getTime())) {
|
||||
String[] arr = param.getTime().split("-");
|
||||
String dateTime = param.getDate() + " " + arr[1]+":00";
|
||||
if (arr.length >= 2 && bookNum < limit) {
|
||||
String startTime = arr[0];
|
||||
String endTime = arr[1];
|
||||
String dateTime = param.getDate() + " " + endTime + ":00";
|
||||
Date currentDate = DateUtil.parseDate(dateTime);
|
||||
if (now.compareTo(currentDate) < 0) {
|
||||
if (StringUtil.isNotEmpty(rangeStart) && StringUtil.isNotEmpty(rangeEnd)) {
|
||||
int startM = Integer.parseInt(startTime.split(":")[0]) * 60 + Integer.parseInt(startTime.split(":")[1]);
|
||||
int endM = Integer.parseInt(endTime.split(":")[0]) * 60 + Integer.parseInt(endTime.split(":")[1]);
|
||||
int rangeStartM = Integer.parseInt(rangeStart.split(":")[0]) * 60 + Integer.parseInt(rangeStart.split(":")[1]);
|
||||
int rangeEndM = Integer.parseInt(rangeEnd.split(":")[0]) * 60 + Integer.parseInt(rangeEnd.split(":")[1]);
|
||||
if (startM >= rangeStartM && endM <= rangeEndM) {
|
||||
result.add(param.getTime());
|
||||
}
|
||||
} else {
|
||||
String[] times = mtBook.getServiceTimes().split(",");
|
||||
if (times.length > 0) {
|
||||
for (String str : times) {
|
||||
String[] arr = str.split("-");
|
||||
if (arr.length > 2) {
|
||||
String item = arr[0] + "-" + arr[1];
|
||||
String dateTime = param.getDate() + " " + arr[1]+":00";
|
||||
result.add(param.getTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (StringUtil.isNotEmpty(rangeStart) && StringUtil.isNotEmpty(rangeEnd)) {
|
||||
int startM = Integer.parseInt(rangeStart.split(":")[0]) * 60 + Integer.parseInt(rangeStart.split(":")[1]);
|
||||
int endM = Integer.parseInt(rangeEnd.split(":")[0]) * 60 + Integer.parseInt(rangeEnd.split(":")[1]);
|
||||
for (int t = startM; t + 60 <= endM; t += 60) {
|
||||
int h = t / 60;
|
||||
int m = t % 60;
|
||||
String timeStr = String.format("%02d:%02d", h, m);
|
||||
String dateTime = param.getDate() + " " + timeStr + ":00";
|
||||
Date currentDate = DateUtil.parseDate(dateTime);
|
||||
if (!bookList.contains(item) && now.compareTo(currentDate) < 0) {
|
||||
result.add(item);
|
||||
if (now.compareTo(currentDate) < 0) {
|
||||
result.add(timeStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取可预约时段剩余名额
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getBookableRemain(BookableParam param) throws BusinessCheckException, ParseException {
|
||||
MtBook mtBook = mtBookMapper.selectById(param.getBookId());
|
||||
if (mtBook == null) {
|
||||
throw new BusinessCheckException("预约项目不存在");
|
||||
}
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
if (StringUtil.isEmpty(param.getTime())) {
|
||||
return result;
|
||||
}
|
||||
|
||||
String serviceTime = mtBook.getServiceTimes();
|
||||
if (StringUtil.isEmpty(serviceTime)) {
|
||||
serviceTime = "08:30-12:00-1";
|
||||
}
|
||||
String[] ranges = serviceTime.split(",");
|
||||
String[] rangeArr = ranges[0].split("-");
|
||||
int limit = 1;
|
||||
if (rangeArr.length > 2) {
|
||||
limit = Integer.parseInt(rangeArr[2]);
|
||||
}
|
||||
|
||||
List<String> bookList = mtBookItemMapper.getBookList(param.getBookId(), param.getDate(), param.getTime());
|
||||
int used = bookList == null ? 0 : bookList.size();
|
||||
int remain = Math.max(limit - used, 0);
|
||||
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("time", param.getTime());
|
||||
data.put("remain", remain);
|
||||
data.put("limit", limit);
|
||||
result.add(data);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -400,4 +487,99 @@ public class BookServiceImpl extends ServiceImpl<MtBookMapper, MtBook> implement
|
||||
|
||||
return dataList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal calculateBookingPayAmount(MtBookItem bookItem) throws BusinessCheckException {
|
||||
if (bookItem == null || bookItem.getBookId() == null) {
|
||||
throw new BusinessCheckException("预约信息有误");
|
||||
}
|
||||
BookDto bookInfo;
|
||||
try {
|
||||
bookInfo = getBookById(bookItem.getBookId(), false);
|
||||
} catch (Exception e) {
|
||||
throw new BusinessCheckException("预约项目不存在");
|
||||
}
|
||||
if (bookInfo == null || StringUtil.isEmpty(bookInfo.getPriceRules())) {
|
||||
throw new BusinessCheckException("未配置预约费用");
|
||||
}
|
||||
|
||||
List<BookingPriceRule> rules = new ArrayList<>();
|
||||
try {
|
||||
JSONArray array = JSONArray.parseArray(bookInfo.getPriceRules());
|
||||
if (array != null) {
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
JSONObject obj = array.getJSONObject(i);
|
||||
if (obj == null) {
|
||||
continue;
|
||||
}
|
||||
BigDecimal hours = obj.getBigDecimal("hours");
|
||||
BigDecimal price = obj.getBigDecimal("price");
|
||||
if (hours == null || price == null) {
|
||||
continue;
|
||||
}
|
||||
if (hours.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
continue;
|
||||
}
|
||||
rules.add(new BookingPriceRule(hours, price));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessCheckException("预约费用配置有误");
|
||||
}
|
||||
if (rules.isEmpty()) {
|
||||
throw new BusinessCheckException("未配置预约费用");
|
||||
}
|
||||
rules.sort(Comparator.comparing(r -> r.hours));
|
||||
|
||||
BigDecimal durationHours = null;
|
||||
if (bookItem.getCheckinDurationHours() != null) {
|
||||
durationHours = bookItem.getCheckinDurationHours();
|
||||
} else if (bookItem.getCheckinStartTime() != null && bookItem.getCheckinEndTime() != null) {
|
||||
long diffMs = bookItem.getCheckinEndTime().getTime() - bookItem.getCheckinStartTime().getTime();
|
||||
double h = Math.max(diffMs / 3600000.0, 0);
|
||||
durationHours = BigDecimal.valueOf(h).setScale(1, RoundingMode.HALF_UP);
|
||||
}
|
||||
if (durationHours == null || durationHours.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
throw new BusinessCheckException("未获取到预约时长,无法结算");
|
||||
}
|
||||
|
||||
for (BookingPriceRule rule : rules) {
|
||||
if (rule.hours.compareTo(durationHours) == 0) {
|
||||
return rule.price.setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
}
|
||||
|
||||
BookingPriceRule minRule = rules.get(0);
|
||||
BookingPriceRule maxRule = rules.get(rules.size() - 1);
|
||||
if (durationHours.compareTo(maxRule.hours) >= 0) {
|
||||
return maxRule.price.setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
if (durationHours.compareTo(minRule.hours) <= 0) {
|
||||
return minRule.price.setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
BookingPriceRule lower = null;
|
||||
BookingPriceRule upper = null;
|
||||
for (BookingPriceRule rule : rules) {
|
||||
if (rule.hours.compareTo(durationHours) < 0) {
|
||||
lower = rule;
|
||||
continue;
|
||||
}
|
||||
if (rule.hours.compareTo(durationHours) > 0) {
|
||||
upper = rule;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (lower == null || upper == null) {
|
||||
throw new BusinessCheckException("未配置预约费用");
|
||||
}
|
||||
|
||||
BigDecimal span = upper.hours.subtract(lower.hours);
|
||||
if (span.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
return lower.price.setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
BigDecimal ratio = durationHours.subtract(lower.hours).divide(span, 8, RoundingMode.HALF_UP);
|
||||
BigDecimal price = lower.price.add(upper.price.subtract(lower.price).multiply(ratio));
|
||||
return price.setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
}
|
||||
|
||||
@ -182,6 +182,11 @@ public class OrderServiceImpl extends ServiceImpl<MtOrderMapper, MtOrder> implem
|
||||
*/
|
||||
private BookItemService bookItemService;
|
||||
|
||||
/**
|
||||
* 预约项目服务接口
|
||||
*/
|
||||
private BookService bookService;
|
||||
|
||||
/**
|
||||
* 获取用户订单列表
|
||||
* @param orderListParam
|
||||
@ -854,6 +859,21 @@ public class OrderServiceImpl extends ServiceImpl<MtOrderMapper, MtOrder> implem
|
||||
}
|
||||
param.setUserId(userId);
|
||||
|
||||
// 预约计费:根据时长和价格规则重新计算应付金额(不信任前端)
|
||||
Integer bookItemId = param.getBookItemId() == null ? 0 : param.getBookItemId();
|
||||
if (bookItemId > 0) {
|
||||
MtBookItem bookItem = bookItemService.getBookItemById(bookItemId);
|
||||
if (bookItem == null) {
|
||||
throw new BusinessCheckException("预约信息有误");
|
||||
}
|
||||
if (userInfo != null && bookItem.getUserId() != null && !bookItem.getUserId().equals(userInfo.getId())) {
|
||||
throw new BusinessCheckException("预约信息有误");
|
||||
}
|
||||
BigDecimal calculatedAmount = bookService.calculateBookingPayAmount(bookItem);
|
||||
payAmount = calculatedAmount.toPlainString();
|
||||
param.setPayAmount(payAmount);
|
||||
}
|
||||
|
||||
// 订单所属店铺
|
||||
if (storeId < 1) {
|
||||
if (userInfo.getStoreId() > 0) {
|
||||
@ -1177,6 +1197,7 @@ public class OrderServiceImpl extends ServiceImpl<MtOrderMapper, MtOrder> implem
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取订单详情
|
||||
*
|
||||
|
||||
@ -10,7 +10,10 @@ import com.fuint.common.service.BookCateService;
|
||||
import com.fuint.common.service.BookItemService;
|
||||
import com.fuint.common.service.SettingService;
|
||||
import com.fuint.common.service.StoreService;
|
||||
import com.fuint.common.util.DateUtil;
|
||||
import com.fuint.common.util.ExcelUtil;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import com.fuint.common.Constants;
|
||||
import com.fuint.framework.exception.BusinessCheckException;
|
||||
import com.fuint.framework.pagination.PaginationResponse;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
@ -21,14 +24,18 @@ import com.fuint.repository.model.MtStore;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import static com.fuint.common.util.XlsUtil.objectConvertToString;
|
||||
|
||||
/**
|
||||
* 预约订单管理类controller
|
||||
@ -160,4 +167,54 @@ public class BackendBookItemController extends BaseController {
|
||||
result.put("mtBookItem", mtBookItem);
|
||||
return getSuccessResult(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出预约订单
|
||||
*/
|
||||
@ApiOperation(value = "导出预约订单")
|
||||
@RequestMapping(value = "/export", method = RequestMethod.GET)
|
||||
@CrossOrigin
|
||||
@PreAuthorize("@pms.hasPermission('book:index')")
|
||||
public void export(HttpServletResponse response, BookItemPage params) throws Exception {
|
||||
AccountInfo accountInfo = TokenUtil.getAccountInfo();
|
||||
params.setPage(Constants.PAGE_NUMBER);
|
||||
params.setPageSize(Constants.MAX_ROWS);
|
||||
if (accountInfo.getMerchantId() != null && accountInfo.getMerchantId() > 0) {
|
||||
params.setMerchantId(accountInfo.getMerchantId());
|
||||
}
|
||||
if (accountInfo.getStoreId() != null && accountInfo.getStoreId() > 0) {
|
||||
params.setStoreId(accountInfo.getStoreId());
|
||||
}
|
||||
|
||||
PaginationResponse<BookItemDto> result = bookItemService.queryBookItemListByPagination(params);
|
||||
|
||||
String[] title = { "预约项目", "会员ID", "联系人", "手机号", "预约日期", "预约时段", "签到开始", "签到结束", "签到时长(小时)", "状态", "提交时间" };
|
||||
String fileName = "预约订单"+ DateUtil.formatDate(new Date(), "yyyy.MM.dd_HHmm") +".xls";
|
||||
String sheetName = "预约订单";
|
||||
|
||||
String[][] content = null;
|
||||
List<BookItemDto> list = result.getContent();
|
||||
if (list.size() > 0) {
|
||||
content = new String[list.size()][title.length];
|
||||
}
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
BookItemDto item = list.get(i);
|
||||
if (item != null) {
|
||||
content[i][0] = objectConvertToString(item.getBookName());
|
||||
content[i][1] = objectConvertToString(item.getUserId());
|
||||
content[i][2] = objectConvertToString(item.getContact());
|
||||
content[i][3] = objectConvertToString(item.getMobile());
|
||||
content[i][4] = objectConvertToString(item.getServiceDate());
|
||||
content[i][5] = objectConvertToString(item.getServiceTime());
|
||||
content[i][6] = objectConvertToString(item.getCheckinStartTime());
|
||||
content[i][7] = objectConvertToString(item.getCheckinEndTime());
|
||||
content[i][8] = objectConvertToString(item.getCheckinDurationHours());
|
||||
content[i][9] = objectConvertToString(item.getStatusName());
|
||||
content[i][10] = objectConvertToString(item.getCreateTime());
|
||||
}
|
||||
}
|
||||
|
||||
HSSFWorkbook wb = ExcelUtil.getHSSFWorkbook(sheetName, title, content, null);
|
||||
ExcelUtil.setResponseHeader(response, fileName, wb);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ import com.fuint.framework.exception.BusinessCheckException;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import com.fuint.repository.model.MtSetting;
|
||||
import com.fuint.utils.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -69,13 +70,14 @@ public class BackendNavigateController extends BaseController {
|
||||
mtSetting.setType(SettingTypeEnum.NAVIGATION.getKey());
|
||||
mtSetting.setName(SettingTypeEnum.NAVIGATION.getKey());
|
||||
navigation.setStatus(navigation.getStatus() == null ? StatusEnum.ENABLED.getKey() : navigation.getStatus());
|
||||
String compareName = StringUtil.isNotBlank(navigation.getOldName()) ? navigation.getOldName() : navigation.getName();
|
||||
if (navigation != null) {
|
||||
List<NavigationDto> navigationNew = new ArrayList<>();
|
||||
List<NavigationDto> navigations = settingService.getNavigation(accountInfo.getMerchantId(), accountInfo.getStoreId(), null);
|
||||
if (!navigation.getStatus().equals(StatusEnum.DISABLE.getKey())) {
|
||||
boolean exit = false;
|
||||
for (NavigationDto item : navigations) {
|
||||
if (item.getName().equals(navigation.getName())) {
|
||||
if (item.getName().equals(compareName)) {
|
||||
exit = true;
|
||||
}
|
||||
}
|
||||
@ -85,7 +87,7 @@ public class BackendNavigateController extends BaseController {
|
||||
}
|
||||
if (navigations != null && navigations.size() > 0) {
|
||||
for (NavigationDto item : navigations) {
|
||||
if (!item.getName().equals(navigation.getName())) {
|
||||
if (!item.getName().equals(compareName)) {
|
||||
navigationNew.add(item);
|
||||
} else {
|
||||
if (!navigation.getStatus().equals(StatusEnum.DISABLE.getKey())) {
|
||||
|
||||
@ -4,6 +4,14 @@ import com.fuint.common.dto.BookDto;
|
||||
import com.fuint.common.dto.BookItemDto;
|
||||
import com.fuint.common.dto.UserInfo;
|
||||
import com.fuint.common.enums.BookStatusEnum;
|
||||
import com.fuint.common.enums.OrderModeEnum;
|
||||
import com.fuint.common.enums.OrderStatusEnum;
|
||||
import com.fuint.common.enums.OrderTypeEnum;
|
||||
import com.fuint.common.enums.PayTypeEnum;
|
||||
import com.fuint.common.enums.StatusEnum;
|
||||
import com.fuint.common.enums.YesOrNoEnum;
|
||||
import com.fuint.common.dto.OrderDto;
|
||||
import com.fuint.repository.model.MtOrder;
|
||||
import com.fuint.common.param.*;
|
||||
import com.fuint.common.service.*;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
@ -15,6 +23,7 @@ import com.fuint.repository.model.MtBookCate;
|
||||
import com.fuint.repository.model.MtBookItem;
|
||||
import com.fuint.repository.model.MtStore;
|
||||
import com.fuint.repository.model.MtUser;
|
||||
import java.math.BigDecimal;
|
||||
import com.fuint.utils.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -23,6 +32,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.text.ParseException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -69,6 +79,11 @@ public class ClientBookController extends BaseController {
|
||||
* */
|
||||
private StoreService storeService;
|
||||
|
||||
/**
|
||||
* 订单服务接口
|
||||
*/
|
||||
private OrderService orderService;
|
||||
|
||||
/**
|
||||
* 获取预约项目列表
|
||||
*/
|
||||
@ -94,6 +109,8 @@ public class ClientBookController extends BaseController {
|
||||
bookPage.setCateId(param.getCateId());
|
||||
bookPage.setPage(param.getPage());
|
||||
bookPage.setPageSize(param.getPageSize());
|
||||
// 仅展示启用的预约项目
|
||||
bookPage.setStatus(StatusEnum.ENABLED.getKey());
|
||||
PaginationResponse<BookDto> paginationResponse = bookService.queryBookListByPagination(bookPage);
|
||||
|
||||
Map<String, Object> result = new HashMap();
|
||||
@ -148,6 +165,88 @@ public class ClientBookController extends BaseController {
|
||||
return getSuccessResult(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 可预约时段剩余名额
|
||||
*/
|
||||
@ApiOperation(value="获取可预约时段剩余名额", notes="根据ID获取可预约时段剩余名额")
|
||||
@RequestMapping(value = "/remain", method = RequestMethod.POST)
|
||||
@CrossOrigin
|
||||
public ResponseObject remain(@RequestBody BookableParam param) throws BusinessCheckException,ParseException {
|
||||
List<Map<String, Object>> result = bookService.getBookableRemain(param);
|
||||
return getSuccessResult(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 预约签到开始
|
||||
*/
|
||||
@ApiOperation(value="预约签到开始", notes="记录预约签到开始时间")
|
||||
@RequestMapping(value = "/checkinStart", method = RequestMethod.POST)
|
||||
@CrossOrigin
|
||||
public ResponseObject checkinStart(@RequestBody Map<String, Object> param) throws BusinessCheckException {
|
||||
Integer bookItemId = param.get("bookItemId") == null ? 0 : Integer.parseInt(param.get("bookItemId").toString());
|
||||
UserInfo loginInfo = TokenUtil.getUserInfo();
|
||||
if (loginInfo == null) {
|
||||
return getFailureResult(1001);
|
||||
}
|
||||
MtBookItem bookItem = bookItemService.getBookItemById(bookItemId);
|
||||
if (bookItem == null || !bookItem.getUserId().equals(loginInfo.getId())) {
|
||||
return getFailureResult(2001);
|
||||
}
|
||||
// 已签到,直接返回
|
||||
if (bookItem.getCheckinStartTime() != null) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("checkinStartTime", bookItem.getCheckinStartTime());
|
||||
return getSuccessResult(result);
|
||||
}
|
||||
MtBookItem update = new MtBookItem();
|
||||
update.setId(bookItemId);
|
||||
update.setCheckinStartTime(new java.util.Date());
|
||||
update.setOperator(loginInfo.getId().toString());
|
||||
|
||||
bookItemService.updateBookItem(update);
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("checkinStartTime", update.getCheckinStartTime());
|
||||
return getSuccessResult(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 预约签到结束
|
||||
*/
|
||||
@ApiOperation(value="预约签到结束", notes="记录预约签到结束时间")
|
||||
@RequestMapping(value = "/checkinEnd", method = RequestMethod.POST)
|
||||
@CrossOrigin
|
||||
public ResponseObject checkinEnd(@RequestBody Map<String, Object> param) throws BusinessCheckException {
|
||||
Integer bookItemId = param.get("bookItemId") == null ? 0 : Integer.parseInt(param.get("bookItemId").toString());
|
||||
UserInfo loginInfo = TokenUtil.getUserInfo();
|
||||
if (loginInfo == null) {
|
||||
return getFailureResult(1001);
|
||||
}
|
||||
MtBookItem bookItem = bookItemService.getBookItemById(bookItemId);
|
||||
if (bookItem == null || !bookItem.getUserId().equals(loginInfo.getId())) {
|
||||
return getFailureResult(2001);
|
||||
}
|
||||
if (bookItem.getCheckinStartTime() == null) {
|
||||
return getFailureResult(2002, "未签到,无法结束");
|
||||
}
|
||||
java.util.Date endTime = new java.util.Date();
|
||||
BigDecimal hours = null;
|
||||
if (bookItem.getCheckinStartTime() != null) {
|
||||
long diffMs = endTime.getTime() - bookItem.getCheckinStartTime().getTime();
|
||||
double h = Math.max(diffMs / 3600000.0, 0);
|
||||
hours = new BigDecimal(h).setScale(1, BigDecimal.ROUND_HALF_UP);
|
||||
}
|
||||
MtBookItem update = new MtBookItem();
|
||||
update.setId(bookItemId);
|
||||
update.setCheckinEndTime(endTime);
|
||||
update.setCheckinDurationHours(hours);
|
||||
update.setOperator(loginInfo.getId().toString());
|
||||
bookItemService.updateBookItem(update);
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("checkinEndTime", endTime);
|
||||
result.put("checkinDurationHours", hours);
|
||||
return getSuccessResult(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 预约提交
|
||||
*/
|
||||
@ -175,6 +274,10 @@ public class ClientBookController extends BaseController {
|
||||
return getFailureResult(2001);
|
||||
}
|
||||
|
||||
if ((storeId == null || storeId <= 0) && bookInfo.getStoreId() != null && bookInfo.getStoreId() > 0) {
|
||||
storeId = bookInfo.getStoreId();
|
||||
}
|
||||
|
||||
MtBookItem mtBookItem = new MtBookItem();
|
||||
mtBookItem.setCateId(bookInfo.getCateId());
|
||||
mtBookItem.setUserId(mtUser.getId());
|
||||
@ -226,6 +329,68 @@ public class ClientBookController extends BaseController {
|
||||
return getSuccessResult(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取我的最新预约
|
||||
*/
|
||||
@ApiOperation(value = "获取我的最新预约")
|
||||
@RequestMapping(value = "/myLatest", method = RequestMethod.GET)
|
||||
@CrossOrigin
|
||||
public ResponseObject myLatest(HttpServletRequest request) throws BusinessCheckException {
|
||||
BookItemPage bookItemPage = new BookItemPage();
|
||||
Integer merchantId = merchantService.getMerchantId(request.getHeader("merchantNo"));
|
||||
if (merchantId > 0) {
|
||||
bookItemPage.setMerchantId(merchantId);
|
||||
}
|
||||
UserInfo loginInfo = TokenUtil.getUserInfo();
|
||||
bookItemPage.setUserId(loginInfo.getId());
|
||||
bookItemPage.setPage(1);
|
||||
bookItemPage.setPageSize(1);
|
||||
|
||||
PaginationResponse<BookItemDto> paginationResponse = bookItemService.queryBookItemListByPagination(bookItemPage);
|
||||
BookItemDto latest = null;
|
||||
if (paginationResponse.getContent() != null && paginationResponse.getContent().size() > 0) {
|
||||
latest = paginationResponse.getContent().get(0);
|
||||
}
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("bookInfo", latest);
|
||||
return getSuccessResult(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 预约完成
|
||||
*/
|
||||
@ApiOperation(value = "预约完成")
|
||||
@RequestMapping(value = "/complete", method = RequestMethod.POST)
|
||||
@CrossOrigin
|
||||
public ResponseObject complete(@RequestBody Map<String, Object> param) throws BusinessCheckException {
|
||||
Integer bookItemId = param.get("bookItemId") == null ? 0 : Integer.parseInt(param.get("bookItemId").toString());
|
||||
UserInfo loginInfo = TokenUtil.getUserInfo();
|
||||
if (loginInfo == null) {
|
||||
return getFailureResult(1001);
|
||||
}
|
||||
if (bookItemId <= 0) {
|
||||
return getFailureResult(2001);
|
||||
}
|
||||
MtBookItem bookItem = bookItemService.getBookItemById(bookItemId);
|
||||
if (bookItem == null || !bookItem.getUserId().equals(loginInfo.getId())) {
|
||||
return getFailureResult(2001);
|
||||
}
|
||||
MtBookItem update = new MtBookItem();
|
||||
update.setId(bookItemId);
|
||||
update.setStatus(BookStatusEnum.COMPLETE.getKey());
|
||||
update.setOperator(loginInfo.getId().toString());
|
||||
bookItemService.updateBookItem(update);
|
||||
if (bookItem.getOrderId() != null && bookItem.getOrderId() > 0) {
|
||||
OrderDto orderDto = new OrderDto();
|
||||
orderDto.setId(bookItem.getOrderId());
|
||||
orderDto.setStatus(OrderStatusEnum.COMPLETE.getKey());
|
||||
orderService.updateOrder(orderDto);
|
||||
}
|
||||
return getSuccessResult(update);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 取消预约
|
||||
*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
# \u57FA\u672C\u914D\u7F6E
|
||||
server.port=8080
|
||||
env.profile=dev
|
||||
env.properties.path=C:/Code/fuint/fuint-backend/configure/
|
||||
server.port=5918
|
||||
env.profile=prod
|
||||
env.properties.path=/www/wwwroot/configure/
|
||||
|
||||
# \u6570\u636E\u5E93\u914D\u7F6E
|
||||
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
|
||||
@ -19,7 +19,7 @@ spring.servlet.multipart.max-file-size=10MB
|
||||
spring.servlet.multipart.max-request-size=10MB
|
||||
|
||||
# mybatis\u914D\u7F6E
|
||||
mybatis-plus.mapper-locations = classpath*:/mapper/*.xml
|
||||
mybatis-plus.mapper-locations=classpath*:/mapper/*.xml
|
||||
|
||||
# \u9ED8\u8BA4\u65F6\u95F4\u683C\u5F0F
|
||||
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
|
||||
|
||||
@ -14,10 +14,10 @@
|
||||
<encoder>
|
||||
<pattern>%d{MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
<file>/data/log/fuint/server.log</file>
|
||||
<file>../log/fuint/server.log</file>
|
||||
<!-- 滚动记录文件,先将日志记录到指定文件,当符合某个条件时,将日志记录到其他文件。-->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>/data/log/fuint/archive/server_all_%d{yyyy-MM-dd}.%i.log.zip
|
||||
<fileNamePattern>../log/fuint/archive/server_all_%d{yyyy-MM-dd}.%i.log.zip
|
||||
</fileNamePattern>
|
||||
<!-- 当天的日志大小 超过${log.max.size}时,压缩日志并保存 -->
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
|
||||
@ -59,6 +59,9 @@ public class MtBook implements Serializable {
|
||||
@ApiModelProperty("描述")
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty("预约费用规则(JSON)")
|
||||
private String priceRules;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@ -65,6 +66,18 @@ public class MtBookItem implements Serializable {
|
||||
@ApiModelProperty("预约员工ID")
|
||||
private Integer serviceStaffId;
|
||||
|
||||
@ApiModelProperty("签到开始时间")
|
||||
private Date checkinStartTime;
|
||||
|
||||
@ApiModelProperty("签到结束时间")
|
||||
private Date checkinEndTime;
|
||||
|
||||
@ApiModelProperty("签到时长(小时)")
|
||||
private BigDecimal checkinDurationHours;
|
||||
|
||||
@ApiModelProperty("预约支付订单ID")
|
||||
private Integer orderId;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
</select>
|
||||
|
||||
<select id="findByOrderSn" resultType="com.fuint.repository.model.MtOrder">
|
||||
select * from mt_order o where o.ORDER_SN = #{orderSn}
|
||||
select * from mt_order o where o.ORDER_SN = #{orderSn} order by o.ID desc limit 1
|
||||
</select>
|
||||
|
||||
<select id="getPayMoney" resultType="java.math.BigDecimal">
|
||||
|
||||
Reference in New Issue
Block a user