Commit 12c9d33a by 吕明尚

增加枚举类

parent ed350316
package share.common.enums;
public enum AvailableEnum {
//(0:可用,1:不可以)
AVAILABLE(0, "可用"),
UNAVAILABLE(1, "不可用");
private Integer code;
private String name;
AvailableEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
AvailableEnum() {
}
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;
}
}
package share.common.enums;
public enum CleaningStatusEnum {
UNCLEAN(0, "未保洁"),
CLEANING(1, "保洁中"),
CLEANED(2, "已保洁");
private Integer code;
private String name;
CleaningStatusEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
CleaningStatusEnum() {
}
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;
}
}
package share.common.enums;
public enum ConsumerCouponUseStatusEnum {
//0:待使用,1:已使用,2:已失效
WAIT_USE(0, "待使用"),
USED(1, "已使用"),
INVALID(2, "已失效");
private Integer code;
private String name;
ConsumerCouponUseStatusEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
ConsumerCouponUseStatusEnum() {
}
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;
}
}
package share.common.enums;
public enum RoleTypeEnum {
MEMBRO(0, "会员"),
CLEANER(1, "保洁人员"),
ADMIN(2, "后台管理人员");;
private Integer code;
private String name;
RoleTypeEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
RoleTypeEnum() {
}
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;
}
}
......@@ -185,7 +185,7 @@ public class OrderTask {
logger.info("=================" + sOrder.getCouponId() + "=================");
logger.info("=================================================");
// 退优惠券
if (Objects.nonNull(sOrder) && sOrder.getCouponId() > 0) {
if (sOrder.getCouponId() > 0) {
SConsumerCoupon couponUser = consumerCouponService.getById(sOrder.getCouponId());
couponUser.setUseStatus(CouponStatusEnum.NORMAL.getValue());
consumerCouponService.updateById(couponUser);
......@@ -225,12 +225,12 @@ public class OrderTask {
});
}
});
boolean execute = transactionTemplate.execute( e -> {
Boolean execute = transactionTemplate.execute(e -> {
orderService.updateBatchById(sOrders,sOrders.size());
roomService.updateBatchById(roomList,roomList.size());
return true;
});
if(!execute){
if (Boolean.FALSE.equals(execute)) {
logger.error("预约订单到期自动更新订单状态失败!");
throw new BaseException("预约订单到期自动更新订单状态失败!");
}
......
......@@ -51,7 +51,7 @@ public class SConsumer
/** 会员角色类型(0:会员,1:保洁人员,2:后台管理人员) */
@ApiModelProperty(value = "会员角色类型", example = "0=:会员,1:保洁人员,2:后台管理人员")
private String roleType;
private Integer roleType;
/** 会员性别(0:未知,1:男,2:女) */
@ApiModelProperty(value = "会员性别", example = "0=:未知,1:男,2:女")
......
......@@ -58,7 +58,7 @@ public class SConsumerCoupon extends BaseEntity
/** 优惠券类型(1:折扣券,2,满减券,3:时长券) */
@Excel(name = "优惠券类型(1:折扣券,2,满减券,3:时长券)")
private String couponType;
private Integer couponType;
/** 门槛时长 */
@Excel(name = "门槛时长")
......
......@@ -3,6 +3,8 @@ package share.system.service.impl;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import share.common.enums.CleaningStatusEnum;
import share.common.enums.RoleTypeEnum;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -148,12 +150,12 @@ public class SCleanRecordsServiceImpl implements ISCleanRecordsService
@Override
public SCleanRecords getByCleanerId() {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
if(!user.getRoleType().equals("1")){
if (!user.getRoleType().equals(RoleTypeEnum.CLEANER.getCode())) {
throw new RuntimeException("当前用户不是保洁人员");
}
LambdaQueryWrapper<SCleanRecords> queryWrapper = new LambdaQueryWrapper();
LambdaQueryWrapper<SCleanRecords> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(SCleanRecords::getConsumerId,user.getId());
queryWrapper.in(SCleanRecords::getStatus,1);
queryWrapper.in(SCleanRecords::getStatus, CleaningStatusEnum.CLEANING.getCode());
SCleanRecords sCleanRecords = sCleanRecordsMapper.selectOne(queryWrapper);
if(sCleanRecords == null){
throw new RuntimeException("当前用户没有保洁任务");
......
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