From aac94d3eed9fc8f1958a24f06b3ca5c41fe11718 Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Tue, 16 Jul 2024 23:15:20 +0800
Subject: [PATCH] 1
---
src/main/java/com/nq/controller/agent/AgentController.java | 16 +
src/main/resources/mapper/StockMapper.xml | 3
src/main/java/com/nq/service/impl/UserAssetsServices.java | 12
src/main/java/com/nq/service/impl/StockServiceImpl.java | 22 +
src/main/resources/mapper/UserOptionLogMapper.xml | 21 +
src/main/java/com/nq/utils/task/stock/StockTask.java | 2
src/main/java/com/nq/utils/ConverterUtil.java | 44 +++
src/main/java/com/nq/vo/user/UserOptionLogVO.java | 27 +
src/main/java/com/nq/pojo/UserOptionLog.java | 35 ++
src/main/java/com/nq/service/impl/SiteUserOptionLogServiceImpl.java | 34 ++
src/main/java/com/nq/dao/AgentUserMapper.java | 5
src/main/java/com/nq/dao/UserOptionLogMapper.java | 12
src/main/java/com/nq/service/ISiteUserOptionLogService.java | 10
src/main/java/com/nq/service/impl/SiteAdminServiceImpl.java | 278 +++++++++++++++++++
src/main/java/com/nq/service/impl/SiteNewsServiceImpl.java | 2
src/main/java/com/nq/vo/agent/AgentUserNodeVO.java | 64 ++++
src/main/java/com/nq/controller/backend/AdminController.java | 14 +
src/main/java/com/nq/pojo/UserWithdraw.java | 161 -----------
src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java | 1
src/main/java/com/nq/dao/UserWithdrawMapper.java | 5
src/main/java/com/nq/service/ISiteAdminService.java | 6
src/main/java/com/nq/controller/backend/AdminLogsController.java | 9
22 files changed, 605 insertions(+), 178 deletions(-)
diff --git a/src/main/java/com/nq/controller/agent/AgentController.java b/src/main/java/com/nq/controller/agent/AgentController.java
index e77a4ce..c32794e 100644
--- a/src/main/java/com/nq/controller/agent/AgentController.java
+++ b/src/main/java/com/nq/controller/agent/AgentController.java
@@ -138,4 +138,20 @@
@RequestParam("userId") Integer id){
return iUserService.getMoney(id);
}
+
+
+ //查询首页充值,提现,注册统计
+ @RequestMapping({"moneyCount.do"})
+ @ResponseBody
+ public ServerResponse moneyCount(@RequestParam(value = "agentId", required = false) String agentId,@RequestParam(value = "startTime", required = false) String startTime,@RequestParam(value = "entTime", required = false) String entTime) {
+ return this.iSiteAdminService.moneyCount(agentId,startTime,entTime);
+ }
+
+ //查询代理总资金
+ @RequestMapping({"totalAgencyFunds.do"})
+ @ResponseBody
+ public ServerResponse totalAgencyFunds(@RequestParam(value = "agentId", required = false) String agentId) {
+ return this.iSiteAdminService.totalAgencyFunds(agentId);
+ }
+
}
diff --git a/src/main/java/com/nq/controller/backend/AdminController.java b/src/main/java/com/nq/controller/backend/AdminController.java
index 47c257a..fbfd3ba 100644
--- a/src/main/java/com/nq/controller/backend/AdminController.java
+++ b/src/main/java/com/nq/controller/backend/AdminController.java
@@ -379,4 +379,18 @@
return iUserAssetsServices.updateUserAssets(id,amt,type);
}
+ //查询首页充值,提现,注册统计
+ @RequestMapping({"moneyCount.do"})
+ @ResponseBody
+ public ServerResponse moneyCount(@RequestParam(value = "agentId", required = false) String agentId,@RequestParam(value = "startTime", required = false) String startTime,@RequestParam(value = "entTime", required = false) String entTime) {
+ return this.iSiteAdminService.moneyCount(agentId,startTime,entTime);
+ }
+
+ //查询代理总资金
+ @RequestMapping({"totalAgencyFunds.do"})
+ @ResponseBody
+ public ServerResponse totalAgencyFunds(@RequestParam(value = "agentId", required = false) String agentId) {
+ return this.iSiteAdminService.totalAgencyFunds(agentId);
+ }
+
}
diff --git a/src/main/java/com/nq/controller/backend/AdminLogsController.java b/src/main/java/com/nq/controller/backend/AdminLogsController.java
index f0f29b0..7ec2968 100644
--- a/src/main/java/com/nq/controller/backend/AdminLogsController.java
+++ b/src/main/java/com/nq/controller/backend/AdminLogsController.java
@@ -42,6 +42,9 @@
@Autowired
ISiteMessageService iSiteMessageService;
+ @Autowired
+ ISiteUserOptionLogService iSiteUserOptionLogService;
+
//分页查询日志管理 所有定时任务信息及模糊查询
@RequestMapping({"taskList.do"})
@ResponseBody
@@ -106,7 +109,11 @@
}
-
+ @RequestMapping("optionList.do")
+ @ResponseBody
+ public ServerResponse optionList(@RequestParam(value = "userId", required = false) Integer userId, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize){
+ return this.iSiteUserOptionLogService.list(null,userId,pageNum,pageSize);
+ }
}
diff --git a/src/main/java/com/nq/dao/AgentUserMapper.java b/src/main/java/com/nq/dao/AgentUserMapper.java
index 6825cb9..2503a86 100644
--- a/src/main/java/com/nq/dao/AgentUserMapper.java
+++ b/src/main/java/com/nq/dao/AgentUserMapper.java
@@ -2,14 +2,13 @@
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nq.pojo.AgentUser;
import java.util.List;
import org.apache.ibatis.annotations.Param;
-public interface AgentUserMapper {
+public interface AgentUserMapper extends BaseMapper<AgentUser> {
int deleteByPrimaryKey(Integer paramInteger);
-
- int insert(AgentUser paramAgentUser);
int insertSelective(AgentUser paramAgentUser);
diff --git a/src/main/java/com/nq/dao/UserOptionLogMapper.java b/src/main/java/com/nq/dao/UserOptionLogMapper.java
new file mode 100644
index 0000000..a468c12
--- /dev/null
+++ b/src/main/java/com/nq/dao/UserOptionLogMapper.java
@@ -0,0 +1,12 @@
+package com.nq.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.nq.pojo.UserOptionLog;
+import com.nq.vo.user.UserOptionLogVO;
+
+import java.util.List;
+
+public interface UserOptionLogMapper extends BaseMapper<UserOptionLog> {
+
+ List<UserOptionLogVO> selective(Integer userId);
+}
diff --git a/src/main/java/com/nq/dao/UserWithdrawMapper.java b/src/main/java/com/nq/dao/UserWithdrawMapper.java
index a30197b..83ba748 100644
--- a/src/main/java/com/nq/dao/UserWithdrawMapper.java
+++ b/src/main/java/com/nq/dao/UserWithdrawMapper.java
@@ -1,14 +1,13 @@
package com.nq.dao;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nq.pojo.UserWithdraw;
import java.math.BigDecimal;
import java.util.List;
import org.apache.ibatis.annotations.Param;
-public interface UserWithdrawMapper {
+public interface UserWithdrawMapper extends BaseMapper<UserWithdraw> {
int deleteByPrimaryKey(Integer paramInteger);
-
- int insert(UserWithdraw paramUserWithdraw);
int insertSelective(UserWithdraw paramUserWithdraw);
diff --git a/src/main/java/com/nq/pojo/UserOptionLog.java b/src/main/java/com/nq/pojo/UserOptionLog.java
new file mode 100644
index 0000000..82a42e3
--- /dev/null
+++ b/src/main/java/com/nq/pojo/UserOptionLog.java
@@ -0,0 +1,35 @@
+package com.nq.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+
+@Data
+@TableName("user_option_log")
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class UserOptionLog {
+
+ @TableId(type = IdType.AUTO,value = "id")
+ private Integer id;
+
+ private BigDecimal money;
+
+ private Integer type;
+
+ private Integer userId;
+
+ private Integer userAccectId;
+
+ private Date createTime;
+
+}
diff --git a/src/main/java/com/nq/pojo/UserWithdraw.java b/src/main/java/com/nq/pojo/UserWithdraw.java
index 0f04103..bb47af4 100644
--- a/src/main/java/com/nq/pojo/UserWithdraw.java
+++ b/src/main/java/com/nq/pojo/UserWithdraw.java
@@ -1,13 +1,15 @@
package com.nq.pojo;
import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
-
+@Data
public class UserWithdraw {
private Integer id;
@@ -40,162 +42,9 @@
private BigDecimal withFee;
@Excel(name = "原因")
private String withMsg;
-
+ @TableField(exist = false)
private String userPhone;
+ private String assetsType;
- public UserWithdraw(Integer id, Integer userId, String nickName, Integer agentId, BigDecimal withAmt, Date applyTime, Date transTime, String withName, String bankNo, String bankName, String bankAddress, Integer withStatus, BigDecimal withFee, String withMsg) {
-
- this.id = id;
-
- this.userId = userId;
-
- this.nickName = nickName;
-
- this.agentId = agentId;
-
- this.withAmt = withAmt;
-
- this.applyTime = applyTime;
-
- this.transTime = transTime;
-
- this.withName = withName;
-
- this.bankNo = bankNo;
-
- this.bankName = bankName;
-
- this.bankAddress = bankAddress;
-
- this.withStatus = withStatus;
-
- this.withFee = withFee;
-
- this.withMsg = withMsg;
-
- }
-
- public UserWithdraw() {
- }
-
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public Integer getUserId() {
- return userId;
- }
-
- public void setUserId(Integer userId) {
- this.userId = userId;
- }
-
- public String getNickName() {
- return nickName;
- }
-
- public void setNickName(String nickName) {
- this.nickName = nickName;
- }
-
- public Integer getAgentId() {
- return agentId;
- }
-
- public void setAgentId(Integer agentId) {
- this.agentId = agentId;
- }
-
- public BigDecimal getWithAmt() {
- return withAmt;
- }
-
- public void setWithAmt(BigDecimal withAmt) {
- this.withAmt = withAmt;
- }
-
- public Date getApplyTime() {
- return applyTime;
- }
-
- public void setApplyTime(Date applyTime) {
- this.applyTime = applyTime;
- }
-
- public Date getTransTime() {
- return transTime;
- }
-
- public void setTransTime(Date transTime) {
- this.transTime = transTime;
- }
-
- public String getWithName() {
- return withName;
- }
-
- public void setWithName(String withName) {
- this.withName = withName;
- }
-
- public String getBankNo() {
- return bankNo;
- }
-
- public void setBankNo(String bankNo) {
- this.bankNo = bankNo;
- }
-
- public String getBankName() {
- return bankName;
- }
-
- public void setBankName(String bankName) {
- this.bankName = bankName;
- }
-
- public String getBankAddress() {
- return bankAddress;
- }
-
- public void setBankAddress(String bankAddress) {
- this.bankAddress = bankAddress;
- }
-
- public Integer getWithStatus() {
- return withStatus;
- }
-
- public void setWithStatus(Integer withStatus) {
- this.withStatus = withStatus;
- }
-
- public BigDecimal getWithFee() {
- return withFee;
- }
-
- public void setWithFee(BigDecimal withFee) {
- this.withFee = withFee;
- }
-
- public String getWithMsg() {
- return withMsg;
- }
-
- public void setWithMsg(String withMsg) {
- this.withMsg = withMsg;
- }
-
- public String getUserPhone() {
- return userPhone;
- }
-
- public void setUserPhone(String userPhone) {
- this.userPhone = userPhone;
- }
}
\ No newline at end of file
diff --git a/src/main/java/com/nq/service/ISiteAdminService.java b/src/main/java/com/nq/service/ISiteAdminService.java
index 7b185bf..9725531 100644
--- a/src/main/java/com/nq/service/ISiteAdminService.java
+++ b/src/main/java/com/nq/service/ISiteAdminService.java
@@ -27,4 +27,10 @@
ServerResponse count();
ServerResponse deleteAdmin(Integer adminId);
+
+ ServerResponse moneyCount(String agentId,String startTime, String entTime);
+
+ ServerResponse totalAgencyFunds(String agentId);
+
+
}
diff --git a/src/main/java/com/nq/service/ISiteUserOptionLogService.java b/src/main/java/com/nq/service/ISiteUserOptionLogService.java
new file mode 100644
index 0000000..96c2cff
--- /dev/null
+++ b/src/main/java/com/nq/service/ISiteUserOptionLogService.java
@@ -0,0 +1,10 @@
+package com.nq.service;
+
+
+import com.github.pagehelper.PageInfo;
+import com.nq.common.ServerResponse;
+
+public interface ISiteUserOptionLogService {
+ ServerResponse<PageInfo> list( Integer agentId,Integer userId, int pageNum, int pageSize);
+
+}
diff --git a/src/main/java/com/nq/service/impl/SiteAdminServiceImpl.java b/src/main/java/com/nq/service/impl/SiteAdminServiceImpl.java
index 4b8abe0..7fd8276 100644
--- a/src/main/java/com/nq/service/impl/SiteAdminServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/SiteAdminServiceImpl.java
@@ -1,19 +1,16 @@
package com.nq.service.impl;
+import cn.hutool.core.collection.CollectionUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.nq.dao.SiteAdminMapper;
+import com.nq.dao.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.nq.common.ServerResponse;
-import com.nq.dao.UserMapper;
-import com.nq.dao.UserRechargeMapper;
-import com.nq.dao.UserWithdrawMapper;
-import com.nq.pojo.SiteAdmin;
-
-import com.nq.pojo.UserRecharge;
+import com.nq.pojo.*;
import com.nq.service.IAgentUserService;
@@ -29,6 +26,7 @@
import com.nq.service.IUserWithdrawService;
+import com.nq.utils.ConverterUtil;
import com.nq.utils.PropertiesUtil;
import com.nq.utils.SymmetricCryptoUtil;
@@ -41,14 +39,17 @@
import java.math.BigDecimal;
-import java.util.Date;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
-import java.util.List;
+import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
+import com.nq.vo.agent.AgentUserNodeVO;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@@ -102,6 +103,12 @@
@Resource
UserMapper userMapper;
+
+ @Autowired
+ AgentUserMapper agentUserMapper;
+
+ @Autowired
+ UserWithdrawMapper userWithdrawMapper;
public ServerResponse login(String adminPhone, String adminPwd, String verifyCode, HttpServletRequest request) {
@@ -479,10 +486,257 @@
return ServerResponse.createBySuccess(adminCountVO);
}
+ @Override
+ public ServerResponse totalAgencyFunds(String agentId) {
+ BigDecimal inTotalAmount = BigDecimal.ZERO;
+ BigDecimal usTotalAmount = BigDecimal.ZERO;
- public static void main(String[] args) {
- System.out.println(RedisShardedPoolUtils.get("1"));
- System.out.println(RedisShardedPoolUtils.get("2"));
+ BigDecimal inTotalWithdrawAmount = BigDecimal.ZERO;
+ BigDecimal usTotalWithdrawAmount = BigDecimal.ZERO;
+ Map<String, Object> map = new HashMap<>();
+ Long todayRegister = 0L;//今日注册
+ map.put("todayRegister", todayRegister);
+ //入金
+ map.put("inTotalAmount", inTotalAmount);
+ map.put("usTotalAmount", usTotalAmount);
+ //出金
+ map.put("inTotalWithdrawAmount", inTotalWithdrawAmount);
+ map.put("usTotalWithdrawAmount", usTotalWithdrawAmount);
+ //查询所有代理用户(管理员)
+ List<AgentUser> agentUsers = agentUserMapper.selectList(new LambdaQueryWrapper<AgentUser>()
+ .eq(AgentUser::getAgentLevel,0)
+ .eq(StringUtils.isNotBlank(agentId),AgentUser::getId,agentId));
+ List<AgentUser> lowerAgentUsers = agentUserMapper.selectList(new LambdaQueryWrapper<AgentUser>()
+ .ne(AgentUser::getAgentLevel,0));
+ if(CollectionUtil.isEmpty(agentUsers)){
+ return ServerResponse.createBySuccess(map);
+ }
+
+ //今日开始结束时间
+ LocalDate currentDate = LocalDate.now();
+ LocalDate nextDay = currentDate.plusDays(1);
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ String start = currentDate.format(formatter);
+ String end = nextDay.format(formatter);
+
+ for (AgentUser agentUser : agentUsers) {
+ AgentUserNodeVO userNodeVO = ConverterUtil.convert(agentUser, AgentUserNodeVO.class);
+ List<AgentUserNodeVO> agentUserNodeVOS = ConverterUtil.convertToList(lowerAgentUsers, AgentUserNodeVO.class);
+ List<AgentUserNodeVO> nodeJson = getNodeJson(userNodeVO, agentUserNodeVOS);
+ userNodeVO.setChildList(nodeJson);
+ //当前节点和子节点的id
+ List<Integer> ids = getAllChildrenIds(userNodeVO);
+ //查询代理id下面所有的用户
+ List<User> users = userMapper.selectList(new LambdaQueryWrapper<User>().in(User::getAgentId, ids));
+ //查询用户充值
+ List<Integer> userIds = users.stream().map(User::getId).collect(Collectors.toList());
+ if(CollectionUtil.isEmpty(userIds)){
+ continue;
+ }
+
+ //今日注册数量
+ todayRegister = userMapper.selectCount(new LambdaQueryWrapper<User>()
+ .ge(User::getRegTime, start)
+ .le(User::getRegTime, end)
+ .in(CollectionUtil.isNotEmpty(userIds),User::getId,userIds));
+
+ List<UserRecharge> userRecharges = userRechargeMapper.selectList(new LambdaQueryWrapper<UserRecharge>()
+ .eq(UserRecharge::getOrderStatus, 1)
+ .in(UserRecharge::getUserId,userIds));
+ Map<String, List<UserRecharge>> typeList = userRecharges.stream().collect(Collectors.groupingBy(UserRecharge::getAssetsType));
+ List<UserRecharge> inUserRecharge = typeList.get("IN");
+ List<UserRecharge> usUserRecharge = typeList.get("US");
+ if(CollectionUtil.isNotEmpty(inUserRecharge)){
+ for (UserRecharge userRecharge : inUserRecharge) {
+ inTotalAmount = inTotalAmount.add(userRecharge.getPayAmt());
+ }
+ }
+ if(CollectionUtil.isNotEmpty(usUserRecharge)){
+ for (UserRecharge userRecharge : usUserRecharge) {
+ usTotalAmount = usTotalAmount.add(userRecharge.getPayAmt());
+ }
+ }
+
+ //总提现
+ List<UserWithdraw> userWithdraws = userWithdrawMapper.selectList(new LambdaQueryWrapper<UserWithdraw>()
+ .eq(UserWithdraw::getWithStatus, 1)
+ .in(CollectionUtil.isNotEmpty(userIds),UserWithdraw::getUserId,userIds));
+ Map<String, List<UserWithdraw>> typeWithdrawsList = userWithdraws.stream().collect(Collectors.groupingBy(UserWithdraw::getAssetsType));
+ List<UserWithdraw> inUserWithdraws = typeWithdrawsList.get("IN");
+ List<UserWithdraw> usUserWithdraws = typeWithdrawsList.get("US");
+ if(CollectionUtil.isNotEmpty(inUserWithdraws)){
+ for (UserWithdraw userWithdraw : inUserWithdraws) {
+ inTotalWithdrawAmount = inTotalWithdrawAmount.add(userWithdraw.getWithAmt());
+ }
+ }
+ if(CollectionUtil.isNotEmpty(usUserWithdraws)){
+ for (UserWithdraw userWithdraw : usUserWithdraws) {
+ usTotalWithdrawAmount = usTotalWithdrawAmount.add(userWithdraw.getWithAmt());
+ }
+ }
+ }
+ map.put("todayRegister", todayRegister);
+ map.put("inTotalAmount", inTotalAmount);
+ map.put("usTotalAmount", usTotalAmount);
+ map.put("inTotalWithdrawAmount", inTotalWithdrawAmount);
+ map.put("usTotalWithdrawAmount", usTotalWithdrawAmount);
+ return ServerResponse.createBySuccess(map);
}
+ @Override
+ public ServerResponse moneyCount(String agentId,String startTime, String entTime) {
+ BigDecimal todayRechargeAmount = BigDecimal.ZERO;//今日充值金额
+ BigDecimal todayWithdrawAmount = BigDecimal.ZERO;//今日提现金额
+ Long todayRegister = 0L;//今日注册
+ Long todayWithdraw = 0L;//今日充值总人数
+ BigDecimal rechargeTotalAmount = BigDecimal.ZERO;//总充值金额
+ BigDecimal withdrawalTotalAmount = BigDecimal.ZERO;//总提现金额
+
+ Map<String, Object> map = new HashMap<>();
+ map.put("todayRechargeAmount", todayRechargeAmount);
+ map.put("todayWithdrawAmount", todayWithdrawAmount);
+ map.put("todayRegister", todayRegister);
+ map.put("todayWithdraw", todayWithdraw);
+ map.put("rechargeTotalAmount", rechargeTotalAmount);
+ map.put("withdrawalTotalAmount", withdrawalTotalAmount);
+
+ //今日开始结束时间
+ LocalDate currentDate = LocalDate.now();
+ LocalDate nextDay = currentDate.plusDays(1);
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ String start = currentDate.format(formatter);
+ String end = nextDay.format(formatter);
+ List<Integer> userIds = null;
+ if(StringUtils.isNotEmpty(agentId)){
+ //当前代理
+ AgentUser agentUser = agentUserMapper.selectById(agentId);
+ if(null == agentUser){
+ return ServerResponse.createBySuccess(map);
+ }
+ List<AgentUser> lowerAgentUsers = agentUserMapper.selectList(new LambdaQueryWrapper<AgentUser>());
+ AgentUserNodeVO userNodeVO = ConverterUtil.convert(agentUser, AgentUserNodeVO.class);
+ List<AgentUserNodeVO> agentUserNodeVOS = ConverterUtil.convertToList(lowerAgentUsers, AgentUserNodeVO.class);
+ List<AgentUserNodeVO> nodeJson = getNodeJson(userNodeVO, agentUserNodeVOS);
+ userNodeVO.setChildList(nodeJson);
+ //当前节点和子节点的id
+ List<Integer> ids = getAllChildrenIds(userNodeVO);
+ //查询代理id下面所有的用户
+ List<User> users = userMapper.selectList(new LambdaQueryWrapper<User>().in(User::getAgentId, ids));
+ userIds = users.stream().map(User::getId).collect(Collectors.toList());
+ }
+ //今日充值
+ List<UserRecharge> todayRecharges = userRechargeMapper.selectList(new LambdaQueryWrapper<UserRecharge>().eq(UserRecharge::getOrderStatus, 1)
+ .ge(UserRecharge::getPayTime, start)
+ .le(UserRecharge::getPayTime, end)
+ .in(CollectionUtil.isNotEmpty(userIds),UserRecharge::getUserId,userIds));
+
+ //今日提现
+ List<UserWithdraw> todayWithdraws = userWithdrawMapper.selectList(new LambdaQueryWrapper<UserWithdraw>().eq(UserWithdraw::getWithStatus, 1)
+ .ge(UserWithdraw::getTransTime, start)
+ .le(UserWithdraw::getTransTime, end)
+ .in(CollectionUtil.isNotEmpty(userIds),UserWithdraw::getUserId,userIds));
+
+ //总充值
+ List<UserRecharge> userRecharges = userRechargeMapper.selectList(new LambdaQueryWrapper<UserRecharge>().eq(UserRecharge::getOrderStatus, 1)
+ .ge(StringUtils.isNotBlank(startTime), UserRecharge::getPayTime, startTime)
+ .le(StringUtils.isNotBlank(entTime), UserRecharge::getPayTime, entTime)
+ .in(CollectionUtil.isNotEmpty(userIds),UserRecharge::getUserId,userIds));
+
+ //总提现
+ List<UserWithdraw> userWithdraws = userWithdrawMapper.selectList(new LambdaQueryWrapper<UserWithdraw>().eq(UserWithdraw::getWithStatus, 1)
+ .ge(StringUtils.isNotBlank(startTime), UserWithdraw::getTransTime, startTime)
+ .le(StringUtils.isNotBlank(entTime), UserWithdraw::getTransTime, entTime)
+ .in(CollectionUtil.isNotEmpty(userIds),UserWithdraw::getUserId,userIds));
+
+ //今日注册数量
+ todayRegister = userMapper.selectCount(new LambdaQueryWrapper<User>()
+ .ge(User::getRegTime, start)
+ .le(User::getRegTime, end)
+ .in(CollectionUtil.isNotEmpty(userIds),User::getId,userIds));
+
+ for (UserRecharge userRecharge : todayRecharges) {
+ todayRechargeAmount = todayRechargeAmount.add(userRecharge.getPayAmt());
+ }
+
+ for (UserWithdraw userWithdraw : todayWithdraws) {
+ todayWithdrawAmount = todayWithdrawAmount.add(userWithdraw.getWithAmt());
+ }
+
+ for (UserRecharge userRecharge : userRecharges) {
+ rechargeTotalAmount = rechargeTotalAmount.add(userRecharge.getPayAmt());
+ }
+
+ for (UserWithdraw userWithdraw : userWithdraws) {
+ withdrawalTotalAmount = withdrawalTotalAmount.add(userWithdraw.getWithAmt());
+ }
+
+ List<UserRecharge> distinctCustomers = todayRecharges.stream()
+ .collect(Collectors.toMap(UserRecharge::getUserId, c -> c, (c1, c2) -> c1))
+ .values().stream()
+ .collect(Collectors.toList());
+ todayWithdraw = Long.valueOf(distinctCustomers.size());
+
+ map.put("todayRechargeAmount", todayRechargeAmount);
+ map.put("todayWithdrawAmount", todayWithdrawAmount);
+ map.put("todayRegister", todayRegister);
+ map.put("todayWithdraw", todayWithdraw);
+ map.put("rechargeTotalAmount", rechargeTotalAmount);
+ map.put("withdrawalTotalAmount", withdrawalTotalAmount);
+ return ServerResponse.createBySuccess(map);
+ }
+ public static List<Integer> getAllChildrenIds(AgentUserNodeVO parent) {
+ List<Integer> allChildrenIds = new ArrayList<>();
+ getAllChildrenIdsHelper(parent, allChildrenIds);
+ return allChildrenIds;
+ }
+
+ private static void getAllChildrenIdsHelper(AgentUserNodeVO node, List<Integer> allChildrenIds) {
+ allChildrenIds.add(node.getId());
+ if(CollectionUtil.isNotEmpty(node.getChildList())){
+ for (AgentUserNodeVO child : node.getChildList()) {
+ getAllChildrenIdsHelper(child, allChildrenIds);
+ }
+ }
+ }
+
+ public List<AgentUserNodeVO> getNodeJson(AgentUserNodeVO agentUser, List<AgentUserNodeVO> nodes){
+
+ //当前层级当前点下的所有子节点
+ List<AgentUserNodeVO> childList = getChildNodes(agentUser.getId(),nodes);
+ List<AgentUserNodeVO> list = new ArrayList<>();
+ childList.forEach(f->{
+ List<AgentUserNodeVO> childs = getNodeJson(f,nodes); //递归调用该方法
+ if(!childs.isEmpty()) {
+ f.setChildList(childs);
+ }
+ list.add(f);
+ });
+ return list;
+ }
+
+ /**
+ * 获取当前节点的所有子节点
+ * @param nodeId
+ * @param nodes
+ * @return
+ */
+ public List<AgentUserNodeVO> getChildNodes(Integer nodeId, List<AgentUserNodeVO> nodes){
+ List<AgentUserNodeVO> list = new ArrayList<>();
+ nodes.forEach(f->{
+ if(f.getParentId().equals(nodeId)){
+ list.add(f);
+ }
+ });
+ return list;
+ }
+
+
+ public String getDate(){
+ LocalDate currentDate = LocalDate.now();
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ return currentDate.format(formatter);
+ }
+
+
+
}
diff --git a/src/main/java/com/nq/service/impl/SiteNewsServiceImpl.java b/src/main/java/com/nq/service/impl/SiteNewsServiceImpl.java
index 506ea52..e24fecd 100644
--- a/src/main/java/com/nq/service/impl/SiteNewsServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/SiteNewsServiceImpl.java
@@ -132,7 +132,7 @@
@Override
public void grabNews() {
- addNews(1, PropertiesUtil.getProperty("JP_HTTP_API") + "stock-markets?key=" + PropertiesUtil.getProperty("JP_KEY") + "&type=6");
+ addNews(1, PropertiesUtil.getProperty("JP_HTTP_API") + "stock-markets?key=" + PropertiesUtil.getProperty("JP_KEY") + "&type=6&country_id=35");
}
private void addNews(Integer type, String url) {
diff --git a/src/main/java/com/nq/service/impl/SiteUserOptionLogServiceImpl.java b/src/main/java/com/nq/service/impl/SiteUserOptionLogServiceImpl.java
new file mode 100644
index 0000000..b8df93e
--- /dev/null
+++ b/src/main/java/com/nq/service/impl/SiteUserOptionLogServiceImpl.java
@@ -0,0 +1,34 @@
+package com.nq.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.nq.common.ServerResponse;
+import com.nq.dao.UserOptionLogMapper;
+import com.nq.service.ISiteUserOptionLogService;
+import com.nq.vo.user.UserOptionLogVO;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+
+@Service("ISiteUserOptionLogService")
+public class SiteUserOptionLogServiceImpl implements ISiteUserOptionLogService {
+ private static final Logger log = LoggerFactory.getLogger(SiteUserOptionLogServiceImpl.class);
+
+ @Autowired
+ UserOptionLogMapper userOptionLogMapper;
+
+ @Override
+ public ServerResponse<PageInfo> list( Integer agentId,Integer userId, int pageNum, int pageSize) {
+ if(null != agentId){
+
+ }
+ PageHelper.startPage(pageNum, pageSize);
+ List<UserOptionLogVO> list = userOptionLogMapper.selective(userId);
+ PageInfo pageInfo = new PageInfo(list);
+ return ServerResponse.createBySuccess(pageInfo);
+ }
+}
diff --git a/src/main/java/com/nq/service/impl/StockServiceImpl.java b/src/main/java/com/nq/service/impl/StockServiceImpl.java
index cb7f279..771f98c 100644
--- a/src/main/java/com/nq/service/impl/StockServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/StockServiceImpl.java
@@ -242,6 +242,28 @@
return ServerResponse.createBySuccess(map);
}
+ public String doGet(String pid, EStockType eStockType) {
+ String apiUrl = eStockType.getStockUrl() + "/indices?country_id="+eStockType.getContryId()+"&key=" + eStockType.getStockKey();
+ try {
+ URL url = new URL(apiUrl);
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setRequestMethod("GET");
+
+ BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+ String inputLine;
+ StringBuffer response = new StringBuffer();
+
+ while ((inputLine = in.readLine()) != null) {
+ response.append(inputLine);
+ }
+ in.close();
+ return response.toString();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
public Map getSingleStock(String code) {
if (StringUtils.isBlank(code))
return null;
diff --git a/src/main/java/com/nq/service/impl/UserAssetsServices.java b/src/main/java/com/nq/service/impl/UserAssetsServices.java
index 7ab3733..8c448c4 100644
--- a/src/main/java/com/nq/service/impl/UserAssetsServices.java
+++ b/src/main/java/com/nq/service/impl/UserAssetsServices.java
@@ -4,10 +4,12 @@
import com.nq.common.ServerResponse;
import com.nq.dao.MoneyLogMapper;
import com.nq.dao.UserAssetsMapper;
+import com.nq.dao.UserOptionLogMapper;
import com.nq.enums.EStockType;
import com.nq.enums.EUserAssets;
import com.nq.pojo.MoneyLog;
import com.nq.pojo.UserAssets;
+import com.nq.pojo.UserOptionLog;
import com.nq.service.IUserAssetsServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -35,6 +37,9 @@
@Autowired
UserWithdrawServiceImpl withdrawService;
+
+ @Resource
+ UserOptionLogMapper userOptionLogMapper;
@Override
public UserAssets assetsByTypeAndUserId(String accetType, Integer userId) {
@@ -86,6 +91,13 @@
userAssets.setAvailableBalance(userAssets.getAvailableBalance().add(bigAmt));
}
if( userAssetsMapper.updateById(userAssets)>0){
+ userOptionLogMapper.insert(UserOptionLog.builder()
+ .userId(userAssets.getUserId())
+ .money(bigAmt)
+ .userAccectId(userAssets.getId())
+ .createTime(new Date())
+ .type(amt.contains("-")?0:1)
+ .build());
return ServerResponse.createBySuccess();
}else{
return ServerResponse.createByErrorMsg("修改金额失败");
diff --git a/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java b/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
index c448c14..e96899c 100644
--- a/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
@@ -148,6 +148,7 @@
userWithdraw.setWithStatus(Integer.valueOf(0));
BigDecimal withfee = siteSetting.getWithFeePercent().multiply(new BigDecimal(amt)).add(new BigDecimal(siteSetting.getWithFeeSingle().intValue()));
userWithdraw.setWithFee(withfee);
+ userWithdraw.setAssetsType(accsetType);
int insertCount = this.userWithdrawMapper.insert(userWithdraw);
if (insertCount > 0) {
return ServerResponse.createBySuccessMsg("提现成功",request);
diff --git a/src/main/java/com/nq/utils/ConverterUtil.java b/src/main/java/com/nq/utils/ConverterUtil.java
new file mode 100644
index 0000000..edda967
--- /dev/null
+++ b/src/main/java/com/nq/utils/ConverterUtil.java
@@ -0,0 +1,44 @@
+package com.nq.utils;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @program: dabao
+ * @description:
+ * @create: 2024-04-01 14:10
+ **/
+public class ConverterUtil {
+
+ public static <T, V> V convert(T pojo, Class<V> voClass) {
+ try {
+ V vo = voClass.newInstance();
+ Field[] pojoFields = pojo.getClass().getDeclaredFields();
+ Field[] voFields = voClass.getDeclaredFields();
+ for (Field pojoField : pojoFields) {
+ pojoField.setAccessible(true);
+ for (Field voField : voFields) {
+ voField.setAccessible(true);
+ if (pojoField.getName().equals(voField.getName()) && pojoField.getType().equals(voField.getType())) {
+ voField.set(vo, pojoField.get(pojo));
+ break;
+ }
+ }
+ }
+ return vo;
+ } catch (InstantiationException | IllegalAccessException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+ public static <T, V> List<V> convertToList(List<T> pojoList, Class<V> voClass) {
+ List<V> voList = new ArrayList<>();
+ for (T pojo : pojoList) {
+ V vo = convert(pojo, voClass);
+ voList.add(vo);
+ }
+ return voList;
+ }
+
+}
diff --git a/src/main/java/com/nq/utils/task/stock/StockTask.java b/src/main/java/com/nq/utils/task/stock/StockTask.java
index dd7ce26..90fba2e 100644
--- a/src/main/java/com/nq/utils/task/stock/StockTask.java
+++ b/src/main/java/com/nq/utils/task/stock/StockTask.java
@@ -61,7 +61,7 @@
/**
* 同步系统所需要的股票
*/
- @Scheduled(cron = "0 */10 * * * ?")
+ @Scheduled(cron = "0 */1 * * * ?")
public void syncINStockData() {
if (syncINStockData.get()) { // 判断任务是否在处理中
return;
diff --git a/src/main/java/com/nq/vo/agent/AgentUserNodeVO.java b/src/main/java/com/nq/vo/agent/AgentUserNodeVO.java
new file mode 100644
index 0000000..fe3f563
--- /dev/null
+++ b/src/main/java/com/nq/vo/agent/AgentUserNodeVO.java
@@ -0,0 +1,64 @@
+package com.nq.vo.agent;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @program: dabao
+ * @description:
+ * @create: 2024-05-21 11:00
+ **/
+@Data
+public class AgentUserNodeVO {
+
+ private Integer id;
+ private String agentName;
+ private String agentPwd;
+ private String agentRealName;
+ private String agentPhone;
+ private String agentCode;
+ private Date addTime;
+ private Integer isLock;
+ private Integer parentId;
+ private String parentName;
+ //代理级别
+ private Integer agentLevel;
+ /**
+ * 手续费比例
+ */
+ private BigDecimal poundageScale;
+
+ /**
+ * 递延费比例
+ */
+ private BigDecimal deferredFeesScale;
+
+ /**
+ * 分红比例
+ */
+ private BigDecimal receiveDividendsScale;
+
+ /**
+ * 总资金
+ */
+ private BigDecimal totalMoney;
+
+ /**
+ * 杠杆倍数,多个用/分割
+ */
+ private String siteLever;
+
+ /**
+ * 在先客服
+ * */
+ private String onLineServices;
+
+ /**
+ * 子节点
+ */
+ private List<AgentUserNodeVO> childList;
+
+}
diff --git a/src/main/java/com/nq/vo/user/UserOptionLogVO.java b/src/main/java/com/nq/vo/user/UserOptionLogVO.java
new file mode 100644
index 0000000..5a6fc11
--- /dev/null
+++ b/src/main/java/com/nq/vo/user/UserOptionLogVO.java
@@ -0,0 +1,27 @@
+package com.nq.vo.user;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+public class UserOptionLogVO {
+
+ private Integer id;
+ //操作金额
+ private BigDecimal money;
+ //类型,0扣款,1入款
+ private Integer type;
+ //用户id
+ private Integer userId;
+ //资产id
+ private Integer userAccectId;
+ //操作时间
+ private Date createTime;
+ //资产账户类型
+ private String userAccectType;
+ //用户名
+ private String userName;
+
+}
diff --git a/src/main/resources/mapper/StockMapper.xml b/src/main/resources/mapper/StockMapper.xml
index dea23bb..1f6f71f 100644
--- a/src/main/resources/mapper/StockMapper.xml
+++ b/src/main/resources/mapper/StockMapper.xml
@@ -262,6 +262,7 @@
<include refid="Base_Column_List" />
from stock
<where>
+ stock_gid = 'TSE'
<if test="showState != null ">
and is_show = #{showState}
</if>
@@ -315,7 +316,7 @@
<include refid="Base_Column_List"/>
FROM stock
- where stock_type = #{stockType}
+ where stock_type = #{stockType} and stock_gid = 'TSE'
<if test="keyWords != null and keyWords != '' ">
and (stock_spell like concat('%',#{keyWords},'%') or stock_name like concat('%',#{keyWords},'%') )
diff --git a/src/main/resources/mapper/UserOptionLogMapper.xml b/src/main/resources/mapper/UserOptionLogMapper.xml
new file mode 100644
index 0000000..86e54a5
--- /dev/null
+++ b/src/main/resources/mapper/UserOptionLogMapper.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.nq.dao.UserOptionLogMapper">
+
+ <select id="selective" resultType="com.nq.vo.user.UserOptionLogVO">
+ SELECT
+ t1.*,
+ t2.accect_type AS userAccectType,
+ t3.real_name AS userName
+ FROM
+ user_option_log t1
+ LEFT JOIN user_assets t2 ON t1.user_accect_id = t2.id
+ LEFT JOIN `user` t3 ON t1.user_id = t3.id
+ where 1=1
+ <if test="userId!=null and userId!=''">
+ and t1.user_id = #{userId}
+ </if>
+ order by create_time desc
+ </select>
+
+</mapper>
\ No newline at end of file
--
Gitblit v1.9.3