返回用户信息
This commit is contained in:
		| @ -42,6 +42,46 @@ import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.E | |||||||
| public class CardController { | public class CardController { | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     // | ||||||
|  | //    //   写一个示例,将一条数据插入redis | ||||||
|  | //    @Resource | ||||||
|  | //    private RedisTemplate<String, Object> redisTemplate; | ||||||
|  | // | ||||||
|  | //    @PostMapping("/weighingAddInfo") | ||||||
|  | //    @Operation(summary = "称重信息入口") | ||||||
|  | //    public void weighingAddInfo(@RequestBody RobotReqVO reqVO) { | ||||||
|  | ////        生成一个redis对象并且插入数据 | ||||||
|  | //        redisTemplate.opsForValue().set(reqVO.getIp(), reqVO); | ||||||
|  | //    } | ||||||
|  | // | ||||||
|  | //    @GetMapping("/weighingGetInfo") | ||||||
|  | //    @Operation(summary = "获取称重相关信息") | ||||||
|  | //    public CommonResult<Object> weighingGetInfo(@RequestParam String ip) { | ||||||
|  | ////        生成一个redis对象并且插入数据 | ||||||
|  | ////        redisTemplate.opsForValue().get(ip); | ||||||
|  | //        return success(redisTemplate.opsForValue().get(ip)); | ||||||
|  | //    } | ||||||
|  | // | ||||||
|  | //    @GetMapping("/plateGetInfo") | ||||||
|  | //    @Operation(summary = "获取盘子信息") | ||||||
|  | //    public CommonResult<Object> plateGetInfo(@RequestParam String ip) { | ||||||
|  | ////        生成一个redis对象并且插入数据 | ||||||
|  | //        return success(redisTemplate.opsForValue().get(ip)); | ||||||
|  | //    } | ||||||
|  | // | ||||||
|  | //    @PostMapping("/plateAddInfo") | ||||||
|  | //    @Operation(summary = "盘子信息入口") | ||||||
|  | //    public void plateAddInfo(@RequestBody RobotReqVO reqVO) { | ||||||
|  | ////        生成一个redis对象并且插入数据 | ||||||
|  | //        redisTemplate.opsForValue().set(reqVO.getIp(), reqVO); | ||||||
|  | //    } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     //   创建一个websocket链接 | ||||||
|  |  | ||||||
|     @Resource |     @Resource | ||||||
|     private CardService cardService; |     private CardService cardService; | ||||||
|  |  | ||||||
|  | |||||||
| @ -0,0 +1,24 @@ | |||||||
|  | package cn.iocoder.yudao.module.member.controller.app.user.vo; | ||||||
|  |  | ||||||
|  | import io.swagger.v3.oas.annotations.media.Schema; | ||||||
|  | import lombok.Data; | ||||||
|  |  | ||||||
|  | import javax.validation.constraints.NotNull; | ||||||
|  | import java.math.BigDecimal; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * @author zt | ||||||
|  |  * @description <description class purpose> | ||||||
|  |  * @since 2024/3/29 | ||||||
|  |  */ | ||||||
|  | @Data | ||||||
|  | public class AppUserInfoCardVO { | ||||||
|  |  | ||||||
|  |     @Schema(description = "余额", requiredMode = Schema.RequiredMode.REQUIRED) | ||||||
|  |     private BigDecimal Money; | ||||||
|  |  | ||||||
|  |     @Schema(description = "姓名", requiredMode = Schema.RequiredMode.REQUIRED) | ||||||
|  |     private String name; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | } | ||||||
| @ -67,8 +67,8 @@ public class BalanceDeductionJob implements JobHandler { | |||||||
|             List<CardDO> list = new ArrayList<>(); |             List<CardDO> list = new ArrayList<>(); | ||||||
|             toPay.forEach(dishOrderDO -> { |             toPay.forEach(dishOrderDO -> { | ||||||
|                 //新的总价 |                 //新的总价 | ||||||
| //                BigDecimal total = new BigDecimal(stringRedisTemplate.opsForValue().get(dishOrderDO.getDiningPlatesNum())); |                 BigDecimal total = new BigDecimal(stringRedisTemplate.opsForValue().get(dishOrderDO.getDiningPlatesNum())); | ||||||
|                 BigDecimal total = new BigDecimal(0.01); | //                BigDecimal total = new BigDecimal(0.01); | ||||||
|                 Long userId = dishOrderDO.getUserId(); |                 Long userId = dishOrderDO.getUserId(); | ||||||
|                 CardDO cardDO = new CardDO(); |                 CardDO cardDO = new CardDO(); | ||||||
|                 cardDO.setType(TimePeriodEnum.getTimePeriod(LocalDateTime.now())); |                 cardDO.setType(TimePeriodEnum.getTimePeriod(LocalDateTime.now())); | ||||||
|  | |||||||
| @ -3,7 +3,9 @@ package cn.iocoder.yudao.module.member.service.diningplates; | |||||||
| import cn.iocoder.yudao.framework.common.pojo.PageResult; | import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||||
| import cn.iocoder.yudao.module.member.controller.admin.diningplates.vo.DiningPlatesPageReqVO; | import cn.iocoder.yudao.module.member.controller.admin.diningplates.vo.DiningPlatesPageReqVO; | ||||||
| import cn.iocoder.yudao.module.member.controller.admin.diningplates.vo.DiningPlatesSaveReqVO; | import cn.iocoder.yudao.module.member.controller.admin.diningplates.vo.DiningPlatesSaveReqVO; | ||||||
|  | import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserInfoCardVO; | ||||||
| import cn.iocoder.yudao.module.member.dal.dataobject.diningplates.DiningPlatesDO; | import cn.iocoder.yudao.module.member.dal.dataobject.diningplates.DiningPlatesDO; | ||||||
|  | import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; | ||||||
|  |  | ||||||
| import javax.validation.Valid; | import javax.validation.Valid; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| @ -80,9 +82,9 @@ public interface DiningPlatesService { | |||||||
|      * 绑定 |      * 绑定 | ||||||
|      * @return |      * @return | ||||||
|      */ |      */ | ||||||
|     Boolean  bind(String diningPlatesNum,String cardId); |     AppUserInfoCardVO  bind(String diningPlatesNum,String cardId); | ||||||
|  |  | ||||||
|     Boolean bindByFace(String diningPlatesNum,Long faceId); |     AppUserInfoCardVO bindByFace(String diningPlatesNum, Long faceId); | ||||||
|  |  | ||||||
|     Boolean checkBind(String diningPlatesNum); |     Boolean checkBind(String diningPlatesNum); | ||||||
| } | } | ||||||
| @ -6,12 +6,14 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | |||||||
| import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||||||
| import cn.iocoder.yudao.module.member.controller.admin.diningplates.vo.DiningPlatesPageReqVO; | import cn.iocoder.yudao.module.member.controller.admin.diningplates.vo.DiningPlatesPageReqVO; | ||||||
| import cn.iocoder.yudao.module.member.controller.admin.diningplates.vo.DiningPlatesSaveReqVO; | import cn.iocoder.yudao.module.member.controller.admin.diningplates.vo.DiningPlatesSaveReqVO; | ||||||
|  | import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserInfoCardVO; | ||||||
| import cn.iocoder.yudao.module.member.dal.dataobject.diningplates.DiningPlatesDO; | import cn.iocoder.yudao.module.member.dal.dataobject.diningplates.DiningPlatesDO; | ||||||
| import cn.iocoder.yudao.module.member.dal.dataobject.order.DishOrderDO; | import cn.iocoder.yudao.module.member.dal.dataobject.order.DishOrderDO; | ||||||
| import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; | import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; | ||||||
| import cn.iocoder.yudao.module.member.dal.mysql.diningplates.DiningPlatesMapper; | 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.order.DishOrderMapper; | ||||||
| import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper; | import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper; | ||||||
|  | import cn.iocoder.yudao.module.member.service.card.CardService; | ||||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||||
| import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||||
| import org.springframework.data.redis.core.StringRedisTemplate; | import org.springframework.data.redis.core.StringRedisTemplate; | ||||||
| @ -38,6 +40,8 @@ public class DiningPlatesServiceImpl implements DiningPlatesService { | |||||||
|     @Resource |     @Resource | ||||||
|     private DiningPlatesMapper diningPlatesMapper; |     private DiningPlatesMapper diningPlatesMapper; | ||||||
|     @Resource |     @Resource | ||||||
|  |     private CardService cardService; | ||||||
|  |     @Resource | ||||||
|     private MemberUserMapper memberUserMapper; |     private MemberUserMapper memberUserMapper; | ||||||
|     @Resource |     @Resource | ||||||
|     private DishOrderMapper dishOrderMapper; |     private DishOrderMapper dishOrderMapper; | ||||||
| @ -127,7 +131,7 @@ public class DiningPlatesServiceImpl implements DiningPlatesService { | |||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     @Transactional(rollbackFor = Exception.class) |     @Transactional(rollbackFor = Exception.class) | ||||||
|     public Boolean bind(String diningPlatesNum,String cardId) { |     public AppUserInfoCardVO bind(String diningPlatesNum, String cardId) { | ||||||
|         DiningPlatesDO diningPlatesDO = diningPlatesMapper.selectOne(Wrappers.<DiningPlatesDO>lambdaQuery() |         DiningPlatesDO diningPlatesDO = diningPlatesMapper.selectOne(Wrappers.<DiningPlatesDO>lambdaQuery() | ||||||
|                 .eq(DiningPlatesDO::getDiningPlatesNum, diningPlatesNum) |                 .eq(DiningPlatesDO::getDiningPlatesNum, diningPlatesNum) | ||||||
|                 .last("limit 1")); |                 .last("limit 1")); | ||||||
| @ -154,11 +158,14 @@ public class DiningPlatesServiceImpl implements DiningPlatesService { | |||||||
|  |  | ||||||
|         //设置总价 |         //设置总价 | ||||||
|         stringRedisTemplate.opsForValue().set(diningPlatesNum, "0"); |         stringRedisTemplate.opsForValue().set(diningPlatesNum, "0"); | ||||||
|         return i>0; |         AppUserInfoCardVO data = new AppUserInfoCardVO(); | ||||||
|  |         data.setName(memberUserDO.getNickname()); | ||||||
|  |         data.setMoney(cardService.getMoneyByUserId(memberUserDO.getId())); | ||||||
|  |         return data; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public Boolean bindByFace(String diningPlatesNum, Long faceId) { |     public AppUserInfoCardVO bindByFace(String diningPlatesNum, Long faceId) { | ||||||
|         DiningPlatesDO diningPlatesDO = diningPlatesMapper.selectOne(Wrappers.<DiningPlatesDO>lambdaQuery() |         DiningPlatesDO diningPlatesDO = diningPlatesMapper.selectOne(Wrappers.<DiningPlatesDO>lambdaQuery() | ||||||
|                 .eq(DiningPlatesDO::getDiningPlatesNum, diningPlatesNum) |                 .eq(DiningPlatesDO::getDiningPlatesNum, diningPlatesNum) | ||||||
|                 .last("limit 1")); |                 .last("limit 1")); | ||||||
| @ -185,7 +192,10 @@ public class DiningPlatesServiceImpl implements DiningPlatesService { | |||||||
|  |  | ||||||
|         //设置总价 |         //设置总价 | ||||||
|         stringRedisTemplate.opsForValue().set(diningPlatesNum, "0"); |         stringRedisTemplate.opsForValue().set(diningPlatesNum, "0"); | ||||||
|         return i>0; |         AppUserInfoCardVO data = new AppUserInfoCardVO(); | ||||||
|  |         data.setName(memberUserDO.getNickname()); | ||||||
|  |         data.setMoney(cardService.getMoneyByUserId(memberUserDO.getId())); | ||||||
|  |         return data; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 zhuer
					zhuer