魔法值
This commit is contained in:
@ -60,10 +60,23 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode ORDER_NOT_EXISTS = new ErrorCode(1_004_013_001, "订单不存在");
|
||||
ErrorCode ORDER_DETAIL_NOT_EXISTS = new ErrorCode(1_004_013_002, "订单明细不存在");
|
||||
ErrorCode RECHARGE_AMOUNT_NOT_EXISTS = new ErrorCode(1_004_013_003, "订单明细不存在");
|
||||
ErrorCode DINING_PLATES_NOT_EXISTS = new ErrorCode(1_004_013_004, "订单明细不存在");
|
||||
//ErrorCode DINING_PLATES_NOT_EXISTS = new ErrorCode(1_004_013_004, "订单明细不存在");
|
||||
ErrorCode USER_EXPAND_NOT_EXISTS = new ErrorCode(1_004_013_005, "订单明细不存在");
|
||||
ErrorCode USER_PREFERENCE_NOT_EXISTS = new ErrorCode(1_004_013_006, "订单明细不存在");
|
||||
ErrorCode ALLOC_NOT_EXISTS = new ErrorCode(1_004_013_007, "订单明细不存在");
|
||||
ErrorCode STORE_EVALUATE_NOT_EXISTS = new ErrorCode(1_004_013_008, "订单明细不存在");
|
||||
ErrorCode STORE_COMPLAIN_NOT_EXISTS = new ErrorCode(1_004_013_009, "订单明细不存在");
|
||||
|
||||
|
||||
ErrorCode DINING_PLATES_NOT_EXISTS = new ErrorCode(1_004_099_000, "餐盘不存在");
|
||||
|
||||
ErrorCode DINING_PLATES_ALREADY_BIND = new ErrorCode(1_004_099_001, "餐盘已被绑定");
|
||||
ErrorCode CARD_NOT_BIND = new ErrorCode(1_004_099_002, "请先绑定餐卡");
|
||||
ErrorCode DINING_PLATES_NOT_BIND = new ErrorCode(1_004_099_003, "餐盘未绑定");
|
||||
ErrorCode ORDER_ALREADY_COMPLETE = new ErrorCode(1_004_099_004, "该餐盘订单已完成,请重新绑定餐盘");
|
||||
ErrorCode FACE_NOT_BIND_USER = new ErrorCode(1_004_099_005, "该人脸未绑定用户");
|
||||
ErrorCode CARD_NOT_BIND_USER = new ErrorCode(1_004_099_006, "该卡未绑定用户");
|
||||
ErrorCode INSUFFICIENT_BALANCE = new ErrorCode(1_004_099_007, "余额不足30元,请充值");
|
||||
ErrorCode CARD_ALREADY_BIND = new ErrorCode(1_004_099_008, "卡号已绑定");
|
||||
|
||||
}
|
||||
|
@ -42,12 +42,8 @@ public class BalanceDeductionJob implements JobHandler {
|
||||
/**
|
||||
* 20分钟之后自动解绑并扣款
|
||||
*/
|
||||
private static final Integer EXPIRATION_TIME = 1;
|
||||
private static final Integer EXPIRATION_TIME = 20;
|
||||
|
||||
/**
|
||||
* 每次删除间隔的条数,如果值太高可能会造成数据库的压力过大
|
||||
*/
|
||||
private static final Integer DELETE_LIMIT = 100;
|
||||
|
||||
@Override
|
||||
@TenantIgnore
|
||||
|
@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.member.dal.dataobject.card.CardDO;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.card.CardMapper;
|
||||
import cn.iocoder.yudao.module.member.enums.CostTypeEnum;
|
||||
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||
import cn.iocoder.yudao.module.member.util.MemberConstants;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -123,7 +124,7 @@ public class CardServiceImpl implements CardService {
|
||||
@Override
|
||||
public BigDecimal getMoneyByUserId(Long userId) {
|
||||
CardDO lastCardDO = cardMapper.selectOne(Wrappers.<CardDO>lambdaQuery().eq(CardDO::getUserId, userId)
|
||||
.orderByDesc(CardDO::getCreateTime).last("limit 1"));
|
||||
.orderByDesc(CardDO::getCreateTime).last(MemberConstants.LIMIT_ONE));
|
||||
if (lastCardDO == null || lastCardDO.getMoney() == null) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
@ -137,7 +138,7 @@ public class CardServiceImpl implements CardService {
|
||||
*/
|
||||
public CardDO getLastCardDO() {
|
||||
CardDO lastCardDO = cardMapper.selectOne(Wrappers.<CardDO>lambdaQuery().eq(CardDO::getUserId, SecurityFrameworkUtils.getLoginUserId())
|
||||
.orderByDesc(CardDO::getCreateTime).last("limit 1"));
|
||||
.orderByDesc(CardDO::getCreateTime).last(MemberConstants.LIMIT_ONE));
|
||||
return lastCardDO;
|
||||
}
|
||||
|
||||
@ -149,7 +150,7 @@ public class CardServiceImpl implements CardService {
|
||||
@Override
|
||||
public AppCardMonthVO getMonthMoney(Long userId, String flag, String time) {
|
||||
|
||||
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern(MemberConstants.TIME_FORMAT);
|
||||
LocalDate parse = LocalDate.parse(time, dateFormatter);
|
||||
|
||||
// 获取指定日期所在月份的第一天
|
||||
|
@ -1,7 +1,6 @@
|
||||
package cn.iocoder.yudao.module.member.service.diningplates;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.diningplates.vo.DiningPlatesPageReqVO;
|
||||
@ -14,6 +13,7 @@ import cn.iocoder.yudao.module.member.dal.mysql.diningplates.DiningPlatesMapper;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.order.DishOrderMapper;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper;
|
||||
import cn.iocoder.yudao.module.member.service.card.CardService;
|
||||
import cn.iocoder.yudao.module.member.util.MemberConstants;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
@ -27,7 +27,7 @@ import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.DINING_PLATES_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 餐盘 Service 实现类
|
||||
@ -135,11 +135,11 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
||||
public AppUserInfoCardVO bind(String diningPlatesNum, String cardId) {
|
||||
DiningPlatesDO diningPlatesDO = diningPlatesMapper.selectOne(Wrappers.<DiningPlatesDO>lambdaQuery()
|
||||
.eq(DiningPlatesDO::getDiningPlatesNum, diningPlatesNum)
|
||||
.last("limit 1"));
|
||||
.last(MemberConstants.LIMIT_ONE));
|
||||
checkDiningPlates(diningPlatesDO);
|
||||
MemberUserDO memberUserDO = memberUserMapper.selectOne(Wrappers.<MemberUserDO>lambdaQuery()
|
||||
.eq(MemberUserDO::getCardId, cardId)
|
||||
.last("limit 1"));
|
||||
.last(MemberConstants.LIMIT_ONE));
|
||||
checkMemberUser(memberUserDO,false);
|
||||
//余额验证
|
||||
BigDecimal money = cardService.getMoneyByUserId(memberUserDO.getId());
|
||||
@ -170,11 +170,11 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
||||
public AppUserInfoCardVO bindByFace(String diningPlatesNum, Long faceId) {
|
||||
DiningPlatesDO diningPlatesDO = diningPlatesMapper.selectOne(Wrappers.<DiningPlatesDO>lambdaQuery()
|
||||
.eq(DiningPlatesDO::getDiningPlatesNum, diningPlatesNum)
|
||||
.last("limit 1"));
|
||||
.last(MemberConstants.LIMIT_ONE));
|
||||
checkDiningPlates(diningPlatesDO);
|
||||
MemberUserDO memberUserDO = memberUserMapper.selectOne(Wrappers.<MemberUserDO>lambdaQuery()
|
||||
.eq(MemberUserDO::getFaceId, faceId)
|
||||
.last("limit 1"));
|
||||
.last(MemberConstants.LIMIT_ONE));
|
||||
checkMemberUser(memberUserDO,true);
|
||||
//余额验证
|
||||
BigDecimal money = cardService.getMoneyByUserId(memberUserDO.getId());
|
||||
@ -203,7 +203,7 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
||||
public Boolean checkBind(String diningPlatesNum) {
|
||||
DiningPlatesDO diningPlatesDO = diningPlatesMapper.selectOne(Wrappers.<DiningPlatesDO>lambdaQuery()
|
||||
.eq(DiningPlatesDO::getDiningPlatesNum, diningPlatesNum)
|
||||
.last("limit 1"));
|
||||
.last(MemberConstants.LIMIT_ONE));
|
||||
if (diningPlatesDO == null || diningPlatesDO.getUserId() == null) {
|
||||
return false;
|
||||
}
|
||||
@ -213,9 +213,9 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
||||
public AppUserInfoCardVO appCheckBind(String diningPlatesNum) {
|
||||
DiningPlatesDO diningPlatesDO = diningPlatesMapper.selectOne(Wrappers.<DiningPlatesDO>lambdaQuery()
|
||||
.eq(DiningPlatesDO::getDiningPlatesNum, diningPlatesNum)
|
||||
.last("limit 1"));
|
||||
.last(MemberConstants.LIMIT_ONE));
|
||||
if (diningPlatesDO == null || diningPlatesDO.getUserId() == null) {
|
||||
throw new ServiceException(20003, "餐盘未绑定");
|
||||
throw exception(DINING_PLATES_NOT_BIND);
|
||||
}
|
||||
|
||||
MemberUserDO memberUserDO = memberUserMapper.selectById(diningPlatesDO.getUserId());
|
||||
@ -228,29 +228,29 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
||||
|
||||
public void checkDiningPlates(DiningPlatesDO diningPlatesDO) {
|
||||
if(diningPlatesDO == null) {
|
||||
throw new ServiceException(20000, "餐盘不存在");
|
||||
throw exception(DINING_PLATES_NOT_EXISTS);
|
||||
}
|
||||
if (diningPlatesDO.getUserId() != null) {
|
||||
throw new ServiceException(20001, "餐盘已被绑定");
|
||||
throw exception(DINING_PLATES_ALREADY_BIND);
|
||||
}
|
||||
}
|
||||
|
||||
public void checkMemberUser(MemberUserDO memberUserDo,Boolean isFace) {
|
||||
if(memberUserDo == null){
|
||||
if (isFace){
|
||||
throw new ServiceException(20005, "该人脸未绑定用户");
|
||||
throw exception(FACE_NOT_BIND_USER);
|
||||
}else {
|
||||
throw new ServiceException(20006, "该卡未绑定用户");
|
||||
throw exception(CARD_NOT_BIND_USER);
|
||||
}
|
||||
}
|
||||
if (StrUtil.isBlank(memberUserDo.getCardId())) {
|
||||
throw new ServiceException(20002, "请先绑定餐卡");
|
||||
throw exception(CARD_NOT_BIND);
|
||||
}
|
||||
}
|
||||
|
||||
public void checkMoney(BigDecimal money) {
|
||||
if (money.compareTo(new BigDecimal("30")) < 0) {
|
||||
throw new ServiceException(20007, "余额不足30元,请充值");
|
||||
if (money.compareTo(MemberConstants.ALARM_BALANCE) < 0) {
|
||||
throw exception(INSUFFICIENT_BALANCE);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package cn.iocoder.yudao.module.member.service.orderdetail;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.member.controller.app.orderdetail.vo.AppOrderDetailPageReqVO;
|
||||
@ -12,6 +11,7 @@ import cn.iocoder.yudao.module.member.dal.dataobject.orderdetail.OrderDetailDO;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.order.DishOrderMapper;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.orderdetail.OrderDetailMapper;
|
||||
import cn.iocoder.yudao.module.member.service.diningplates.DiningPlatesService;
|
||||
import cn.iocoder.yudao.module.member.util.MemberConstants;
|
||||
import cn.iocoder.yudao.module.system.api.carteen.CarteenApi;
|
||||
import cn.iocoder.yudao.module.system.api.carteen.dto.CarteenRespDto;
|
||||
import cn.iocoder.yudao.module.system.api.dish.DishesApi;
|
||||
@ -31,7 +31,7 @@ import java.math.RoundingMode;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.ORDER_DETAIL_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 订单明细 Service 实现类
|
||||
@ -73,15 +73,15 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||
//判定餐盘是否绑定
|
||||
Boolean b = diningPlatesService.checkBind(createReqVO.getDiningPlatesNum());
|
||||
if(!b){
|
||||
throw new ServiceException(20003,"餐盘未绑定");
|
||||
throw exception(DINING_PLATES_NOT_BIND);
|
||||
}
|
||||
//餐盘号去获取订单
|
||||
DishOrderDO dishOrderDO = dishOrderMapper.selectOne(Wrappers.<DishOrderDO>lambdaQuery().eq(DishOrderDO::getDiningPlatesNum, createReqVO.getDiningPlatesNum())
|
||||
.eq(DishOrderDO::getOrderStatus, DishOrderDO.INCOMPLETE)
|
||||
.orderByDesc(DishOrderDO::getCreateTime)
|
||||
.last("limit 1"));
|
||||
.last(MemberConstants.LIMIT_ONE));
|
||||
if(dishOrderDO==null){
|
||||
throw new ServiceException(20004,"该餐盘订单已完成,请重新绑定餐盘");
|
||||
throw exception(ORDER_ALREADY_COMPLETE);
|
||||
}
|
||||
|
||||
DishesRespDto dish = dishesApi.getDish(createReqVO.getDishesId());
|
||||
|
@ -1,7 +1,6 @@
|
||||
package cn.iocoder.yudao.module.member.service.storeevaluate;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
@ -10,6 +9,7 @@ import cn.iocoder.yudao.module.member.controller.admin.storeevaluate.vo.StoreEva
|
||||
import cn.iocoder.yudao.module.member.controller.app.storeevaluate.vo.AppStoreEvaluateSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.storeevaluate.StoreEvaluateDO;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.storeevaluate.StoreEvaluateMapper;
|
||||
import cn.iocoder.yudao.module.member.util.MemberConstants;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -78,7 +78,7 @@ public class StoreEvaluateServiceImpl implements StoreEvaluateService {
|
||||
StoreEvaluateDO storeEvaluateDO = storeEvaluateMapper.selectOne(Wrappers.<StoreEvaluateDO>lambdaQuery()
|
||||
.eq(StoreEvaluateDO::getUserId, createReqVO.getUserId())
|
||||
.eq(createReqVO.getStoreId() != null,StoreEvaluateDO::getStoreId,createReqVO.getStoreId())
|
||||
.last("limit 1"));
|
||||
.last(MemberConstants.LIMIT_ONE));
|
||||
if(storeEvaluateDO == null){
|
||||
StoreEvaluateDO add = new StoreEvaluateDO();
|
||||
BeanUtil.copyProperties(createReqVO,add);
|
||||
@ -98,7 +98,7 @@ public class StoreEvaluateServiceImpl implements StoreEvaluateService {
|
||||
StoreEvaluateDO storeEvaluateDO = storeEvaluateMapper.selectOne(Wrappers.<StoreEvaluateDO>lambdaQuery()
|
||||
.eq(StoreEvaluateDO::getUserId, loginUserId)
|
||||
.eq(storeId != null,StoreEvaluateDO::getStoreId,storeId)
|
||||
.last("limit 1"));
|
||||
.last(MemberConstants.LIMIT_ONE));
|
||||
return storeEvaluateDO;
|
||||
}
|
||||
}
|
@ -9,7 +9,6 @@ import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.*;
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
@ -41,6 +40,7 @@ import cn.iocoder.yudao.module.member.service.card.CardService;
|
||||
import cn.iocoder.yudao.module.member.service.order.OrderService;
|
||||
import cn.iocoder.yudao.module.member.service.orderdetail.OrderDetailService;
|
||||
import cn.iocoder.yudao.module.member.service.userexpand.UserExpandService;
|
||||
import cn.iocoder.yudao.module.member.util.MemberConstants;
|
||||
import cn.iocoder.yudao.module.system.api.dishesnutrition.DishesNutritionApi;
|
||||
import cn.iocoder.yudao.module.system.api.dishesnutrition.dto.DishesNutritionRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.sms.SmsCodeApi;
|
||||
@ -390,7 +390,7 @@ public class MemberUserServiceImpl implements MemberUserService {
|
||||
public Boolean bindCard(String cardId) {
|
||||
List<MemberUserDO> memberUserDOS = memberUserMapper.selectList(Wrappers.<MemberUserDO>lambdaQuery().eq(MemberUserDO::getCardId, cardId));
|
||||
if(memberUserDOS.size()>0){
|
||||
throw new ServiceException(600,"卡号已绑定");
|
||||
throw exception(CARD_ALREADY_BIND);
|
||||
}
|
||||
MemberUserDO memberUserDO = memberUserMapper.selectById(SecurityFrameworkUtils.getLoginUserId());
|
||||
memberUserDO.setCardId(cardId);
|
||||
@ -406,10 +406,8 @@ public class MemberUserServiceImpl implements MemberUserService {
|
||||
@Override
|
||||
public List<AppNutritionDayVo> nutritionDay(String start, String end) {
|
||||
List<AppNutritionDayVo> result = new ArrayList<>();
|
||||
//获取日期的订单
|
||||
//String start = time+" 00:00:00";
|
||||
//String end = time+" 23:59:59";
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(MemberConstants.TIME_FORMAT);
|
||||
|
||||
LocalDateTime startTime = LocalDateTime.parse(start, formatter);
|
||||
LocalDateTime endTime = LocalDateTime.parse(end, formatter);
|
||||
@ -477,8 +475,8 @@ public class MemberUserServiceImpl implements MemberUserService {
|
||||
//获取日期的订单
|
||||
//String newStart = start + " 00:00:00";
|
||||
//String newEnd = end + " 23:59:59";
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(MemberConstants.TIME_FORMAT);
|
||||
DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern(MemberConstants.DATE_FORMAT);
|
||||
LocalDateTime startTime = LocalDateTime.parse(start, formatter);
|
||||
LocalDateTime endTime = LocalDateTime.parse(end, formatter);
|
||||
List<DishOrderDO> dishOrderDOS = orderService.getDishOrderByTime(startTime, endTime);
|
||||
@ -575,12 +573,12 @@ public class MemberUserServiceImpl implements MemberUserService {
|
||||
//判断是否需要 科学膳食小建议
|
||||
if(Boolean.TRUE.equals(bol)){
|
||||
Map<String, String> build = MapUtil.builder(new HashMap<String, String>()).build();
|
||||
if(sum<=5000){
|
||||
build.put("prompt","您本周摄入的热量不达标,饮食均衡才能保证每天活动的能量和营养素供应充足,减肥也要吃饱,吃好哦。建议多吃肉类、水果以及根茎类的蔬菜。以上建议不成为医疗建议");
|
||||
}else if(sum<10000){
|
||||
build.put("prompt","您本周摄入的热量达标,饮食均衡才能保证每天活动的能量和营养素供应充足,减肥也要吃饱,吃好哦。建议多吃谷类、水果以及根茎类的蔬菜。以上建议不成为医疗建议");
|
||||
if(sum<=MemberConstants.STANDARDS){
|
||||
build.put("prompt",MemberConstants.INSUFFICIENT_PROPOSAL);
|
||||
}else if(sum<MemberConstants.EXCEED_STANDARDS){
|
||||
build.put("prompt",MemberConstants.STANDARDS_PROPOSAL);
|
||||
}else{
|
||||
build.put("prompt","您本周摄入的热量超标,饮食均衡才能保证每天活动的能量和营养素供应充足,减肥也要吃饱,吃好哦。建议多吃水果,少吃肉类以及根茎类的蔬菜。以上建议不成为医疗建议");
|
||||
build.put("prompt",MemberConstants.EXCEED_PROPOSAL);
|
||||
}
|
||||
maps.add(build);
|
||||
}
|
||||
@ -651,7 +649,7 @@ public class MemberUserServiceImpl implements MemberUserService {
|
||||
|
||||
MemberUserDO memberUserDO = memberUserMapper.selectById(userId);
|
||||
if(memberUserDO == null){
|
||||
throw new ServiceException(601,"用户不存在");
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
if(memberUserDO.getFaceId()!=null){
|
||||
memberUserMapper.deleteFace(memberUserDO.getFaceId());
|
||||
|
@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.member.controller.admin.userexpand.vo.UserExpandS
|
||||
import cn.iocoder.yudao.module.member.controller.app.user.vo.AppMemberUserUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.userexpand.UserExpandDO;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.userexpand.UserExpandMapper;
|
||||
import cn.iocoder.yudao.module.member.util.MemberConstants;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -75,7 +76,7 @@ public class UserExpandServiceImpl implements UserExpandService {
|
||||
public void updateUserExpandByuserId(Long userId, AppMemberUserUpdateReqVO reqVO) {
|
||||
UserExpandDO userExpandDO = userExpandMapper.selectOne(Wrappers.<UserExpandDO>lambdaQuery()
|
||||
.eq(UserExpandDO::getUserId, userId)
|
||||
.last("limit 1"));
|
||||
.last(MemberConstants.LIMIT_ONE));
|
||||
if(userExpandDO == null){
|
||||
UserExpandDO add = new UserExpandDO();
|
||||
BeanUtil.copyProperties(reqVO,add);
|
||||
@ -91,7 +92,7 @@ public class UserExpandServiceImpl implements UserExpandService {
|
||||
public UserExpandDO getUserExpandByuserId(Long userId) {
|
||||
UserExpandDO userExpandDO = userExpandMapper.selectOne(Wrappers.<UserExpandDO>lambdaQuery()
|
||||
.eq(UserExpandDO::getUserId, userId)
|
||||
.last("limit 1"));
|
||||
.last(MemberConstants.LIMIT_ONE));
|
||||
return userExpandDO;
|
||||
}
|
||||
}
|
@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.member.controller.admin.userpreference.vo.UserPre
|
||||
import cn.iocoder.yudao.module.member.controller.app.userpreference.vo.AppUserPreferenceSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.userpreference.UserPreferenceDO;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.userpreference.UserPreferenceMapper;
|
||||
import cn.iocoder.yudao.module.member.util.MemberConstants;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -75,7 +76,7 @@ public class UserPreferenceServiceImpl implements UserPreferenceService {
|
||||
public Boolean saveOrUpdate(AppUserPreferenceSaveReqVO updateReqVO) {
|
||||
UserPreferenceDO userPreferenceDO = userPreferenceMapper.selectOne(Wrappers.<UserPreferenceDO>lambdaQuery()
|
||||
.eq(UserPreferenceDO::getUserId, updateReqVO.getUserId())
|
||||
.last("limit 1"));
|
||||
.last(MemberConstants.LIMIT_ONE));
|
||||
Boolean result = true;
|
||||
if(userPreferenceDO == null){
|
||||
UserPreferenceDO add = new UserPreferenceDO();
|
||||
@ -93,7 +94,7 @@ public class UserPreferenceServiceImpl implements UserPreferenceService {
|
||||
public UserPreferenceDO getUserPreferenceByUserId(Long userId) {
|
||||
UserPreferenceDO userPreferenceDO = userPreferenceMapper.selectOne(Wrappers.<UserPreferenceDO>lambdaQuery()
|
||||
.eq(UserPreferenceDO::getUserId, userId)
|
||||
.last("limit 1"));
|
||||
.last(MemberConstants.LIMIT_ONE));
|
||||
return userPreferenceDO;
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package cn.iocoder.yudao.module.member.util;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author zt
|
||||
* @description <description class purpose>
|
||||
* @since 2024/4/12
|
||||
*/
|
||||
public class MemberConstants {
|
||||
|
||||
/**
|
||||
* 报警余额
|
||||
*/
|
||||
public static final BigDecimal ALARM_BALANCE = new BigDecimal("30");
|
||||
|
||||
/**
|
||||
* 时间格式
|
||||
*/
|
||||
public static final String TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
/**
|
||||
* 日期格式
|
||||
*/
|
||||
public static final String DATE_FORMAT = "yyyy-MM-dd";
|
||||
|
||||
/**
|
||||
* limit
|
||||
*/
|
||||
public static final String LIMIT_ONE = "limit 1";
|
||||
|
||||
/**
|
||||
* 热量达标量
|
||||
*/
|
||||
public static final Integer STANDARDS = 5000;
|
||||
|
||||
/**
|
||||
* 热量超标量
|
||||
*/
|
||||
public static final Integer EXCEED_STANDARDS = 10000;
|
||||
|
||||
/**
|
||||
* 热量不足建议
|
||||
*/
|
||||
public static final String INSUFFICIENT_PROPOSAL = "您本周摄入的热量不达标,饮食均衡才能保证每天活动的能量和营养素供应充足,减肥也要吃饱,吃好哦。建议多吃肉类、水果以及根茎类的蔬菜。以上建议不成为医疗建议";
|
||||
|
||||
/**
|
||||
* 热量达标建议
|
||||
*/
|
||||
public static final String STANDARDS_PROPOSAL = "您本周摄入的热量达标,饮食均衡才能保证每天活动的能量和营养素供应充足,减肥也要吃饱,吃好哦。建议多吃谷类、水果以及根茎类的蔬菜。以上建议不成为医疗建议";
|
||||
|
||||
/**
|
||||
* 热量超标建议
|
||||
*/
|
||||
public static final String EXCEED_PROPOSAL = "您本周摄入的热量超标,饮食均衡才能保证每天活动的能量和营养素供应充足,减肥也要吃饱,吃好哦。建议多吃水果,少吃肉类以及根茎类的蔬菜。以上建议不成为医疗建议";
|
||||
|
||||
}
|
Reference in New Issue
Block a user