| | |
| | | if(checkType == 2){ |
| | | userPositionCheckDz.setCheckType(checkType); |
| | | service.updateById(userPositionCheckDz); |
| | | return ServerResponse.createBySuccess("审核成功"); |
| | | return ServerResponse.createBySuccessMsg("审核成功"); |
| | | } |
| | | User user = userMapper.selectById(userPositionCheckDz.getUserId()); |
| | | |
| | |
| | | } |
| | | return serverResponse; |
| | | } |
| | | |
| | | //修改资金管理 提现列表 提现状态 |
| | | @RequestMapping({"updateCardNumber.do"}) |
| | | @ResponseBody |
| | | public ServerResponse updateCardNumber(@RequestParam(value = "withId") Integer withId, |
| | | @RequestParam(value = "bankNo") String bankNo) { |
| | | ServerResponse serverResponse = null; |
| | | try { |
| | | serverResponse = iUserWithdrawService.updateCardNumber(withId,bankNo); |
| | | } catch (Exception e) { |
| | | log.error("admin修改充值订单状态出错 ,异常 = {}", e); |
| | | } |
| | | return serverResponse; |
| | | } |
| | | |
| | | |
| | | |
| | | //删除资金记录 |
| | | @RequestMapping({"deleteWithdraw.do"}) |
| | | @ResponseBody |
| | |
| | | return this.iUserWithdrawService.findUserWithList(withStatus, request, pageNum, pageSize); |
| | | } |
| | | |
| | | |
| | | //用户提现 |
| | | @RequestMapping({"outMoney.do"}) |
| | | @ResponseBody |
| | | public ServerResponse outMoney(@RequestParam(value = "amt") String amt,@RequestParam(value = "bankId") String bankId, |
| | | public ServerResponse outMoney(@RequestParam(value = "amt") String amt, |
| | | @RequestParam(value = "bankName") String bankName, |
| | | @RequestParam(value = "bankNo") String bankNo, |
| | | @RequestParam(value = "assetsType") String accsetType, |
| | | HttpServletRequest request) { |
| | | ServerResponse serverResponse = null; |
| | | User user = this.iUserService.getCurrentRefreshUser(request); |
| | | try { |
| | | serverResponse = this.iUserWithdrawService.outMoney(amt, user.getWithPwd(), accsetType,bankId,request); |
| | | serverResponse = this.iUserWithdrawService.outMoney(amt, user.getWithPwd(), accsetType,bankName,bankNo,request); |
| | | } catch (Exception e) { |
| | | log.error("出金异常 e = {}", e); |
| | | serverResponse = ServerResponse.createByErrorMsg("提现异常,请稍后再试",request); |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | public interface IUserWithdrawService { |
| | | ServerResponse outMoney(String paramString,String with_Pwd, String assetsType,String bankId,HttpServletRequest paramHttpServletRequest) throws Exception; |
| | | ServerResponse outMoney(String paramString,String with_Pwd, String assetsType,String bankName,String bankNo,HttpServletRequest paramHttpServletRequest) throws Exception; |
| | | |
| | | ServerResponse<PageInfo> findUserWithList(String paramString, HttpServletRequest paramHttpServletRequest, int paramInt1, int paramInt2); |
| | | |
| | |
| | | |
| | | List<UserWithdraw> exportByAdmin( Integer agentId, Integer userId, String realName, Integer state, String beginTime, String endTime, HttpServletRequest request); |
| | | |
| | | ServerResponse updateCardNumber(Integer withId,String bankNo); |
| | | } |
| | |
| | | String price = iPriceServices.getNowPrice(f.getStockCode()).toString(); |
| | | BigDecimal subtract = new BigDecimal(price).subtract(f.getNowPrice()); |
| | | f.setPriceSpread(subtract); |
| | | f.setNowPrice(new BigDecimal(price)); |
| | | f.setPriceSpreadPercentum( |
| | | subtract.divide(new BigDecimal(price), 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)) |
| | | ); }); |
| | |
| | | PageInfo pageInfo = new PageInfo(); |
| | | pageInfo.setList(list); |
| | | return ServerResponse.createBySuccess(pageInfo); |
| | | }else if(state == 3){ |
| | | List<UserPositionCheckDz> list = userPositionCheckDzService.list(new LambdaQueryWrapper<UserPositionCheckDz>() |
| | | .eq(UserPositionCheckDz::getUserId, user.getId()) |
| | | .orderByDesc(UserPositionCheckDz::getBuyOrderTime) |
| | | ); |
| | | PageInfo pageInfo = new PageInfo(); |
| | | pageInfo.setList(list); |
| | | return ServerResponse.createBySuccess(pageInfo); |
| | | }else { |
| | | if (null != stockCode && stockCode.equals("HJYY")) { |
| | | LambdaQueryWrapper<UserPosition> wrapper = getUserPositionLambdaQueryWrapper(stockCode, state, user); |
| | |
| | | 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.redis.*; |
| | | 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; |
| | |
| | | public ServerResponse getMoney(Integer userId) { |
| | | List<UserAssets> userAssetsList = userAssetsServices.assetsByUserId(userId); |
| | | List<RUserAssets> rUserAssetsList = new ArrayList<>(); |
| | | int s= 4; |
| | | int s= 2; |
| | | /** |
| | | * 浮动盈亏 |
| | | * */ |
| | |
| | | BigDecimal hMoney = userAssets.getHandlingCharge(); |
| | | BigDecimal hProfitAndLose = userAssets.getCumulativeProfitAndLoss(); |
| | | rUserAssets.setId(userAssets.getId()); |
| | | rUserAssets.setTotalMoney((totalAssets.toString())); |
| | | rUserAssets.setTotalMoney((totalAssets.setScale(s,BigDecimal.ROUND_DOWN).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.setAvailableBalance(amt.setScale(s,BigDecimal.ROUND_DOWN).toString()); |
| | | rUserAssets.setFreezeMoney(freeMoney.setScale(s,BigDecimal.ROUND_DOWN).toString()); |
| | | rUserAssets.setCumulativeProfitAndLoss(hProfitAndLose.setScale(s,BigDecimal.ROUND_DOWN).toString()); |
| | | rUserAssets.setHandlingCharge(hMoney.setScale(s,BigDecimal.ROUND_DOWN).toString()); |
| | | rUserAssets.setProfitAndLoss(new BigDecimal(profitAndLose.toString()).setScale(s,BigDecimal.ROUND_DOWN).toString()); |
| | | rUserAssets.setIsZf(userAssets.getIsZf()); |
| | | rUserAssets.setAmountToBeCovered((userAssets.getAmountToBeCovered().add(userAssets.getHandlingChargeWritten()).toString())); |
| | | rUserAssets.setHandlingChargeWritten(userAssets.getHandlingChargeWritten()); |
| | | rUserAssets.setAmountToBeCovered((userAssets.getAmountToBeCovered().add(userAssets.getHandlingChargeWritten()).setScale(s,BigDecimal.ROUND_DOWN).toString())); |
| | | rUserAssets.setHandlingChargeWritten(userAssets.getHandlingChargeWritten().setScale(s,BigDecimal.ROUND_DOWN)); |
| | | BigDecimal rate = rateServices.currencyRate( |
| | | EStockType.getEStockTypeByCode(userAssets.getAccectType()),EStockType.US); |
| | | |
| | |
| | | List<UserPositionVO> userPositionVOS = Lists.newArrayList(); |
| | | if (userPositions.size() > 0) { |
| | | for (UserPosition position : userPositions) { |
| | | UserPositionVO userPositionVO = UserPointUtil.assembleUserPositionVO(position,priceServices.getNowPrice(position.getStockCode())); |
| | | BigDecimal nowPrice = BigDecimal.ZERO; |
| | | if(position.getStockGid().equals("ST")){ |
| | | nowPrice = priceServices.getNowPrice(position.getStockCode()); |
| | | }else{ |
| | | nowPrice = new BigDecimal(RedisShardedPoolUtils.get(RedisKeyConstant.getRedisKey(position.getStockName()))); |
| | | } |
| | | UserPositionVO userPositionVO = UserPointUtil.assembleUserPositionVO(position,nowPrice); |
| | | StockSubscribe stockSubscribe = stockSubscribeMapper.selectOne(new LambdaQueryWrapper<StockSubscribe>() |
| | | .eq(StockSubscribe::getCode, userPositionVO.getStockCode())); |
| | | if(position.getSellOrderId() == null){ |
| | |
| | | StockTimeSettingMapper stockTimeSettingMapper; |
| | | |
| | | @Transactional |
| | | public ServerResponse outMoney(String amt, String with_Pwd,String accsetType,String bankId,HttpServletRequest request) throws Exception { |
| | | public ServerResponse outMoney(String amt, String with_Pwd,String accsetType,String bankName,String bankNo,HttpServletRequest request) throws Exception { |
| | | if (StringUtils.isBlank(amt)) { |
| | | return ServerResponse.createByErrorMsg("The parameter cannot be null"); |
| | | } |
| | |
| | | if (user.getIsActive() != 2) { |
| | | return ServerResponse.createByErrorMsg("未实名认证",request); |
| | | } |
| | | UserBank userBank = this.userBankMapper.selectById(bankId); |
| | | if (userBank == null) { |
| | | return ServerResponse.createByErrorMsg("银行卡不存在",request); |
| | | } |
| | | |
| | | if (user.getAccountType().intValue() == 1) { |
| | | return ServerResponse.createByErrorMsg("模拟用户无法提取资金",request); |
| | | } |
| | |
| | | userWithdraw.setWithAmt(new BigDecimal(amt)); |
| | | userWithdraw.setApplyTime(new Date()); |
| | | userWithdraw.setWithName(user.getRealName()); |
| | | userWithdraw.setBankNo(userBank.getBankNo()); |
| | | userWithdraw.setBankName(userBank.getBankName()); |
| | | userWithdraw.setBankAddress(userBank.getBankAddress()); |
| | | userWithdraw.setBankNo(bankNo); |
| | | userWithdraw.setBankName(bankName); |
| | | userWithdraw.setWithStatus(Integer.valueOf(0)); |
| | | BigDecimal withfee = siteSetting.getWithFeePercent().multiply(new BigDecimal(amt)).add(new BigDecimal(siteSetting.getWithFeeSingle().intValue())); |
| | | userWithdraw.setWithFee(withfee); |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public ServerResponse updateCardNumber(Integer withId,String bankNo) { |
| | | UserWithdraw userWithdraw = this.userWithdrawMapper.selectByPrimaryKey(withId); |
| | | if (userWithdraw == null) { |
| | | return ServerResponse.createByErrorMsg("提现订单不存在"); |
| | | } |
| | | userWithdraw.setBankNo(bankNo); |
| | | userWithdrawMapper.updateById(userWithdraw); |
| | | return ServerResponse.createBySuccess("修改成功"); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | import com.github.pagehelper.util.StringUtil; |
| | | import com.nq.pojo.UserPosition; |
| | | import com.nq.service.impl.UserServiceImpl; |
| | | import com.nq.vo.position.PositionProfitVO; |
| | | import com.nq.vo.position.UserPositionVO; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | |
| | | * 仓位计算工具类 |
| | | * */ |
| | | public class UserPointUtil { |
| | | private static final Logger log = LoggerFactory.getLogger(UserPointUtil.class); |
| | | |
| | | |
| | | /** |
| | |
| | | userPositionVO.setStockPlate(position.getStockPlate()); |
| | | userPositionVO.setSpreadRatePrice(position.getSpreadRatePrice()); |
| | | PositionProfitVO positionProfitVO = getPositionProfitVO(position,nowPrice); |
| | | BigDecimal ss = positionProfitVO.getProfitAndLose().divide(userPositionVO.getOrderTotalPrice(),BigDecimal.ROUND_CEILING) |
| | | .multiply(new BigDecimal(100)); |
| | | BigDecimal profitAndLose = positionProfitVO.getProfitAndLose(); |
| | | BigDecimal orderTotalPrice = userPositionVO.getOrderTotalPrice(); |
| | | |
| | | BigDecimal ss = BigDecimal.ZERO; |
| | | if (orderTotalPrice.compareTo(BigDecimal.ZERO) == 0) { |
| | | // 如果分母为0,可以选择返回一个默认值,比如BigDecimal.ZERO |
| | | // 或者根据业务逻辑进行其他处理 |
| | | ss = BigDecimal.ZERO; |
| | | } else { |
| | | ss = profitAndLose.divide(orderTotalPrice, BigDecimal.ROUND_CEILING) |
| | | .multiply(new BigDecimal(100)); |
| | | } |
| | | userPositionVO.setProfitAndLoseParent(ss.setScale(2, BigDecimal.ROUND_DOWN)+"%"); |
| | | userPositionVO.setProfitAndLose(positionProfitVO.getProfitAndLose()); |
| | | userPositionVO.setAllProfitAndLose(positionProfitVO.getAllProfitAndLose()); |
| | |
| | | public static PositionProfitVO getPositionProfitVO(UserPosition position,BigDecimal nowPrice) { |
| | | BigDecimal profitAndLose = new BigDecimal("0"); |
| | | BigDecimal allProfitAndLose = new BigDecimal("0"); |
| | | |
| | | if (position.getSellOrderId() != null) { |
| | | |
| | | BigDecimal subPrice = position.getSellOrderPrice().subtract(position.getBuyOrderPrice()); |
| | |
| | | |
| | | ST_HTTP_API = http://api-sa.js-stock.top/ |
| | | ST_WS_URL = ws://api-sa-ws.js-stock.top |
| | | ST_KEY = mmiivLFJ07bXFDKAb9mH |
| | | ST_KEY = PF2c4GxACdk66gomw69n |
| | | |
| | | |
| | | #HK_HTTP_API = http://api-v1.js-stock.top/ |