| | |
| | | package com.stylefeng.guns.modular.api; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | |
| | | import com.stylefeng.guns.modular.system.dao.TUseMoneyMapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.PayMoneyUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.UUIDUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | |
| | | private IWithdrawalService withdrawalService; |
| | | @Autowired |
| | | private ITRechargeMoneyService rechargeMoneyService; |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | @Autowired |
| | | private TUseMoneyMapper useMoneyMapper; |
| | | |
| | | @ResponseBody |
| | | @PostMapping ("/money/get") |
| | | @ApiOperation(value = "拿到后台配置的充值金额") |
| | |
| | | @ResponseBody |
| | | @PostMapping ("/recharge") |
| | | @ApiOperation(value = "微信充值操作") |
| | | public ResultUtil recharge(BigDecimal money,HttpServletRequest request){ |
| | | |
| | | return ResultUtil.success(); |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "充值金额", name = "money", required = true, dataType = "double"), |
| | | }) |
| | | public ResultUtil recharge(BigDecimal money,HttpServletRequest request) throws Exception { |
| | | Integer uid = driverService.getUserIdFormRedis(request); |
| | | if (null == uid) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String s = sdf.format(new Date()) + UUIDUtil.getRandomCode(3); |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay("充值", |
| | | "", |
| | | s, |
| | | money.toString(), |
| | | "/base/wxRecharge", |
| | | "APP"); |
| | | if (weixinpay.getCode()==200){ |
| | | // 新增扣除使用费记录 |
| | | TransactionDetails transactionDetails = new TransactionDetails(); |
| | | transactionDetails.setCode(s); |
| | | transactionDetails.setUserId(uid); |
| | | transactionDetails.setInsertTime(new Date()); |
| | | transactionDetails.setRemark("充值"); |
| | | // 将money转化为double类型 |
| | | transactionDetails.setMoney(money.doubleValue()); |
| | | transactionDetails.setState(1); |
| | | transactionDetails.setType(1); |
| | | transactionDetails.setUserType(2); |
| | | transactionDetails.setOrderType(5); |
| | | iTransactionDetailsService.insert(transactionDetails); |
| | | } |
| | | return weixinpay; |
| | | } |
| | | |
| | | |
| | |
| | | if (state!=null&&state==2){ |
| | | eq.eq("state",2); |
| | | } |
| | | eq.orderBy("insertTime",false); |
| | | List<TransactionDetails> transactionDetails = iTransactionDetailsService.selectList(eq); |
| | | if ((state!=null&&state==1)||(state!=null&&state==2)){ |
| | | List<HistoryVo> historyVos = new ArrayList<>(); |
| | | for (TransactionDetails transactionDetail : transactionDetails) { |
| | | HistoryVo historyVo = new HistoryVo(); |
| | | if (transactionDetail.getState()==1){ |
| | | historyVo.setState("充值"); |
| | | switch (transactionDetail.getOrderType()){ |
| | | case 2: |
| | | historyVo.setState("订单收入"); |
| | | break; |
| | | default: |
| | | historyVo.setState("充值"); |
| | | break; |
| | | } |
| | | historyVo.setAddordown(1); |
| | | }else { |
| | | historyVo.setState("扣除"); |
| | |
| | | for (TransactionDetails transactionDetail : transactionDetails) { |
| | | HistoryVo historyVo = new HistoryVo(); |
| | | if (transactionDetail.getState()==1){ |
| | | historyVo.setState("充值"); |
| | | switch (transactionDetail.getOrderType()){ |
| | | case 2: |
| | | historyVo.setState("订单收入"); |
| | | break; |
| | | default: |
| | | historyVo.setState("充值"); |
| | | break; |
| | | } |
| | | historyVo.setAddordown(1); |
| | | }else { |
| | | historyVo.setState("扣除"); |