账户门店
This commit is contained in:
@ -37,4 +37,7 @@ public class AppCardPageReqVO extends PageParam {
|
|||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
private LocalDateTime[] createTime;
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
@Schema(description = "消费类型")
|
||||||
|
private String carteenId;
|
||||||
|
|
||||||
}
|
}
|
@ -64,23 +64,23 @@ public class AppDiningPlatesController {
|
|||||||
@GetMapping("/checkBind")
|
@GetMapping("/checkBind")
|
||||||
@Operation(summary = "验证餐盘绑定")
|
@Operation(summary = "验证餐盘绑定")
|
||||||
public CommonResult<AppUserInfoCardVO> checkBind(String diningPlatesNum, Long storeId) {
|
public CommonResult<AppUserInfoCardVO> checkBind(String diningPlatesNum, Long storeId) {
|
||||||
storeId = getCarteen(storeId);
|
Long newStoreId = getCarteen(storeId);
|
||||||
return success(diningPlatesService.appCheckBind(diningPlatesNum,storeId));
|
return success(diningPlatesService.appCheckBind(diningPlatesNum,newStoreId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/unbind")
|
@GetMapping("/unbind")
|
||||||
@Operation(summary = "餐盘解绑")
|
@Operation(summary = "餐盘解绑")
|
||||||
public CommonResult<String> unbind(String diningPlatesNum,Long storeId) {
|
public CommonResult<String> unbind(String diningPlatesNum,Long storeId) {
|
||||||
storeId = getCarteen(storeId);
|
Long newStoreId = getCarteen(storeId);
|
||||||
diningPlatesService.unbind(diningPlatesNum,storeId);
|
diningPlatesService.unbind(diningPlatesNum,newStoreId);
|
||||||
return success(diningPlatesNum);
|
return success(diningPlatesNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getUserAndDish")
|
@GetMapping("/getUserAndDish")
|
||||||
@Operation(summary = "根据餐盘号获取当前余额")
|
@Operation(summary = "根据餐盘号获取当前余额")
|
||||||
public CommonResult<AppUserInfo> getMoney(String cId, Long dishesId,Long storeId) {
|
public CommonResult<AppUserInfo> getMoney(String cId, Long dishesId,Long storeId) {
|
||||||
storeId = getCarteen(storeId);
|
Long newStoreId = getCarteen(storeId);
|
||||||
return success(diningPlatesService.getMoney(cId,dishesId,storeId));
|
return success(diningPlatesService.getMoney(cId,dishesId,newStoreId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getBind")
|
@GetMapping("/getBind")
|
||||||
@ -92,8 +92,8 @@ public class AppDiningPlatesController {
|
|||||||
@GetMapping("/checkBindAndUnBind")
|
@GetMapping("/checkBindAndUnBind")
|
||||||
@Operation(summary = "餐盘解绑")
|
@Operation(summary = "餐盘解绑")
|
||||||
public CommonResult<String> checkBindAndUnBind(String diningPlatesNum,Long storeId) {
|
public CommonResult<String> checkBindAndUnBind(String diningPlatesNum,Long storeId) {
|
||||||
storeId = getCarteen(storeId);
|
Long newStoreId = getCarteen(storeId);
|
||||||
Map<String, String> map = diningPlatesService.checkBindAndUnBind(diningPlatesNum, storeId);
|
Map<String, String> map = diningPlatesService.checkBindAndUnBind(diningPlatesNum, newStoreId);
|
||||||
CommonResult<String> result = new CommonResult<>();
|
CommonResult<String> result = new CommonResult<>();
|
||||||
result.setCode(200);
|
result.setCode(200);
|
||||||
result.setData(map.get("data"));
|
result.setData(map.get("data"));
|
||||||
@ -109,7 +109,7 @@ public class AppDiningPlatesController {
|
|||||||
|
|
||||||
|
|
||||||
public Long getCarteen(Long storeId) {
|
public Long getCarteen(Long storeId) {
|
||||||
if (storeId != null){
|
if (storeId != null && storeId != 0){
|
||||||
return storeId;
|
return storeId;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -56,6 +56,7 @@ public interface CardMapper extends BaseMapperX<CardDO> {
|
|||||||
.eqIfPresent(CardDO::getFlag, reqVO.getFlag())
|
.eqIfPresent(CardDO::getFlag, reqVO.getFlag())
|
||||||
.eqIfPresent(CardDO::getChangeMoney, reqVO.getChangeMoney())
|
.eqIfPresent(CardDO::getChangeMoney, reqVO.getChangeMoney())
|
||||||
.betweenIfPresent(CardDO::getCreateTime, reqVO.getCreateTime())
|
.betweenIfPresent(CardDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.eqIfPresent(CardDO::getCarteenId,reqVO.getCarteenId())
|
||||||
.orderByDesc(CardDO::getId));
|
.orderByDesc(CardDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,10 @@ public class DeductionServiceImpl implements DeductionService {
|
|||||||
//当前金额
|
//当前金额
|
||||||
BigDecimal wxAmount = user.getWxAmount();
|
BigDecimal wxAmount = user.getWxAmount();
|
||||||
BigDecimal giftAmount = user.getGiftAmount();
|
BigDecimal giftAmount = user.getGiftAmount();
|
||||||
BigDecimal cashAmount = moneyDO.getCashAmount();
|
BigDecimal cashAmount = BigDecimal.ZERO;
|
||||||
|
if(ObjectUtil.isNotEmpty(moneyDO)){
|
||||||
|
cashAmount = moneyDO.getCashAmount();
|
||||||
|
}
|
||||||
|
|
||||||
BigDecimal money = wxAmount.add(giftAmount).add(cashAmount);
|
BigDecimal money = wxAmount.add(giftAmount).add(cashAmount);
|
||||||
// user.setMoney(money.subtract(total));
|
// user.setMoney(money.subtract(total));
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.member.service.diningplates;
|
package cn.iocoder.yudao.module.member.service.diningplates;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||||
@ -208,11 +209,10 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
|||||||
.last(MemberConstants.LIMIT_ONE));
|
.last(MemberConstants.LIMIT_ONE));
|
||||||
checkMemberUser(memberUserDO, false);
|
checkMemberUser(memberUserDO, false);
|
||||||
//订单验证
|
//订单验证
|
||||||
checkOrder(memberUserDO.getId());
|
checkOrder(memberUserDO.getId(),diningPlatesDO.getStoreId());
|
||||||
|
|
||||||
//余额验证
|
//余额验证
|
||||||
BigDecimal money = memberUserDO.getMoney();
|
BigDecimal money = checkMoney(memberUserDO, storeId);
|
||||||
checkMoney(money);
|
|
||||||
|
|
||||||
diningPlatesDO.setUserId(memberUserDO.getId());
|
diningPlatesDO.setUserId(memberUserDO.getId());
|
||||||
diningPlatesDO.setStatus(DiningPlatesDO.USE);
|
diningPlatesDO.setStatus(DiningPlatesDO.USE);
|
||||||
@ -260,10 +260,9 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
|||||||
MemberUserDO memberUserDO = memberUserMapper.selectOne(wrapper);
|
MemberUserDO memberUserDO = memberUserMapper.selectOne(wrapper);
|
||||||
checkMemberUser(memberUserDO, true);
|
checkMemberUser(memberUserDO, true);
|
||||||
//订单验证
|
//订单验证
|
||||||
checkOrder(memberUserDO.getId());
|
checkOrder(memberUserDO.getId(),diningPlatesDO.getStoreId());
|
||||||
//余额验证
|
//余额验证
|
||||||
BigDecimal money = memberUserDO.getMoney();
|
BigDecimal money = checkMoney(memberUserDO,storeId);
|
||||||
checkMoney(money);
|
|
||||||
|
|
||||||
diningPlatesDO.setUserId(memberUserDO.getId());
|
diningPlatesDO.setUserId(memberUserDO.getId());
|
||||||
diningPlatesDO.setStatus(DiningPlatesDO.USE);
|
diningPlatesDO.setStatus(DiningPlatesDO.USE);
|
||||||
@ -363,19 +362,32 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
|||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkMoney(BigDecimal money) {
|
public BigDecimal checkMoney(MemberUserDO memberUserDO,Long storeId) {
|
||||||
|
BigDecimal cashAmount = BigDecimal.ZERO;
|
||||||
|
MoneyDO moneyDO = moneyService.getMoney(memberUserDO.getId(), storeId);
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotEmpty(moneyDO)) {
|
||||||
|
cashAmount = moneyDO.getCashAmount();
|
||||||
|
}else {
|
||||||
|
MoneyDO add = new MoneyDO();
|
||||||
|
add.setUserId(memberUserDO.getId());
|
||||||
|
add.setCarteenId(storeId);
|
||||||
|
moneyService.insertOne(add);
|
||||||
|
}
|
||||||
|
BigDecimal money = memberUserDO.getWxAmount().add(cashAmount);
|
||||||
if (money.compareTo(MemberConstants.ALARM_BALANCE) < 0) {
|
if (money.compareTo(MemberConstants.ALARM_BALANCE) < 0) {
|
||||||
throw exception(INSUFFICIENT_BALANCE);
|
throw exception(INSUFFICIENT_BALANCE);
|
||||||
}
|
}
|
||||||
|
return money;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkOrder(Long userId) {
|
public void checkOrder(Long userId,Long carteenId) {
|
||||||
|
|
||||||
LambdaQueryWrapper<DishOrderDO> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<DishOrderDO> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
wrapper.eq(DishOrderDO::getUserId,userId);
|
wrapper.eq(DishOrderDO::getUserId,userId);
|
||||||
wrapper.eq(DishOrderDO::getOrderStatus,DishOrderDO.TOCOMPLETE);
|
wrapper.eq(DishOrderDO::getOrderStatus,DishOrderDO.TOCOMPLETE);
|
||||||
|
wrapper.eq(DishOrderDO::getStoreId,carteenId);
|
||||||
List<DishOrderDO> dishOrderDOS = dishOrderMapper.selectList(wrapper);
|
List<DishOrderDO> dishOrderDOS = dishOrderMapper.selectList(wrapper);
|
||||||
ErrorCode code = new ErrorCode(1_004_099_008, "存在未支付完的订单");
|
ErrorCode code = new ErrorCode(1_004_099_008, "存在未支付完的订单");
|
||||||
if(CollectionUtil.isNotEmpty(dishOrderDOS)){
|
if(CollectionUtil.isNotEmpty(dishOrderDOS)){
|
||||||
@ -481,12 +493,16 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
|||||||
DishesRespDto dish = dishesApi.getDish(dishId);
|
DishesRespDto dish = dishesApi.getDish(dishId);
|
||||||
|
|
||||||
MoneyDO moneyDO = moneyService.getMoney(memberUserDO.getId(), storeId);
|
MoneyDO moneyDO = moneyService.getMoney(memberUserDO.getId(), storeId);
|
||||||
|
BigDecimal cashAmount = BigDecimal.ZERO;
|
||||||
|
if(ObjectUtil.isNotEmpty(moneyDO)){
|
||||||
|
cashAmount = moneyDO.getCashAmount();
|
||||||
|
}
|
||||||
|
|
||||||
AppUserInfo appUserInfo = new AppUserInfo();
|
AppUserInfo appUserInfo = new AppUserInfo();
|
||||||
appUserInfo.setNickname(StrUtil.isNotBlank(memberUserDO.getName())?memberUserDO.getName():memberUserDO.getNickname())
|
appUserInfo.setNickname(StrUtil.isNotBlank(memberUserDO.getName())?memberUserDO.getName():memberUserDO.getNickname())
|
||||||
.setDishesName(dish.getDishesName())
|
.setDishesName(dish.getDishesName())
|
||||||
.setDishesBasePrice(dish.getDishesBasePrice()).setDishesSumPrice(dish.getDishesSumPrice())
|
.setDishesBasePrice(dish.getDishesBasePrice()).setDishesSumPrice(dish.getDishesSumPrice())
|
||||||
.setMoney(memberUserDO.getWxAmount().add(moneyDO.getCashAmount()))
|
.setMoney(memberUserDO.getWxAmount().add(cashAmount))
|
||||||
.setOrderMoney(new BigDecimal(stringRedisTemplate.opsForValue().get(diningPlatesNum+"-"+storeId)))
|
.setOrderMoney(new BigDecimal(stringRedisTemplate.opsForValue().get(diningPlatesNum+"-"+storeId)))
|
||||||
.setReception(memberUserDO.getReception()).setLimitAmount(memberUserDO.getLimitAmount());
|
.setReception(memberUserDO.getReception()).setLimitAmount(memberUserDO.getLimitAmount());
|
||||||
return appUserInfo;
|
return appUserInfo;
|
||||||
|
@ -188,29 +188,13 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
List<AppOrderRespVO> list = appOrderRespVOPageResult.getList();
|
List<AppOrderRespVO> list = appOrderRespVOPageResult.getList();
|
||||||
for (AppOrderRespVO dishOrderDO : list) {
|
for (AppOrderRespVO dishOrderDO : list) {
|
||||||
List<AppOrderDetailRespVO> appOrderDetailRespVOS = orderDetailService.selectListByOrderId(dishOrderDO.getId());
|
List<AppOrderDetailRespVO> appOrderDetailRespVOS = orderDetailService.selectListByOrderId(dishOrderDO.getId());
|
||||||
// if (CollectionUtil.isNotEmpty(appOrderDetailRespVOS)) {
|
|
||||||
// List<Long> dishIds = appOrderDetailRespVOS.stream().map(AppOrderDetailRespVO::getDishesId).collect(Collectors.toList());
|
|
||||||
//
|
|
||||||
// List<DishesRespDto> dishInfo = dishesApi.getDishInfo(dishIds);
|
|
||||||
// Map<Long, DishesRespDto> dishMap = dishInfo.stream().collect(Collectors.toMap(DishesRespDto::getId, DishesRespDto -> DishesRespDto));
|
|
||||||
//
|
|
||||||
// appOrderDetailRespVOS.forEach(respVo -> {
|
|
||||||
// DishesRespDto dishesRespDto = dishMap.get(respVo.getDishesId());
|
|
||||||
// if (ObjectUtil.isNotEmpty(dishesRespDto)) {
|
|
||||||
// respVo.setDishesBasePrice(dishesRespDto.getDishesBasePrice())
|
|
||||||
// .setDishesSumPrice(ObjectUtil.isNotEmpty(respVo.getUnitPrice())?respVo.getUnitPrice():dishesRespDto.getDishesSumPrice())
|
|
||||||
// .setDishesNumber(dishesRespDto.getDishesNumber());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
for (AppOrderDetailRespVO respVo : appOrderDetailRespVOS) {
|
for (AppOrderDetailRespVO respVo : appOrderDetailRespVOS) {
|
||||||
respVo.setDishesSumPrice(respVo.getUnitPrice());
|
respVo.setDishesSumPrice(respVo.getUnitPrice());
|
||||||
}
|
}
|
||||||
dishOrderDO.setRefundStatus(refundService.getRefundStatus(dishOrderDO.getId()));
|
dishOrderDO.setRefundStatus(refundService.getRefundStatus(dishOrderDO.getId()));
|
||||||
dishOrderDO.setDetailList(appOrderDetailRespVOS);
|
dishOrderDO.setDetailList(appOrderDetailRespVOS);
|
||||||
dishOrderDO.setMoney(cardMapper.getMoneyByUsr(dishOrderDO.getUserId()));
|
// dishOrderDO.setMoney(cardMapper.getMoneyByUsr(dishOrderDO.getUserId()));
|
||||||
|
|
||||||
}
|
}
|
||||||
return appOrderRespVOPageResult;
|
return appOrderRespVOPageResult;
|
||||||
|
@ -8,7 +8,7 @@ spring:
|
|||||||
autoconfigure:
|
autoconfigure:
|
||||||
exclude:
|
exclude:
|
||||||
- com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源
|
- com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源
|
||||||
- org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration # 默认 local 环境,不开启 Quartz 的自动配置
|
# - org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration # 默认 local 环境,不开启 Quartz 的自动配置
|
||||||
- de.codecentric.boot.admin.server.config.AdminServerAutoConfiguration # 禁用 Spring Boot Admin 的 Server 的自动配置
|
- de.codecentric.boot.admin.server.config.AdminServerAutoConfiguration # 禁用 Spring Boot Admin 的 Server 的自动配置
|
||||||
- de.codecentric.boot.admin.server.ui.config.AdminServerUiAutoConfiguration # 禁用 Spring Boot Admin 的 Server UI 的自动配置
|
- de.codecentric.boot.admin.server.ui.config.AdminServerUiAutoConfiguration # 禁用 Spring Boot Admin 的 Server UI 的自动配置
|
||||||
- de.codecentric.boot.admin.client.config.SpringBootAdminClientAutoConfiguration # 禁用 Spring Boot Admin 的 Client 的自动配置
|
- de.codecentric.boot.admin.client.config.SpringBootAdminClientAutoConfiguration # 禁用 Spring Boot Admin 的 Client 的自动配置
|
||||||
|
Reference in New Issue
Block a user