| | |
| | | |
| | | import java.util.Optional; |
| | | |
| | | public interface ExchangeRateRepository extends JpaRepository<ExchangeRate, Long> { |
| | | public interface ExchangeRateRepository extends JpaRepository<ExchangeRate, Integer> { |
| | | |
| | | Optional<ExchangeRate> findExchangeRateByCurrencyAndConversionCurrency(String currency, String conversionCurrency); |
| | | |
| | |
| | | @ResponseBody |
| | | public ServerResponse getStockAiOrderList(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum, |
| | | @RequestParam(value = "pageSize", defaultValue = "5") int pageSize, |
| | | @RequestParam(value = "stockType") String stockType, |
| | | @RequestParam(value = "status") String status, |
| | | @RequestParam(value = "userId") Integer userId, |
| | | @RequestParam(value = "phone") String phone) { |
| | | @RequestParam(value = "stockType", required = false) String stockType, |
| | | @RequestParam(value = "status", required = false) String status, |
| | | @RequestParam(value = "userId", required = false) Integer userId, |
| | | @RequestParam(value = "phone", required = false) String phone) { |
| | | return stockAiService.getAdminStockAiOrderList(pageNum, pageSize, stockType, status, userId, phone); |
| | | } |
| | | |
| | |
| | | BUY_HANDLING_CHARGE("BUY_HANDLING_CHARGE","买入手续费"), |
| | | SELL_HANDLING_CHARGE("SELL_HANDLING_CHARGE","平仓手续费"), |
| | | LIMIT_DOWN_IS_SELL("limit_down_is_sell","跌停是否可以平仓"), |
| | | AGENT_MAX_GRADE("agent_max_grade","最大代理等级"); |
| | | AGENT_MAX_GRADE("agent_max_grade","最大代理等级"), |
| | | |
| | | INDICES("indices","指数数据"); |
| | | |
| | | private String code; |
| | | private String desc; |
| | |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | private Long id; |
| | | private Integer id; |
| | | /** |
| | | * 汇率 |
| | | */ |
| | |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | private Long id; |
| | | private Integer id; |
| | | |
| | | //股票类型 |
| | | private String stockType; |
| | |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | private Long id; |
| | | private Integer id; |
| | | |
| | | //用户id |
| | | private Integer userId; |
| | |
| | | private BigDecimal realEarning; |
| | | |
| | | /** |
| | | * 状态 待审核 申请通过 申请通过 已完成 |
| | | * 状态 待审核 申请通过 申请不通过 已完成 |
| | | */ |
| | | private String status; |
| | | |
| | |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | private Long id; |
| | | private Integer id; |
| | | |
| | | //ai交易产品订单id |
| | | private Long stockAiOrderId; |
| | |
| | | IUserService iUserService; |
| | | @Autowired |
| | | IUserAssetsServices iUserAssetsServices; |
| | | @Autowired |
| | | ExchangeRateRepository exchangeRateRepository; |
| | | |
| | | /** |
| | | * 获取上架ai产品 |
| | |
| | | |
| | | if (!pageInfo.getList().isEmpty()) { |
| | | List<StockAiVO> newStockAiList = pageInfo.getList(); |
| | | newStockAiList.forEach(stockAiVO -> { |
| | | pageInfo.getList().forEach(stockAiVO -> { |
| | | EStockType eStockType = EStockType.getEStockTypeByCode(stockAiVO.getStockType()); |
| | | stockAiVO.setStockTypeName(eStockType.getSymbol1()); |
| | | stockAiVO.setSymbol(stockType); |
| | | }); |
| | | pageInfo.setList(newStockAiList); |
| | | } |
| | | |
| | | |
| | | return ServerResponse.createBySuccess(pageInfo); |
| | | } catch (Exception ex) { |
| | | log.error("StockAiService getAdminStockAiList error", ex); |
| | |
| | | userPosition.setOrderStayDays(Integer.valueOf(0)); |
| | | userPosition.setOrderStayFee(BigDecimal.ZERO); |
| | | userPositionMapper.insert(userPosition); |
| | | iUserAssetsServices.availablebalanceChange(EStockType.MX.getCode(), user.getId(), EUserAssets.BUY, buyAmt.negate(), "", ""); |
| | | iUserAssetsServices.availablebalanceChange(EStockType.MX.getCode(), user.getId(), EUserAssets.HANDLING_CHARGE, orderFree, "", ""); |
| | | iUserAssetsServices.availablebalanceChange(stock.getStockType(), user.getId(), EUserAssets.BUY, buyAmt.negate(), "", ""); |
| | | iUserAssetsServices.availablebalanceChange(stock.getStockType(), user.getId(), EUserAssets.HANDLING_CHARGE, orderFree, "", ""); |
| | | return ServerResponse.createBySuccessMsg("下单成功", request); |
| | | } |
| | | } |
| | |
| | | UserStockSubscribe userStockSubscribe = Convert.convert(UserStockSubscribe.class, model); |
| | | userStockSubscribe.setNewStockId(stockSubscribe.getNewlistId()); |
| | | ret = userStockSubscribeMapper.insert(userStockSubscribe); |
| | | iUserAssetsServices.availablebalanceChange(EStockType.US.getCode(), user.getId(),EUserAssets.BUY,bound.negate(),"",""); |
| | | iUserAssetsServices.availablebalanceChange(stockSubscribe.getStockType(), user.getId(),EUserAssets.BUY,bound.negate(),"",""); |
| | | if (ret > 0) { |
| | | return ServerResponse.createBySuccessMsg("配售成功",request); |
| | | } else { |
| | |
| | | } |
| | | BigDecimal cCount = new BigDecimal(model.getApplyNums()-model.getApplyNumber()); |
| | | BigDecimal tMoney = ((stockSubscribe.getMinPrice() != null ? stockSubscribe.getMinPrice() : stockSubscribe.getPrice())).multiply(cCount); |
| | | iUserAssetsServices.availablebalanceChange(EStockType.US.getCode(),userStockSubscribe.getUserId(), |
| | | iUserAssetsServices.availablebalanceChange(stockSubscribe.getStockType(),userStockSubscribe.getUserId(), |
| | | EUserAssets.TOP_UP,tMoney,"",""); |
| | | model.setBond((stockSubscribe.getMinPrice() != null ? stockSubscribe.getMinPrice() : stockSubscribe.getPrice()).multiply(BigDecimal.valueOf(model.getApplyNumber()))); |
| | | model.setDbMoney(BigDecimal.ZERO); |
| | |
| | | return ServerResponse.createByErrorMsg("未中签,无需支付",request); |
| | | } |
| | | if (userStockSubscribe.getStatus() == 3) { |
| | | StockSubscribe stockSubscribe = stockSubscribeMapper.selectOne(new QueryWrapper<>(new StockSubscribe()) |
| | | .eq("newlist_id", userStockSubscribe.getNewStockId())); |
| | | if (stockSubscribe == null) { |
| | | return ServerResponse.createByErrorMsg("新股不存在",request); |
| | | } |
| | | userStockSubscribe.setSubmitTime(DateTimeUtil.getCurrentDate()); |
| | | userStockSubscribe.setStatus(4); |
| | | BigDecimal bigDecimal = iUserAssetsServices. |
| | |
| | | if(bigDecimal.compareTo(multiply) <= 0){ |
| | | return ServerResponse.createByErrorMsg("余额不足",request); |
| | | } |
| | | iUserAssetsServices.availablebalanceChange(EStockType.US.getCode(),userStockSubscribe.getUserId(), |
| | | iUserAssetsServices.availablebalanceChange(stockSubscribe.getStockType(), userStockSubscribe.getUserId(), |
| | | EUserAssets.BUY,multiply.negate(),"",""); |
| | | userStockSubscribe.setDbMoney(BigDecimal.ZERO); |
| | | userStockSubscribeMapper.update1(userStockSubscribe); |
| | |
| | | import com.nq.Repository.StockRepository; |
| | | import com.nq.dao.StockMapper; |
| | | import com.nq.dao.UserPositionMapper; |
| | | import com.nq.enums.EConfigKey; |
| | | import com.nq.enums.EStockType; |
| | | import com.nq.pojo.*; |
| | | import com.nq.service.ExchangeRateService; |
| | |
| | | stock.setStockCode(o.getId()); |
| | | stock.setStockName(o.getName()); |
| | | stock.setStockType(eStockType.getCode()); |
| | | if (o.getType() == null) { |
| | | stock.setStockGid(eStockType.getCode()); |
| | | } else { |
| | | stock.setStockGid(o.getType()); |
| | | } |
| | | //指数数据类型 |
| | | stock.setStockGid(EConfigKey.INDICES.getCode()); |
| | | stock.setStockSpell(o.getSymbol()); |
| | | stock.setIsLock(0); |
| | | stock.setIsShow(0); |
| | |
| | | <include refid="Base_Column_List"/> |
| | | FROM stock |
| | | |
| | | where stock_spell not like '%.st%' |
| | | where stock_spell not like '%.st%' and stock_gid !='indices' |
| | | <if test="stockType != null and stockType != '' "> |
| | | and stock_type = #{stockType} |
| | | </if> |