|
@@ -1,13 +1,10 @@
|
|
package com.yonge.cooleshow.teacher.controller;
|
|
package com.yonge.cooleshow.teacher.controller;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
import com.yonge.cooleshow.biz.dal.dto.req.WithdrawalReq;
|
|
import com.yonge.cooleshow.biz.dal.dto.req.WithdrawalReq;
|
|
import com.yonge.cooleshow.biz.dal.dto.search.TeacherWithdrawalSearch;
|
|
import com.yonge.cooleshow.biz.dal.dto.search.TeacherWithdrawalSearch;
|
|
-import com.yonge.cooleshow.biz.dal.entity.UserWithdrawalCallback;
|
|
|
|
-import com.yonge.cooleshow.biz.dal.enums.DealStatusEnum;
|
|
|
|
import com.yonge.cooleshow.biz.dal.service.UserWithdrawalService;
|
|
import com.yonge.cooleshow.biz.dal.service.UserWithdrawalService;
|
|
import com.yonge.cooleshow.biz.dal.support.PageUtil;
|
|
import com.yonge.cooleshow.biz.dal.support.PageUtil;
|
|
import com.yonge.cooleshow.biz.dal.vo.UserWithdrawalVo;
|
|
import com.yonge.cooleshow.biz.dal.vo.UserWithdrawalVo;
|
|
@@ -16,38 +13,28 @@ import com.yonge.cooleshow.common.controller.BaseController;
|
|
import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
import com.yonge.toolset.base.exception.BizException;
|
|
import com.yonge.toolset.base.exception.BizException;
|
|
import com.yonge.toolset.base.page.PageInfo;
|
|
import com.yonge.toolset.base.page.PageInfo;
|
|
-import com.yonge.toolset.thirdparty.lingxinpay.RSA;
|
|
|
|
import com.yonge.toolset.utils.date.DateUtil;
|
|
import com.yonge.toolset.utils.date.DateUtil;
|
|
-import com.yonge.toolset.utils.json.JsonUtil;
|
|
|
|
import com.yonge.toolset.utils.string.StringUtil;
|
|
import com.yonge.toolset.utils.string.StringUtil;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
|
-import org.slf4j.Logger;
|
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.HttpStatus;
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import springfox.documentation.annotations.ApiIgnore;
|
|
import springfox.documentation.annotations.ApiIgnore;
|
|
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalTime;
|
|
import java.time.LocalTime;
|
|
import java.time.temporal.TemporalAdjusters;
|
|
import java.time.temporal.TemporalAdjusters;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
-import java.util.Map;
|
|
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/userWithdrawal")
|
|
@RequestMapping("/userWithdrawal")
|
|
@Api(value = "用户账户提现表", tags = "用户账户提现表")
|
|
@Api(value = "用户账户提现表", tags = "用户账户提现表")
|
|
public class UserWithdrawalController extends BaseController {
|
|
public class UserWithdrawalController extends BaseController {
|
|
- private final static Logger log = LoggerFactory.getLogger(UserWithdrawalController.class);
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private UserWithdrawalService userWithdrawalService;
|
|
private UserWithdrawalService userWithdrawalService;
|
|
@@ -55,9 +42,6 @@ public class UserWithdrawalController extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private SysUserFeignService sysUserFeignService;
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
|
|
|
- @Value("${withdraw.privateKey}")
|
|
|
|
- private String privateKey;
|
|
|
|
-
|
|
|
|
@PostMapping("/getWithdrawalInfo")
|
|
@PostMapping("/getWithdrawalInfo")
|
|
@ApiOperation(value = "查询提现页面信息")
|
|
@ApiOperation(value = "查询提现页面信息")
|
|
public HttpResponseResult<WithdrawalInfoRes> getWithdrawalInfo() {
|
|
public HttpResponseResult<WithdrawalInfoRes> getWithdrawalInfo() {
|
|
@@ -119,78 +103,4 @@ public class UserWithdrawalController extends BaseController {
|
|
IPage<UserWithdrawalVo> pages = userWithdrawalService.selectPage(PageUtil.getPage(query), query);
|
|
IPage<UserWithdrawalVo> pages = userWithdrawalService.selectPage(PageUtil.getPage(query), query);
|
|
return succeed(PageUtil.pageInfo(pages));
|
|
return succeed(PageUtil.pageInfo(pages));
|
|
}
|
|
}
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 异步回调接收-提现
|
|
|
|
- *
|
|
|
|
- * @param content
|
|
|
|
- * @param request
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- @PostMapping("/callback")
|
|
|
|
- public String callback(@RequestBody String content, HttpServletRequest request) {
|
|
|
|
- log.info("交易回调请求地址:{} 请求参数:{}", request.getRemoteAddr(), content);
|
|
|
|
- try {
|
|
|
|
- if (StringUtils.isBlank(content)) {
|
|
|
|
- throw new Exception();
|
|
|
|
- }
|
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(content);
|
|
|
|
- String jsonStr = RSA.decryptPri(jsonObject.getString("sign"), privateKey);
|
|
|
|
- log.info("jsonStr:{}", jsonStr);
|
|
|
|
-
|
|
|
|
- Map<String, Object> withdrawRecord = JSONObject.parseObject(jsonStr);
|
|
|
|
- UserWithdrawalCallback callback = JsonUtil.toJavaObject(withdrawRecord, UserWithdrawalCallback.class);
|
|
|
|
-
|
|
|
|
- userWithdrawalService.callback(callback, jsonStr);
|
|
|
|
- } catch (BizException e) {
|
|
|
|
- log.error("解密失败e:{}", e.getMessage());
|
|
|
|
- return "failed";
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- log.error("解密失败e:{}", e);
|
|
|
|
- return "failed";
|
|
|
|
- }
|
|
|
|
- return "success";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 异步回调接收-签署协议
|
|
|
|
- *
|
|
|
|
- * @param dataStr
|
|
|
|
- * @param request
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- @PostMapping("/contractCallback")
|
|
|
|
- public String contractCallback(@RequestBody String dataStr, HttpServletRequest request) {
|
|
|
|
- log.info("回调请求地址:{} 请求参数:{}", request.getRemoteAddr(), dataStr);
|
|
|
|
- try {
|
|
|
|
- if (StringUtils.isBlank(dataStr)) {
|
|
|
|
- throw new Exception();
|
|
|
|
- }
|
|
|
|
- JSONObject data = JSONObject.parseObject(dataStr);
|
|
|
|
- JSONObject content = data.getJSONObject("content");
|
|
|
|
-
|
|
|
|
- String return_code = data.getString("return_code");
|
|
|
|
-
|
|
|
|
- if (CollectionUtils.isEmpty(content) || null == content.getString("serialNo")) {
|
|
|
|
- log.error("签署失败,返回合同编号为空 {}", dataStr);
|
|
|
|
- return "failed";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if ("T".equals(return_code)) {
|
|
|
|
- userWithdrawalService.contractCallback(
|
|
|
|
- DealStatusEnum.SCCESS.getCode(), content.getString("serialNo"),
|
|
|
|
- content.getString("contractUrl"), null);
|
|
|
|
- return "success";
|
|
|
|
- } else {
|
|
|
|
- String return_message = data.getString("return_message");
|
|
|
|
- userWithdrawalService.contractCallback(
|
|
|
|
- DealStatusEnum.FAILED.getCode(), content.getString("serialNo"), null, return_message);
|
|
|
|
- return "failed";
|
|
|
|
- }
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- log.error("签署失败e:{}", e);
|
|
|
|
- return "failed";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
}
|
|
}
|