新版
This commit is contained in:
@ -38,40 +38,54 @@ public class AppDiningPlatesController {
|
||||
|
||||
@GetMapping("/bindByCard")
|
||||
@Operation(summary = "打卡绑定餐盘")
|
||||
public CommonResult<AppUserInfoCardVO> bindByCard(String diningPlatesNum,String cardId) {
|
||||
return success(diningPlatesService.bind(diningPlatesNum,cardId));
|
||||
public CommonResult<AppUserInfoCardVO> bindByCard(String diningPlatesNum,String cardId,Long storeId) {
|
||||
return success(diningPlatesService.bind(diningPlatesNum,cardId,storeId));
|
||||
}
|
||||
|
||||
@GetMapping("/bindByFace")
|
||||
@Operation(summary = "人脸绑定餐盘")
|
||||
public CommonResult<AppUserInfoCardVO> bindByFace(String diningPlatesNum, Long faceId) {
|
||||
return success(diningPlatesService.bindByFace(diningPlatesNum,faceId));
|
||||
public CommonResult<AppUserInfoCardVO> bindByFace(String diningPlatesNum, Long faceId,Long storeId) {
|
||||
return success(diningPlatesService.bindByFace(diningPlatesNum,faceId,storeId));
|
||||
}
|
||||
|
||||
@GetMapping("/checkBind")
|
||||
@Operation(summary = "验证餐盘绑定")
|
||||
public CommonResult<AppUserInfoCardVO> checkBind(String diningPlatesNum) {
|
||||
return success(diningPlatesService.appCheckBind(diningPlatesNum));
|
||||
public CommonResult<AppUserInfoCardVO> checkBind(String diningPlatesNum,Long storeId) {
|
||||
return success(diningPlatesService.appCheckBind(diningPlatesNum,storeId));
|
||||
}
|
||||
|
||||
@GetMapping("/unbind")
|
||||
@Operation(summary = "餐盘解绑")
|
||||
public CommonResult<String> unbind(String diningPlatesNum) {
|
||||
diningPlatesService.unbind(diningPlatesNum);
|
||||
public CommonResult<String> unbind(String diningPlatesNum,Long storeId) {
|
||||
diningPlatesService.unbind(diningPlatesNum,storeId);
|
||||
return success(diningPlatesNum);
|
||||
}
|
||||
|
||||
@GetMapping("/getUserAndDish")
|
||||
@Operation(summary = "根据餐盘号获取当前余额")
|
||||
public CommonResult<AppUserInfo> getMoney(String cId, Long dishesId) {
|
||||
return success(diningPlatesService.getMoney(cId,dishesId));
|
||||
public CommonResult<AppUserInfo> getMoney(String cId, Long dishesId,Long storeId) {
|
||||
return success(diningPlatesService.getMoney(cId,dishesId,storeId));
|
||||
}
|
||||
|
||||
@GetMapping("/getBind")
|
||||
@Operation(summary = "获取绑定餐盘")
|
||||
@Operation(summary = "获取绑定餐盘验证")
|
||||
public CommonResult<List<String>> getBind() {
|
||||
return success(diningPlatesService.getBindDiningPlatesList());
|
||||
}
|
||||
|
||||
@GetMapping("/checkBindAndUnBind")
|
||||
@Operation(summary = "餐盘解绑")
|
||||
public CommonResult<String> checkBindAndUnBind(String diningPlatesNum,Long storeId) {
|
||||
Boolean b = diningPlatesService.checkBindAndUnBind(diningPlatesNum, storeId);
|
||||
CommonResult<String> result = new CommonResult<>();
|
||||
result.setCode(200);
|
||||
if (b) {
|
||||
result.setMsg("餐盘已解绑");
|
||||
result.setData("bind");
|
||||
}else {
|
||||
result.setData("unbind");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -32,5 +32,8 @@ public class AppOrderDetailSaveReqVO {
|
||||
@Schema(description = "餐盘编号")
|
||||
private String diningPlatesNum;
|
||||
|
||||
@Schema(description = "门店Id")
|
||||
private Long storeId;
|
||||
|
||||
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.member.job;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.card.CardDO;
|
||||
@ -12,6 +13,7 @@ import cn.iocoder.yudao.module.member.service.diningplates.DiningPlatesService;
|
||||
import cn.iocoder.yudao.module.member.service.order.OrderService;
|
||||
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -68,7 +70,8 @@ public class BalanceDeductionJob implements JobHandler {
|
||||
List<CardDO> list = new ArrayList<>();
|
||||
toPay.forEach(dishOrderDO -> {
|
||||
//新的总价
|
||||
BigDecimal total = new BigDecimal(stringRedisTemplate.opsForValue().get(dishOrderDO.getDiningPlatesNum()));
|
||||
String s = stringRedisTemplate.opsForValue().get(dishOrderDO.getDiningPlatesNum() + "-" + dishOrderDO.getStoreId());
|
||||
BigDecimal total = new BigDecimal(StrUtil.isBlank(s)?"0":s);
|
||||
//BigDecimal total = new BigDecimal(0.01);
|
||||
Long userId = dishOrderDO.getUserId();
|
||||
CardDO cardDO = new CardDO();
|
||||
@ -146,7 +149,7 @@ public class BalanceDeductionJob implements JobHandler {
|
||||
|
||||
dishOrderDO.setTotalMoney(total);
|
||||
dishOrderDO.setUpdateTime(LocalDateTime.now());
|
||||
stringRedisTemplate.delete(dishOrderDO.getDiningPlatesNum());
|
||||
stringRedisTemplate.delete(dishOrderDO.getDiningPlatesNum()+ "-" + dishOrderDO.getStoreId());
|
||||
});
|
||||
//取消批量,防止同一人订餐少扣款
|
||||
//cardService.insertBatch(list);
|
||||
|
@ -84,23 +84,25 @@ public interface DiningPlatesService {
|
||||
* 绑定
|
||||
* @return
|
||||
*/
|
||||
AppUserInfoCardVO bind(String diningPlatesNum,String cardId);
|
||||
AppUserInfoCardVO bind(String diningPlatesNum,String cardId,Long storeId);
|
||||
|
||||
AppUserInfoCardVO bindByFace(String diningPlatesNum, Long faceId);
|
||||
AppUserInfoCardVO bindByFace(String diningPlatesNum, Long faceId,Long storeId);
|
||||
|
||||
Boolean checkBind(String diningPlatesNum);
|
||||
Boolean checkBind(String diningPlatesNum,Long storeId);
|
||||
|
||||
AppUserInfoCardVO appCheckBind(String diningPlatesNum);
|
||||
AppUserInfoCardVO appCheckBind(String diningPlatesNum,Long storeId);
|
||||
|
||||
List<DiningPlatesStoreVO> getDiningPlatesNum(LocalDateTime localDateTime, Integer time);
|
||||
|
||||
void unbind(String diningPlatesNum);
|
||||
void unbind(String diningPlatesNum,Long storeId);
|
||||
|
||||
AppUserInfo getMoney(String diningPlatesNum, Long dishId);
|
||||
AppUserInfo getMoney(String diningPlatesNum, Long dishId,Long storeId);
|
||||
|
||||
/**
|
||||
* 获取绑定餐盘列表
|
||||
* @return
|
||||
*/
|
||||
List<String> getBindDiningPlatesList();
|
||||
|
||||
Boolean checkBindAndUnBind(String diningPlatesNum,Long storeId);
|
||||
}
|
@ -75,7 +75,8 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
||||
// 插入
|
||||
DiningPlatesDO diningPlates = BeanUtils.toBean(createReqVO, DiningPlatesDO.class);
|
||||
List<DiningPlatesDO> diningPlatesDOS = diningPlatesMapper.selectList(Wrappers.<DiningPlatesDO>lambdaQuery()
|
||||
.eq(DiningPlatesDO::getDiningPlatesNum, diningPlates.getDiningPlatesNum()));
|
||||
.eq(DiningPlatesDO::getDiningPlatesNum, diningPlates.getDiningPlatesNum())
|
||||
.eq(DiningPlatesDO::getStoreId, diningPlates.getStoreId()));
|
||||
if(CollectionUtil.isNotEmpty(diningPlatesDOS)){
|
||||
throw exception(DINING_PLATES_ALREADY);
|
||||
}
|
||||
@ -114,7 +115,14 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
||||
|
||||
@Override
|
||||
public PageResult<DiningPlatesDO> getDiningPlatesPage(DiningPlatesPageReqVO pageReqVO) {
|
||||
return diningPlatesMapper.selectPage(pageReqVO);
|
||||
PageResult<DiningPlatesDO> diningPlatesDOPageResult = diningPlatesMapper.selectPage(pageReqVO);
|
||||
List<DiningPlatesDO> list = diningPlatesDOPageResult.getList();
|
||||
if(CollectionUtil.isNotEmpty(list)){
|
||||
list.forEach(diningPlatesDO -> {
|
||||
diningPlatesDO.setStoreName(carteenApi.getCarteenById(diningPlatesDO.getStoreId()).getStoresName());
|
||||
});
|
||||
}
|
||||
return diningPlatesDOPageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -159,9 +167,10 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AppUserInfoCardVO bind(String diningPlatesNum, String cardId) {
|
||||
public AppUserInfoCardVO bind(String diningPlatesNum, String cardId,Long storeId) {
|
||||
DiningPlatesDO diningPlatesDO = diningPlatesMapper.selectOne(Wrappers.<DiningPlatesDO>lambdaQuery()
|
||||
.eq(DiningPlatesDO::getDiningPlatesNum, diningPlatesNum)
|
||||
.eq(DiningPlatesDO::getStoreId,storeId)
|
||||
.last(MemberConstants.LIMIT_ONE));
|
||||
checkDiningPlates(diningPlatesDO);
|
||||
MemberUserDO memberUserDO = memberUserMapper.selectOne(Wrappers.<MemberUserDO>lambdaQuery()
|
||||
@ -185,14 +194,14 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
||||
dishOrderDO.setDiningPlatesNum(diningPlatesNum)
|
||||
.setOrderStatus(DishOrderDO.INCOMPLETE)
|
||||
.setUserId(memberUserDO.getId())
|
||||
.setStoreId(diningPlatesDO.getStoreId())
|
||||
.setStoreName(diningPlatesDO.getStoreName());
|
||||
.setStoreId(storeId)
|
||||
.setStoreName(carteenApi.getCarteenById(storeId).getStoresName());
|
||||
dishOrderMapper.insert(dishOrderDO);
|
||||
|
||||
diningPlatesDO.setOrderId(dishOrderDO.getId());
|
||||
diningPlatesMapper.updateById(diningPlatesDO);
|
||||
//设置总价
|
||||
stringRedisTemplate.opsForValue().set(diningPlatesNum, "0");
|
||||
stringRedisTemplate.opsForValue().set(diningPlatesNum+"-"+storeId, "0");
|
||||
AppUserInfoCardVO data = new AppUserInfoCardVO();
|
||||
data.setName(memberUserDO.getNickname());
|
||||
data.setMoney(money);
|
||||
@ -203,9 +212,10 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AppUserInfoCardVO bindByFace(String diningPlatesNum, Long faceId) {
|
||||
public AppUserInfoCardVO bindByFace(String diningPlatesNum, Long faceId,Long storeId) {
|
||||
DiningPlatesDO diningPlatesDO = diningPlatesMapper.selectOne(Wrappers.<DiningPlatesDO>lambdaQuery()
|
||||
.eq(DiningPlatesDO::getDiningPlatesNum, diningPlatesNum)
|
||||
.eq(DiningPlatesDO::getStoreId,storeId)
|
||||
.last(MemberConstants.LIMIT_ONE));
|
||||
checkDiningPlates(diningPlatesDO);
|
||||
MemberUserDO memberUserDO = memberUserMapper.selectOne(Wrappers.<MemberUserDO>lambdaQuery()
|
||||
@ -227,14 +237,14 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
||||
dishOrderDO.setDiningPlatesNum(diningPlatesNum)
|
||||
.setOrderStatus(DishOrderDO.INCOMPLETE)
|
||||
.setUserId(memberUserDO.getId())
|
||||
.setStoreId(diningPlatesDO.getStoreId())
|
||||
.setStoreName(diningPlatesDO.getStoreName());
|
||||
.setStoreId(storeId)
|
||||
.setStoreName(carteenApi.getCarteenById(storeId).getStoresName());
|
||||
dishOrderMapper.insert(dishOrderDO);
|
||||
|
||||
diningPlatesDO.setOrderId(dishOrderDO.getId());
|
||||
diningPlatesMapper.updateById(diningPlatesDO);
|
||||
//设置总价
|
||||
stringRedisTemplate.opsForValue().set(diningPlatesNum, "0");
|
||||
stringRedisTemplate.opsForValue().set(diningPlatesNum+"-"+storeId, "0");
|
||||
AppUserInfoCardVO data = new AppUserInfoCardVO();
|
||||
data.setName(memberUserDO.getNickname());
|
||||
data.setMoney(money);
|
||||
@ -244,9 +254,10 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean checkBind(String diningPlatesNum) {
|
||||
public Boolean checkBind(String diningPlatesNum, Long storeId) {
|
||||
DiningPlatesDO diningPlatesDO = diningPlatesMapper.selectOne(Wrappers.<DiningPlatesDO>lambdaQuery()
|
||||
.eq(DiningPlatesDO::getDiningPlatesNum, diningPlatesNum)
|
||||
.eq(DiningPlatesDO::getStoreId,storeId)
|
||||
.last(MemberConstants.LIMIT_ONE));
|
||||
if (diningPlatesDO == null || diningPlatesDO.getUserId() == null) {
|
||||
return false;
|
||||
@ -258,9 +269,10 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppUserInfoCardVO appCheckBind(String diningPlatesNum) {
|
||||
public AppUserInfoCardVO appCheckBind(String diningPlatesNum, Long storeId) {
|
||||
DiningPlatesDO diningPlatesDO = diningPlatesMapper.selectOne(Wrappers.<DiningPlatesDO>lambdaQuery()
|
||||
.eq(DiningPlatesDO::getDiningPlatesNum, diningPlatesNum)
|
||||
.eq(DiningPlatesDO::getStoreId,storeId)
|
||||
.last(MemberConstants.LIMIT_ONE));
|
||||
if (diningPlatesDO == null || diningPlatesDO.getUserId() == null) {
|
||||
throw exception(DINING_PLATES_NOT_BIND);
|
||||
@ -374,9 +386,9 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void unbind(String diningPlatesNum) {
|
||||
public void unbind(String diningPlatesNum,Long storeId) {
|
||||
|
||||
String money = stringRedisTemplate.opsForValue().get(diningPlatesNum);
|
||||
String money = stringRedisTemplate.opsForValue().get(diningPlatesNum+"-"+storeId);
|
||||
if(StringUtils.isBlank(money)){
|
||||
throw exception(DINING_PLATES_NOT_BIND);
|
||||
}
|
||||
@ -386,6 +398,7 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
||||
}
|
||||
DiningPlatesDO diningPlatesDO = diningPlatesMapper.selectOne(Wrappers.<DiningPlatesDO>lambdaQuery()
|
||||
.eq(DiningPlatesDO::getDiningPlatesNum, diningPlatesNum)
|
||||
.eq(DiningPlatesDO::getStoreId,storeId)
|
||||
.last("limit 1"));
|
||||
|
||||
dishOrderMapper.update(Wrappers.<DishOrderDO>lambdaUpdate()
|
||||
@ -403,9 +416,10 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppUserInfo getMoney(String diningPlatesNum,Long dishId) {
|
||||
public AppUserInfo getMoney(String diningPlatesNum,Long dishId,Long storeId) {
|
||||
DiningPlatesDO diningPlatesDO = diningPlatesMapper.selectOne(Wrappers.<DiningPlatesDO>lambdaQuery()
|
||||
.eq(DiningPlatesDO::getDiningPlatesNum, diningPlatesNum)
|
||||
.eq(DiningPlatesDO::getStoreId,storeId)
|
||||
.last("limit 1"));
|
||||
BigDecimal moneyByUserId = cardService.getMoneyByUserId(diningPlatesDO.getUserId());
|
||||
MemberUserDO memberUserDO = memberUserMapper.selectById(diningPlatesDO.getUserId());
|
||||
@ -416,7 +430,7 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
||||
appUserInfo.setNickname(memberUserDO.getNickname())
|
||||
.setDishesName(dish.getDishesName())
|
||||
.setDishesBasePrice(dish.getDishesBasePrice()).setDishesSumPrice(dish.getDishesSumPrice())
|
||||
.setMoney(moneyByUserId).setOrderMoney(new BigDecimal(stringRedisTemplate.opsForValue().get(diningPlatesNum)));
|
||||
.setMoney(moneyByUserId).setOrderMoney(new BigDecimal(stringRedisTemplate.opsForValue().get(diningPlatesNum+"-"+storeId)));
|
||||
return appUserInfo;
|
||||
}
|
||||
|
||||
@ -427,4 +441,18 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
||||
List<String> list = diningPlatesDOS.stream().map(DiningPlatesDO::getDiningPlatesNum).collect(Collectors.toList());
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean checkBindAndUnBind(String diningPlatesNum,Long storeId) {
|
||||
DiningPlatesDO diningPlatesDO = diningPlatesMapper.selectOne(Wrappers.<DiningPlatesDO>lambdaQuery()
|
||||
.eq(DiningPlatesDO::getDiningPlatesNum, diningPlatesNum)
|
||||
.eq(DiningPlatesDO::getStoreId, storeId));
|
||||
if(diningPlatesDO == null || diningPlatesDO.getUserId() == null){
|
||||
return false;
|
||||
}else {
|
||||
unbind(diningPlatesNum,storeId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -72,22 +72,24 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createOrderDetail(AppOrderDetailSaveReqVO createReqVO) {
|
||||
//判定餐盘是否绑定并刷新绑定时间
|
||||
Boolean b = diningPlatesService.checkBind(createReqVO.getDiningPlatesNum());
|
||||
if(!b){
|
||||
throw exception(DINING_PLATES_NOT_BIND);
|
||||
}
|
||||
|
||||
|
||||
//餐盘号去获取订单
|
||||
DishOrderDO dishOrderDO = dishOrderMapper.selectOne(Wrappers.<DishOrderDO>lambdaQuery().eq(DishOrderDO::getDiningPlatesNum, createReqVO.getDiningPlatesNum())
|
||||
DishOrderDO dishOrderDO = dishOrderMapper.selectOne(Wrappers.<DishOrderDO>lambdaQuery()
|
||||
.eq(DishOrderDO::getDiningPlatesNum, createReqVO.getDiningPlatesNum())
|
||||
.eq(DishOrderDO::getStoreId, createReqVO.getStoreId())
|
||||
.eq(DishOrderDO::getOrderStatus, DishOrderDO.INCOMPLETE)
|
||||
.orderByDesc(DishOrderDO::getCreateTime)
|
||||
.last(MemberConstants.LIMIT_ONE));
|
||||
if(dishOrderDO==null){
|
||||
if (dishOrderDO == null) {
|
||||
throw exception(ORDER_ALREADY_COMPLETE);
|
||||
}
|
||||
|
||||
//判定餐盘是否绑定并刷新绑定时间
|
||||
Boolean b = diningPlatesService.checkBind(createReqVO.getDiningPlatesNum(), createReqVO.getStoreId());
|
||||
if (!b) {
|
||||
throw exception(DINING_PLATES_NOT_BIND);
|
||||
}
|
||||
|
||||
DishesRespDto dish = dishesApi.getDish(createReqVO.getDishesId());
|
||||
DishesNutritionRespDTO dishEnergy = dishesNutritionApi.getDishEnergy(createReqVO.getDishesId());
|
||||
|
||||
@ -101,20 +103,20 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||
// dishOrderMapper.updateById(dishOrderDO);
|
||||
//}
|
||||
//计算新总价
|
||||
String old = stringRedisTemplate.opsForValue().get(createReqVO.getDiningPlatesNum());
|
||||
BigDecimal oldBigDecimal = new BigDecimal(old);
|
||||
String old = stringRedisTemplate.opsForValue().get(createReqVO.getDiningPlatesNum()+"-" +createReqVO.getStoreId());
|
||||
BigDecimal oldBigDecimal = new BigDecimal(StrUtil.isBlank(old)?"0":old);
|
||||
//计算每个菜品的价格
|
||||
BigDecimal bigDecimal1 = dish.getDishesSumPrice().multiply(createReqVO.getWeight()).divide(dish.getDishesNumber(),2, RoundingMode.HALF_UP);
|
||||
BigDecimal bigDecimal1 = dish.getDishesSumPrice().multiply(createReqVO.getWeight()).divide(dish.getDishesNumber(), 2, RoundingMode.HALF_UP);
|
||||
//
|
||||
BigDecimal newPrice =bigDecimal1.add(oldBigDecimal).setScale(2, RoundingMode.HALF_UP);
|
||||
stringRedisTemplate.opsForValue().set(createReqVO.getDiningPlatesNum(),newPrice.toString());
|
||||
BigDecimal newPrice = bigDecimal1.add(oldBigDecimal).setScale(2, RoundingMode.HALF_UP);
|
||||
stringRedisTemplate.opsForValue().set(createReqVO.getDiningPlatesNum() + "-" +createReqVO.getStoreId(), newPrice.toString());
|
||||
|
||||
//计算热量
|
||||
if( dishEnergy !=null && StrUtil.isNotEmpty(dishEnergy.getDishesNumber())){
|
||||
if (dishEnergy != null && StrUtil.isNotEmpty(dishEnergy.getDishesNumber())) {
|
||||
BigDecimal dishesNumber = new BigDecimal(dishEnergy.getDishesNumber());
|
||||
BigDecimal nutritionNumber = new BigDecimal(dishEnergy.getNutritionNumber());
|
||||
if(BigDecimal.ZERO.compareTo(dishesNumber)!=0){
|
||||
BigDecimal bigDecimal = createReqVO.getWeight().multiply(nutritionNumber).divide(dishesNumber.multiply(new BigDecimal("4.184")),2,RoundingMode.HALF_UP);
|
||||
if (BigDecimal.ZERO.compareTo(dishesNumber) != 0) {
|
||||
BigDecimal bigDecimal = createReqVO.getWeight().multiply(nutritionNumber).divide(dishesNumber.multiply(new BigDecimal("4.184")), 2, RoundingMode.HALF_UP);
|
||||
orderDetail.setHeat(bigDecimal.doubleValue());
|
||||
}
|
||||
}
|
||||
@ -165,7 +167,7 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||
Long storeId = dishOrderMapper.selectById(orderId).getStoreId();
|
||||
List<OrderDetailDO> orderDetailDOS = orderDetailMapper.selectList(Wrappers.<OrderDetailDO>lambdaQuery().eq(OrderDetailDO::getOrderId, orderId));
|
||||
List<AppOrderDetailRespVO> bean = BeanUtils.toBean(orderDetailDOS, AppOrderDetailRespVO.class);
|
||||
bean.forEach(f->f.setStoreId(storeId));
|
||||
bean.forEach(f -> f.setStoreId(storeId));
|
||||
return bean;
|
||||
}
|
||||
|
||||
@ -174,11 +176,12 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||
List<OrderDetailDO> orderDetailDOS = orderDetailMapper.selectList(Wrappers.<OrderDetailDO>lambdaQuery().in(OrderDetailDO::getOrderId, orderIds));
|
||||
return orderDetailDOS;
|
||||
}
|
||||
public String getHearder(){
|
||||
|
||||
public String getHearder() {
|
||||
try {
|
||||
return httpServletRequest.getHeader("Authorization");
|
||||
} catch (Exception e) {
|
||||
throw exception(2000_10_001,"无法获取设备编码");
|
||||
throw exception(2000_10_001, "无法获取设备编码");
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,7 +189,7 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||
public List<DishVO> selectDishSale(Long storeId) {
|
||||
LocalDate today = LocalDate.now();
|
||||
String time = today.format(DateTimeFormatter.ofPattern(MemberConstants.DATE_FORMAT));
|
||||
return orderDetailMapper.selectDishSale(time,storeId);
|
||||
return orderDetailMapper.selectDishSale(time, storeId);
|
||||
}
|
||||
|
||||
|
||||
|
@ -681,9 +681,9 @@ public class MemberUserServiceImpl implements MemberUserService {
|
||||
if(memberUserDO == null){
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
if(memberUserDO.getFaceId()!=null){
|
||||
memberUserMapper.deleteFace(memberUserDO.getFaceId());
|
||||
}
|
||||
// if(memberUserDO.getFaceId()!=null){
|
||||
// memberUserMapper.deleteFace(memberUserDO.getFaceId());
|
||||
// }
|
||||
memberUserDO.setFaceId(faceId);
|
||||
return memberUserMapper.updateById(memberUserDO)>0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user