24 files modified
2 files added
| | |
| | | |
| | | |
| | | public static <T> ServerResponse<T> createBySuccessMsg(String msg,HttpServletRequest request) { |
| | | return new ServerResponse(ResponseCode.SUCCESS.getCode(), new GoogleTranslateUtil().translate(msg,request.getHeader(LANG))); |
| | | return new ServerResponse(ResponseCode.SUCCESS.getCode(), msg); |
| | | } |
| | | |
| | | public static <T> ServerResponse<T> createBySuccess(T data) { |
| | |
| | | |
| | | |
| | | public static <T> ServerResponse<T> createBySuccess(String data,HttpServletRequest request) { |
| | | return new ServerResponse(ResponseCode.SUCCESS.getCode(), new GoogleTranslateUtil().translate(data,request.getHeader(LANG))); |
| | | return new ServerResponse(ResponseCode.SUCCESS.getCode(),data); |
| | | } |
| | | |
| | | public static <T> ServerResponse<T> createBySuccess(String msg, T data) { |
| | |
| | | return new ServerResponse(ResponseCode.ERROR.getCode(), errormsg); |
| | | } |
| | | public static <T> ServerResponse<T> createByErrorMsg(String errormsg, HttpServletRequest request) { |
| | | return new ServerResponse(ResponseCode.ERROR.getCode(), new GoogleTranslateUtil().translate(errormsg,request.getHeader(LANG))); |
| | | return new ServerResponse(ResponseCode.ERROR.getCode(),errormsg); |
| | | } |
| | | |
| | | |
| | |
| | | @Autowired |
| | | IAgentAgencyFeeService iAgentAgencyFeeService; |
| | | |
| | | @Autowired |
| | | ISiteUserOptionLogService iSiteUserOptionLogService; |
| | | |
| | | @Autowired |
| | | ISiteAdminService iSiteAdminService; |
| | |
| | | return this.iAgentUserService.getAgentInfo(request); |
| | | } |
| | | |
| | | @RequestMapping("optionList.do") |
| | | @ResponseBody |
| | | public ServerResponse optionList(@RequestParam(value = "agentId", required = false) Integer agentId,@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(agentId,userId,pageNum,pageSize); |
| | | } |
| | | |
| | | //修改代理用户密码 |
| | | @RequestMapping({"updatePwd.do"}) |
| | | @ResponseBody |
| | |
| | | return this.iAgentUserService.updatePwd(oldPwd, newPwd, request); |
| | | } |
| | | |
| | | //查询首页充值,提现,注册统计 |
| | | @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); |
| | | } |
| | | |
| | | //查询首页 资金情况、持仓情况、盈亏信息、提现情况、股票信息、代理信息 |
| | | @RequestMapping({"count.do"}) |
| | |
| | | return this.iSiteAdminService.count(); |
| | | } |
| | | |
| | | //查询首页 资金情况、持仓情况、盈亏信息、提现情况、股票信息、代理信息 |
| | | //查询首页充值,提现,注册统计 |
| | | @RequestMapping({"moneyCount.do"}) |
| | | @ResponseBody |
| | | public ServerResponse moneyCount(@RequestParam(value = "startTime", required = false) String startTime,@RequestParam(value = "entTime", required = false) String entTime) { |
| | | return this.iSiteAdminService.moneyCount(startTime,entTime); |
| | | 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); |
| | | } |
| | | |
| | | //处理图片上传 |
| | |
| | | @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(userId,pageNum,pageSize); |
| | | return this.iSiteUserOptionLogService.list(null,userId,pageNum,pageSize); |
| | | } |
| | | |
| | | //分页查询日志管理 所有短信日志信息 |
| | |
| | | |
| | | |
| | | |
| | | 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); |
| | |
| | | |
| | | public interface UserRechargeMapper extends BaseMapper<UserRecharge> { |
| | | |
| | | int insert(UserRecharge paramUserRecharge); |
| | | // int insert(UserRecharge paramUserRecharge); |
| | | |
| | | int insertSelective(UserRecharge paramUserRecharge); |
| | | |
| | |
| | | public interface UserWithdrawMapper extends BaseMapper<UserWithdraw> { |
| | | int deleteByPrimaryKey(Integer paramInteger); |
| | | |
| | | int insert(UserWithdraw paramUserWithdraw); |
| | | |
| | | int insertSelective(UserWithdraw paramUserWithdraw); |
| | | |
| | | UserWithdraw selectByPrimaryKey(Integer paramInteger); |
| | |
| | | package com.nq.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | |
| | | @Data |
| | | public class AgentUser { |
| | | @TableId(value = "id",type = IdType.AUTO) |
| | | private Integer id; |
| | | private String agentName; |
| | | private String agentPwd; |
| | |
| | | import org.joda.time.DateTime; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | |
| | | @Data |
| | |
| | | |
| | | private Integer userAccectId; |
| | | |
| | | private DateTime createTime; |
| | | private Date createTime; |
| | | |
| | | } |
| | |
| | | package com.nq.pojo; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | import java.util.Date; |
| | | |
| | | |
| | | @Data |
| | | public class UserWithdraw { |
| | | |
| | | @TableId(type= IdType.AUTO) |
| | | private Integer id; |
| | | @Excel(name = "用户id") |
| | | private Integer userId; |
| | |
| | | |
| | | @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) { |
| | | |
| | |
| | | |
| | | ServerResponse deleteAdmin(Integer adminId); |
| | | |
| | | ServerResponse moneyCount(String startTime, String entTime); |
| | | ServerResponse moneyCount(String agentId,String startTime, String entTime); |
| | | |
| | | ServerResponse totalAgencyFunds(String agentId); |
| | | } |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | public interface ISiteUserOptionLogService { |
| | | ServerResponse<PageInfo> list(Integer userId, int pageNum, int pageSize); |
| | | ServerResponse<PageInfo> list( Integer agentId,Integer userId, int pageNum, int pageSize); |
| | | |
| | | } |
| | |
| | | userRecharge.setAddTime(new Date()); |
| | | userRecharge.setPayId(payType); |
| | | userRecharge.setImg(currency); |
| | | userRecharge.setAssetsType(sitePay.getAssetsType()); |
| | | userRechargeMapper.insert(userRecharge); |
| | | return ServerResponse.createBySuccess(""); |
| | | } |
| | |
| | | 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.*; |
| | | |
| | | import com.nq.pojo.UserRecharge; |
| | | |
| | | import com.nq.pojo.UserWithdraw; |
| | | import com.nq.service.IAgentUserService; |
| | | |
| | | import com.nq.service.ISiteAdminService; |
| | |
| | | |
| | | import com.nq.service.IUserWithdrawService; |
| | | |
| | | import com.nq.utils.ConverterUtil; |
| | | import com.nq.utils.PropertiesUtil; |
| | | |
| | | import com.nq.utils.SymmetricCryptoUtil; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | import java.util.Date; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | 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; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | import org.xmlunit.util.Convert; |
| | | |
| | | |
| | | @Service("iSiteAdminServiceImpl") |
| | |
| | | @Autowired |
| | | UserWithdrawMapper userWithdrawMapper; |
| | | |
| | | @Autowired |
| | | AgentUserMapper agentUserMapper; |
| | | |
| | | public ServerResponse login(String adminPhone, String adminPwd, String verifyCode, HttpServletRequest request) { |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ServerResponse moneyCount(String startTime, String entTime) { |
| | | BigDecimal rechargeTotalAmount = BigDecimal.ZERO; |
| | | BigDecimal withdrawalTotalAmount = BigDecimal.ZERO; |
| | | 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)); |
| | | .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)); |
| | | .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()); |
| | |
| | | withdrawalTotalAmount = withdrawalTotalAmount.add(userWithdraw.getWithAmt()); |
| | | } |
| | | |
| | | Map<String, BigDecimal> map = new HashMap<>(); |
| | | 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); |
| | | } |
| | | |
| | | @Override |
| | | public ServerResponse totalAgencyFunds(String agentId) { |
| | | BigDecimal inTotalAmount = BigDecimal.ZERO; |
| | | BigDecimal usTotalAmount = BigDecimal.ZERO; |
| | | |
| | | BigDecimal inTotalWithdrawAmount = BigDecimal.ZERO; |
| | | BigDecimal usTotalWithdrawAmount = BigDecimal.ZERO; |
| | | Map<String, Object> map = new HashMap<>(); |
| | | //入金 |
| | | 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); |
| | | } |
| | | |
| | | 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()); |
| | | List<UserRecharge> userRecharges = userRechargeMapper.selectList(new LambdaQueryWrapper<UserRecharge>() |
| | | .eq(UserRecharge::getOrderStatus, 1) |
| | | .in(CollectionUtil.isNotEmpty(userIds),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("inTotalAmount", inTotalAmount); |
| | | map.put("usTotalAmount", usTotalAmount); |
| | | map.put("inTotalWithdrawAmount", inTotalWithdrawAmount); |
| | | map.put("usTotalWithdrawAmount", usTotalWithdrawAmount); |
| | | 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); |
| | | } |
| | | |
| | | public SiteAdmin findAdminByName(String name) { |
| | | return this.siteAdminMapper.findAdminByName(name); |
| | |
| | | UserOptionLogMapper userOptionLogMapper; |
| | | |
| | | @Override |
| | | public ServerResponse<PageInfo> list(Integer userId, int pageNum, int pageSize) { |
| | | 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); |
| | |
| | | .userId(userAssets.getUserId()) |
| | | .money(bigAmt) |
| | | .userAccectId(userAssets.getId()) |
| | | .createTime(new DateTime()) |
| | | .createTime(new Date()) |
| | | .type(amt.contains("-")?0:1) |
| | | .build()); |
| | | return ServerResponse.createBySuccess(); |
| | |
| | | |
| | | @Autowired |
| | | SiteSettingServiceImpl siteSettingService; |
| | | @Resource |
| | | UserAssetsMapper userAssetsMapper; |
| | | |
| | | |
| | | @Transactional |
| | |
| | | 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); |
| | |
| | | if (user == null) { |
| | | return ServerResponse.createByErrorMsg("用户不存在"); |
| | | } |
| | | int updateCount = this.userMapper.updateById(user); |
| | | UserAssets userAssets = iUserAssetsServices.assetsByTypeAndUserId(userWithdraw.getAssetsType(), user.getId()); |
| | | if (userAssets == null) { |
| | | return ServerResponse.createByErrorMsg("用户资金账户不存在"); |
| | | } |
| | | userAssets.setAvailableBalance(userAssets.getAvailableBalance().add(userWithdraw.getWithAmt())); |
| | | int updateCount = userAssetsMapper.updateById(userAssets); |
| | | if (updateCount > 0) { |
| | | log.info("提现失败,返还用户资金成功!"); |
| | | } else { |
| New file |
| | |
| | | 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; |
| | | } |
| | | |
| | | } |
| | |
| | | /** |
| | | * 强制平仓 |
| | | */ |
| | | @Scheduled(cron = "0/1 * * * * ?") |
| | | // @Scheduled(cron = "0/1 * * * * ?") |
| | | public void stockConstraint(){ |
| | | if (stockConstraintLock.tryLock()) { |
| | | log.info("强制平仓任务:--------->开始"); |
| New file |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | import org.joda.time.DateTime; |
| | | |
| | | 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 DateTime createTime; |
| | | |
| | | //操作时间 |
| | | private Date createTime; |
| | | //资产账户类型 |
| | | private String userAccectType; |
| | | |
| | | //用户名 |
| | | private String userName; |
| | | |
| | | } |
| | |
| | | SELECT |
| | | t1.*, |
| | | t2.accect_type AS userAccectType, |
| | | t3.nick_name AS userName |
| | | t3.real_name AS userName |
| | | FROM |
| | | user_option_log t1 |
| | | LEFT JOIN user_assets t2 ON t1.user_accect_id = t2.id |
| | |
| | | id, user_id, nick_name, agent_id, order_sn, pay_sn, pay_channel, pay_amt, order_status, |
| | | order_desc, add_time, pay_time, pay_id,img |
| | | </sql> |
| | | <insert id="insert" parameterType="com.nq.pojo.UserRecharge" > |
| | | insert into user_recharge (id, user_id, nick_name, |
| | | agent_id, order_sn, pay_sn, |
| | | pay_channel, pay_amt, order_status, |
| | | order_desc, add_time, pay_time,pay_id,img |
| | | ) |
| | | values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{nickName,jdbcType=VARCHAR}, |
| | | #{agentId,jdbcType=INTEGER}, #{orderSn,jdbcType=VARCHAR}, #{paySn,jdbcType=VARCHAR}, |
| | | #{payChannel,jdbcType=VARCHAR}, #{payAmt,jdbcType=DECIMAL}, #{orderStatus,jdbcType=INTEGER}, |
| | | #{orderDesc,jdbcType=VARCHAR}, #{addTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP}, #{payId,jdbcType=INTEGER}, #{img,jdbcType=VARCHAR} |
| | | ) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.nq.pojo.UserRecharge" > |
| | | insert into user_recharge |
| | | <trim prefix="(" suffix=")" suffixOverrides="," > |
| | |
| | | <result column="with_fee" property="withFee"/> |
| | | <result column="with_msg" property="withMsg"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List" > |
| | | id, user_id, nick_name, agent_id, with_amt, apply_time, trans_time, with_name, bank_no, |
| | | bank_name, bank_address, with_status, with_fee, with_msg |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | * |
| | | from user_withdraw |
| | | where id = #{id,jdbcType=INTEGER} |
| | | </select> |
| | |
| | | delete from user_withdraw |
| | | where id = #{id,jdbcType=INTEGER} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.nq.pojo.UserWithdraw" > |
| | | insert into user_withdraw (id, user_id, nick_name, |
| | | agent_id, with_amt, apply_time, |
| | | trans_time, with_name, bank_no, |
| | | bank_name, bank_address, with_status, |
| | | with_fee, with_msg) |
| | | values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{nickName,jdbcType=VARCHAR}, |
| | | #{agentId,jdbcType=INTEGER}, #{withAmt,jdbcType=DECIMAL}, #{applyTime,jdbcType=TIMESTAMP}, |
| | | #{transTime,jdbcType=TIMESTAMP}, #{withName,jdbcType=VARCHAR}, #{bankNo,jdbcType=VARCHAR}, |
| | | #{bankName,jdbcType=VARCHAR}, #{bankAddress,jdbcType=VARCHAR}, #{withStatus,jdbcType=INTEGER}, |
| | | #{withFee,jdbcType=DECIMAL}, #{withMsg,jdbcType=VARCHAR}) |
| | | </insert> |
| | | |
| | | <insert id="insertSelective" parameterType="com.nq.pojo.UserWithdraw" > |
| | | insert into user_withdraw |
| | | <trim prefix="(" suffix=")" suffixOverrides="," > |
| | |
| | | |
| | | <select id="findUserWithList" parameterType="map" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | * |
| | | FROM user_withdraw |
| | | <where> |
| | | user_id = #{uid} |
| | |
| | | |
| | | <select id="listByAgent" resultMap="BaseResultMap" parameterType="map"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | * |
| | | FROM user_withdraw |
| | | <where> |
| | | agent_id = #{searchId} |
| | |
| | | |
| | | <select id="listByAdmin" resultMap="BaseResultMap" parameterType="map"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | * |
| | | FROM user_withdraw |
| | | where agent_id != 1 |
| | | <if test="agentId != null"> |
| | |
| | | id, user_id, nick_name, agent_id, order_sn, pay_sn, pay_channel, pay_amt, order_status, |
| | | order_desc, add_time, pay_time, pay_id,img |
| | | </sql> |
| | | <insert id="insert" parameterType="com.nq.pojo.UserRecharge" > |
| | | insert into user_recharge (id, user_id, nick_name, |
| | | agent_id, order_sn, pay_sn, |
| | | pay_channel, pay_amt, order_status, |
| | | order_desc, add_time, pay_time,pay_id,img |
| | | ) |
| | | values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{nickName,jdbcType=VARCHAR}, |
| | | #{agentId,jdbcType=INTEGER}, #{orderSn,jdbcType=VARCHAR}, #{paySn,jdbcType=VARCHAR}, |
| | | #{payChannel,jdbcType=VARCHAR}, #{payAmt,jdbcType=DECIMAL}, #{orderStatus,jdbcType=INTEGER}, |
| | | #{orderDesc,jdbcType=VARCHAR}, #{addTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP}, #{payId,jdbcType=INTEGER}, #{img,jdbcType=VARCHAR} |
| | | ) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.nq.pojo.UserRecharge" > |
| | | insert into user_recharge |
| | | <trim prefix="(" suffix=")" suffixOverrides="," > |
| | |
| | | <result column="with_fee" property="withFee"/> |
| | | <result column="with_msg" property="withMsg"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List" > |
| | | id, user_id, nick_name, agent_id, with_amt, apply_time, trans_time, with_name, bank_no, |
| | | bank_name, bank_address, with_status, with_fee, with_msg |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | * |
| | | from user_withdraw |
| | | where id = #{id,jdbcType=INTEGER} |
| | | </select> |
| | |
| | | delete from user_withdraw |
| | | where id = #{id,jdbcType=INTEGER} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.nq.pojo.UserWithdraw" > |
| | | insert into user_withdraw (id, user_id, nick_name, |
| | | agent_id, with_amt, apply_time, |
| | | trans_time, with_name, bank_no, |
| | | bank_name, bank_address, with_status, |
| | | with_fee, with_msg) |
| | | values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{nickName,jdbcType=VARCHAR}, |
| | | #{agentId,jdbcType=INTEGER}, #{withAmt,jdbcType=DECIMAL}, #{applyTime,jdbcType=TIMESTAMP}, |
| | | #{transTime,jdbcType=TIMESTAMP}, #{withName,jdbcType=VARCHAR}, #{bankNo,jdbcType=VARCHAR}, |
| | | #{bankName,jdbcType=VARCHAR}, #{bankAddress,jdbcType=VARCHAR}, #{withStatus,jdbcType=INTEGER}, |
| | | #{withFee,jdbcType=DECIMAL}, #{withMsg,jdbcType=VARCHAR}) |
| | | </insert> |
| | | |
| | | <insert id="insertSelective" parameterType="com.nq.pojo.UserWithdraw" > |
| | | insert into user_withdraw |
| | | <trim prefix="(" suffix=")" suffixOverrides="," > |
| | |
| | | |
| | | <select id="findUserWithList" parameterType="map" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | * |
| | | FROM user_withdraw |
| | | <where> |
| | | user_id = #{uid} |
| | |
| | | |
| | | <select id="listByAgent" resultMap="BaseResultMap" parameterType="map"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | * |
| | | FROM user_withdraw |
| | | <where> |
| | | agent_id = #{searchId} |
| | |
| | | |
| | | <select id="listByAdmin" resultMap="BaseResultMap" parameterType="map"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | * |
| | | FROM user_withdraw |
| | | where agent_id != 1 |
| | | <if test="agentId != null"> |