| | |
| | | .eq(UserAssets::getUserId, userPosition.getUserId()) |
| | | .eq(UserAssets::getAccectType, "IN") |
| | | ); |
| | | if(userAssets.getAmountToBeCovered().compareTo(BigDecimal.ZERO) > 0){ |
| | | Long count = userStockSubscribeMapper.selectCount(new LambdaQueryWrapper<>(UserStockSubscribe.class).eq(UserStockSubscribe::getNewCode, userPosition.getStockCode())); |
| | | if(count > 0 && userAssets.getAmountToBeCovered().compareTo(BigDecimal.ZERO) > 0){ |
| | | return ServerResponse.createByErrorMsg("请先缴清待补资金", request); |
| | | } |
| | | Boolean b = tradingHourService.timeCheck(userPosition.getStockCode()); |
| | |
| | | return ServerResponse.createByErrorMsg("订单失败,不在交易时间之内", request); |
| | | } |
| | | if(userPosition.getPositionType() == 3){ |
| | | StockDz stockDz = stockDzMapper.selectOne(new LambdaQueryWrapper<StockDz>().eq(StockDz::getStockCode, userPosition.getStockCode())); |
| | | StockDz stockDz = stockDzMapper.selectOne(new LambdaQueryWrapper<StockDz>().eq(StockDz::getId, userPosition.getDzId())); |
| | | LocalDateTime buyOrderLocalDateTime = LocalDateTime.ofInstant(userPosition.getBuyOrderTime().toInstant(), ZoneId.systemDefault()); |
| | | // 计算天数差 |
| | | long daysBetween = ChronoUnit.DAYS.between(buyOrderLocalDateTime, LocalDateTime.now()); |
| | |
| | | end_time = DateTimeUtil.searchStrToTimestamp(endTime); |
| | | } |
| | | |
| | | PageHelper.startPage(pageNum, pageSize); |
| | | |
| | | |
| | | |
| | | List<Integer> ids = new ArrayList<>(); |
| | |
| | | ids = getSubordinates(searchId); |
| | | ids.add(searchId); |
| | | } |
| | | |
| | | PageHelper.startPage(pageNum, pageSize); |
| | | List<UserPosition> userPositions = this.userPositionMapper.listByAgent(positionType, state, |
| | | userId, ids, positionSn, begin_time, end_time,null); |
| | | |
| | |
| | | |
| | | private AgentPositionVO assembleAgentPositionVO(UserPosition position) { |
| | | AgentPositionVO agentPositionVO = new AgentPositionVO(); |
| | | |
| | | User user = userMapper.selectById(position.getUserId()); |
| | | if(null != user){ |
| | | AgentUser agentUser = agentUserMapper.selectById(user.getAgentId()); |
| | | agentPositionVO.setPhone(user.getPhone()); |
| | | if(null != agentUser){ |
| | | agentPositionVO.setAgentName(agentUser.getAgentName()); |
| | | } |
| | | } |
| | | agentPositionVO.setId(position.getId()); |
| | | agentPositionVO.setPositionSn(position.getPositionSn()); |
| | | agentPositionVO.setPositionType(position.getPositionType()); |
| | |
| | | |
| | | //判断审核开关 |
| | | if(stockDz.getSwitchType() == 1){ |
| | | UserPosition userPosition = getUserPosition(num, user, stockDz, nowPrice, stock, buyAmt); |
| | | UserPosition userPosition = getUserPosition(dzId,num, user, stockDz, nowPrice, stock, buyAmt); |
| | | UserPositionCheckDz userPositionCheckDz = Convert.convert(UserPositionCheckDz.class, userPosition); |
| | | userPositionCheckDz.setDzId(dzId); |
| | | userPositionCheckDzService.save(userPositionCheckDz); |
| | |
| | | } |
| | | |
| | | // 创建UserPosition对象 |
| | | UserPosition userPosition = getUserPosition(num, user, stockDz, nowPrice, stock, buyAmt); |
| | | UserPosition userPosition = getUserPosition(dzId,num, user, stockDz, nowPrice, stock, buyAmt); |
| | | userPositionMapper.insert(userPosition); |
| | | userAssetsServices.availablebalanceChange(EStockType.IN.getCode(), user.getId(), EUserAssets.BUY, buyAmt.negate(),"",""); |
| | | return ServerResponse.createBySuccess("购买成功", request); |
| | | } |
| | | |
| | | private UserPosition getUserPosition(Integer num, User user, StockDz stockDz, BigDecimal nowPrice, Stock stock, BigDecimal buyAmt) { |
| | | private UserPosition getUserPosition(Integer dzId,Integer num, User user, StockDz stockDz, BigDecimal nowPrice, Stock stock, BigDecimal buyAmt) { |
| | | UserPosition userPosition = new UserPosition(); |
| | | userPosition.setPositionType(3); |
| | | userPosition.setPositionSn(KeyUtils.getUniqueKey()); |
| | |
| | | userPosition.setOrderStayDays(Integer.valueOf(0)); |
| | | userPosition.setOrderStayFee(new BigDecimal("0")); |
| | | userPosition.setOrderSpread(BigDecimal.ZERO); |
| | | userPosition.setDzId(dzId); |
| | | return userPosition; |
| | | } |
| | | |