Commit e560e5ab by wuwenlong

create order otp;

user login opt;
parent 538f83d0
...@@ -77,7 +77,7 @@ public class LoginController { ...@@ -77,7 +77,7 @@ public class LoginController {
/** /**
* 退出登录 * 退出登录
*/ */
// @ApiOperation(value = "退出") @ApiOperation(value = "退出")
@RequestMapping(value = "/logout", method = RequestMethod.GET) @RequestMapping(value = "/logout", method = RequestMethod.GET)
public R<String> loginOut(HttpServletRequest request){ public R<String> loginOut(HttpServletRequest request){
loginService.loginOut(request); loginService.loginOut(request);
......
...@@ -62,13 +62,14 @@ public class FrontTokenInterceptor implements HandlerInterceptor { ...@@ -62,13 +62,14 @@ public class FrontTokenInterceptor implements HandlerInterceptor {
SConsumer userEntry = frontTokenComponent.getLoginSConsumerEntry(request); SConsumer userEntry = frontTokenComponent.getLoginSConsumerEntry(request);
if(userEntry!=null){ if(userEntry!=null){
FrontTokenComponent.loginSConsumerEntryThreadLocal.set(userEntry); FrontTokenComponent.loginSConsumerEntryThreadLocal.set(userEntry);
}else {
token = "f788beab1ea14f0ab3a369e4c66ee627";
userEntry = new SConsumer();
userEntry.setId(1714160213741535234L);
userEntry.setAccount("15527462530");
userEntry.setPhone("15527462530");
FrontTokenComponent.loginSConsumerEntryThreadLocal.set(userEntry);
} }
/* SConsumer userEntry = new SConsumer();
userEntry.setUid(1520);
userEntry.setAccount("aaa");
userEntry.setNickname("nizbh");
userEntry.setRealName("relxiaohuige");
FrontTokenComponent.loginUserEntryThreadLocal.set(userEntry);*/
if(token == null || token.isEmpty() || userEntry == null){ if(token == null || token.isEmpty() || userEntry == null){
//判断路由,部分路由不管用户是否登录都可以访问 //判断路由,部分路由不管用户是否登录都可以访问
boolean result = frontTokenComponent.checkRouter(RequestUtil.getUri(request)); boolean result = frontTokenComponent.checkRouter(RequestUtil.getUri(request));
......
package share.system.request; package share.system.request;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
...@@ -21,11 +24,11 @@ import java.util.Date; ...@@ -21,11 +24,11 @@ import java.util.Date;
public class CreateOrderRequest { public class CreateOrderRequest {
@ApiModelProperty(value = "门店ID", required = true) @ApiModelProperty(value = "门店ID", required = true)
@NotBlank(message = "门店ID不能为空") @NotNull(message = "门店ID不能为空")
private Long storeId; private Long storeId;
@ApiModelProperty(value = "房间ID", required = true) @ApiModelProperty(value = "房间ID", required = true)
@NotBlank(message = "房间ID不能为空") @NotNull(message = "房间ID不能为空")
private Long roomId; private Long roomId;
@ApiModelProperty(value = "优惠券id") @ApiModelProperty(value = "优惠券id")
...@@ -34,39 +37,43 @@ public class CreateOrderRequest { ...@@ -34,39 +37,43 @@ public class CreateOrderRequest {
@ApiModelProperty(value = "套餐ID") @ApiModelProperty(value = "套餐ID")
private Long packId; private Long packId;
@ApiModelProperty(value = "订单类型(0:订房订单,1:续房订单,2:充值订单)", required = true) @ApiModelProperty(value = "订单类型(1:订房订单,2:续房订单,3:充值订单)", required = true)
@NotBlank(message = "订单类型不能为空") @NotNull(message = "订单类型不能为空")
private Integer orderType; private Integer orderType;
@ApiModelProperty(value = "续房订单的上一笔订单编号", required = true) @ApiModelProperty(value = "续房订单的上一笔订单编号", required = true)
private String preOrderNo; private String preOrderNo;
@ApiModelProperty(value = "购买方式(1:小时,2:套餐)", required = true) @ApiModelProperty(value = "购买方式(1:小时,2:套餐)", required = true)
@NotBlank(message = "购买方式不能为空") @NotNull(message = "购买方式不能为空")
private Integer buyType; private Integer buyType;
@ApiModelProperty(value = "支付类型(1:微信,2:支付宝)", required = true) @ApiModelProperty(value = "支付类型(1:微信,2:支付宝)", required = true)
@NotBlank(message = "支付类型不能为空") @NotNull(message = "支付类型不能为空")
private Integer payType; private Integer payType;
/** 预约开始时间 */ /** 预约开始时间 */
@ApiModelProperty(value = "预约开始时间 yyyy-MM-dd HH:mm", required = true) @ApiModelProperty(value = "预约开始时间 yyyy-MM-dd HH:mm:ss", required = true)
@NotBlank(message = "预约开始时间不能为空") @NotNull(message = "预约开始时间不能为空")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date preStartDate; private Date preStartDate;
/** 预约结束时间 */ /** 预约结束时间 */
@ApiModelProperty(value = "预约结束时间 yyyy-MM-dd HH:mm", required = true) @ApiModelProperty(value = "预约结束时间 yyyy-MM-dd HH:mm:ss", required = true)
@NotBlank(message = "预约结束时间不能为空") @NotNull(message = "预约结束时间不能为空")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date preEndDate; private Date preEndDate;
@ApiModelProperty(value = "总金额") @ApiModelProperty(value = "总金额")
@NotBlank(message = "总金额不能为空") @NotNull(message = "总金额不能为空")
private BigDecimal totalFee; private BigDecimal totalFee;
@ApiModelProperty(value = "优惠券优惠金额") @ApiModelProperty(value = "优惠券优惠金额")
private BigDecimal couponFee; private BigDecimal couponFee;
@ApiModelProperty(value = "实际支付金额") @ApiModelProperty(value = "实际支付金额")
@NotBlank(message = "实际支付金额不能为空") @NotNull(message = "实际支付金额不能为空")
private BigDecimal payFee; private BigDecimal payFee;
} }
...@@ -32,11 +32,4 @@ public class LoginMobileRequest implements Serializable { ...@@ -32,11 +32,4 @@ public class LoginMobileRequest implements Serializable {
@Pattern(regexp = RegularConstants.VALIDATE_CODE_NUM_SIX, message = "验证码格式错误,验证码必须为6位数字") @Pattern(regexp = RegularConstants.VALIDATE_CODE_NUM_SIX, message = "验证码格式错误,验证码必须为6位数字")
private String captcha; private String captcha;
@ApiModelProperty(value = "推广人id")
@JsonProperty(value = "spread_spid")
private Integer spreadPid;
@ApiModelProperty(value = "拓客渠道")
private String channel;
} }
...@@ -79,7 +79,7 @@ public interface SConsumerService extends IService<SConsumer> ...@@ -79,7 +79,7 @@ public interface SConsumerService extends IService<SConsumer>
* @param channel 渠道 * @param channel 渠道
* @return * @return
*/ */
SConsumer registerPhone(String phone, String channel); SConsumer registerPhone(String phone);
SConsumer getByPhone(String phone); SConsumer getByPhone(String phone);
......
...@@ -86,7 +86,7 @@ public class LoginServiceImpl implements LoginService { ...@@ -86,7 +86,7 @@ public class LoginServiceImpl implements LoginService {
//查询手机号信息 //查询手机号信息
SConsumer user = sConsumerService.getByPhone(loginRequest.getPhone()); SConsumer user = sConsumerService.getByPhone(loginRequest.getPhone());
if (ObjectUtil.isNull(user)) {// 此用户不存在,走新用户注册流程 if (ObjectUtil.isNull(user)) {// 此用户不存在,走新用户注册流程
user = sConsumerService.registerPhone(loginRequest.getPhone(), loginRequest.getChannel()); user = sConsumerService.registerPhone(loginRequest.getPhone());
} else { } else {
if (Objects.isNull(user)|| YesNoEnum.no.getIndex().equals(user.getStatus())) { if (Objects.isNull(user)|| YesNoEnum.no.getIndex().equals(user.getStatus())) {
throw new BaseException("当前账户已禁用,请联系管理员!"); throw new BaseException("当前账户已禁用,请联系管理员!");
......
...@@ -121,7 +121,7 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer ...@@ -121,7 +121,7 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
} }
@Override @Override
public SConsumer registerPhone(String phone, String channel) { public SConsumer registerPhone(String phone) {
return null; return null;
} }
......
...@@ -230,6 +230,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen ...@@ -230,6 +230,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
private SOrder generatSOrder(CreateOrderRequest request, SConsumer user){ private SOrder generatSOrder(CreateOrderRequest request, SConsumer user){
SOrder sOrder = new SOrder(); SOrder sOrder = new SOrder();
BeanUtils.copyProperties(request,sOrder); BeanUtils.copyProperties(request,sOrder);
sOrder.setTotalPrice(request.getTotalFee());
sOrder.setCouponPrice(request.getCouponFee());
sOrder.setPayPrice(request.getPayFee());
//设置订单号 //设置订单号
sOrder.setOrderNo(BaseUtil.getOrderNo(PayTypeEnum.getEnumByCode(request.getPayType()).getValue())); sOrder.setOrderNo(BaseUtil.getOrderNo(PayTypeEnum.getEnumByCode(request.getPayType()).getValue()));
sOrder.setConsumerId(user.getId()); sOrder.setConsumerId(user.getId());
...@@ -271,6 +274,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen ...@@ -271,6 +274,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
// 计算优惠券金额 // 计算优惠券金额
if (ObjectUtil.isNull(request.getCouponId()) || request.getCouponId() <= 0) { if (ObjectUtil.isNull(request.getCouponId()) || request.getCouponId() <= 0) {
priceResponse.setCouponFee(BigDecimal.ZERO); priceResponse.setCouponFee(BigDecimal.ZERO);
priceResponse.setPayFee(totalPrice);
} else { } else {
// 判断优惠券是否可以使用 // 判断优惠券是否可以使用
SConsumerCoupon consumerCoupon = consumerCouponService.getById(request.getCouponId()); SConsumerCoupon consumerCoupon = consumerCouponService.getById(request.getCouponId());
......
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