Commit 66a455f8 by 吕明尚

更改魔法值

parent 12c9d33a
......@@ -45,4 +45,13 @@ public enum CouponTypeEnum {
}
return null;
}
public static CouponTypeEnum getTypeCode(Integer code) {
for (CouponTypeEnum type : CouponTypeEnum.values()) {
if (type.getCode().equals(code)) {
return type;
}
}
return null;
}
}
package share.common.enums;
public enum PayStatusEnum {
//0:未支付,1:已支付
UNPAID(0, "未支付"),
PAID(1, "已支付");
private Integer code;
private String name;
PayStatusEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
PayStatusEnum() {
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
......@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.constant.Constants;
import share.common.constant.SmsConstants;
import share.common.enums.ConsumerCouponUseStatusEnum;
import share.common.exception.base.BaseException;
import share.common.utils.BaseUtil;
import share.common.utils.DateUtil;
......@@ -160,7 +161,7 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
SConsumer currentUser = getInfo();
SConsumerCoupon sConsumerCoupon = new SConsumerCoupon();
sConsumerCoupon.setConsumerId(currentUser.getId());
sConsumerCoupon.setUseStatus(0);
sConsumerCoupon.setUseStatus(ConsumerCouponUseStatusEnum.WAIT_USE.getCode());
int count = sConsumerCouponService.selectSConsumerCouponConut(sConsumerCoupon);
if(count>0){
currentUser.setNumber(count);
......
......@@ -361,8 +361,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
@Override
public List<SOrder> queryList() {
LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SOrder::getPayStatus, 1);
queryWrapper.ne(SOrder::getRefundStatus, 0);
queryWrapper.eq(SOrder::getPayStatus, PayStatusEnum.PAID.getCode());
queryWrapper.ne(SOrder::getRefundStatus, RefundStatusEnum.UNREFUND.getCode());
return sOrderMapper.selectList(queryWrapper);
}
......@@ -446,7 +446,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
if (date.compareTo(consumerCoupon.getEndDate()) > 0) {
throw new BaseException("此优惠券已经失效了");
}
CouponTypeEnum couponType = CouponTypeEnum.getType(consumerCoupon.getCouponType());
CouponTypeEnum couponType = CouponTypeEnum.getTypeCode(consumerCoupon.getCouponType());
switch (couponType){
case DISCOUNT://TODO 折扣券
break;
......
......@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import share.common.enums.RoleTypeEnum;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -142,7 +143,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
@Override
public String openDoor(Long id) {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
if(!user.getRoleType().equals("1")){
if (!user.getRoleType().equals(RoleTypeEnum.CLEANER.getCode())) {
throw new RuntimeException("当前用户不是保洁人员");
}
SRoom room = sRoomMapper.selectById(id);
......
......@@ -11,6 +11,7 @@ import org.bouncycastle.util.Store;
import org.locationtech.spatial4j.context.SpatialContext;
import org.locationtech.spatial4j.distance.DistanceUtils;
import org.springframework.beans.BeanUtils;
import share.common.enums.RoleTypeEnum;
import share.common.enums.YesNoEnum;
import share.common.exception.base.BaseException;
import share.common.utils.DateUtils;
......@@ -253,7 +254,7 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
@Override
public List<SStoreVo> listVoByCleaner() {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
if (Integer.parseInt(user.getRoleType()) != 1) {
if (!user.getRoleType().equals(RoleTypeEnum.CLEANER.getCode())) {
throw new BaseException("当前用户不是保洁人员!");
}
//查询保洁人员所属门店
......
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