| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.matrix.component.redis.RedisUserLoginUtils; |
| | | import com.matrix.component.wechat.externalInterface.protocol.paramProtocol.BrandWCPayRequestData; |
| | | import com.matrix.component.wechat.externalInterface.weixinUtil.WeixinServiceUtil; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.pojo.BasePageQueryDto; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.system.common.init.UserCacheManager; |
| | | import com.matrix.system.hive.bean.MoneyCardUse; |
| | | import com.matrix.system.hive.bean.MoneyCardUseFlow; |
| | | import com.matrix.system.hive.bean.SysVipInfo; |
| | | import com.matrix.system.hive.dao.MoneyCardUseFlowDao; |
| | | import com.matrix.system.hive.dao.MoneyCardUseV2Dao; |
| | | import com.matrix.system.hive.service.CodeService; |
| | | import com.matrix.system.shopXcx.api.dto.MoneyCardUseFlowDto; |
| | | import com.matrix.system.shopXcx.api.vo.WxMoneyCardUseVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | private MoneyCardUseV2Dao moneyCardUseV2Dao; |
| | | |
| | | @Autowired |
| | | private RedisUserLoginUtils redisUserLoginUtils; |
| | | private UserCacheManager userCacheManager; |
| | | |
| | | @Autowired |
| | | MoneyCardUseFlowDao moneyCardUseFlowDao; |
| | |
| | | @Autowired |
| | | CodeService codeService; |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "查询会员主卡", notes = "") |
| | | @GetMapping(value = "/getUserVipCard") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = WxMoneyCardUseVO.class) |
| | | }) |
| | | public AjaxResult getUserVipCard() { |
| | | SysVipInfo sysVipInfo = userCacheManager.getLoginUser(); |
| | | QueryWrapper queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("vip_id", sysVipInfo.getId()); |
| | | queryWrapper.eq("is_vip_car","Y"); |
| | | MoneyCardUse moneyCardUse = moneyCardUseV2Dao.selectOne(queryWrapper); |
| | | WxMoneyCardUseVO vo = new WxMoneyCardUseVO(); |
| | | BeanUtils.copyProperties(moneyCardUse, vo); |
| | | return AjaxResult.buildSuccessInstance(vo); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "查询会员储值卡", notes = "") |
| | | @PostMapping(value = "/getUserMoneyCardUseList") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = WxMoneyCardUseVO.class) |
| | | }) |
| | | public AjaxResult getUserMoneyCardUseList(@RequestBody @Validated BasePageQueryDto pageDto) { |
| | | SysVipInfo sysVipInfo = redisUserLoginUtils.getLoginUser(SysVipInfo.class); |
| | | SysVipInfo sysVipInfo = userCacheManager.getLoginUser(); |
| | | QueryWrapper queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("vip_id", sysVipInfo.getId()); |
| | | IPage<MoneyCardUse> page = new Page<>(pageDto.getPageNum(), pageDto.getPageSize()); |
| | |
| | | BeanUtils.copyProperties(item, vo); |
| | | return vo; |
| | | }).collect(Collectors.toList()); |
| | | System.out.println(rows.get(0).getId()); |
| | | return AjaxResult.buildSuccessInstance(rows); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "创建储值卡充值预付单", notes = "传入参数 {rechargeAmount:10} 最少充值1元,最多2位小数 ") |
| | | @PostMapping(value = "/createRechargeOrder") |
| | |
| | | |
| | | String rechargeAmount = param.get("rechargeAmount"); |
| | | if (StringUtils.isBlank(rechargeAmount)) { |
| | | return AjaxResult.buildFailInstance("去输入充值金额"); |
| | | return AjaxResult.buildFailInstance("请输入充值金额"); |
| | | } |
| | | double total = new BigDecimal(rechargeAmount).setScale(2, BigDecimal.ROUND_HALF_DOWN).doubleValue(); |
| | | if (total < 0.02) { |
| | | return AjaxResult.buildFailInstance("充值金额最底1元"); |
| | | } |
| | | SysVipInfo sysVipInfo = redisUserLoginUtils.getLoginUser(SysVipInfo.class); |
| | | SysVipInfo sysVipInfo = userCacheManager.getLoginUser(); |
| | | MoneyCardUseFlow moneyCardUseFlow = new MoneyCardUseFlow(); |
| | | moneyCardUseFlow.setVipId(sysVipInfo.getId()); |
| | | moneyCardUseFlow.setPayNo(codeService.get32LenNumberCode()); |
| | |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = MoneyCardUseFlow.class) |
| | | }) |
| | | public AjaxResult getRechargeList(@RequestBody @Validated BasePageQueryDto pageDto) { |
| | | if(StringUtils.isBlank(pageDto.getKeywords())){ |
| | | return AjaxResult.buildFailInstance("keywords参数是必须的"); |
| | | } |
| | | PaginationVO pageVo = new PaginationVO(); |
| | | pageVo.setOffset((pageDto.getPageNum() - 1) * pageDto.getPageSize()); |
| | | pageVo.setLimit(pageDto.getPageSize()); |
| | | SysVipInfo sysVipInfo = redisUserLoginUtils.getLoginUser(SysVipInfo.class); |
| | | MoneyCardUseFlow moneyCardUseFlow=new MoneyCardUseFlow(); |
| | | moneyCardUseFlow.setVipId(sysVipInfo.getId()); |
| | | moneyCardUseFlow.setCarUseId(Long.parseLong(pageDto.getKeywords())); |
| | | List<MoneyCardUseFlow> dataList = moneyCardUseFlowDao.selectInPage(moneyCardUseFlow, pageVo); |
| | | return AjaxResult.buildSuccessInstance(dataList, moneyCardUseFlowDao.selectTotalRecord(moneyCardUseFlow)); |
| | | public AjaxResult getRechargeList(@RequestBody @Validated MoneyCardUseFlowDto pageDto) { |
| | | SysVipInfo sysVipInfo = userCacheManager.getLoginUser(); |
| | | pageDto.setCompanyId(sysVipInfo.getCompanyId()); |
| | | List<MoneyCardUseFlow> dataList = moneyCardUseFlowDao.selectForWxInPage(pageDto); |
| | | return AjaxResult.buildSuccessInstance(dataList); |
| | | } |
| | | |
| | | |