| | |
| | | @RequestMapping("getStockAiList.do") |
| | | @ResponseBody |
| | | public ServerResponse getStockAiList(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum, |
| | | @RequestParam(value = "pageSize", defaultValue = "5") int pageSize) { |
| | | return stockAiService.getStockAiList(pageNum, pageSize); |
| | | @RequestParam(value = "pageSize", defaultValue = "5") int pageSize, |
| | | @RequestParam(value = "stockName") String stockName) { |
| | | return stockAiService.getStockAiList(pageNum, pageSize, stockName); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.nq.enums.EStockType; |
| | | import com.nq.pojo.ExchangeRate; |
| | | import com.nq.service.ExchangeRateService; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | |
| | | if (model == null) { |
| | | return ServerResponse.createByErrorMsg("editRate model is null"); |
| | | } |
| | | if (model.getRata() == null || model.getCurrency().isEmpty() || model.getConversionCurrency().isEmpty()) { |
| | | if (model.getRata() == null || StringUtils.isBlank(model.getCurrency()) || StringUtils.isBlank(model.getConversionCurrency())) { |
| | | return ServerResponse.createByErrorMsg("请输入货币和汇率参数不能为空"); |
| | | } |
| | | if (model.getCurrency().equals(model.getConversionCurrency())) { |
| | |
| | | import com.nq.pojo.StockAIOrderPosition; |
| | | import com.nq.service.IStockAiService; |
| | | import com.nq.service.IStockService; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | if (id == null) { |
| | | return ServerResponse.createByErrorMsg("id is null"); |
| | | } |
| | | if (status.isEmpty()) { |
| | | if (StringUtils.isBlank(status)) { |
| | | return ServerResponse.createByErrorMsg("status is null"); |
| | | } |
| | | return stockAiService.orderOperation(id, status); |
| | |
| | | return ServerResponse.createBySuccess(iEchoServices.queryList()); |
| | | } |
| | | |
| | | @PostMapping("queryEchoPage.do") |
| | | @ResponseBody |
| | | public ServerResponse queryEchoPage(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum, |
| | | @RequestParam(value = "pageSize", defaultValue = "5") int pageSize, |
| | | HttpServletRequest request) { |
| | | return iEchoServices.queryListPage(pageNum, pageSize); |
| | | } |
| | | |
| | | |
| | | @PostMapping("buyEcho.do") |
| | | @ResponseBody |
| | |
| | | |
| | | public List<EChoBean> queryList(); |
| | | |
| | | ServerResponse queryListPage(int pageNum, int pageSize); |
| | | |
| | | |
| | | boolean buyECho(String eId, BigDecimal money, String accectType, HttpServletRequest request); |
| | | |
| | |
| | | |
| | | public interface IStockAiService { |
| | | |
| | | ServerResponse getStockAiList(Integer pageNum, Integer pageSize); |
| | | ServerResponse getStockAiList(Integer pageNum, Integer pageSize, String stockName); |
| | | |
| | | ServerResponse buyStockAi(Long id, BigDecimal buyNum, HttpServletRequest request); |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ServerResponse queryListPage(int pageNum, int pageSize) { |
| | | try { |
| | | PageHelper.startPage(pageNum, pageSize); |
| | | List<EChoBean> eChoBeans = eChoMapper.selectList(null); |
| | | PageInfo<EChoBean> pageInfo = new PageInfo<>(eChoBeans); |
| | | return ServerResponse.createBySuccess(pageInfo); |
| | | } catch (Exception ex) { |
| | | log.error("echoService queryListPage error", ex); |
| | | } |
| | | return ServerResponse.createByError(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean buyECho(String eId, BigDecimal money, String accectType, HttpServletRequest request) { |
| | | |
| | | User user = this.iUserService.getCurrentRefreshUser(request); |
| | |
| | | import com.nq.vo.stock.ai.StockAiOrderTypeVO; |
| | | import com.nq.vo.stock.ai.StockAiOrderVO; |
| | | import com.nq.vo.stock.ai.StockAiVO; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ServerResponse getStockAiList(Integer pageNum, Integer pageSize) { |
| | | public ServerResponse getStockAiList(Integer pageNum, Integer pageSize, String stockName) { |
| | | try { |
| | | PageHelper.startPage(pageNum, pageSize); |
| | | List<StockAI> stockAiList = stockAiMapper.selectList(new QueryWrapper<StockAI>() |
| | | .eq("status", EStockAIStatus.online.getValue())); |
| | | .eq("status", EStockAIStatus.online.getValue()) |
| | | .eq(StringUtils.isNotBlank(stockName),"stock_name", stockName)); |
| | | // 获取分页信息 |
| | | PageInfo<StockAI> pageInfo = new PageInfo<>(stockAiList); |
| | | return ServerResponse.createBySuccess(pageInfo); |
| | |
| | | if (model == null) { |
| | | return ServerResponse.createByErrorMsg("editStockAi model is null"); |
| | | } |
| | | if (model.getStockType().isEmpty() || model.getStockName().isEmpty() || model.getMinPrice() == null |
| | | || model.getSuccessRate() == null || model.getExpectedEarning() == null || model.getStatus().isEmpty()) { |
| | | if (StringUtils.isBlank(model.getStockType()) || StringUtils.isBlank(model.getStockName()) || model.getMinPrice() == null |
| | | || model.getSuccessRate() == null || model.getExpectedEarning() == null || StringUtils.isBlank(model.getStatus())) { |
| | | return ServerResponse.createByErrorMsg("请完善必填信息"); |
| | | } |
| | | if (!model.getStockType().equals(EStockType.US.getCode()) && !model.getStockType().equals(EStockType.MX.getCode())) { |