|
@@ -1,6 +1,9 @@
|
|
|
package com.sqx.modules.shop.controller.app;
|
|
package com.sqx.modules.shop.controller.app;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
|
|
+import com.sqx.common.exception.SqxException;
|
|
|
import com.sqx.common.utils.PageUtils;
|
|
import com.sqx.common.utils.PageUtils;
|
|
|
import com.sqx.common.utils.Result;
|
|
import com.sqx.common.utils.Result;
|
|
|
import com.sqx.modules.app.dao.UserDao;
|
|
import com.sqx.modules.app.dao.UserDao;
|
|
@@ -14,14 +17,20 @@ import com.sqx.modules.goods.dao.GoodsShopDao;
|
|
|
import com.sqx.modules.goods.entity.GoodsShop;
|
|
import com.sqx.modules.goods.entity.GoodsShop;
|
|
|
import com.sqx.modules.pay.controller.app.AliPayController;
|
|
import com.sqx.modules.pay.controller.app.AliPayController;
|
|
|
import com.sqx.modules.pay.controller.query.CashOutQueryDTO;
|
|
import com.sqx.modules.pay.controller.query.CashOutQueryDTO;
|
|
|
|
|
+import com.sqx.modules.pay.dto.GetPayParamDTO;
|
|
|
|
|
+import com.sqx.modules.pay.enums.PayChannelEnum;
|
|
|
|
|
+import com.sqx.modules.pay.enums.PaySceneEnum;
|
|
|
import com.sqx.modules.pay.service.CashOutService;
|
|
import com.sqx.modules.pay.service.CashOutService;
|
|
|
|
|
+import com.sqx.modules.pay.service.NewPayService;
|
|
|
import com.sqx.modules.pay.service.WxService;
|
|
import com.sqx.modules.pay.service.WxService;
|
|
|
|
|
+import com.sqx.modules.pay.vo.WechatTransactionsParamVO;
|
|
|
import com.sqx.modules.sys.controller.AbstractController;
|
|
import com.sqx.modules.sys.controller.AbstractController;
|
|
|
import com.sqx.modules.sys.dao.SysUserDao;
|
|
import com.sqx.modules.sys.dao.SysUserDao;
|
|
|
import com.sqx.modules.sys.entity.SysUserEntity;
|
|
import com.sqx.modules.sys.entity.SysUserEntity;
|
|
|
|
|
+import icu.xuyijie.secureapi.annotation.DecryptParam;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
@@ -31,30 +40,24 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
|
+import java.math.RoundingMode;
|
|
|
|
|
|
|
|
@Api(tags={"商户端-商户钱包"})
|
|
@Api(tags={"商户端-商户钱包"})
|
|
|
@RestController
|
|
@RestController
|
|
|
@RequestMapping("/shop/shopmoney")
|
|
@RequestMapping("/shop/shopmoney")
|
|
|
|
|
+@RequiredArgsConstructor
|
|
|
public class ShopMoneyController extends AbstractController {
|
|
public class ShopMoneyController extends AbstractController {
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private UserMoneyService userMoneyService;
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private UserMoneyDetailsService userMoneyDetailsService;
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private UserDao userDao;
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private CashOutService cashOutService;
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private UserService userService;
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private WxService wxService;
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private SysUserDao sysUserDao;
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private AliPayController aliPayController;
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private GoodsShopDao goodsShopDao;
|
|
|
|
|
|
|
+ private final UserMoneyService userMoneyService;
|
|
|
|
|
+ private final UserMoneyDetailsService userMoneyDetailsService;
|
|
|
|
|
+ private final UserDao userDao;
|
|
|
|
|
+ private final CashOutService cashOutService;
|
|
|
|
|
+ private final UserService userService;
|
|
|
|
|
+ private final WxService wxService;
|
|
|
|
|
+ private final SysUserDao sysUserDao;
|
|
|
|
|
+ private final AliPayController aliPayController;
|
|
|
|
|
+ private final GoodsShopDao goodsShopDao;
|
|
|
|
|
+ private final NewPayService newPayService;
|
|
|
|
|
|
|
|
@GetMapping("/selectShopMoney")
|
|
@GetMapping("/selectShopMoney")
|
|
|
@ApiOperation("商户钱包余额")
|
|
@ApiOperation("商户钱包余额")
|
|
@@ -72,9 +75,36 @@ public class ShopMoneyController extends AbstractController {
|
|
|
return Result.success().put("data", userMoneyService.selectUserMoneyByUserId(goodsShop.getUserId()));
|
|
return Result.success().put("data", userMoneyService.selectUserMoneyByUserId(goodsShop.getUserId()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @ApiOperation("商户缴纳保证金")
|
|
|
|
|
|
|
+ @ApiOperation("商户缴纳保证金(新)")
|
|
|
@PostMapping(value = "shopCashDeposit")
|
|
@PostMapping(value = "shopCashDeposit")
|
|
|
- public Result shopCashDeposit(String openId, Double money,Integer type) throws Exception {
|
|
|
|
|
|
|
+ public Result shopCashDeposit(@DecryptParam(value = "openId") String openId, @DecryptParam(value = "money") BigDecimal money) {
|
|
|
|
|
+ SysUserEntity user = getUser();
|
|
|
|
|
+ Long adminUserId = user.getUserId();
|
|
|
|
|
+ SysUserShop sysUserShop = sysUserDao.selectUserShop(adminUserId);
|
|
|
|
|
+ GoodsShop goodsShop = goodsShopDao.selectById(sysUserShop.getShopId());
|
|
|
|
|
+ if(goodsShop.getStatus() != 1){
|
|
|
|
|
+ throw new SqxException("管理端审核成功后才能交保证金");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 构建获取支付参数dto
|
|
|
|
|
+ GetPayParamDTO dto = GetPayParamDTO.builder()
|
|
|
|
|
+ .orderNo(IdWorker.getTimeId())
|
|
|
|
|
+ .orderDesc("墨轩商场-商户缴纳保证金")
|
|
|
|
|
+ .amount(money.setScale(2, RoundingMode.HALF_UP))
|
|
|
|
|
+ .userId(adminUserId)
|
|
|
|
|
+ .userThirdId(openId)
|
|
|
|
|
+ .payChannel(PayChannelEnum.WECHAT_JS_API)
|
|
|
|
|
+ .paySceneEnum(PaySceneEnum.BOND_PAY)
|
|
|
|
|
+ .build();
|
|
|
|
|
+
|
|
|
|
|
+ WechatTransactionsParamVO wechatTransactionsParamVO = newPayService.getWechatTransactionsParamVO(dto);
|
|
|
|
|
+
|
|
|
|
|
+ return Result.success(BeanUtil.beanToMap(wechatTransactionsParamVO, false, true));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation("商户缴纳保证金(废弃)")
|
|
|
|
|
+ @PostMapping(value = "shopCashDeposit-bak")
|
|
|
|
|
+ public Result shopCashDepositBak(String openId, Double money,Integer type) throws Exception {
|
|
|
SysUserEntity user = getUser();
|
|
SysUserEntity user = getUser();
|
|
|
Long adminUserId = user.getUserId();
|
|
Long adminUserId = user.getUserId();
|
|
|
SysUserShop sysUserShop = sysUserDao.selectUserShop(adminUserId);
|
|
SysUserShop sysUserShop = sysUserDao.selectUserShop(adminUserId);
|