package com.nq.service.impl;
|
|
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.date.DateUtil;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageInfo;
|
import com.google.common.collect.Lists;
|
import com.nq.common.ServerResponse;
|
import com.nq.config.StockPoll;
|
import com.nq.dao.*;
|
import com.nq.enums.EStockType;
|
import com.nq.enums.EUserAssets;
|
import com.nq.pojo.*;
|
import com.nq.pojo.reponse.RUserAssets;
|
import com.nq.service.*;
|
import com.nq.utils.UserPointUtil;
|
import com.nq.utils.redis.RedisKeyUtil;
|
import com.nq.utils.timeutil.DateTimeUtil;
|
import com.nq.utils.PropertiesUtil;
|
import com.nq.utils.SymmetricCryptoUtil;
|
import com.nq.utils.ip.IpUtils;
|
import com.nq.utils.ip.JuheIpApi;
|
import com.nq.utils.redis.CookieUtils;
|
import com.nq.utils.redis.JsonUtil;
|
import com.nq.utils.redis.RedisShardedPoolUtils;
|
import com.nq.utils.stock.sina.StockApi;
|
import com.nq.vo.agent.AgentUserListVO;
|
import com.nq.vo.futuresposition.FuturesPositionVO;
|
import com.nq.vo.indexposition.IndexPositionVO;
|
import com.nq.vo.position.PositionProfitVO;
|
import com.nq.vo.position.PositionVO;
|
import com.nq.vo.position.UserPositionVO;
|
import com.nq.vo.stock.StockAdminListVO;
|
import com.nq.vo.stock.StockListVO;
|
import com.nq.vo.user.UserInfoVO;
|
|
import java.math.BigDecimal;
|
import java.math.RoundingMode;
|
import java.text.ParseException;
|
import java.text.SimpleDateFormat;
|
import java.util.*;
|
import java.util.stream.Collectors;
|
import javax.annotation.Resource;
|
import javax.servlet.http.HttpServletRequest;
|
|
import com.nq.vo.user.UserOut;
|
import org.apache.commons.lang3.Conversion;
|
import org.apache.commons.lang3.StringUtils;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
import org.springframework.transaction.annotation.Transactional;
|
|
@Service("iUserService")
|
public class UserServiceImpl implements IUserService {
|
private static final Logger log = LoggerFactory.getLogger(UserServiceImpl.class);
|
|
@Resource
|
UserMapper userMapper;
|
|
@Autowired
|
IAgentUserService iAgentUserService;
|
|
@Autowired
|
ISiteLoginLogService iSiteLoginLogService;
|
|
@Resource
|
StockOptionMapper stockOptionMapper;
|
|
|
@Autowired
|
IUserService userService;
|
|
@Autowired
|
IRateServices rateServices;
|
|
@Autowired
|
IUserAssetsServices userAssetsServices;
|
|
@Autowired
|
StockMapper stockMapper;
|
@Autowired
|
IUserPositionService iUserPositionService;
|
@Autowired
|
IUserBankService iUserBankService;
|
@Resource
|
AgentUserMapper agentUserMapper;
|
@Resource
|
SiteTaskLogMapper siteTaskLogMapper;
|
@Autowired
|
IStockOptionService iStockOptionService;
|
@Autowired
|
ISiteSettingService iSiteSettingService;
|
@Autowired
|
IUserCashDetailService iUserCashDetailService;
|
@Autowired
|
IUserRechargeService iUserRechargeService;
|
@Autowired
|
IUserWithdrawService iUserWithdrawService;
|
@Autowired
|
IUserIndexPositionService iUserIndexPositionService;
|
@Autowired
|
ISiteIndexSettingService iSiteIndexSettingService;
|
@Autowired
|
StockPoll stockPoll;
|
|
@Autowired
|
StockSubscribeMapper stockSubscribeMapper;
|
|
@Resource
|
MoneyLogMapper mapper;
|
|
@Resource
|
IUserPositionService userPositionService;
|
@Resource
|
SiteAmtTransLogMapper siteAmtTransLogMapper;
|
@Autowired
|
IUserFuturesPositionService iUserFuturesPositionService;
|
@Autowired
|
ISiteFuturesSettingService iSiteFuturesSettingService;
|
@Autowired
|
IStockFuturesService iStockFuturesService;
|
|
@Autowired
|
ISiteMessageService iSiteMessageService;
|
|
@Autowired
|
private ApplyLeverMapper applyLeverMapper;
|
|
@Autowired
|
private UserPositionMapper userPositionMapper;
|
|
@Autowired
|
IPriceServices priceServices;
|
|
@Autowired
|
IUserService iUserService;
|
|
|
public ServerResponse reg(String yzmCode, String agentCode, String phone, String userPwd, HttpServletRequest request) {
|
if (StringUtils.isBlank(agentCode) || StringUtils.isBlank(phone) ||
|
StringUtils.isBlank(userPwd) || StringUtils.isBlank(yzmCode)) {
|
return ServerResponse.createByErrorMsg("注册失败。该参数不能为空",request);
|
}
|
|
|
String keys = "AliyunSmsCode:" + phone;
|
String redis_yzm = RedisShardedPoolUtils.get(keys);
|
|
log.info("redis_yzm = {},yzmCode = {}", redis_yzm, yzmCode);
|
if (!yzmCode.equals(redis_yzm) && !"6666".equals(yzmCode)) {
|
return ServerResponse.createByErrorMsg("由于验证码不正确,注册失败。过程",request);
|
}
|
|
|
AgentUser agentUser = this.iAgentUserService.findByCode(agentCode);
|
if (agentUser == null) {
|
return ServerResponse.createByErrorMsg("由于代理不存在,注册失败",request);
|
}
|
if (agentUser.getIsLock().intValue() == 1) {
|
return ServerResponse.createByErrorMsg("注册失败。代理被锁定",request);
|
}
|
|
|
User dbuser = this.userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getPhone,phone).last( " limit 1"));
|
if (dbuser != null) {
|
return ServerResponse.createByErrorMsg("注册失败,手机号已注册",request);
|
}
|
|
|
User user = new User();
|
user.setAgentId(agentUser.getId());
|
user.setAgentName(agentUser.getAgentName());
|
user.setPhone(phone);
|
user.setUserPwd(SymmetricCryptoUtil.encryptPassword(userPwd));
|
|
|
user.setAccountType(Integer.valueOf(0));
|
user.setIsLock(Integer.valueOf(1));
|
user.setIsActive(Integer.valueOf(0));
|
|
user.setRegTime(new Date());
|
String uip = IpUtils.getIp(request);
|
user.setRegIp(uip);
|
String uadd = JuheIpApi.ip2Add(uip);
|
user.setRegAddress(uadd);
|
|
user.setIsLogin(Integer.valueOf(0));
|
|
int insertCount = this.userMapper.insert(user);
|
|
if (insertCount > 0) {
|
log.info("用户注册成功 手机 {} , ip = {} 地址 = {}", new Object[]{phone, uip, uadd});
|
return ServerResponse.createBySuccessMsg("Registration successful. Please login");
|
}
|
return ServerResponse.createBySuccessMsg("注册错误,请重试",request);
|
}
|
|
|
public ServerResponse login(String phone, String userPwd, HttpServletRequest request) {
|
if (StringUtils.isBlank(phone) || StringUtils.isBlank(userPwd)) {
|
return ServerResponse.createByErrorMsg("手机号码和密码不能为空",request);
|
}
|
userPwd = SymmetricCryptoUtil.encryptPassword(userPwd);
|
User user = this.userMapper.login(phone, userPwd);
|
if (user != null) {
|
if (user.getIsLogin().intValue() == 1) {
|
return ServerResponse.createByErrorMsg("登录失败。账户锁定",request);
|
}
|
//默认墨西哥资产
|
userAssetsServices.assetsByTypeAndUserId(EStockType.MX.getCode(),user.getId());
|
this.iSiteLoginLogService.saveLog(user, request);
|
return ServerResponse.createBySuccess(user);
|
}
|
return ServerResponse.createByErrorMsg("登录失败,用户名和密码错误",request);
|
}
|
|
|
public User getCurrentUser(HttpServletRequest request) {
|
String property = PropertiesUtil.getProperty("user.cookie.name");
|
String loginToken = request.getHeader(property);
|
if (loginToken == null) {
|
return null;
|
}
|
String userJson = RedisShardedPoolUtils.get(loginToken);
|
return (User) JsonUtil.string2Obj(userJson, User.class);
|
}
|
|
|
public User getCurrentRefreshUser(HttpServletRequest request) {
|
String property = PropertiesUtil.getProperty("user.cookie.name");
|
String header = request.getHeader(property);
|
if (header == null) {
|
return null;
|
}
|
// String loginToken = CookieUtils.readLoginToken(request, PropertiesUtil.getProperty("user.cookie.name"));
|
String userJson = RedisShardedPoolUtils.get(header);
|
User user = (User) JsonUtil.string2Obj(userJson, User.class);
|
|
if (user == null) {
|
return null;
|
} else {
|
return this.userMapper.selectById(user.getId());
|
}
|
}
|
|
public ServerResponse addOption(String code, HttpServletRequest request) {
|
User user = getCurrentUser(request);
|
String stockcode = code;
|
StockOption dboption = this.stockOptionMapper.findMyOptionIsExistByCode(user.getId(), stockcode);
|
if (dboption != null) {
|
return ServerResponse.createByErrorMsg("未能添加所选股票,因为它已经存在",request );
|
}
|
//期货逻辑
|
Stock stock = this.stockMapper.findStockByCode(code);
|
if (stock == null) {
|
return ServerResponse.createByErrorMsg("添加失败,库存不存在",request );
|
}
|
StockOption stockOption = new StockOption();
|
stockOption.setUserId(user.getId());
|
stockOption.setStockId(stock.getId());
|
stockOption.setAddTime(new Date());
|
stockOption.setStockCode(stock.getStockCode());
|
stockOption.setStockName(stock.getStockName());
|
stockOption.setStockGid(stock.getStockType());
|
stockOption.setIsLock(stock.getIsLock());
|
|
int insertCount = this.stockOptionMapper.insert(stockOption);
|
if (insertCount > 0) {
|
return ServerResponse.createBySuccessMsg("添加自选股票成功",request );
|
}
|
return ServerResponse.createByErrorMsg("添加失败,请重试",request );
|
}
|
|
|
public ServerResponse delOption(String code, HttpServletRequest request) {
|
User user = getCurrentUser(request);
|
String stockcode = code;
|
StockOption dboption = this.stockOptionMapper.findMyOptionIsExistByCode(user.getId(), stockcode);
|
if (dboption == null) {
|
return ServerResponse.createByErrorMsg("删除失败,因为自选股票不存在",request);
|
}
|
int delCount = this.stockOptionMapper.deleteByPrimaryKey(dboption.getId());
|
if (delCount > 0) {
|
return ServerResponse.createBySuccessMsg("删除自选成功",request);
|
}
|
return ServerResponse.createByErrorMsg("删除自选失败",request);
|
}
|
|
|
public ServerResponse isOption(String code, HttpServletRequest request) {
|
User user = getCurrentUser(request);
|
String stockcode = code;
|
return this.iStockOptionService.isOption(user.getId(), stockcode);
|
}
|
|
|
public ServerResponse getUserInfo(HttpServletRequest request) {
|
String cookie_name = PropertiesUtil.getProperty("user.cookie.name");
|
String loginToken = request.getHeader(cookie_name);
|
String userJson = RedisShardedPoolUtils.get(loginToken);
|
User user = (User) JsonUtil.string2Obj(userJson, User.class);
|
User dbuser = this.userMapper.selectById(user.getId());
|
|
SiteSetting siteSetting = iSiteSettingService.getSiteSetting();
|
UserInfoVO userInfoVO = assembleUserInfoVO(dbuser, siteSetting);
|
ApplyLever applyLever = applyLeverMapper.selectOne(new LambdaQueryWrapper<ApplyLever>()
|
.eq(ApplyLever::getUserId, user.getId())
|
.eq(ApplyLever::getState, 1)
|
.orderByDesc(ApplyLever::getCreateTime)
|
.last(" limit 1"));
|
if(null == applyLever || applyLever.getLever().equals("1")){
|
userInfoVO.setSiteLever("1");
|
}else{
|
userInfoVO.setSiteLever(leverSplit(applyLever.getLever()));
|
}
|
return ServerResponse.createBySuccess(userInfoVO);
|
}
|
|
public String leverSplit(String lever){
|
String levers = "1/2/5/10";
|
String[] parts = levers.split("/");
|
int index = Arrays.asList(parts).indexOf(lever);
|
if (index != -1) {
|
return String.join("/", Arrays.copyOfRange(parts, 0, index + 1));
|
}
|
return null;
|
}
|
|
|
public ServerResponse updatePwd(String oldPwd, String newPwd, HttpServletRequest request) {
|
if (StringUtils.isBlank(oldPwd) || StringUtils.isBlank(newPwd)) {
|
return ServerResponse.createByErrorMsg("该参数不能为空",request);
|
}
|
|
User user = getCurrentRefreshUser(request);
|
oldPwd = SymmetricCryptoUtil.encryptPassword(oldPwd);
|
if (!oldPwd.equals(user.getUserPwd())) {
|
return ServerResponse.createByErrorMsg("密码错误",request);
|
}
|
|
user.setUserPwd(SymmetricCryptoUtil.encryptPassword(newPwd));
|
int updateCount = this.userMapper.updateById(user);
|
if (updateCount > 0) {
|
return ServerResponse.createBySuccessMsg("修改成功",request);
|
}
|
return ServerResponse.createByErrorMsg("修改失败",request);
|
}
|
|
|
public ServerResponse checkPhone(String phone) {
|
User user = this.userMapper.findByPhone(phone);
|
if (user != null) {
|
return ServerResponse.createBySuccessMsg("User exists");
|
}
|
return ServerResponse.createByErrorMsg("User exists");
|
}
|
|
|
public ServerResponse updatePwd(String phone, String code, String newPwd) {
|
if (StringUtils.isBlank(phone) ||
|
StringUtils.isBlank(code) ||
|
StringUtils.isBlank(newPwd)) {
|
return ServerResponse.createByErrorMsg("The parameter cannot be null");
|
}
|
|
|
String keys = "AliyunSmsCode:" + phone;
|
String redis_yzm = RedisShardedPoolUtils.get(keys);
|
|
log.info("redis_yzm = {} , code = {}", redis_yzm, code);
|
if (!code.equals(redis_yzm)) {
|
return ServerResponse.createByErrorMsg("Description Failed to change the password because the verification code is incorrect");
|
}
|
|
User user = this.userMapper.findByPhone(phone);
|
if (user == null) {
|
return ServerResponse.createByErrorMsg("Description Failed to change the password because the verification code is incorrect");
|
}
|
|
user.setUserPwd(SymmetricCryptoUtil.encryptPassword(newPwd));
|
int updateCount = this.userMapper.updateById(user);
|
if (updateCount > 0) {
|
return ServerResponse.createBySuccess("Password changed successfully!");
|
}
|
return ServerResponse.createByErrorMsg("Failed to change the password!");
|
}
|
|
|
public ServerResponse update(User user) {
|
if (user.getAgentId() != null) {
|
AgentUser agentUser = this.agentUserMapper.selectByPrimaryKey(user.getAgentId());
|
if (agentUser != null) {
|
user.setAgentName(agentUser.getAgentName());
|
}
|
}
|
if (user.getUserPwd() != null && !user.getUserPwd().equals("")) {
|
user.setUserPwd(SymmetricCryptoUtil.encryptPassword(user.getUserPwd()));
|
}
|
int updateCount = this.userMapper.updateById(user);
|
if (updateCount > 0) {
|
return ServerResponse.createBySuccessMsg("Modified successfully");
|
}
|
return ServerResponse.createByErrorMsg("Modification failure");
|
}
|
|
|
public ServerResponse auth(String realName, String idCard, String vaildNumber, String img1key, String img2key, String img3key, HttpServletRequest request) {
|
if (StringUtils.isBlank(realName) ||
|
StringUtils.isBlank(idCard)) {
|
|
return ServerResponse.createByErrorMsg("该参数不能为空",request);
|
}
|
|
User user = getCurrentRefreshUser(request);
|
|
if (((0 != user.getIsActive().intValue())) & ((3 != user.getIsActive().intValue()))) {
|
return ServerResponse.createByErrorMsg("当前状态无法验证",request);
|
}
|
user.setImg1Key(img1key);
|
user.setImg2Key(img2key);
|
user.setNickName(realName);
|
user.setRealName(realName);
|
user.setIdCard(idCard);
|
user.setVaildNumber(vaildNumber);
|
|
user.setIsActive(Integer.valueOf(1));
|
|
|
int updateCount = this.userMapper.updateById(user);
|
if (updateCount > 0) {
|
return ServerResponse.createBySuccessMsg("实名认证",request);
|
}
|
return ServerResponse.createByErrorMsg("实名认证失败",request);
|
}
|
|
|
public ServerResponse transAmt(Integer amt, Integer type, HttpServletRequest request) {
|
User user = getCurrentRefreshUser(request);
|
if (user == null) {
|
return ServerResponse.createBySuccessMsg("Please log in first");
|
}
|
if (amt.intValue() <= 0) {
|
return ServerResponse.createByErrorMsg("Incorrect amount");
|
}
|
|
|
// 转美元转卢比的是1 卢比转美元的是2
|
BigDecimal userAmt = BigDecimal.ZERO;
|
BigDecimal enableAmt = BigDecimal.ZERO;
|
BigDecimal userIndexAmt = BigDecimal.ZERO;
|
BigDecimal enableIndexAmt = BigDecimal.ZERO;
|
|
BigDecimal exranRate = iSiteSettingService.getSiteSetting().getExchangeRate();
|
if (type == 1) {
|
|
BigDecimal usdt = new BigDecimal(amt).multiply(exranRate).setScale(2, RoundingMode.UP);
|
|
} else if (2 == type) {
|
|
BigDecimal usdt = new BigDecimal(amt).divide(exranRate).setScale(2, RoundingMode.UP);
|
}
|
int updateCount = this.userMapper.updateById(user);
|
if (updateCount > 0) {
|
saveAmtTransLog(user, type, amt);
|
return ServerResponse.createBySuccessMsg("Transfer successful");
|
}
|
return ServerResponse.createByErrorMsg("Transfer failure");
|
}
|
|
@Override
|
public ServerResponse getMoney(HttpServletRequest request) {
|
return getMoney(getCurrentUser(request).getId());
|
}
|
|
@Override
|
public ServerResponse getMoney(Integer userId) {
|
List<UserAssets> userAssetsList = userAssetsServices.assetsByUserId(userId);
|
List<RUserAssets> rUserAssetsList = new ArrayList<>();
|
int s= 4;
|
/**
|
* 浮动盈亏
|
* */
|
BigDecimal AllProfitAndLose = BigDecimal.ZERO;
|
/**
|
* 总资产
|
* */
|
BigDecimal allTotalAssets = BigDecimal.ZERO;
|
/**
|
* 总可用余额
|
* */
|
BigDecimal allAmt = BigDecimal.ZERO;
|
/**
|
* 累计盈亏
|
* */
|
BigDecimal AllHProfitAndLose = BigDecimal.ZERO;
|
/**
|
* 总冻结资产
|
* */
|
BigDecimal allFreeMoney = BigDecimal.ZERO;
|
/**
|
* 总手续费
|
* */
|
BigDecimal allHMoney = BigDecimal.ZERO;
|
for (int i = 0; i <userAssetsList.size() ; i++) {
|
RUserAssets rUserAssets = new RUserAssets();
|
UserAssets userAssets = userAssetsList.get(i);
|
// 浮动盈亏
|
String profitAndLose = getProfitAndLose(userId).toString();
|
BigDecimal amt = userAssets.getAvailableBalance();
|
BigDecimal totalAssets = userAssets.getAvailableBalance().add(userAssets.getFreezeMoney()).add(new BigDecimal(profitAndLose)).subtract(userAssets.getHandlingChargeWritten());
|
// BigDecimal totalAssets = userAssets.getAvailableBalance().add(userAssets.getFreezeMoney()).subtract(userAssets.getCumulativeProfitAndLoss()).add(profitAndLose);
|
BigDecimal freeMoney = userAssets.getFreezeMoney();
|
BigDecimal hMoney = userAssets.getHandlingCharge();
|
BigDecimal hProfitAndLose = userAssets.getCumulativeProfitAndLoss();
|
rUserAssets.setId(userAssets.getId());
|
rUserAssets.setTotalMoney((totalAssets.toString()));
|
rUserAssets.setAccectType(userAssets.getAccectType());
|
rUserAssets.setAvailableBalance(amt.toString());
|
rUserAssets.setFreezeMoney(freeMoney.toString());
|
rUserAssets.setCumulativeProfitAndLoss(hProfitAndLose.toString());
|
rUserAssets.setHandlingCharge(hMoney.toString());
|
rUserAssets.setProfitAndLoss(profitAndLose.toString());
|
rUserAssets.setIsZf(userAssets.getIsZf());
|
rUserAssets.setAmountToBeCovered((userAssets.getAmountToBeCovered().add(userAssets.getHandlingChargeWritten()).toString()));
|
rUserAssets.setHandlingChargeWritten(userAssets.getHandlingChargeWritten());
|
BigDecimal rate = rateServices.currencyRate(
|
EStockType.getEStockTypeByCode(userAssets.getAccectType()),EStockType.US);
|
|
BigDecimal availableBalanceUSD = amt;
|
if(amt.compareTo(BigDecimal.ZERO)>0){
|
availableBalanceUSD = amt.multiply(rate);
|
}
|
|
BigDecimal freezeMoneyUSD = freeMoney;
|
if(freeMoney.compareTo(BigDecimal.ZERO)>0){
|
freezeMoneyUSD = freeMoney.multiply(rate);
|
}
|
|
BigDecimal totleMoneyUSD = totalAssets;
|
if(totalAssets.compareTo(BigDecimal.ZERO)>0){
|
totleMoneyUSD = totleMoneyUSD.multiply(rate);
|
}
|
|
BigDecimal cumulativeProfitAndLossUSD = hProfitAndLose;
|
if(hProfitAndLose.compareTo(BigDecimal.ZERO)>0){
|
cumulativeProfitAndLossUSD = hProfitAndLose.multiply(rate);
|
}
|
|
BigDecimal handlingChargeUSD = hMoney;
|
if(hMoney.compareTo(BigDecimal.ZERO)>0){
|
handlingChargeUSD =hMoney.multiply(rate);
|
}
|
BigDecimal profitAndLossUSD = new BigDecimal(profitAndLose);
|
if(new BigDecimal(profitAndLose).compareTo(BigDecimal.ZERO)>0){
|
profitAndLossUSD =new BigDecimal(profitAndLose).multiply(rate);
|
}
|
|
|
|
rUserAssets.setAvailableBalanceUSD(availableBalanceUSD.setScale(s,BigDecimal.ROUND_UP).toString());
|
rUserAssets.setFreezeMoneyUSD(freezeMoneyUSD.setScale(s,BigDecimal.ROUND_UP).toString());
|
rUserAssets.setTotalMoneyUSD(totleMoneyUSD.setScale(s,BigDecimal.ROUND_UP).toString());
|
rUserAssets.setSymbol(EStockType.getEStockTypeByCode(userAssets.getAccectType()).getSymbol1());
|
rUserAssets.setSymbolCode(EStockType.getEStockTypeByCode(userAssets.getAccectType()).getSymbol());
|
rUserAssets.setCumulativeProfitAndLossUSD(cumulativeProfitAndLossUSD.setScale(s,BigDecimal.ROUND_UP).toString());
|
rUserAssets.setHandlingChargeUSD(handlingChargeUSD.setScale(s,BigDecimal.ROUND_UP).toString());
|
rUserAssets.setProfitAndLossUSD(profitAndLossUSD.setScale(s,BigDecimal.ROUND_UP).toString());
|
rUserAssets.setProfitAndLoss(profitAndLose);
|
// BigDecimal decimal = new BigDecimal(rUserAssets.getTotalMoney()).add(new BigDecimal(rUserAssets.getProfitAndLoss()));
|
// rUserAssets.setTotalMoney(decimal.toString());
|
AllProfitAndLose = AllProfitAndLose.add(profitAndLossUSD);
|
allTotalAssets = allTotalAssets.add(totleMoneyUSD);
|
allAmt = allAmt.add(availableBalanceUSD);
|
AllHProfitAndLose = AllHProfitAndLose.add(handlingChargeUSD);
|
allFreeMoney = allFreeMoney.add(freezeMoneyUSD);
|
allHMoney = allHMoney.add(handlingChargeUSD);
|
|
|
|
|
rUserAssetsList.add(rUserAssets);
|
}
|
|
|
|
|
RUserAssets rUserAssets = new RUserAssets();
|
rUserAssets.setAccectType("ALL");
|
rUserAssets.setProfitAndLoss(AllProfitAndLose.setScale(s,BigDecimal.ROUND_DOWN).toString());
|
rUserAssets.setProfitAndLossUSD(AllProfitAndLose.setScale(s,BigDecimal.ROUND_DOWN).toString());
|
rUserAssets.setHandlingCharge(allHMoney.setScale(s,BigDecimal.ROUND_DOWN).toString());
|
rUserAssets.setHandlingChargeUSD(allHMoney.setScale(s,BigDecimal.ROUND_DOWN).toString());
|
rUserAssets.setCumulativeProfitAndLoss(AllHProfitAndLose.setScale(s,BigDecimal.ROUND_DOWN).toString());
|
rUserAssets.setCumulativeProfitAndLossUSD(AllHProfitAndLose.setScale(s,BigDecimal.ROUND_DOWN).toString());
|
rUserAssets.setTotalMoney(allTotalAssets.setScale(s,BigDecimal.ROUND_DOWN).toString());
|
rUserAssets.setTotalMoneyUSD(allTotalAssets.setScale(s,BigDecimal.ROUND_DOWN).toString());
|
rUserAssets.setAvailableBalance(allAmt.setScale(s,BigDecimal.ROUND_DOWN).toString());
|
rUserAssets.setAvailableBalanceUSD(allAmt.setScale(s,BigDecimal.ROUND_DOWN).toString());
|
rUserAssets.setFreezeMoney(allFreeMoney.setScale(s,BigDecimal.ROUND_DOWN).toString());
|
rUserAssets.setFreezeMoneyUSD(allFreeMoney.setScale(s,BigDecimal.ROUND_DOWN).toString());
|
rUserAssets.setSymbol("$");
|
rUserAssets.setSymbolCode("USD");
|
rUserAssetsList.add(rUserAssets);
|
|
return ServerResponse.createBySuccess(rUserAssetsList);
|
}
|
|
public BigDecimal getProfitAndLose(Integer userId){
|
List<UserPosition> userPositions;
|
userPositions = userPositionMapper.
|
findMyPositionByCodeAndSpell(userId,
|
"","",
|
0, "IN");
|
|
|
List<UserPositionVO> userPositionVOS = Lists.newArrayList();
|
if (userPositions.size() > 0) {
|
for (UserPosition position : userPositions) {
|
UserPositionVO userPositionVO = UserPointUtil.assembleUserPositionVO(position,priceServices.getNowPrice(position.getStockCode()));
|
StockSubscribe stockSubscribe = stockSubscribeMapper.selectOne(new LambdaQueryWrapper<StockSubscribe>()
|
.eq(StockSubscribe::getCode, userPositionVO.getStockCode()));
|
if(position.getSellOrderId() == null){
|
if (null != stockSubscribe && DateUtil.date().before(stockSubscribe.getListDate())) {
|
userPositionVO.setProfitAndLose(BigDecimal.ZERO);
|
}else{
|
userPositionVO.setProfitAndLose(userPositionVO.getProfitAndLose().multiply(new BigDecimal(userPositionVO.getOrderLever())));
|
}
|
}else{
|
userPositionVO.setProfitAndLose(userPositionVO.getProfitAndLose().multiply(new BigDecimal(userPositionVO.getOrderLever())));
|
}
|
|
userPositionVOS.add(userPositionVO);
|
|
}
|
}
|
BigDecimal profitAndLose = BigDecimal.ZERO;
|
for (UserPositionVO f : userPositionVOS) {
|
profitAndLose = profitAndLose.add(f.getProfitAndLose());
|
}
|
return profitAndLose;
|
}
|
|
@Override
|
public ServerResponse transfer(String fromType, String toType, String amt,HttpServletRequest request) {
|
User user = userService.getCurrentUser(request);
|
UserAssets formAssets = userAssetsServices.assetsByTypeAndUserId(fromType,user.getId());
|
BigDecimal amtBig = new BigDecimal(amt);
|
if(formAssets.getAvailableBalance().compareTo(amtBig)<0){
|
return ServerResponse.createByErrorMsg("余额不足",request);
|
}
|
userAssetsServices.availablebalanceChange(fromType,user.getId(), EUserAssets.TRANSFER,amtBig.negate(),fromType+"/"+toType,"");
|
amtBig = rateServices.currencyRate(EStockType.getEStockTypeByCode(fromType),EStockType.getEStockTypeByCode(toType)).multiply(amtBig);
|
userAssetsServices.availablebalanceChange(toType,user.getId(),EUserAssets.TRANSFER,amtBig.setScale(5,RoundingMode.HALF_DOWN),fromType+"/"+toType,"");
|
return ServerResponse.createBySuccess();
|
}
|
|
|
private void saveAmtTransLog(User user, Integer type, Integer amt) {
|
String amtFrom = "";
|
String amtTo = "";
|
if (1 == type.intValue()) {
|
amtFrom = "融资";
|
amtTo = "指数";
|
} else if (2 == type.intValue()) {
|
amtFrom = "指数";
|
amtTo = "融资";
|
} else if (3 == type.intValue()) {
|
amtFrom = "融资";
|
amtTo = "期货";
|
} else if (4 == type.intValue()) {
|
amtFrom = "期货";
|
amtTo = "融资";
|
}
|
|
SiteAmtTransLog siteAmtTransLog = new SiteAmtTransLog();
|
siteAmtTransLog.setUserId(user.getId());
|
siteAmtTransLog.setRealName(user.getRealName());
|
siteAmtTransLog.setAgentId(user.getAgentId());
|
siteAmtTransLog.setAmtFrom(amtFrom);
|
siteAmtTransLog.setAmtTo(amtTo);
|
siteAmtTransLog.setTransAmt(new BigDecimal(amt.intValue()));
|
siteAmtTransLog.setAddTime(new Date());
|
this.siteAmtTransLogMapper.insert(siteAmtTransLog);
|
}
|
|
|
public void ForceSellTask() {
|
|
}
|
|
@Override
|
public void ForceSellOneStockTask() {
|
|
}
|
|
@Override
|
public void ForceSellOneStockTaskV2() {
|
|
}
|
|
@Override
|
public void ForceSellMessageTask() {
|
|
}
|
|
@Override
|
public void ForceSellIndexTask() {
|
|
}
|
|
@Override
|
public void ForceSellIndexsMessageTask() {
|
|
}
|
|
@Override
|
public void ForceSellFuturesTask() {
|
|
}
|
|
@Override
|
public void ForceSellFuturesMessageTask() {
|
|
}
|
|
|
@Override
|
public void qh1() {
|
|
}
|
|
@Override
|
public void zs1() {
|
|
}
|
|
|
public ServerResponse listByAgent(String realName, String phone, Integer agentId, Integer accountType, int pageNum, int pageSize, HttpServletRequest request) {
|
SiteSetting siteSetting = this.iSiteSettingService.getSiteSetting();
|
SiteIndexSetting siteIndexSetting = this.iSiteIndexSettingService.getSiteIndexSetting();
|
SiteFuturesSetting siteFuturesSetting = this.iSiteFuturesSettingService.getSetting();
|
|
|
AgentUser currentAgent = this.iAgentUserService.getCurrentAgent(request);
|
|
if (agentId != null) {
|
AgentUser agentUser = this.agentUserMapper.selectByPrimaryKey(agentId);
|
if (agentUser.getParentId() != currentAgent.getId()) {
|
return ServerResponse.createByErrorMsg("Positions held by non-subordinate agent users cannot be queried");
|
}
|
}
|
Integer searchId = null;
|
if (agentId == null) {
|
searchId = currentAgent.getId();
|
} else {
|
searchId = agentId;
|
}
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
List<User> users = this.userMapper.listByAgent(realName, phone, searchId, accountType);
|
|
List<AgentUserListVO> agentUserListVOS = Lists.newArrayList();
|
|
for (User user : users) {
|
|
ServerResponse money = iUserService.getMoney(user.getId());
|
List<RUserAssets> rUserAssetsList = (List<RUserAssets>) money.getData();
|
RUserAssets rUserAssets = rUserAssetsList.stream()
|
.filter(stock -> "IN".equals(stock.getAccectType()))
|
.findFirst()
|
.orElse(null);
|
|
AgentUserListVO agentUserListVO = assembleAgentUserListVO(user, siteSetting
|
.getForceStopPercent(), siteIndexSetting
|
.getForceSellPercent(), siteFuturesSetting.getForceSellPercent());
|
if (rUserAssets != null) {
|
agentUserListVO.setUserAmt(rUserAssets.getTotalMoney().equals("0E-8") ? new BigDecimal("0") : new BigDecimal(rUserAssets.getTotalMoney()));
|
agentUserListVO.setFreezeMoney(rUserAssets.getFreezeMoney().equals("0E-8") ? "0" : rUserAssets.getFreezeMoney());
|
agentUserListVO.setAvailableBalance(rUserAssets.getAvailableBalance().equals("0E-8") ? "0" : rUserAssets.getAvailableBalance());
|
}
|
agentUserListVOS.add(agentUserListVO);
|
}
|
|
PageInfo pageInfo = new PageInfo(users);
|
pageInfo.setList(agentUserListVOS);
|
|
return ServerResponse.createBySuccess(pageInfo);
|
}
|
|
|
@Transactional
|
public ServerResponse addSimulatedAccount(Integer agentId, String phone, String pwd, String amt, Integer accountType, HttpServletRequest request) {
|
if (StringUtils.isBlank(phone) || StringUtils.isBlank(pwd)) {
|
return ServerResponse.createByErrorMsg("The parameter cannot be null");
|
}
|
|
QueryWrapper queryWrapper = new QueryWrapper();
|
queryWrapper.eq("phone",phone);
|
User dbUser = userMapper.selectOne(queryWrapper);
|
if (dbUser != null) {
|
return ServerResponse.createByErrorMsg("The phone number is registered");
|
}
|
|
|
User user = new User();
|
user.setAccountType(accountType);
|
user.setPhone(phone);
|
user.setIsLock(Integer.valueOf(0));
|
user.setIsLogin(Integer.valueOf(0));
|
user.setIsActive(Integer.valueOf(0));
|
user.setRegTime(new Date());
|
|
|
if (accountType.intValue() == 1) {
|
user.setNickName("模拟用户");
|
}
|
|
|
if (agentId != null) {
|
AgentUser agentUser = this.agentUserMapper.selectByPrimaryKey(agentId);
|
user.setAgentName(agentUser.getAgentName());
|
user.setAgentId(agentUser.getId());
|
}
|
|
int insertCount = this.userMapper.insert(user);
|
dbUser = userMapper.selectOne(queryWrapper);
|
userAssetsServices.getAvailableBalance(EStockType.IN.getCode(),dbUser.getId() );
|
userAssetsServices.availablebalanceChange(EStockType.IN.getCode(),dbUser.getId(),EUserAssets.TOP_UP,new BigDecimal(amt),"","");
|
if (insertCount > 0) {
|
return ServerResponse.createBySuccessMsg("Success");
|
}
|
return ServerResponse.createByErrorMsg("User addition failure");
|
}
|
|
|
public ServerResponse listByAdmin(String realName, String phone, Integer agentId, Integer accountType, int pageNum, int pageSize, Integer isLock, Integer isLogin, String regTime, Integer isActive, HttpServletRequest request) throws ParseException {
|
PageHelper.startPage(pageNum, pageSize);
|
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd");
|
String formattedDateString = null;
|
if (StringUtils.isNotEmpty(regTime)) {
|
formattedDateString = outputFormat.format(inputFormat.parse(regTime));
|
}
|
List<User> users = this.userMapper.listByAdmin(realName, phone, agentId, accountType, isLock, isLogin, formattedDateString, isActive);
|
List<UserOut> userOuts = new ArrayList<>();
|
|
// 获取用户资产信息并构建返回结果
|
Map<Integer, UserOut> userOutMap = new HashMap<>();
|
for (User user : users) {
|
ServerResponse money = iUserService.getMoney(user.getId());
|
List<RUserAssets> rUserAssetsList = (List<RUserAssets>) money.getData();
|
RUserAssets rUserAssets = rUserAssetsList.stream()
|
.filter(stock -> "IN".equals(stock.getAccectType()))
|
.findFirst()
|
.orElse(null);
|
|
UserOut userOut = Convert.convert(UserOut.class, user);
|
if (rUserAssets != null) {
|
userOut.setTotalMoney(rUserAssets.getTotalMoney().equals("0E-8") ? "0" : rUserAssets.getTotalMoney());
|
userOut.setFreezeMoney(rUserAssets.getFreezeMoney().equals("0E-8") ? "0" : rUserAssets.getFreezeMoney());
|
userOut.setAvailableBalance(rUserAssets.getAvailableBalance().equals("0E-8") ? "0" : rUserAssets.getAvailableBalance());
|
userOut.setAmountToBeCovered(rUserAssets.getAmountToBeCovered());
|
}
|
|
userOutMap.put(user.getId(), userOut);
|
userOuts.add(userOut);
|
}
|
|
PageInfo pageInfo = new PageInfo(users);
|
pageInfo.setList(userOuts);
|
return ServerResponse.createBySuccess(pageInfo);
|
}
|
|
|
|
|
public ServerResponse findByUserId(Integer userId) {
|
return ServerResponse.createBySuccess(this.userMapper.selectById(userId));
|
}
|
|
|
public ServerResponse updateLock(Integer userId) {
|
User user = this.userMapper.selectById(userId);
|
if (user == null) {
|
return ServerResponse.createByErrorMsg("User does not exist");
|
}
|
|
if (user.getIsLock().intValue() == 1) {
|
user.setIsLock(Integer.valueOf(0));
|
} else {
|
user.setIsLock(Integer.valueOf(1));
|
}
|
|
int updateCount = this.userMapper.updateById(user);
|
if (updateCount > 0) {
|
return ServerResponse.createBySuccess("Modified successfully");
|
}
|
return ServerResponse.createByErrorMsg("Modification failure");
|
}
|
|
|
@Transactional
|
public ServerResponse updateAmt(Integer userId, String amt, Integer direction) {
|
if (userId == null || amt == null || direction == null) {
|
return ServerResponse.createByErrorMsg("The parameter cannot be null");
|
}
|
|
User user = this.userMapper.selectById(userId);
|
if (user == null) {
|
return ServerResponse.createByErrorMsg("User does not exist");
|
}
|
this.userMapper.updateById(user);
|
|
|
SiteTaskLog siteTaskLog = new SiteTaskLog();
|
siteTaskLog.setTaskType("管理员修改金额");
|
StringBuffer cnt = new StringBuffer();
|
cnt.append("管理员修改金额 - ")
|
.append((direction.intValue() == 0) ? "入款" : "扣款")
|
.append(amt).append("元");
|
siteTaskLog.setTaskCnt(cnt.toString());
|
|
StringBuffer target = new StringBuffer();
|
siteTaskLog.setTaskTarget(target.toString());
|
|
siteTaskLog.setIsSuccess(Integer.valueOf(0));
|
siteTaskLog.setAddTime(new Date());
|
|
int insertCount = this.siteTaskLogMapper.insert(siteTaskLog);
|
if (insertCount > 0) {
|
return ServerResponse.createBySuccessMsg("Modified fund success");
|
}
|
return ServerResponse.createByErrorMsg("Failure to modify funds");
|
}
|
|
|
public ServerResponse delete(Integer userId, HttpServletRequest request) {
|
String cookie_name = PropertiesUtil.getProperty("admin.cookie.name");
|
String logintoken = CookieUtils.readLoginToken(request, cookie_name);
|
String adminJson = RedisShardedPoolUtils.get(logintoken);
|
SiteAdmin siteAdmin = (SiteAdmin) JsonUtil.string2Obj(adminJson, SiteAdmin.class);
|
|
log.info("管理员 {} 删除用户 {}", siteAdmin.getAdminName(), userId);
|
|
|
int delChargeCount = this.iUserRechargeService.deleteByUserId(userId);
|
if (delChargeCount > 0) {
|
log.info("删除 充值 记录成功");
|
} else {
|
log.info("删除 充值 记录失败");
|
}
|
|
|
int delWithdrawCount = this.iUserWithdrawService.deleteByUserId(userId);
|
if (delWithdrawCount > 0) {
|
log.info("删除 提现 记录成功");
|
} else {
|
log.info("删除 提现 记录失败");
|
}
|
|
|
int delCashCount = this.iUserCashDetailService.deleteByUserId(userId);
|
if (delCashCount > 0) {
|
log.info("删除 资金 记录成功");
|
} else {
|
log.info("删除 资金 记录成功");
|
}
|
|
|
int delPositionCount = this.iUserPositionService.deleteByUserId(userId);
|
if (delPositionCount > 0) {
|
log.info("删除 持仓 记录成功");
|
} else {
|
log.info("删除 持仓 记录失败");
|
}
|
|
|
int delLogCount = this.iSiteLoginLogService.deleteByUserId(userId);
|
if (delLogCount > 0) {
|
log.info("删除 登录 记录成功");
|
} else {
|
log.info("删除 登录 记录失败");
|
}
|
|
|
int delUserCount = this.userMapper.deleteById(userId);
|
if (delUserCount > 0) {
|
return ServerResponse.createBySuccessMsg("Successful operation");
|
}
|
return ServerResponse.createByErrorMsg("Operation failed. View logs");
|
}
|
|
|
public int CountUserSize(Integer accountType) {
|
return this.userMapper.CountUserSize(accountType);
|
}
|
|
|
public BigDecimal CountUserAmt(Integer accountType) {
|
return this.userMapper.CountUserAmt(accountType);
|
}
|
|
|
public BigDecimal CountEnableAmt(Integer accountType) {
|
return this.userMapper.CountEnableAmt(accountType);
|
}
|
|
|
public ServerResponse authByAdmin(Integer userId, Integer state, String authMsg) {
|
if (state == null || userId == null) {
|
return ServerResponse.createByErrorMsg("id and state cannot be empty");
|
}
|
|
User user = this.userMapper.selectById(userId);
|
if (user == null) {
|
return ServerResponse.createByErrorMsg("This user cannot be found");
|
}
|
|
if (state.intValue() == 3) {
|
if (StringUtils.isBlank(authMsg)) {
|
return ServerResponse.createByErrorMsg("Audit failure information is required");
|
}
|
user.setAuthMsg(authMsg);
|
}
|
|
if(state == 2){
|
user.setIsLock(0);
|
}
|
user.setIsActive(state);
|
|
int updateCount = this.userMapper.updateById(user);
|
if (updateCount > 0) {
|
return ServerResponse.createBySuccessMsg("Successful audit");
|
}
|
return ServerResponse.createByErrorMsg("Audit failure");
|
}
|
|
@Override
|
public ServerResponse findIdWithPwd(String phone) {
|
String idWithPwd = userMapper.findIdWithPwd(phone);
|
|
if (idWithPwd == null) {
|
return ServerResponse.createByErrorMsg("Please set the withdrawal password!");
|
} else {
|
return ServerResponse.createBySuccessMsg("Password has been set, you can withdraw!");
|
}
|
}
|
|
@Override
|
public ServerResponse updateWithPwd(String with_pwd, String phone) {
|
|
if (StringUtils.isBlank(with_pwd) || StringUtils.isBlank(phone)) {
|
return ServerResponse.createByErrorMsg("The parameter cannot be null");
|
}
|
|
String withPwd = userMapper.findWithPwd(with_pwd);
|
|
if (withPwd != null) {
|
return ServerResponse.createByErrorMsg("You have added your withdrawal password!");
|
}
|
|
int i = userMapper.updateWithPwd(with_pwd, phone);
|
if (i > 0) {
|
return ServerResponse.createBySuccessMsg("Add successfully!");
|
} else {
|
return ServerResponse.createByErrorMsg("Add failure!");
|
}
|
}
|
|
|
private AgentUserListVO assembleAgentUserListVO(User user, BigDecimal forcePercent, BigDecimal indexForcePercent, BigDecimal futuresForcePercent) {
|
AgentUserListVO agentUserListVO = new AgentUserListVO();
|
|
agentUserListVO.setId(user.getId());
|
agentUserListVO.setAgentId(user.getAgentId());
|
agentUserListVO.setAgentName(user.getAgentName());
|
agentUserListVO.setPhone(user.getPhone());
|
agentUserListVO.setRealName(user.getRealName());
|
agentUserListVO.setIdCard(user.getIdCard());
|
agentUserListVO.setAccountType(user.getAccountType());
|
agentUserListVO.setIsLock(user.getIsLock());
|
agentUserListVO.setIsLogin(user.getIsLogin());
|
agentUserListVO.setRegAddress(user.getRegAddress());
|
agentUserListVO.setIsActive(user.getIsActive());
|
agentUserListVO.setImg1Key(user.getImg1Key());
|
agentUserListVO.setImg2Key(user.getImg2Key());
|
agentUserListVO.setImg3Key(user.getImg3Key());
|
|
|
|
|
PositionVO positionVO = this.iUserPositionService.findUserPositionAllProfitAndLose(user.getId());
|
BigDecimal allProfitAndLose = positionVO.getAllProfitAndLose();
|
BigDecimal allFreezAmt = positionVO.getAllFreezAmt();
|
agentUserListVO.setAllProfitAndLose(allProfitAndLose);
|
agentUserListVO.setAllFreezAmt(allFreezAmt);
|
|
BigDecimal forceLine = forcePercent.multiply(allFreezAmt);
|
agentUserListVO.setForceLine(forceLine);
|
|
|
IndexPositionVO indexPositionVO = this.iUserIndexPositionService.findUserIndexPositionAllProfitAndLose(user.getId());
|
agentUserListVO.setAllIndexProfitAndLose(indexPositionVO.getAllIndexProfitAndLose());
|
agentUserListVO.setAllIndexFreezAmt(indexPositionVO.getAllIndexFreezAmt());
|
|
BigDecimal indexForceLine = indexForcePercent.multiply(indexPositionVO.getAllIndexFreezAmt());
|
|
agentUserListVO.setIndexForceLine(indexForceLine);
|
|
|
FuturesPositionVO futuresPositionVO = this.iUserFuturesPositionService.findUserFuturesPositionAllProfitAndLose(user.getId());
|
agentUserListVO.setAllFuturesFreezAmt(futuresPositionVO.getAllFuturesDepositAmt());
|
agentUserListVO.setAllFuturesProfitAndLose(futuresPositionVO.getAllFuturesProfitAndLose());
|
|
BigDecimal futuresForceLine = futuresForcePercent.multiply(futuresPositionVO.getAllFuturesDepositAmt());
|
|
agentUserListVO.setFuturesForceLine(futuresForceLine);
|
|
return agentUserListVO;
|
}
|
|
private UserInfoVO assembleUserInfoVO(User user, SiteSetting siteSetting) {
|
UserInfoVO userInfoVO = new UserInfoVO();
|
|
userInfoVO.setId(user.getId());
|
userInfoVO.setAgentId(user.getAgentId());
|
userInfoVO.setAgentName(user.getAgentName());
|
userInfoVO.setPhone(user.getPhone());
|
userInfoVO.setNickName(user.getNickName());
|
userInfoVO.setRealName(user.getRealName());
|
userInfoVO.setIdCard(user.getIdCard());
|
userInfoVO.setAccountType(user.getAccountType());
|
userInfoVO.setRecomPhone(user.getRecomPhone());
|
userInfoVO.setIsLock(user.getIsLock());
|
userInfoVO.setRegTime(user.getRegTime());
|
userInfoVO.setRegIp(user.getRegIp());
|
userInfoVO.setRegAddress(user.getRegAddress());
|
userInfoVO.setImg1Key(user.getImg1Key());
|
userInfoVO.setImg2Key(user.getImg2Key());
|
userInfoVO.setImg3Key(user.getImg3Key());
|
userInfoVO.setIsActive(user.getIsActive());
|
userInfoVO.setAuthMsg(user.getAuthMsg());
|
userInfoVO.setVaildNumber(user.getVaildNumber());
|
return userInfoVO;
|
}
|
|
|
public static void main(String[] args) {
|
int a = 3;
|
|
System.out.println((a != 0));
|
System.out.println((a != 3));
|
|
System.out.println(((a != 0) ? 1 : 0) & ((a != 3) ? 1 : 0));
|
System.out.println((a != 0 && a != 3));
|
|
|
if (a != 0 && a != 3) {
|
System.out.println("不能认证");
|
} else {
|
System.out.println("可以认证");
|
}
|
}
|
|
|
@Override
|
public void updateUserAmt(Double amt, Integer user_id) {
|
userMapper.updateUserAmt(amt, user_id);
|
}
|
|
|
@Override
|
public ServerResponse queryMyOption(String code, HttpServletRequest request) {
|
User user = getCurrentUser(request);
|
return this.iStockOptionService.isOption(user.getId(), code);
|
}
|
|
@Override
|
public ServerResponse getMoenyLog(String type,HttpServletRequest request) {
|
User user = getCurrentUser(request);
|
QueryWrapper<MoneyLog> queryWrapper = new QueryWrapper<>();
|
queryWrapper.eq("type",type);
|
queryWrapper.eq("user_id",user.getId());
|
return ServerResponse.createBySuccess(mapper.selectList(queryWrapper));
|
}
|
|
}
|