list = lendReturnService.selectByLendId(lendId);
+ return R.ok().data("list", list);
+ }
+}
diff --git a/service-core/src/main/java/com/wwj/srb/core/controller/api/LendController.java b/service-core/src/main/java/com/wwj/srb/core/controller/api/LendController.java
index 7c9a703163b1aa580d7c3f16e230c5780f13007c..45c52ee1eb71a5dae757287a17c4f81efdf583c9 100644
--- a/service-core/src/main/java/com/wwj/srb/core/controller/api/LendController.java
+++ b/service-core/src/main/java/com/wwj/srb/core/controller/api/LendController.java
@@ -6,13 +6,17 @@ import com.wwj.srb.core.pojo.entity.Lend;
import com.wwj.srb.core.service.LendService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
+import java.math.BigDecimal;
import java.util.List;
+import java.util.Map;
/**
*
@@ -37,5 +41,33 @@ public class LendController {
List lendList = lendService.selectList();
return R.ok().data("lendList", lendList);
}
+
+ @ApiOperation("获取标的信息")
+ @GetMapping("/show/{id}")
+ public R show(
+ @ApiParam(value = "标的id", required = true)
+ @PathVariable Long id) {
+ Map lendDetail = lendService.getLendDetail(id);
+ return R.ok().data("lendDetail", lendDetail);
+ }
+
+ @ApiOperation("计算投资收益")
+ @GetMapping("/getInterestCount/{invest}/{yearRate}/{totalmonth}/{returnMethod}")
+ public R getInterestCount(
+ @ApiParam(value = "投资金额", required = true)
+ @PathVariable("invest") BigDecimal invest,
+
+ @ApiParam(value = "年化收益", required = true)
+ @PathVariable("yearRate")BigDecimal yearRate,
+
+ @ApiParam(value = "期数", required = true)
+ @PathVariable("totalmonth")Integer totalmonth,
+
+ @ApiParam(value = "还款方式", required = true)
+ @PathVariable("returnMethod")Integer returnMethod) {
+
+ BigDecimal interestCount = lendService.getInterestCount(invest, yearRate, totalmonth, returnMethod);
+ return R.ok().data("interestCount", interestCount);
+ }
}
diff --git a/service-core/src/main/java/com/wwj/srb/core/controller/api/LendItemController.java b/service-core/src/main/java/com/wwj/srb/core/controller/api/LendItemController.java
new file mode 100644
index 0000000000000000000000000000000000000000..387970329fba4dd58a16aa9b083ce6ddc1559937
--- /dev/null
+++ b/service-core/src/main/java/com/wwj/srb/core/controller/api/LendItemController.java
@@ -0,0 +1,84 @@
+package com.wwj.srb.core.controller.api;
+
+
+import com.alibaba.fastjson.JSON;
+import com.wwj.common.result.R;
+import com.wwj.srb.base.util.JwtUtils;
+import com.wwj.srb.core.hfb.RequestHelper;
+import com.wwj.srb.core.pojo.entity.LendItem;
+import com.wwj.srb.core.pojo.vo.InvestVO;
+import com.wwj.srb.core.service.LendItemService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ * 标的出借记录表 前端控制器
+ *
+ *
+ * @author wangweijun
+ * @since 2021-04-27
+ */
+@Api(tags = "标的投资")
+@RestController
+@RequestMapping("/api/core/lendItem")
+@Slf4j
+public class LendItemController {
+
+ @Resource
+ LendItemService lendItemService;
+
+ @ApiOperation("会员投资提交数据")
+ @PostMapping("/auth/commitInvest")
+ public R commitInvest(@RequestBody InvestVO investVO, HttpServletRequest request) {
+
+ String token = request.getHeader("token");
+ Long userId = JwtUtils.getUserId(token);
+ String userName = JwtUtils.getUserName(token);
+ investVO.setInvestUserId(userId);
+ investVO.setInvestName(userName);
+
+ //构建充值自动提交表单
+ String formStr = lendItemService.commitInvest(investVO);
+ return R.ok().data("formStr", formStr);
+ }
+
+ @ApiOperation("会员投资异步回调")
+ @PostMapping("/notify")
+ public String notify(HttpServletRequest request) {
+
+ Map paramMap = RequestHelper.switchMap(request.getParameterMap());
+ log.info("用户投资异步回调:" + JSON.toJSONString(paramMap));
+
+ //校验签名 P2pInvestNotifyVo
+ if(RequestHelper.isSignEquals(paramMap)) {
+ if("0001".equals(paramMap.get("resultCode"))) {
+ lendItemService.notify(paramMap);
+ } else {
+ log.info("用户投资异步回调失败:" + JSON.toJSONString(paramMap));
+ return "fail";
+ }
+ } else {
+ log.info("用户投资异步回调签名错误:" + JSON.toJSONString(paramMap));
+ return "fail";
+ }
+ return "success";
+ }
+
+ @ApiOperation("获取列表")
+ @GetMapping("/list/{lendId}")
+ public R list(
+ @ApiParam(value = "标的id", required = true)
+ @PathVariable Long lendId) {
+ List list = lendItemService.selectByLendId(lendId);
+ return R.ok().data("list", list);
+ }
+}
\ No newline at end of file
diff --git a/service-core/src/main/java/com/wwj/srb/core/controller/api/LendItemReturnController.java b/service-core/src/main/java/com/wwj/srb/core/controller/api/LendItemReturnController.java
new file mode 100644
index 0000000000000000000000000000000000000000..efa76a971f25b8e85c7a10bb82fefef36f4bab5a
--- /dev/null
+++ b/service-core/src/main/java/com/wwj/srb/core/controller/api/LendItemReturnController.java
@@ -0,0 +1,50 @@
+package com.wwj.srb.core.controller.api;
+
+
+import com.wwj.common.result.R;
+import com.wwj.srb.base.util.JwtUtils;
+import com.wwj.srb.core.pojo.entity.LendItemReturn;
+import com.wwj.srb.core.service.LendItemReturnService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+/**
+ *
+ * 标的出借回款记录表 前端控制器
+ *
+ *
+ * @author wangweijun
+ * @since 2021-04-27
+ */
+@Api(tags = "回款计划")
+@RestController
+@RequestMapping("/api/core/lendItemReturn")
+@Slf4j
+public class LendItemReturnController {
+
+ @Resource
+ private LendItemReturnService lendItemReturnService;
+
+ @ApiOperation("获取列表")
+ @GetMapping("/auth/list/{lendId}")
+ public R list(
+ @ApiParam(value = "标的id", required = true)
+ @PathVariable Long lendId, HttpServletRequest request) {
+
+ String token = request.getHeader("token");
+ Long userId = JwtUtils.getUserId(token);
+ List list = lendItemReturnService.selectByLendId(lendId, userId);
+ return R.ok().data("list", list);
+ }
+}
+
diff --git a/service-core/src/main/java/com/wwj/srb/core/controller/api/LendReturnController.java b/service-core/src/main/java/com/wwj/srb/core/controller/api/LendReturnController.java
new file mode 100644
index 0000000000000000000000000000000000000000..a333aa8f5ecbdb323fc5cf82a3e77e4537700a1f
--- /dev/null
+++ b/service-core/src/main/java/com/wwj/srb/core/controller/api/LendReturnController.java
@@ -0,0 +1,81 @@
+package com.wwj.srb.core.controller.api;
+
+
+import com.alibaba.fastjson.JSON;
+import com.wwj.common.result.R;
+import com.wwj.srb.base.util.JwtUtils;
+import com.wwj.srb.core.hfb.RequestHelper;
+import com.wwj.srb.core.pojo.entity.LendReturn;
+import com.wwj.srb.core.service.LendReturnService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ * 还款记录表 前端控制器
+ *
+ *
+ * @author wangweijun
+ * @since 2021-04-27
+ */
+@Api(tags = "还款计划")
+@RestController
+@RequestMapping("/api/core/lendReturn")
+@Slf4j
+public class LendReturnController {
+
+ @Resource
+ private LendReturnService lendReturnService;
+
+ @ApiOperation("获取列表")
+ @GetMapping("/list/{lendId}")
+ public R list(
+ @ApiParam(value = "标的id", required = true)
+ @PathVariable Long lendId) {
+ List list = lendReturnService.selectByLendId(lendId);
+ return R.ok().data("list", list);
+ }
+
+ @ApiOperation("用户还款")
+ @PostMapping("/auth/commitReturn/{lendReturnId}")
+ public R commitReturn(
+ @ApiParam(value = "还款计划id", required = true)
+ @PathVariable Long lendReturnId, HttpServletRequest request) {
+
+ String token = request.getHeader("token");
+ Long userId = JwtUtils.getUserId(token);
+ String formStr = lendReturnService.commitReturn(lendReturnId, userId);
+ return R.ok().data("formStr", formStr);
+ }
+
+ @ApiOperation("还款异步回调")
+ @PostMapping("/notifyUrl")
+ public String notifyUrl(HttpServletRequest request) {
+
+ Map paramMap = RequestHelper.switchMap(request.getParameterMap());
+ log.info("还款异步回调:" + JSON.toJSONString(paramMap));
+
+ //校验签名
+ if(RequestHelper.isSignEquals(paramMap)) {
+ if("0001".equals(paramMap.get("resultCode"))) {
+ lendReturnService.notify(paramMap);
+ } else {
+ log.info("还款异步回调失败:" + JSON.toJSONString(paramMap));
+ return "fail";
+ }
+ } else {
+ log.info("还款异步回调签名错误:" + JSON.toJSONString(paramMap));
+ return "fail";
+ }
+ return "success";
+ }
+}
+
diff --git a/service-core/src/main/java/com/wwj/srb/core/controller/api/TransFlowController.java b/service-core/src/main/java/com/wwj/srb/core/controller/api/TransFlowController.java
new file mode 100644
index 0000000000000000000000000000000000000000..ad6cc42f72e31d2d559154f87535d562fa4528ca
--- /dev/null
+++ b/service-core/src/main/java/com/wwj/srb/core/controller/api/TransFlowController.java
@@ -0,0 +1,45 @@
+package com.wwj.srb.core.controller.api;
+
+
+import com.wwj.common.result.R;
+import com.wwj.srb.base.util.JwtUtils;
+import com.wwj.srb.core.pojo.entity.TransFlow;
+import com.wwj.srb.core.service.TransFlowService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+/**
+ *
+ * 交易流水表 前端控制器
+ *
+ *
+ * @author wangweijun
+ * @since 2021-04-27
+ */
+@Api(tags = "资金记录")
+@RestController
+@RequestMapping("/api/core/transFlow")
+@Slf4j
+public class TransFlowController {
+
+ @Resource
+ private TransFlowService transFlowService;
+
+ @ApiOperation("获取列表")
+ @GetMapping("/list")
+ public R list(HttpServletRequest request) {
+ String token = request.getHeader("token");
+ Long userId = JwtUtils.getUserId(token);
+ List list = transFlowService.selectByUserId(userId);
+ return R.ok().data("list", list);
+ }
+}
+
diff --git a/service-core/src/main/java/com/wwj/srb/core/controller/api/UserAccountController.java b/service-core/src/main/java/com/wwj/srb/core/controller/api/UserAccountController.java
index b613c09ed7ed5755889ce77944f2b6f31acdbd0f..ffd3edc1dd038ba48c87194eb12d22c591c5046c 100644
--- a/service-core/src/main/java/com/wwj/srb/core/controller/api/UserAccountController.java
+++ b/service-core/src/main/java/com/wwj/srb/core/controller/api/UserAccountController.java
@@ -10,10 +10,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -69,4 +66,47 @@ public class UserAccountController {
return "fail";
}
}
+
+ @ApiOperation("查询账户余额")
+ @GetMapping("/auth/getAccount")
+ public R getAccount(HttpServletRequest request) {
+ String token = request.getHeader("token");
+ Long userId = JwtUtils.getUserId(token);
+ BigDecimal account = userAccountService.getAccount(userId);
+ return R.ok().data("account", account);
+ }
+
+ @ApiOperation("用户提现")
+ @PostMapping("/auth/commitWithdraw/{fetchAmt}")
+ public R commitWithdraw(
+ @ApiParam(value = "金额", required = true)
+ @PathVariable BigDecimal fetchAmt, HttpServletRequest request) {
+
+ String token = request.getHeader("token");
+ Long userId = JwtUtils.getUserId(token);
+ String formStr = userAccountService.commitWithdraw(fetchAmt, userId);
+ return R.ok().data("formStr", formStr);
+ }
+
+ @ApiOperation("用户提现异步回调")
+ @PostMapping("/notifyWithdraw")
+ public String notifyWithdraw(HttpServletRequest request) {
+ Map paramMap = RequestHelper.switchMap(request.getParameterMap());
+ log.info("提现异步回调:" + JSON.toJSONString(paramMap));
+
+ //校验签名
+ if(RequestHelper.isSignEquals(paramMap)) {
+ //提现成功交易
+ if("0001".equals(paramMap.get("resultCode"))) {
+ userAccountService.notifyWithdraw(paramMap);
+ } else {
+ log.info("提现异步回调充值失败:" + JSON.toJSONString(paramMap));
+ return "fail";
+ }
+ } else {
+ log.info("提现异步回调签名错误:" + JSON.toJSONString(paramMap));
+ return "fail";
+ }
+ return "success";
+ }
}
diff --git a/service-core/src/main/java/com/wwj/srb/core/controller/api/UserInfoController.java b/service-core/src/main/java/com/wwj/srb/core/controller/api/UserInfoController.java
index b8c966dd6689886a03acedd1a44b735b0605542a..b5764e904dcbe8dd14f789fb2baf81c2bbaa7775 100644
--- a/service-core/src/main/java/com/wwj/srb/core/controller/api/UserInfoController.java
+++ b/service-core/src/main/java/com/wwj/srb/core/controller/api/UserInfoController.java
@@ -7,6 +7,7 @@ import com.wwj.common.util.RegexValidateUtils;
import com.wwj.srb.base.util.JwtUtils;
import com.wwj.srb.core.pojo.vo.LoginVO;
import com.wwj.srb.core.pojo.vo.RegisterVO;
+import com.wwj.srb.core.pojo.vo.UserIndexVO;
import com.wwj.srb.core.pojo.vo.UserInfoVO;
import com.wwj.srb.core.service.UserInfoService;
import io.swagger.annotations.Api;
@@ -87,4 +88,13 @@ public class UserInfoController {
public boolean checkMobile(@PathVariable String mobile) {
return userInfoService.checkMobile(mobile);
}
+
+ @ApiOperation("获取个人空间用户信息")
+ @GetMapping("/auth/getIndexUserInfo")
+ public R getIndexUserInfo(HttpServletRequest request) {
+ String token = request.getHeader("token");
+ Long userId = JwtUtils.getUserId(token);
+ UserIndexVO userIndexVO = userInfoService.getIndexUserInfo(userId);
+ return R.ok().data("userIndexVO", userIndexVO);
+ }
}
diff --git a/service-core/src/main/java/com/wwj/srb/core/pojo/vo/InvestVO.java b/service-core/src/main/java/com/wwj/srb/core/pojo/vo/InvestVO.java
new file mode 100644
index 0000000000000000000000000000000000000000..1ba05aa3b4c49602b660a898eb641052100705ac
--- /dev/null
+++ b/service-core/src/main/java/com/wwj/srb/core/pojo/vo/InvestVO.java
@@ -0,0 +1,27 @@
+package com.wwj.srb.core.pojo.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+@Data
+@ApiModel(description = "投标信息")
+public class InvestVO {
+
+ private Long lendId;
+
+ /**
+ * 投标金额
+ */
+ private String investAmount;
+
+
+ /**
+ * 用户id
+ */
+ private Long investUserId;
+
+ /**
+ * 用户姓名
+ */
+ private String investName;
+}
diff --git a/service-core/src/main/java/com/wwj/srb/core/pojo/vo/UserIndexVO.java b/service-core/src/main/java/com/wwj/srb/core/pojo/vo/UserIndexVO.java
new file mode 100644
index 0000000000000000000000000000000000000000..cd83100cc7cb994310309c016db5372e96880eb7
--- /dev/null
+++ b/service-core/src/main/java/com/wwj/srb/core/pojo/vo/UserIndexVO.java
@@ -0,0 +1,41 @@
+package com.wwj.srb.core.pojo.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+@Data
+@ApiModel(description = "首页用户信息")
+public class UserIndexVO {
+
+ @ApiModelProperty(value = "用户id")
+ private Long userId;
+
+ @ApiModelProperty(value = "用户姓名")
+ private String name;
+
+ @ApiModelProperty(value = "用户昵称")
+ private String nickName;
+
+ @ApiModelProperty(value = "1:出借人 2:借款人")
+ private Integer userType;
+
+ @ApiModelProperty(value = "用户头像")
+ private String headImg;
+
+ @ApiModelProperty(value = "绑定状态(0:未绑定,1:绑定成功 -1:绑定失败)")
+ private Integer bindStatus;
+
+ @ApiModelProperty(value = "帐户可用余额")
+ private BigDecimal amount;
+
+ @ApiModelProperty(value = "冻结金额")
+ private BigDecimal freezeAmount;
+
+ @ApiModelProperty(value = "上次登录时间")
+ private LocalDateTime lastLoginTime;
+
+}
\ No newline at end of file
diff --git a/service-core/src/main/java/com/wwj/srb/core/service/LendItemReturnService.java b/service-core/src/main/java/com/wwj/srb/core/service/LendItemReturnService.java
index 6f434c4b324a406396bd2a54921ac84773d9c84b..1ccf487f7ab175ed171ad722db3192005e55bf25 100644
--- a/service-core/src/main/java/com/wwj/srb/core/service/LendItemReturnService.java
+++ b/service-core/src/main/java/com/wwj/srb/core/service/LendItemReturnService.java
@@ -3,6 +3,9 @@ package com.wwj.srb.core.service;
import com.wwj.srb.core.pojo.entity.LendItemReturn;
import com.baomidou.mybatisplus.extension.service.IService;
+import java.util.List;
+import java.util.Map;
+
/**
*
* 标的出借回款记录表 服务类
@@ -13,4 +16,15 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface LendItemReturnService extends IService {
+ List selectByLendId(Long lendId, Long userId);
+
+ List