| | |
| | | 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.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.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.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | 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; |
| | |
| | | |
| | | @Autowired |
| | | IUserService userService; |
| | | |
| | | @Autowired |
| | | IRateServices rateServices; |
| | | |
| | | @Autowired |
| | | IUserAssetsServices userAssetsServices; |
| | |
| | | @Autowired |
| | | StockPoll stockPoll; |
| | | |
| | | @Autowired |
| | | StockSubscribeMapper stockSubscribeMapper; |
| | | |
| | | @Resource |
| | | UserPositionMapper userPositionMapper; |
| | | MoneyLogMapper mapper; |
| | | |
| | | @Resource |
| | | IUserPositionService userPositionService; |
| | | @Resource |
| | | SiteAmtTransLogMapper siteAmtTransLogMapper; |
| | | @Autowired |
| | |
| | | @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("Registration failed. The parameter cannot be empty"); |
| | | return ServerResponse.createByErrorMsg("注册失败。该参数不能为空",request); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | 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"); |
| | | return ServerResponse.createByErrorMsg("由于验证码不正确,注册失败。过程",request); |
| | | } |
| | | |
| | | |
| | | AgentUser agentUser = this.iAgentUserService.findByCode(agentCode); |
| | | if (agentUser == null) { |
| | | return ServerResponse.createByErrorMsg("Registration failed because the agent does not exist"); |
| | | return ServerResponse.createByErrorMsg("由于代理不存在,注册失败",request); |
| | | } |
| | | if (agentUser.getIsLock().intValue() == 1) { |
| | | return ServerResponse.createByErrorMsg("Registration failed. The agent is locked"); |
| | | return ServerResponse.createByErrorMsg("注册失败。代理被锁定",request); |
| | | } |
| | | |
| | | |
| | | User dbuser = this.userMapper.findByPhone(phone); |
| | | User dbuser = this.userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getPhone,phone).last( " limit 1")); |
| | | if (dbuser != null) { |
| | | return ServerResponse.createByErrorMsg("Registration failed, the mobile phone number has been registered"); |
| | | return ServerResponse.createByErrorMsg("注册失败,手机号已注册",request); |
| | | } |
| | | |
| | | |
| | |
| | | log.info("用户注册成功 手机 {} , ip = {} 地址 = {}", new Object[]{phone, uip, uadd}); |
| | | return ServerResponse.createBySuccessMsg("Registration successful. Please login"); |
| | | } |
| | | return ServerResponse.createBySuccessMsg("Registration error, please try again"); |
| | | return ServerResponse.createBySuccessMsg("注册错误,请重试",request); |
| | | } |
| | | |
| | | |
| | | 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"); |
| | | 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("Login failed. Account locked"); |
| | | return ServerResponse.createByErrorMsg("登录失败。账户锁定",request); |
| | | } |
| | | |
| | | log.info("用户{}登陆成功, 登陆状态{} ,交易状态{}", new Object[]{user.getId(), user.getIsLogin(), user.getIsLock()}); |
| | | |
| | | userAssetsServices.assetsByTypeAndUserId(EStockType.MAS.getCode(),user.getId()); |
| | | userAssetsServices.assetsByTypeAndUserId(EStockType.US.getCode(),user.getId()); |
| | | userAssetsServices.assetsByTypeAndUserId(EStockType.IN.getCode(),user.getId()); |
| | | this.iSiteLoginLogService.saveLog(user, request); |
| | | return ServerResponse.createBySuccess(user); |
| | | } |
| | | return ServerResponse.createByErrorMsg("Login failed, the user name and password are incorrect"); |
| | | return ServerResponse.createByErrorMsg("登录失败,用户名和密码错误",request); |
| | | } |
| | | |
| | | |
| | | 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; |
| | |
| | | |
| | | 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"); |
| | | return ServerResponse.createByErrorMsg("未能添加所选股票,因为它已经存在",request ); |
| | | } |
| | | //期货逻辑 |
| | | Stock stock = this.stockMapper.findStockByCode(code); |
| | | if (stock == null) { |
| | | return ServerResponse.createByErrorMsg("Add failed, stock does not exist"); |
| | | return ServerResponse.createByErrorMsg("添加失败,库存不存在",request ); |
| | | } |
| | | StockOption stockOption = new StockOption(); |
| | | stockOption.setUserId(user.getId()); |
| | |
| | | |
| | | int insertCount = this.stockOptionMapper.insert(stockOption); |
| | | if (insertCount > 0) { |
| | | return ServerResponse.createBySuccessMsg("Adding self-selected stocks succeeded"); |
| | | return ServerResponse.createBySuccessMsg("添加自选股票成功",request ); |
| | | } |
| | | return ServerResponse.createByErrorMsg("Failed to add, please try again"); |
| | | return ServerResponse.createByErrorMsg("添加失败,请重试",request ); |
| | | } |
| | | |
| | | |
| | | 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"); |
| | | return ServerResponse.createByErrorMsg("删除失败,因为自选股票不存在",request); |
| | | } |
| | | |
| | | int delCount = this.stockOptionMapper.deleteByPrimaryKey(dboption.getId()); |
| | | if (delCount > 0) { |
| | | return ServerResponse.createBySuccessMsg("Deleting self-selected stocks succeeded. Procedure"); |
| | | return ServerResponse.createBySuccessMsg("删除自选成功",request); |
| | | } |
| | | return ServerResponse.createByErrorMsg("Failed to delete, please try again"); |
| | | return ServerResponse.createByErrorMsg("删除自选失败",request); |
| | | } |
| | | |
| | | |
| | | 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); |
| | | } |
| | | |
| | |
| | | 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("The parameter cannot be null"); |
| | | return ServerResponse.createByErrorMsg("该参数不能为空",request); |
| | | } |
| | | |
| | | 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"); |
| | | return ServerResponse.createByErrorMsg("密码错误",request); |
| | | } |
| | | |
| | | user.setUserPwd(SymmetricCryptoUtil.encryptPassword(newPwd)); |
| | | int updateCount = this.userMapper.updateById(user); |
| | | if (updateCount > 0) { |
| | | return ServerResponse.createBySuccessMsg("Modified successfully"); |
| | | return ServerResponse.createBySuccessMsg("修改成功",request); |
| | | } |
| | | return ServerResponse.createByErrorMsg("Modification failure"); |
| | | return ServerResponse.createByErrorMsg("修改失败",request); |
| | | } |
| | | |
| | | |
| | |
| | | if (StringUtils.isBlank(realName) || |
| | | StringUtils.isBlank(idCard)) { |
| | | |
| | | return ServerResponse.createByErrorMsg("The parameter cannot be null"); |
| | | return ServerResponse.createByErrorMsg("该参数不能为空",request); |
| | | } |
| | | |
| | | 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"); |
| | | return ServerResponse.createByErrorMsg("当前状态无法验证",request); |
| | | } |
| | | |
| | | user.setImg1Key(img1key); |
| | | user.setImg2Key(img2key); |
| | | user.setNickName(realName); |
| | | user.setRealName(realName); |
| | | user.setIdCard(idCard); |
| | |
| | | |
| | | int updateCount = this.userMapper.updateById(user); |
| | | if (updateCount > 0) { |
| | | return ServerResponse.createBySuccessMsg("Real name authentication"); |
| | | return ServerResponse.createBySuccessMsg("实名认证",request); |
| | | } |
| | | return ServerResponse.createByErrorMsg("Real-name authentication failed. Procedure"); |
| | | return ServerResponse.createByErrorMsg("实名认证失败",request); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | @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); |
| | | return getMoney(getCurrentUser(request).getId()); |
| | | } |
| | | |
| | | @Override |
| | | public ServerResponse getMoney(Integer userId) { |
| | | BigDecimal exchangeRate = iSiteSettingService.getSiteSetting().getExchangeRate(); |
| | | List<UserAssets> userAssetsList = userAssetsServices.assetsByUserId(userId); |
| | | List<RUserAssets> rUserAssetsList = new ArrayList<>(); |
| | | int s= 4; |
| | | /** |
| | | * 浮动盈亏 |
| | | * */ |
| | |
| | | RUserAssets rUserAssets = new RUserAssets(); |
| | | UserAssets userAssets = userAssetsList.get(i); |
| | | // 浮动盈亏 |
| | | BigDecimal profitAndLose = userAssets.getProfitAndLoss(); |
| | | String profitAndLose = getProfitAndLose(userId).toString(); |
| | | BigDecimal amt = userAssets.getAvailableBalance(); |
| | | BigDecimal totalAssets = userAssets.getAvailableBalance().add(userAssets.getFreezeMoney()); |
| | | 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.setScale(2).toString())); |
| | | rUserAssets.setTotalMoney((totalAssets.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()); |
| | | 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); |
| | | |
| | | }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()); |
| | | BigDecimal availableBalanceUSD = amt; |
| | | if(amt.compareTo(BigDecimal.ZERO)>0){ |
| | | availableBalanceUSD = amt.multiply(rate); |
| | | } |
| | | |
| | | 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)); |
| | | 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(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.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); |
| | | } |
| | | |
| | | @Override |
| | | public ServerResponse transfer(String fromType, String toType, String amt,HttpServletRequest paramHttpServletRequest) { |
| | | public BigDecimal getProfitAndLose(Integer userId){ |
| | | List<UserPosition> userPositions; |
| | | userPositions = userPositionMapper. |
| | | findMyPositionByCodeAndSpell(userId, |
| | | "","", |
| | | 0, "IN"); |
| | | |
| | | User user = userService.getCurrentUser(paramHttpServletRequest); |
| | | |
| | | 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("Insufficient amount"); |
| | | return ServerResponse.createByErrorMsg("余额不足",request); |
| | | } |
| | | userAssetsServices.availablebalanceChange(fromType,user.getId(), EUserAssets.TRANSFER,amtBig.negate(),"",""); |
| | | userAssetsServices.availablebalanceChange(toType,user.getId(),EUserAssets.TRANSFER,amtBig,"",""); |
| | | 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(); |
| | | } |
| | | |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | @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"); |
| | | } |
| | | |
| | | |
| | | User dbUser = this.userMapper.findByPhone(phone); |
| | | QueryWrapper queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("phone",phone); |
| | | User dbUser = userMapper.selectOne(queryWrapper); |
| | | 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.setIsLogin(Integer.valueOf(0)); |
| | | user.setIsActive(Integer.valueOf(0)); |
| | | user.setRegTime(new Date()); |
| | | |
| | | |
| | | if (accountType.intValue() == 1) { |
| | | user.setNickName("模拟用户"); |
| | |
| | | } |
| | | |
| | | 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"); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | public ServerResponse listByAdmin(String realName, String phone, Integer agentId, Integer accountType, int pageNum, int pageSize, HttpServletRequest request) { |
| | | 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<>(); |
| | | |
| | | List<User> users = this.userMapper.listByAdmin(realName, phone, agentId, accountType); |
| | | // 获取用户资产信息并构建返回结果 |
| | | 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) { |
| | |
| | | user.setAuthMsg(authMsg); |
| | | } |
| | | |
| | | if(state == 2){ |
| | | user.setIsLock(0); |
| | | } |
| | | user.setIsActive(state); |
| | | |
| | | int updateCount = this.userMapper.updateById(user); |
| | |
| | | agentUserListVO.setIsLogin(user.getIsLogin()); |
| | | agentUserListVO.setRegAddress(user.getRegAddress()); |
| | | agentUserListVO.setIsActive(user.getIsActive()); |
| | | |
| | | agentUserListVO.setImg1Key(user.getImg1Key()); |
| | | agentUserListVO.setImg2Key(user.getImg2Key()); |
| | | agentUserListVO.setImg3Key(user.getImg3Key()); |
| | | |
| | | |
| | | |
| | |
| | | |
| | | 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; |
| | | } |
| | | |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | 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); |
| | | // } |
| | | |
| | | @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)); |
| | | } |
| | | |
| | | } |
| | | |