|  |  |  | 
|---|
|  |  |  | 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.hive.bean.MoneyCardUse; | 
|---|
|  |  |  | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | CodeService codeService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "查询会员主卡", notes = "") | 
|---|
|  |  |  | @GetMapping(value = "/getUserVipCard") | 
|---|
|  |  |  | @ApiResponses({ | 
|---|
|  |  |  | @ApiResponse(code = 200, message = "ok", response = WxMoneyCardUseVO.class) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public AjaxResult getUserVipCard() { | 
|---|
|  |  |  | SysVipInfo sysVipInfo = redisUserLoginUtils.getLoginUser(SysVipInfo.class); | 
|---|
|  |  |  | 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 = "") | 
|---|
|  |  |  | @GetMapping(value = "/getUserMoneyCardUseList") | 
|---|
|  |  |  | @PostMapping(value = "/getUserMoneyCardUseList") | 
|---|
|  |  |  | @ApiResponses({ | 
|---|
|  |  |  | @ApiResponse(code = 200, message = "ok", response = WxMoneyCardUseVO.class) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | 
|---|
|  |  |  | 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) { | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "查询会员储值卡充值使用记录", notes = "keywords 传入会员卡ID") | 
|---|
|  |  |  | @GetMapping(value = "/getRechargeList") | 
|---|
|  |  |  | @PostMapping(value = "/getRechargeList") | 
|---|
|  |  |  | @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()); | 
|---|
|  |  |  | public AjaxResult getRechargeList(@RequestBody @Validated MoneyCardUseFlowDto pageDto) { | 
|---|
|  |  |  | 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)); | 
|---|
|  |  |  | pageDto.setCompanyId(sysVipInfo.getCompanyId()); | 
|---|
|  |  |  | List<MoneyCardUseFlow> dataList = moneyCardUseFlowDao.selectForWxInPage(pageDto); | 
|---|
|  |  |  | return AjaxResult.buildSuccessInstance(dataList); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|