package com.nq.service.impl;
|
|
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.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.stock.StockListVO;
|
import com.nq.vo.user.UserInfoVO;
|
|
import java.math.BigDecimal;
|
import java.math.RoundingMode;
|
import java.util.ArrayList;
|
import java.util.Arrays;
|
import java.util.Date;
|
import java.util.List;
|
import javax.annotation.Resource;
|
import javax.servlet.http.HttpServletRequest;
|
|
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
|
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;
|
|
|
@Resource
|
UserPositionMapper userPositionMapper;
|
@Resource
|
SiteAmtTransLogMapper siteAmtTransLogMapper;
|
@Autowired
|
IUserFuturesPositionService iUserFuturesPositionService;
|
@Autowired
|
ISiteFuturesSettingService iSiteFuturesSettingService;
|
@Autowired
|
IStockFuturesService iStockFuturesService;
|
|
@Autowired
|
ISiteMessageService iSiteMessageService;
|
|
|
|
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("Registration failed. The parameter cannot be empty");
|
}
|
|
|
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("Registration failed because the verification code is incorrect. Procedure");
|
}
|
|
|
AgentUser agentUser = this.iAgentUserService.findByCode(agentCode);
|
if (agentUser == null) {
|
return ServerResponse.createByErrorMsg("Registration failed because the agent does not exist");
|
}
|
if (agentUser.getIsLock().intValue() == 1) {
|
return ServerResponse.createByErrorMsg("Registration failed. The agent is locked");
|
}
|
|
|
User dbuser = this.userMapper.findByPhone(phone);
|
if (dbuser != null) {
|
return ServerResponse.createByErrorMsg("Registration failed, the mobile phone number has been registered");
|
}
|
|
|
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("Registration error, please try again");
|
}
|
|
|
public ServerResponse login(String phone, String userPwd, HttpServletRequest request) {
|
if (StringUtils.isBlank(phone) || StringUtils.isBlank(userPwd)) {
|
return ServerResponse.createByErrorMsg("The mobile phone number and password cannot be empty");
|
}
|
userPwd = SymmetricCryptoUtil.encryptPassword(userPwd);
|
User user = this.userMapper.login(phone, userPwd);
|
if (user != null) {
|
if (user.getIsLogin().intValue() == 1) {
|
return ServerResponse.createByErrorMsg("Login failed. Account locked");
|
}
|
|
log.info("用户{}登陆成功, 登陆状态{} ,交易状态{}", new Object[]{user.getId(), user.getIsLogin(), user.getIsLock()});
|
|
userAssetsServices.assetsByTypeAndUserId(EStockType.MAS.getCode(),user.getId());
|
userAssetsServices.assetsByTypeAndUserId(EStockType.US.getCode(),user.getId());
|
this.iSiteLoginLogService.saveLog(user, request);
|
return ServerResponse.createBySuccess(user);
|
}
|
return ServerResponse.createByErrorMsg("Login failed, the user name and password are incorrect");
|
}
|
|
|
public User getCurrentUser(HttpServletRequest request) {
|
String property = PropertiesUtil.getProperty("user.cookie.name");
|
// System.out.println(property);
|
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);
|
if (user == null) {
|
return ServerResponse.createBySuccessMsg("Please log in first");
|
}
|
String stockcode = code;
|
StockOption dboption = this.stockOptionMapper.findMyOptionIsExistByCode(user.getId(), stockcode);
|
if (dboption != null) {
|
return ServerResponse.createByErrorMsg("Failed to add the selected stock because it already exists");
|
}
|
//期货逻辑
|
Stock stock = this.stockMapper.findStockByCode(code);
|
if (stock == null) {
|
return ServerResponse.createByErrorMsg("Add failed, stock does not exist");
|
}
|
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("Adding self-selected stocks succeeded");
|
}
|
return ServerResponse.createByErrorMsg("Failed to add, please try again");
|
}
|
|
|
public ServerResponse delOption(String code, HttpServletRequest request) {
|
User user = getCurrentUser(request);
|
if (user == null) {
|
return ServerResponse.createBySuccessMsg("Please log in first");
|
}
|
String stockcode = code;
|
if (code.contains("hf")) {
|
stockcode = code.split("_")[1].toString();
|
}
|
stockcode = stockcode.replace("sh", "").replace("sz", "").replace("bj", "");
|
StockOption dboption = this.stockOptionMapper.findMyOptionIsExistByCode(user.getId(), stockcode);
|
|
if (dboption == null) {
|
return ServerResponse.createByErrorMsg("Failed to delete because the self-selected stock does not exist");
|
}
|
|
int delCount = this.stockOptionMapper.deleteByPrimaryKey(dboption.getId());
|
if (delCount > 0) {
|
return ServerResponse.createBySuccessMsg("Deleting self-selected stocks succeeded. Procedure");
|
}
|
return ServerResponse.createByErrorMsg("Failed to delete, please try again");
|
}
|
|
|
public ServerResponse isOption(String code, HttpServletRequest request) {
|
User user = getCurrentUser(request);
|
|
if (user == null) {
|
return ServerResponse.createBySuccessMsg("Please log in first");
|
}
|
String stockcode = code;
|
if (code.contains("hf")) {
|
stockcode = code.split("_")[1].toString();
|
}
|
stockcode = stockcode.replace("sh", "").replace("sz", "").replace("bj", "");
|
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);
|
return ServerResponse.createBySuccess(userInfoVO);
|
}
|
|
|
public ServerResponse updatePwd(String oldPwd, String newPwd, HttpServletRequest request) {
|
if (StringUtils.isBlank(oldPwd) || StringUtils.isBlank(newPwd)) {
|
return ServerResponse.createByErrorMsg("The parameter cannot be null");
|
}
|
|
User user = getCurrentRefreshUser(request);
|
if (user == null) {
|
return ServerResponse.createBySuccessMsg("Please log in first");
|
}
|
oldPwd = SymmetricCryptoUtil.encryptPassword(oldPwd);
|
if (!oldPwd.equals(user.getUserPwd())) {
|
return ServerResponse.createByErrorMsg("Password error");
|
}
|
|
user.setUserPwd(SymmetricCryptoUtil.encryptPassword(newPwd));
|
int updateCount = this.userMapper.updateById(user);
|
if (updateCount > 0) {
|
return ServerResponse.createBySuccessMsg("Modified successfully");
|
}
|
return ServerResponse.createByErrorMsg("Modification failure");
|
}
|
|
|
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("The parameter cannot be null");
|
}
|
|
User user = getCurrentRefreshUser(request);
|
if (user == null) {
|
return ServerResponse.createByErrorMsg("Please log in!");
|
}
|
|
if (((0 != user.getIsActive().intValue())) & ((3 != user.getIsActive().intValue()))) {
|
return ServerResponse.createByErrorMsg("The current status cannot be authenticated");
|
}
|
|
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("Real name authentication");
|
}
|
return ServerResponse.createByErrorMsg("Real-name authentication failed. Procedure");
|
}
|
|
|
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) {
|
BigDecimal exchangeRate = iSiteSettingService.getSiteSetting().getExchangeRate();
|
List<UserAssets> userAssetsList = userAssetsServices.assetsByUserId(getCurrentUser(request).getId());
|
List<RUserAssets> rUserAssetsList = new ArrayList<>();
|
/**
|
* 浮动盈亏
|
* */
|
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);
|
// 浮动盈亏
|
BigDecimal profitAndLose = userAssets.getProfitAndLoss();
|
BigDecimal amt = userAssets.getAvailableBalance();
|
BigDecimal totalAssets = userAssets.getAvailableBalance().add(userAssets.getFreezeMoney());
|
BigDecimal freeMoney = userAssets.getFreezeMoney();
|
BigDecimal hMoney = userAssets.getHandlingCharge();
|
BigDecimal hProfitAndLose = userAssets.getCumulativeProfitAndLoss();
|
|
rUserAssets.setTotalMoney((totalAssets.setScale(2).toString()));
|
rUserAssets.setAccectType(userAssets.getAccectType());
|
rUserAssets.setAvailableBalance(amt.setScale(2).toString());
|
rUserAssets.setFreezeMoney(freeMoney.setScale(2).toString());
|
rUserAssets.setCumulativeProfitAndLoss(hProfitAndLose.setScale(2).toString());
|
rUserAssets.setHandlingCharge(hMoney.setScale(2).toString());
|
rUserAssets.setProfitAndLoss(profitAndLose.setScale(2).toString());
|
if(userAssets.getAccectType().equals("US")){
|
rUserAssets.setSymbol("$");
|
rUserAssets.setSymbolCode("USD");
|
AllProfitAndLose = AllProfitAndLose.add(profitAndLose);
|
allTotalAssets = allTotalAssets.add(totalAssets);
|
allAmt = allAmt.add(amt);
|
AllHProfitAndLose = AllHProfitAndLose.add(hProfitAndLose);
|
allFreeMoney = allFreeMoney.add(freeMoney);
|
allHMoney = allHMoney.add(hMoney);
|
rUserAssets.setAvailableBalanceUSD(rUserAssets.getAvailableBalance());
|
rUserAssets.setFreezeMoneyUSD(rUserAssets.getFreezeMoney());
|
rUserAssets.setTotalMoneyUSD(rUserAssets.getTotalMoney());
|
rUserAssets.setCumulativeProfitAndLossUSD(hProfitAndLose.setScale(2).toString());
|
rUserAssets.setHandlingChargeUSD(hMoney.setScale(2).toString());
|
rUserAssets.setProfitAndLossUSD(hProfitAndLose.setScale(2).toString());
|
|
}else{
|
rUserAssets.setAvailableBalanceUSD(userAssets.getAvailableBalance().divide(exchangeRate,BigDecimal.ROUND_CEILING).toString());
|
rUserAssets.setFreezeMoneyUSD(userAssets.getFreezeMoney().divide(exchangeRate,BigDecimal.ROUND_CEILING).toString());
|
rUserAssets.setTotalMoneyUSD(userAssets.getTotleAssets().divide(exchangeRate,BigDecimal.ROUND_CEILING).toString());
|
rUserAssets.setSymbol("RM");
|
rUserAssets.setSymbolCode("MYR");
|
rUserAssets.setCumulativeProfitAndLossUSD(hProfitAndLose.divide(exchangeRate,BigDecimal.ROUND_CEILING).toString());
|
rUserAssets.setHandlingChargeUSD(hMoney.divide(exchangeRate,BigDecimal.ROUND_CEILING).toString());
|
rUserAssets.setProfitAndLossUSD(hProfitAndLose.divide(exchangeRate,BigDecimal.ROUND_CEILING).toString());
|
|
AllProfitAndLose = AllProfitAndLose.add(profitAndLose.divide(exchangeRate,BigDecimal.ROUND_CEILING));
|
allTotalAssets = allTotalAssets.add(totalAssets.divide(exchangeRate,BigDecimal.ROUND_CEILING));
|
allAmt = allAmt.add(amt.divide(exchangeRate,BigDecimal.ROUND_CEILING));
|
AllHProfitAndLose = AllHProfitAndLose.add(hProfitAndLose.divide(exchangeRate,BigDecimal.ROUND_CEILING));
|
allFreeMoney = allFreeMoney.add(freeMoney.divide(exchangeRate,BigDecimal.ROUND_CEILING));
|
allHMoney = allHMoney.add(hMoney.divide(exchangeRate,BigDecimal.ROUND_CEILING));
|
}
|
rUserAssetsList.add(rUserAssets);
|
}
|
|
|
|
RUserAssets rUserAssets = new RUserAssets();
|
rUserAssets.setAccectType("ALL");
|
rUserAssets.setProfitAndLoss(AllProfitAndLose.setScale(2).toString());
|
rUserAssets.setProfitAndLossUSD(AllProfitAndLose.setScale(2).toString());
|
rUserAssets.setHandlingCharge(allHMoney.setScale(2).toString());
|
rUserAssets.setHandlingChargeUSD(allHMoney.setScale(2).toString());
|
rUserAssets.setCumulativeProfitAndLoss(AllHProfitAndLose.setScale(2).toString());
|
rUserAssets.setCumulativeProfitAndLossUSD(AllHProfitAndLose.setScale(2).toString());
|
rUserAssets.setTotalMoney(allTotalAssets.setScale(2).toString());
|
rUserAssets.setTotalMoneyUSD(allTotalAssets.setScale(2).toString());
|
rUserAssets.setAvailableBalance(allAmt.setScale(2).toString());
|
rUserAssets.setAvailableBalanceUSD(allAmt.setScale(2).toString());
|
rUserAssets.setFreezeMoney(allFreeMoney.setScale(2).toString());
|
rUserAssets.setFreezeMoneyUSD(allFreeMoney.setScale(2).toString());
|
rUserAssets.setSymbol("$");
|
rUserAssets.setSymbolCode("USD");
|
rUserAssetsList.add(rUserAssets);
|
|
return ServerResponse.createBySuccess(rUserAssetsList);
|
}
|
|
@Override
|
public ServerResponse getMoney(Integer userId) {
|
BigDecimal exchangeRate = iSiteSettingService.getSiteSetting().getExchangeRate();
|
List<UserAssets> userAssetsList = userAssetsServices.assetsByUserId(userId);
|
List<RUserAssets> rUserAssetsList = new ArrayList<>();
|
/**
|
* 浮动盈亏
|
* */
|
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);
|
// 浮动盈亏
|
BigDecimal profitAndLose = userAssets.getProfitAndLoss();
|
BigDecimal amt = userAssets.getAvailableBalance();
|
BigDecimal totalAssets = userAssets.getAvailableBalance().add(userAssets.getFreezeMoney());
|
BigDecimal freeMoney = userAssets.getFreezeMoney();
|
BigDecimal hMoney = userAssets.getHandlingCharge();
|
BigDecimal hProfitAndLose = userAssets.getCumulativeProfitAndLoss();
|
rUserAssets.setId(userAssets.getId());
|
rUserAssets.setTotalMoney((totalAssets.setScale(2).toString()));
|
rUserAssets.setAccectType(userAssets.getAccectType());
|
rUserAssets.setAvailableBalance(amt.setScale(2).toString());
|
rUserAssets.setFreezeMoney(freeMoney.setScale(2).toString());
|
rUserAssets.setCumulativeProfitAndLoss(hProfitAndLose.setScale(2).toString());
|
rUserAssets.setHandlingCharge(hMoney.setScale(2).toString());
|
rUserAssets.setProfitAndLoss(profitAndLose.setScale(2).toString());
|
if(userAssets.getAccectType().equals("US")){
|
rUserAssets.setSymbol("$");
|
rUserAssets.setSymbolCode("USD");
|
AllProfitAndLose = AllProfitAndLose.add(profitAndLose);
|
allTotalAssets = allTotalAssets.add(totalAssets);
|
allAmt = allAmt.add(amt);
|
AllHProfitAndLose = AllHProfitAndLose.add(hProfitAndLose);
|
allFreeMoney = allFreeMoney.add(freeMoney);
|
allHMoney = allHMoney.add(hMoney);
|
rUserAssets.setAvailableBalanceUSD(rUserAssets.getAvailableBalance());
|
rUserAssets.setFreezeMoneyUSD(rUserAssets.getFreezeMoney());
|
rUserAssets.setTotalMoneyUSD(rUserAssets.getTotalMoney());
|
rUserAssets.setCumulativeProfitAndLossUSD(hProfitAndLose.setScale(2).toString());
|
rUserAssets.setHandlingChargeUSD(hMoney.setScale(2).toString());
|
rUserAssets.setProfitAndLossUSD(hProfitAndLose.setScale(2).toString());
|
|
}else{
|
rUserAssets.setAvailableBalanceUSD(userAssets.getAvailableBalance().divide(exchangeRate,BigDecimal.ROUND_CEILING).toString());
|
rUserAssets.setFreezeMoneyUSD(userAssets.getFreezeMoney().divide(exchangeRate,BigDecimal.ROUND_CEILING).toString());
|
rUserAssets.setTotalMoneyUSD(userAssets.getTotleAssets().divide(exchangeRate,BigDecimal.ROUND_CEILING).toString());
|
rUserAssets.setSymbol("RM");
|
rUserAssets.setSymbolCode("MYR");
|
rUserAssets.setCumulativeProfitAndLossUSD(hProfitAndLose.divide(exchangeRate,BigDecimal.ROUND_CEILING).toString());
|
rUserAssets.setHandlingChargeUSD(hMoney.divide(exchangeRate,BigDecimal.ROUND_CEILING).toString());
|
rUserAssets.setProfitAndLossUSD(hProfitAndLose.divide(exchangeRate,BigDecimal.ROUND_CEILING).toString());
|
|
AllProfitAndLose = AllProfitAndLose.add(profitAndLose.divide(exchangeRate,BigDecimal.ROUND_CEILING));
|
allTotalAssets = allTotalAssets.add(totalAssets.divide(exchangeRate,BigDecimal.ROUND_CEILING));
|
allAmt = allAmt.add(amt.divide(exchangeRate,BigDecimal.ROUND_CEILING));
|
AllHProfitAndLose = AllHProfitAndLose.add(hProfitAndLose.divide(exchangeRate,BigDecimal.ROUND_CEILING));
|
allFreeMoney = allFreeMoney.add(freeMoney.divide(exchangeRate,BigDecimal.ROUND_CEILING));
|
allHMoney = allHMoney.add(hMoney.divide(exchangeRate,BigDecimal.ROUND_CEILING));
|
}
|
rUserAssetsList.add(rUserAssets);
|
}
|
|
|
|
RUserAssets rUserAssets = new RUserAssets();
|
rUserAssets.setAccectType("ALL");
|
rUserAssets.setProfitAndLoss(AllProfitAndLose.setScale(2).toString());
|
rUserAssets.setProfitAndLossUSD(AllProfitAndLose.setScale(2).toString());
|
rUserAssets.setHandlingCharge(allHMoney.setScale(2).toString());
|
rUserAssets.setHandlingChargeUSD(allHMoney.setScale(2).toString());
|
rUserAssets.setCumulativeProfitAndLoss(AllHProfitAndLose.setScale(2).toString());
|
rUserAssets.setCumulativeProfitAndLossUSD(AllHProfitAndLose.setScale(2).toString());
|
rUserAssets.setTotalMoney(allTotalAssets.setScale(2).toString());
|
rUserAssets.setTotalMoneyUSD(allTotalAssets.setScale(2).toString());
|
rUserAssets.setAvailableBalance(allAmt.setScale(2).toString());
|
rUserAssets.setAvailableBalanceUSD(allAmt.setScale(2).toString());
|
rUserAssets.setFreezeMoney(allFreeMoney.setScale(2).toString());
|
rUserAssets.setFreezeMoneyUSD(allFreeMoney.setScale(2).toString());
|
rUserAssets.setSymbol("$");
|
rUserAssets.setSymbolCode("USD");
|
rUserAssetsList.add(rUserAssets);
|
|
return ServerResponse.createBySuccess(rUserAssetsList);
|
}
|
|
@Override
|
public ServerResponse transfer(String fromType, String toType, String amt,HttpServletRequest paramHttpServletRequest) {
|
|
User user = userService.getCurrentUser(paramHttpServletRequest);
|
UserAssets formAssets = userAssetsServices.assetsByTypeAndUserId(fromType,user.getId());
|
BigDecimal amtBig = new BigDecimal(amt);
|
if(formAssets.getAvailableBalance().compareTo(amtBig)<0){
|
return ServerResponse.createByErrorMsg("Insufficient amount");
|
}
|
userAssetsServices.availablebalanceChange(fromType,user.getId(), EUserAssets.TRANSFER,amtBig.negate(),"","");
|
userAssetsServices.availablebalanceChange(toType,user.getId(),EUserAssets.TRANSFER,amtBig,"","");
|
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) {
|
AgentUserListVO agentUserListVO = assembleAgentUserListVO(user, siteSetting
|
.getForceStopPercent(), siteIndexSetting
|
.getForceSellPercent(), siteFuturesSetting.getForceSellPercent());
|
agentUserListVOS.add(agentUserListVO);
|
}
|
|
PageInfo pageInfo = new PageInfo(users);
|
pageInfo.setList(agentUserListVOS);
|
|
return ServerResponse.createBySuccess(pageInfo);
|
}
|
|
|
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");
|
}
|
|
|
User dbUser = this.userMapper.findByPhone(phone);
|
if (dbUser != null) {
|
return ServerResponse.createByErrorMsg("The phone number is registered");
|
}
|
|
|
if ((new BigDecimal(amt)).compareTo(new BigDecimal("200000")) == 1) {
|
return ServerResponse.createByErrorMsg("The phone number is registered");
|
}
|
amt = "0"; //代理后台添加用户时金额默认为0
|
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);
|
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, HttpServletRequest request) {
|
PageHelper.startPage(pageNum, pageSize);
|
|
List<User> users = this.userMapper.listByAdmin(realName, phone, agentId, accountType);
|
|
PageInfo pageInfo = new PageInfo(users);
|
|
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);
|
}
|
|
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());
|
|
|
|
|
|
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);
|
|
|
UserBank userBank = this.iUserBankService.findUserBankByUserId(user.getId());
|
if (userBank != null) {
|
agentUserListVO.setBankName(userBank.getBankName());
|
agentUserListVO.setBankNo(userBank.getBankNo());
|
agentUserListVO.setBankAddress(userBank.getBankAddress());
|
}
|
|
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());
|
BigDecimal exchangRate = iSiteSettingService.getSiteSetting().getExchangeRate();
|
BigDecimal totalUsMoney = userAssetsServices.getAvailableBalance(EStockType.US.getCode(),user.getId());
|
BigDecimal totalMasMoney = userAssetsServices.getAvailableBalance(EStockType.IN.getCode(), user.getId())
|
.divide(exchangRate,BigDecimal.ROUND_CEILING).setScale(2,
|
RoundingMode.UP);
|
|
|
userInfoVO.setMasTotalAssets(totalMasMoney.setScale(2).toString());
|
userInfoVO.setUsTotalAssets(totalUsMoney.setScale(2).toString());
|
userInfoVO.setTotalAssets((totalUsMoney.add(totalMasMoney)).setScale(2).toString());
|
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);
|
//
|
// if (user == null) {
|
// return ServerResponse.createBySuccessMsg("請先登錄");
|
// }
|
// String stockcode = code;
|
// if(code.contains("hf")){
|
// stockcode = code.split("_")[1].toString();
|
// }
|
// stockcode = stockcode.replace("sh","").replace("sz","").replace("bj","");
|
// return this.iStockOptionService.isOption(user.getId(), stockcode);
|
// }
|
|
}
|