|
@@ -5,12 +5,13 @@ import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.web.work.api.util.AppUtil;
|
|
|
import com.ruoyi.web.work.domain.Pay;
|
|
|
import com.ruoyi.web.work.domain.User;
|
|
|
import com.ruoyi.web.work.domain.dto.PayAuditDto;
|
|
|
-import com.ruoyi.web.work.domain.dto.PayDto;
|
|
|
+import com.ruoyi.web.work.domain.dto.PayCashOutDto;
|
|
|
import com.ruoyi.web.work.mapper.PayMapper;
|
|
|
import com.ruoyi.web.work.service.IPayService;
|
|
|
import com.ruoyi.web.work.service.IUserService;
|
|
@@ -20,7 +21,6 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.rmi.ServerException;
|
|
|
-import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -49,12 +49,12 @@ public class PayServiceImpl extends ServiceImpl<PayMapper, Pay> implements IPayS
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public AjaxResult cashOut(PayDto dto) throws ServerException {
|
|
|
+ public AjaxResult cashOut(PayCashOutDto dto) throws ServerException {
|
|
|
User user = userService.getById(AppUtil.getUser().getId());
|
|
|
if (dto.getMoney().compareTo(user.getMoney()) > 0) {
|
|
|
return AjaxResult.error("提现金额超过账户余额");
|
|
|
}
|
|
|
- if (StringUtils.isEmpty(user.getBankName()) || StringUtils.isEmpty(user.getBankAccount())) {
|
|
|
+ if (dto.getWay() == 0 && StringUtils.isEmpty(user.getBankAccount())) {
|
|
|
return AjaxResult.error("银行卡信息未完善,无法提现");
|
|
|
}
|
|
|
//保存提现记录
|
|
@@ -63,6 +63,7 @@ public class PayServiceImpl extends ServiceImpl<PayMapper, Pay> implements IPayS
|
|
|
pay.setMoney(dto.getMoney());
|
|
|
pay.setState(0);
|
|
|
pay.setType(2);
|
|
|
+ pay.setWay(dto.getWay());
|
|
|
pay.setTitle("余额提现");
|
|
|
pay.setVersion(System.currentTimeMillis());
|
|
|
pay.setNums(StringUtils.generateNumber());
|
|
@@ -116,9 +117,9 @@ public class PayServiceImpl extends ServiceImpl<PayMapper, Pay> implements IPayS
|
|
|
body.set("touser", user.getOpenId());
|
|
|
body.set("template_id", "PtdKbqfzmpvGsJPx_YekDX4-cljbhOXcvoUB3XJaVLg");
|
|
|
body.set("page", "pages/user/money/index");
|
|
|
- content.set("amount3", new JSONObject().set("value", pay.getMoney()));//提现金额
|
|
|
+ content.set("amount3", new JSONObject().set("value", pay.getMoney() + "元"));//提现金额
|
|
|
content.set("character_string4", new JSONObject().set("value", pay.getNums()));//交易单号
|
|
|
- content.set("time2", new JSONObject().set("value", new Date())); //提现时间
|
|
|
+ content.set("time2", new JSONObject().set("value", DateUtils.getTime())); //提现时间
|
|
|
}
|
|
|
//提现失败通知
|
|
|
if (pay.getState() == 2) {
|
|
@@ -126,10 +127,10 @@ public class PayServiceImpl extends ServiceImpl<PayMapper, Pay> implements IPayS
|
|
|
body.set("touser", user.getOpenId());
|
|
|
body.set("template_id", "NIqSQq0j765o9Iz9gMiSelnuxMgPIPeCnk3lvEnWJlo");
|
|
|
body.set("page", "pages/user/money/index");
|
|
|
- content.set("amount3", new JSONObject().set("value", pay.getMoney()));//提现金额
|
|
|
+ content.set("amount3", new JSONObject().set("value", pay.getMoney() + "元"));//提现金额
|
|
|
content.set("character_string4", new JSONObject().set("value", pay.getNums()));//交易单号
|
|
|
content.set("thing5", new JSONObject().set("value", pay.getMsg())); //失败原因
|
|
|
- content.set("time2", new JSONObject().set("value", new Date())); //提现时间
|
|
|
+ content.set("time2", new JSONObject().set("value", DateUtils.getTime())); //提现时间
|
|
|
}
|
|
|
body.set("data", content);
|
|
|
String result = HttpUtil.post("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + jsonObject.getStr("access_token"), body.toString());
|