From 5a8a43d5edb7af016b76246d9e9f661f4363342e Mon Sep 17 00:00:00 2001
From: jack <zengjieli93@163.com>
Date: Thu, 18 Apr 2024 11:13:24 +0800
Subject: [PATCH] 修改自选BUG 汇率
---
src/main/java/com/nq/dao/StockTimeSettingMapper.java | 7
src/main/java/com/nq/ws/HKWebsocketRunClient.java | 51 +
src/main/java/com/nq/utils/http/HttpRequest.java | 3
src/main/java/com/nq/service/IRateServices.java | 11
src/main/java/com/nq/utils/timeutil/TimeUtil.java | 43
src/main/java/com/nq/utils/translate/GoogleTranslateUtil.java | 2
src/main/java/com/nq/service/impl/UserServiceImpl.java | 348 ++-----
src/main/java/com/nq/service/impl/StockTimeSettingServicesImpl.java | 32
src/main/java/com/nq/service/IStockTimeSettingServices.java | 13
src/main/resources/application.properties | 21
target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst | 48 -
src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java | 53
src/main/java/com/nq/utils/UserPointUtil.java | 91 ++
src/main/java/com/nq/service/impl/RateServicesImpl.java | 49 +
src/main/java/com/nq/vo/position/UserPositionVO.java | 450 ---------
src/main/java/com/nq/service/impl/TradingHourServiceImpl.java | 44
src/main/java/com/nq/service/impl/StockServiceImpl.java | 71 -
src/main/java/com/nq/dao/StockSettingMapper.java | 7
src/main/java/com/nq/controller/backend/AdminStockTimeSettingController.java | 42
src/main/java/com/nq/controller/protol/UserController.java | 96 -
src/main/java/com/nq/utils/task/news/NewsTask.java | 2
src/main/java/com/nq/ws/WebSocketClientBeanConfig.java | 23
src/main/java/com/nq/service/impl/SiteNewsServiceImpl.java | 14
src/main/java/com/nq/controller/backend/AdminController.java | 2
src/main/java/com/nq/service/impl/UserStockSubscribeServiceImpl.java | 100 -
target/classes/application.properties | 21
src/main/java/com/nq/controller/StockApiController.java | 68 -
src/main/java/com/nq/utils/task/stock/StockTask.java | 69 -
src/main/java/com/nq/service/impl/UserPositionServiceImpl.java | 426 +++------
src/main/java/com/nq/service/IUserPositionService.java | 12
src/main/java/com/nq/pojo/StockTimeSetting.java | 23
src/main/java/com/nq/service/impl/UserBankServiceImpl.java | 30
src/main/java/com/nq/common/ServerResponse.java | 20
src/main/java/com/nq/service/impl/UserRechargeServiceImpl.java | 19
src/main/java/com/nq/service/IPriceServices.java | 8
src/main/java/com/nq/controller/UserApiController.java | 5
src/main/java/com/nq/service/ITradingHourService.java | 7
src/main/java/com/nq/service/impl/PriceServicesImpl.java | 48 +
target/stock-0.0.1-SNAPSHOT.jar.original | 0
src/main/java/com/nq/pojo/MoneyLog.java | 2
src/main/resources/mapper/UserRechargeMapper.xml | 7
src/main/java/com/nq/utils/task/YEBTask.java | 2
src/main/java/com/nq/controller/agent/AgentController.java | 8
src/main/java/com/nq/enums/EStockType.java | 49
src/main/java/com/nq/service/impl/UserAssetsServices.java | 19
src/main/java/com/nq/controller/protol/UserWithdrawController.java | 2
src/main/java/com/nq/controller/backend/AdminStockSettingController.java | 50 +
src/main/java/com/nq/pojo/StockSetting.java | 23
src/main/java/com/nq/service/IStockSettingServices.java | 17
src/main/java/com/nq/controller/protol/UserPositionController.java | 7
/dev/null | 5
src/main/java/com/nq/pojo/reponse/RPageInfo.java | 20
target/classes/application.yml | 3
src/main/java/com/nq/service/impl/SiteSettingServiceImpl.java | 10
src/main/java/com/nq/service/impl/StockOptionServiceImpl.java | 9
src/main/java/com/nq/service/impl/StockSettingServicesImpl.java | 68 +
target/classes/mapper/UserRechargeMapper.xml | 7
src/main/java/com/nq/pojo/UserRecharge.java | 8
src/main/resources/application.yml | 3
59 files changed, 1,212 insertions(+), 1,486 deletions(-)
diff --git a/src/main/java/com/nq/common/ServerResponse.java b/src/main/java/com/nq/common/ServerResponse.java
index f489723..208c7ac 100644
--- a/src/main/java/com/nq/common/ServerResponse.java
+++ b/src/main/java/com/nq/common/ServerResponse.java
@@ -1,8 +1,11 @@
package com.nq.common;
+import com.nq.utils.http.HttpClientRequest;
+import com.nq.utils.translate.GoogleTranslateUtil;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.map.annotate.JsonSerialize;
+import javax.servlet.http.HttpServletRequest;
import java.io.Serializable;
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@@ -10,6 +13,9 @@
private int status;
private String msg;
private T data;
+
+
+ private static String LANG = "lang";
private ServerResponse(int status) {
this.status = status;
@@ -66,8 +72,18 @@
return new ServerResponse(ResponseCode.SUCCESS.getCode(), msg);
}
+
+ public static <T> ServerResponse<T> createBySuccessMsg(String msg,HttpServletRequest request) {
+ return new ServerResponse(ResponseCode.SUCCESS.getCode(), new GoogleTranslateUtil().translate(msg,request.getHeader(LANG)));
+ }
+
public static <T> ServerResponse<T> createBySuccess(T data) {
return new ServerResponse(ResponseCode.SUCCESS.getCode(), data);
+ }
+
+
+ public static <T> ServerResponse<T> createBySuccess(String data,HttpServletRequest request) {
+ return new ServerResponse(ResponseCode.SUCCESS.getCode(), new GoogleTranslateUtil().translate(data,request.getHeader(LANG)));
}
public static <T> ServerResponse<T> createBySuccess(String msg, T data) {
@@ -86,6 +102,10 @@
public static <T> ServerResponse<T> createByErrorMsg(String errormsg) {
return new ServerResponse(ResponseCode.ERROR.getCode(), errormsg);
}
+ public static <T> ServerResponse<T> createByErrorMsg(String errormsg, HttpServletRequest request) {
+ return new ServerResponse(ResponseCode.ERROR.getCode(), new GoogleTranslateUtil().translate(errormsg,request.getHeader(LANG)));
+ }
+
public static <T> ServerResponse<T> createByErrorCodeMsg(int errorcode, String errormsg) {
return new ServerResponse(errorcode, errormsg);
diff --git a/src/main/java/com/nq/controller/PayController.java b/src/main/java/com/nq/controller/PayController.java
deleted file mode 100644
index a4cab88..0000000
--- a/src/main/java/com/nq/controller/PayController.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.nq.controller;
-
-import org.springframework.stereotype.Controller;
-
-@Controller
-public class PayController {
-}
diff --git a/src/main/java/com/nq/controller/StockApiController.java b/src/main/java/com/nq/controller/StockApiController.java
index 775b006..28f0db9 100644
--- a/src/main/java/com/nq/controller/StockApiController.java
+++ b/src/main/java/com/nq/controller/StockApiController.java
@@ -67,25 +67,8 @@
public ServerResponse getSingleStock(@RequestParam("code") String code, HttpServletRequest request) {
return this.iStockService.getSingleStock(code, request);
}
- //美股股票代码查询股票信息
- @RequestMapping({"getSingleStockByCode.do"})
- @ResponseBody
- public ServerResponse getSingleStockByCode(@RequestParam("code") String code) {
- return this.iStockService.getSingleStockByCode(code);
- }
- @RequestMapping({"getMinK.do"})
- @ResponseBody
- public ServerResponse getMinK(@RequestParam("code") String code, @RequestParam("time") Integer time, @RequestParam("ma") Integer ma, @RequestParam("size") Integer size) {
- return this.iStockService.getMinK(code, time, ma, size);
- }
- /*查询股票日线*/
- @RequestMapping({"getDayK.do"})
- @ResponseBody
- public ServerResponse getDayK(@RequestParam("code") String code) {
- return this.iStockService.getDayK_Echarts(code);
- }
/*查询股票日线*/
@RequestMapping({"getKData.do"})
@ResponseBody
@@ -99,57 +82,6 @@
- //查询股票历史数据数据
- @RequestMapping({"getMinK_Echarts.do"})
- @ResponseBody
- public ServerResponse getMinK_Echarts(@RequestParam("code") String code, @RequestParam("time") Integer time, @RequestParam("ma") Integer ma, @RequestParam("size") Integer size) {
- return this.iStockService.getMinK_Echarts(code, time, ma, size);
- }
-
- /*期货分时-k线*/
- @RequestMapping({"getFuturesMinK_Echarts.do"})
- @ResponseBody
- public ServerResponse getFuturesMinK_Echarts(@RequestParam("code") String code, @RequestParam("time") Integer time, @RequestParam("size") Integer size) {
- return this.iStockService.getFuturesMinK_Echarts(code, time, size);
- }
-
- /*指数分时-k线*/
- @RequestMapping({"getIndexMinK_Echarts.do"})
- @ResponseBody
- public ServerResponse getIndexMinK_Echarts(@RequestParam("code") String code, @RequestParam("time") Integer time, @RequestParam("size") Integer size) {
- return this.iStockService.getIndexMinK_Echarts(code, time, size);
- }
-
- /*查询期货日线*/
- @RequestMapping({"getFuturesDayK.do"})
- @ResponseBody
- public ServerResponse getFuturesDayK(@RequestParam("code") String code) {
- return this.iStockService.getFuturesDayK(code);
- }
-
- /*指数日线*/
- @RequestMapping({"getIndexDayK.do"})
- @ResponseBody
- public ServerResponse getIndexDayK(@RequestParam("code") String code) {
- return this.iStockService.getIndexDayK(code);
- }
-
- /* 股票日线*/
- @RequestMapping({"getStockDayK.do"})
- @ResponseBody
- public ServerResponse getStockDayK(@RequestParam("code") String code) {
- return this.iStockService.getStockDayK(code);
- }
-
-
-
-
-// //查询股票需要换数据源的股票
-// @RequestMapping({"stockDataBase.do"})
-// @ResponseBody
-// public ServerResponse stockDataBase() {
-// return this.iStockService.stockDataBase();
-// }
/**
*大宗交易 列表
diff --git a/src/main/java/com/nq/controller/StockFuturesApiController.java b/src/main/java/com/nq/controller/StockFuturesApiController.java
deleted file mode 100644
index 4755acf..0000000
--- a/src/main/java/com/nq/controller/StockFuturesApiController.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package com.nq.controller;
-
-
-import com.nq.common.ServerResponse;
-
-import com.nq.pojo.StockFutures;
-import com.nq.service.IStockFuturesService;
-
-import com.nq.vo.stockfutures.FuturesVO;
-
-import org.slf4j.Logger;
-
-import org.slf4j.LoggerFactory;
-
-import org.springframework.beans.factory.annotation.Autowired;
-
-import org.springframework.stereotype.Controller;
-
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.web.bind.annotation.RequestParam;
-
-import org.springframework.web.bind.annotation.ResponseBody;
-
-import javax.servlet.http.HttpServletRequest;
-
-
-@Controller
-@RequestMapping({"/api/futures/"})
-public class StockFuturesApiController {
-
- private static final Logger log = LoggerFactory.getLogger(StockFuturesApiController.class);
-
- @Autowired
- IStockFuturesService iStockFuturesService;
-
- //查询所有首页显示的期货信息
- @RequestMapping({"queryHome.do"})
- @ResponseBody
- public ServerResponse queryHome() {
- return this.iStockFuturesService.queryHome();
- }
-
-
- //查询所有列表显示的期货信息
- @RequestMapping({"queryList.do"})
- @ResponseBody
- public ServerResponse queryList(HttpServletRequest request) {
- return this.iStockFuturesService.queryList(request);
- }
- //查询是否可交易
- @RequestMapping({"queryTrans.do"})
- @ResponseBody
- public ServerResponse queryTrans(@RequestParam("futuresId") Integer futuresId) {
- return this.iStockFuturesService.queryTrans(futuresId);
- }
-
- //查询汇率
- @RequestMapping({"queryExchange.do"})
- @ResponseBody
- public ServerResponse queryExchange(@RequestParam("coinCode") String coinCode) {
- return this.iStockFuturesService.getExchangeRate(coinCode);
- }
-
- //查询期货详情信息 (开盘价/收盘价/最高/最低等等。。。)
- @RequestMapping({"querySingleMarket.do"})
- @ResponseBody
- public ServerResponse querySingleMarket(@RequestParam("futuresGid") String futuresGid) {
- FuturesVO futuresVO = this.iStockFuturesService.querySingleMarket(futuresGid);
- return ServerResponse.createBySuccess(futuresVO);
- }
-
- //查询期货详情
- @RequestMapping({"queryFuturesByCode.do"})
- @ResponseBody
- public ServerResponse queryFuturesByCode(@RequestParam("futuresCode") String futuresCode) {
- StockFutures stockFutures = this.iStockFuturesService.selectFuturesByCode(futuresCode);
- return ServerResponse.createBySuccess(stockFutures);
- }
-}
diff --git a/src/main/java/com/nq/controller/StockIndexApiController.java b/src/main/java/com/nq/controller/StockIndexApiController.java
deleted file mode 100644
index 81c35ae..0000000
--- a/src/main/java/com/nq/controller/StockIndexApiController.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.nq.controller;
-
-
-import com.nq.common.ServerResponse;
-import com.nq.service.IStockIndexService;
-import com.nq.vo.stock.MarketVO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
-
-@Controller
-@RequestMapping({"/api/index/"})
-public class StockIndexApiController {
- private static final Logger log = LoggerFactory.getLogger(StockIndexApiController.class);
-
- @Autowired
- IStockIndexService iStockIndexService;
-
-
- @RequestMapping({"queryHomeIndex.do"})
- @ResponseBody
- public ServerResponse queryHomeIndex() {
- return this.iStockIndexService.queryHomeIndex();
- }
- //查询指数信息
- @RequestMapping({"queryListIndex.do"})
- @ResponseBody
- public ServerResponse queryListIndex(HttpServletRequest request) {
- return this.iStockIndexService.queryListIndex(request);
- }
- //查询固定指数信息
- @RequestMapping({"queryListIndexByCode.do"})
- @ResponseBody
- public ServerResponse queryListIndexByCode(@RequestParam List<String> code) {
- return this.iStockIndexService.queryListIndexByCode(code);
- }
-
- @RequestMapping({"queryTransIndex.do"})
- @ResponseBody
- public ServerResponse queryTransIndex(@RequestParam("indexId") Integer indexId) {
- return this.iStockIndexService.queryTransIndex(indexId);
- }
-
- @RequestMapping({"querySingleIndex.do"})
- @ResponseBody
- public ServerResponse querySingleIndex(@RequestParam("indexCode") String indexCode) {
- MarketVO marketVO = this.iStockIndexService.querySingleIndex(indexCode);
- return ServerResponse.createBySuccess(marketVO);
- }
- //指数新闻
- @RequestMapping({"queryIndexNews.do"})
- @ResponseBody
- public ServerResponse queryIndexNews() {
- return this.iStockIndexService.queryIndexNews();
- }
-}
diff --git a/src/main/java/com/nq/controller/UserApiController.java b/src/main/java/com/nq/controller/UserApiController.java
index d5bf5ac..8c42607 100644
--- a/src/main/java/com/nq/controller/UserApiController.java
+++ b/src/main/java/com/nq/controller/UserApiController.java
@@ -54,13 +54,12 @@
@Autowired
ISiteSpreadService iSiteSpreadService;
-
//注册
@RequestMapping(value = {"reg.do"}, method = {RequestMethod.POST})
@ResponseBody
public ServerResponse reg(@RequestParam("agentCode") String agentCode, @RequestParam("phone") String phone, @RequestParam(value = "yzmCode", defaultValue = "") String yzmCode, @RequestParam("userPwd") String userPwd, HttpServletRequest httpServletRequest) {
return this.iUserService.reg(yzmCode, agentCode, phone, userPwd, httpServletRequest);
-}
+ }
//登录
@RequestMapping(value = {"login.do"}, method = {RequestMethod.POST})
@@ -76,7 +75,7 @@
UserLoginResultVO resultVO = new UserLoginResultVO();
resultVO.setKey(pc_cookie_name);
resultVO.setToken(token);
- return ServerResponse.createBySuccess("Login Success", resultVO);
+ return ServerResponse.createBySuccess("登录成功", resultVO);
}
return serverResponse;
}
diff --git a/src/main/java/com/nq/controller/agent/AgentController.java b/src/main/java/com/nq/controller/agent/AgentController.java
index cae8335..e77a4ce 100644
--- a/src/main/java/com/nq/controller/agent/AgentController.java
+++ b/src/main/java/com/nq/controller/agent/AgentController.java
@@ -130,4 +130,12 @@
}
return this.iAgentUserService.updateOnlineServices(onLineServices,agentId);
}
+
+
+ @RequestMapping("getMoney.do")
+ @ResponseBody
+ public ServerResponse getMoney(
+ @RequestParam("userId") Integer id){
+ return iUserService.getMoney(id);
+ }
}
diff --git a/src/main/java/com/nq/controller/backend/AdminController.java b/src/main/java/com/nq/controller/backend/AdminController.java
index 7b0d769..0ea5e18 100644
--- a/src/main/java/com/nq/controller/backend/AdminController.java
+++ b/src/main/java/com/nq/controller/backend/AdminController.java
@@ -329,7 +329,7 @@
@RequestMapping("getMoney.do")
@ResponseBody
- public ServerResponse updateayChnnel(
+ public ServerResponse getMoney(
@RequestParam("userId") Integer id){
return iUserService.getMoney(id);
diff --git a/src/main/java/com/nq/controller/backend/AdminStockSettingController.java b/src/main/java/com/nq/controller/backend/AdminStockSettingController.java
new file mode 100644
index 0000000..8e0f269
--- /dev/null
+++ b/src/main/java/com/nq/controller/backend/AdminStockSettingController.java
@@ -0,0 +1,50 @@
+package com.nq.controller.backend;
+
+
+import com.nq.common.ServerResponse;
+import com.nq.pojo.StockSetting;
+import com.nq.service.IStockSettingServices;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.servlet.http.HttpServletRequest;
+
+@Controller
+@RequestMapping({"/admin/stockSetting/"})
+public class AdminStockSettingController {
+
+
+ @Autowired
+ IStockSettingServices stockSettingServices;
+
+
+ @RequestMapping({"add.do"})
+ @ResponseBody
+ public ServerResponse list(HttpServletRequest request, StockSetting stockSetting) {
+ return stockSettingServices.saveStockSetting(stockSetting);
+ }
+
+ @RequestMapping({"update.do"})
+ @ResponseBody
+ public ServerResponse update(HttpServletRequest request, StockSetting stockSetting) {
+ return stockSettingServices.updateStockSetting(stockSetting);
+ }
+
+
+ @RequestMapping({"delete.do"})
+ @ResponseBody
+ public ServerResponse delete(HttpServletRequest request,@RequestParam(value = "id") Integer id) {
+ return stockSettingServices.deleteStockSetting(id);
+ }
+
+
+ @RequestMapping({"queryAll.do"})
+ @ResponseBody
+ public ServerResponse queryAll(HttpServletRequest request,@RequestParam(value = "stockCode", required = false)String stockCode) {
+ return stockSettingServices.queryAll(stockCode);
+ }
+
+}
diff --git a/src/main/java/com/nq/controller/backend/AdminStockTimeSettingController.java b/src/main/java/com/nq/controller/backend/AdminStockTimeSettingController.java
new file mode 100644
index 0000000..3d76fa7
--- /dev/null
+++ b/src/main/java/com/nq/controller/backend/AdminStockTimeSettingController.java
@@ -0,0 +1,42 @@
+package com.nq.controller.backend;
+
+
+import com.nq.common.ServerResponse;
+import com.nq.pojo.StockSetting;
+import com.nq.pojo.StockTimeSetting;
+import com.nq.service.IStockSettingServices;
+import com.nq.service.IStockTimeSettingServices;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.servlet.http.HttpServletRequest;
+
+@Controller
+@RequestMapping({"/admin/stockTimeSetting/"})
+public class AdminStockTimeSettingController {
+
+
+
+ @Autowired
+ IStockTimeSettingServices stockSettingServices;
+
+
+
+
+
+ @RequestMapping({"update.do"})
+ @ResponseBody
+ public ServerResponse update(HttpServletRequest request, StockTimeSetting stockSetting) {
+ return stockSettingServices.updateStockTimeSetting(stockSetting);
+ }
+ @RequestMapping({"queryAll.do"})
+ @ResponseBody
+ public ServerResponse queryAll(HttpServletRequest request) {
+ return stockSettingServices.queryStockTimeSetting();
+ }
+
+
+
+}
diff --git a/src/main/java/com/nq/controller/protol/UserController.java b/src/main/java/com/nq/controller/protol/UserController.java
index 970c355..b2ac108 100644
--- a/src/main/java/com/nq/controller/protol/UserController.java
+++ b/src/main/java/com/nq/controller/protol/UserController.java
@@ -3,6 +3,7 @@
import com.google.common.collect.Maps;
import com.nq.common.ServerResponse;
+import com.nq.enums.EStockType;
import com.nq.pojo.StockSubscribe;
import com.nq.pojo.UserStockSubscribe;
import com.nq.service.*;
@@ -50,6 +51,12 @@
@Autowired
UserPendingorderService userPendingorderService;
+ @Autowired
+ IRateServices rateServices;
+
+ @Autowired
+ IUserRechargeService iUserRechargeService;
+
//添加到自选股
@RequestMapping({"addOption.do"})
@ResponseBody
@@ -93,13 +100,7 @@
@RequestParam("lever") Integer lever,
@RequestParam(value = "profitTarget",required = false)
BigDecimal profitTarget,@RequestParam(value = "stopTarget",required = false) BigDecimal stopTarget, HttpServletRequest request) {
- ServerResponse serverResponse = null;
- try {
- serverResponse = this.iUserPositionService.buy(stockId, buyNum, buyType, lever,profitTarget,stopTarget, request);
- } catch (Exception e) {
- log.error("用户下单操作 = {}", e);
- }
- return serverResponse;
+ return this.iUserPositionService.buy(stockId, buyNum, buyType, lever,profitTarget,stopTarget, request);
}
//修改涨跌板
@RequestMapping({"updateProfitTarget.do"})
@@ -117,11 +118,7 @@
@RequestMapping({"sell.do"})
@ResponseBody
public ServerResponse sell(HttpServletRequest request, @RequestParam("positionSn") String positionSn) {
- try {
- return this.iUserPositionService.sell(positionSn, 1);
- } catch (Exception e) {
- return ServerResponse.createByErrorMsg("Sell Fail");
- }
+ return this.iUserPositionService.sell(positionSn, 1,request);
}
@@ -132,7 +129,7 @@
try {
return this.iUserPositionService.allSell(request,positionSn);
} catch (Exception e) {
- return ServerResponse.createByErrorMsg("Sell Fail");
+ return ServerResponse.createByErrorMsg("Sell Fail",request);
}
}
@@ -198,57 +195,11 @@
return serverResponse;
}
- @RequestMapping({"buyIndex.do"})
- @ResponseBody
- public ServerResponse buyIndex(@RequestParam("indexId") Integer indexId, @RequestParam("buyNum") Integer buyNum, @RequestParam("buyType") Integer buyType, @RequestParam("lever") Integer lever,@RequestParam(value = "profitTarget",required = false) BigDecimal profitTarget,@RequestParam(value = "stopTarget",required = false) BigDecimal stopTarget, HttpServletRequest request) {
- ServerResponse serverResponse = null;
- try {
- serverResponse = this.iUserIndexPositionService.buyIndex(indexId, buyNum, buyType, lever,profitTarget,stopTarget, request);
- } catch (Exception e) {
- log.error("用户下单指数操作 = {}", e);
- }
- return serverResponse;
- }
- @RequestMapping({"sellIndex.do"})
- @ResponseBody
- public ServerResponse sellIndex(HttpServletRequest request, @RequestParam("positionSn") String positionSn) {
- ServerResponse serverResponse = null;
- try {
- serverResponse = this.iUserIndexPositionService.sellIndex(positionSn, 1);
- } catch (Exception e) {
- log.error("用户平仓指数操作 = {}", e);
- }
- return serverResponse;
- }
- //期货交易 用户下单
- @RequestMapping({"buyFutures.do"})
- @ResponseBody
- public ServerResponse buyFutures(@RequestParam("FuturesId") Integer FuturesId, @RequestParam("buyNum") Integer buyNum, @RequestParam("buyType") Integer buyType, @RequestParam("lever") Integer lever, HttpServletRequest request) {
- ServerResponse serverResponse = null;
- try {
- serverResponse = this.iUserFuturesPositionService.buyFutures(FuturesId, buyNum, buyType, lever, request);
- } catch (Exception e) {
- log.error("用户下单 期货 操作 = {}", e);
- }
- return serverResponse;
- }
- @RequestMapping({"sellFutures.do"})
- @ResponseBody
- public ServerResponse sellFutures(HttpServletRequest request, @RequestParam("positionSn") String positionSn) {
- ServerResponse serverResponse = null;
- try {
- serverResponse = this.iUserFuturesPositionService.sellFutures(positionSn, 1);
- } catch (Exception e) {
- log.error("用户平仓 期货 操作 = {}", e);
- }
- return serverResponse;
- }
- @Autowired
- IUserRechargeService iUserRechargeService;
+
//查询 用户信息
@RequestMapping({"getUserInfo.do"})
@@ -304,12 +255,6 @@
return serverResponse;
}
- //资产互转
- @RequestMapping({"transAmt.do"})
- @ResponseBody
- public ServerResponse transAmt(@RequestParam("amt") Integer amt, @RequestParam("type") Integer type, HttpServletRequest request) {
- return this.iUserService.transAmt(amt, type, request);
- }
/**
* 用户新股列表
@@ -353,13 +298,7 @@
@ResponseBody
public ServerResponse transfer(@RequestParam("fromType") String fromType, @RequestParam("toType") String toType,
@RequestParam("amt") String amt, HttpServletRequest request) {
- ServerResponse serverResponse = null;
- try {
- serverResponse = this.iUserService.transfer(fromType, toType, amt,request);
- } catch (Exception e) {
- log.error("vip抢筹下单操作出错 = {}", e);
- }
- return serverResponse;
+ return iUserService.transfer(fromType, toType, amt,request);
}
@@ -395,11 +334,20 @@
}
- //大宗下单列表
+
@RequestMapping({"getMoenyLog.do"})
@ResponseBody
public ServerResponse getMoenyLog(@RequestParam("type") String stockCode, HttpServletRequest request) {
return this.iUserService.getMoenyLog(stockCode, request);
}
+
+ @RequestMapping({"currencyRate.do"})
+ @ResponseBody
+ public ServerResponse currencyRate(@RequestParam("fromType") String stockCode,
+ @RequestParam("toType") String toType, HttpServletRequest request) {
+ return ServerResponse.createBySuccess(rateServices.currencyRate(EStockType.getEStockTypeByCode(stockCode), EStockType.getEStockTypeByCode(toType)));
+ }
+
+
}
diff --git a/src/main/java/com/nq/controller/protol/UserFundsController.java b/src/main/java/com/nq/controller/protol/UserFundsController.java
deleted file mode 100644
index 4b2fc12..0000000
--- a/src/main/java/com/nq/controller/protol/UserFundsController.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package com.nq.controller.protol;
-
-
-import com.nq.common.ServerResponse;
-import com.nq.pojo.FundsAppend;
-import com.nq.pojo.FundsApply;
-import com.nq.service.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-import javax.servlet.http.HttpServletRequest;
-
-@Controller
-@RequestMapping({"/user/funds/"})
-public class UserFundsController {
- private static final Logger log = LoggerFactory.getLogger(UserFundsController.class);
-
- @Autowired
- IFundsSettingService iFundsSettingService;
-
- @Autowired
- IFundsLeverService iFundsLeverService;
-
- @Autowired
- IFundsApplyService iFundsApplyService;
-
- @Autowired
- IUserFundsPositionService iUserFundsPositionService;
-
- @Autowired
- IFundsAppendService iFundsAppendService;
-
- //分仓配资设置信息查询
- @RequestMapping({"getFundsSetting.do"})
- @ResponseBody
- public ServerResponse getFundsSetting() {
- return ServerResponse.createBySuccess(this.iFundsSettingService.getFundsSetting());
- }
-
- //查询配资类型杠杆
- @RequestMapping({"getFundsTypeList.do"})
- @ResponseBody
- public ServerResponse getFundsTypeList(Integer cycleType) {
- return this.iFundsLeverService.getFundsTypeList(cycleType);
- }
-
- //配资申请-添加
- @RequestMapping({"addFundsApply.do"})
- @ResponseBody
- public ServerResponse addFundsApply(FundsApply fundsApply, HttpServletRequest request) throws Exception {
- return this.iFundsApplyService.insert(fundsApply, request);
- }
-
- //配资申请-用户配资列表
- @RequestMapping({"getUserApplyList.do"})
- @ResponseBody
- public ServerResponse getUserApplyList(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "12") int pageSize, @RequestParam(value = "userId", defaultValue = "") int userId, HttpServletRequest request) {
- return this.iFundsApplyService.getUserApplyList(pageNum, pageSize, userId, request);
- }
-
- //配资申请-用户操盘中子账户
- @RequestMapping({"getUserSubaccount.do"})
- @ResponseBody
- public ServerResponse getUserSubaccount(HttpServletRequest request) {
- return this.iFundsApplyService.getUserEnabledSubaccount(request);
- }
-
- //分仓交易-入仓
- @RequestMapping({"buyFunds.do"})
- @ResponseBody
- public ServerResponse buyFunds(Integer stockId, Integer buyNum, Integer buyType, Integer lever, Integer subaccountNumber, HttpServletRequest request) {
- ServerResponse serverResponse = null;
- try {
- serverResponse = this.iUserFundsPositionService.buyFunds(stockId, buyNum, buyType, lever, subaccountNumber, request);
- } catch (Exception e) {
- log.error("用户下单操作 = {}", e);
- }
- return serverResponse;
- }
-
- //分仓交易-用户平仓操作
- @RequestMapping({"sellFunds.do"})
- @ResponseBody
- public ServerResponse sellFunds(HttpServletRequest request, @RequestParam("positionSn") String positionSn) {
- ServerResponse serverResponse = null;
- try {
- serverResponse = this.iUserFundsPositionService.sellFunds(positionSn, 1);
- } catch (Exception e) {
- log.error("用户平仓操作 = {}", e);
- }
- return serverResponse;
- }
-
- //分仓交易-查询所有平仓/持仓信息
- @RequestMapping({"fundsList.do"})
- @ResponseBody
- public ServerResponse fundsList(HttpServletRequest request, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize, @RequestParam(value = "state", required = false) Integer state, @RequestParam(value = "stockCode", required = false) String stockCode, @RequestParam(value = "stockSpell", required = false) String stockSpell) {
- return this.iUserFundsPositionService.findMyPositionByCodeAndSpell(stockCode, stockSpell, state, request, pageNum, pageSize);
- }
-
- //查询子账户详情
- @RequestMapping({"getSubaccountInfo.do"})
- @ResponseBody
- public ServerResponse getSubaccountInfo(Integer id) {
- return this.iFundsApplyService.getDetail(id);
- }
-
- /**
- * 配资杠杆-查询杠杆费率
- * cycleType:周期类型:1按天、2按周、3按月
- * lever:杠杆
- */
- @RequestMapping({"getLeverRateInfo.do"})
- @ResponseBody
- public ServerResponse getLeverRateInfo(Integer cycleType, Integer lever) {
- return this.iFundsLeverService.getLeverRateInfo(cycleType, lever);
- }
-
- //配资追加申请-保存
- @RequestMapping({"appendApply.do"})
- @ResponseBody
- public ServerResponse appendApply(FundsAppend fundsApply, HttpServletRequest request) throws Exception {
- return this.iFundsAppendService.save(fundsApply, request);
- }
-
- //配资追加申请-查询用户追加列表
- @RequestMapping({"getAppendList.do"})
- @ResponseBody
- public ServerResponse getAppendList(HttpServletRequest request, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize, @RequestParam(value = "keyword", required = false) String keyword, @RequestParam(value = "status", required = false) Integer status, @RequestParam(value = "userId", required = false) Integer userId, @RequestParam(value = "appendType", required = false) Integer appendType) {
- return this.iFundsAppendService.getList(pageNum, pageSize, keyword, status, userId, appendType, request);
- }
-
- //根据分仓配资代码查询用户最早入仓股票
- @RequestMapping({"findUserFundsPositionByCode.do"})
- @ResponseBody
- public ServerResponse findUserFundsPositionByCode(HttpServletRequest request, @RequestParam(value = "fundsCode", required = false) String fundsCode) {
- return this.iUserFundsPositionService.findUserFundsPositionByCode(request, fundsCode);
- }
-
-
-
-}
\ No newline at end of file
diff --git a/src/main/java/com/nq/controller/protol/UserFuturesPositionController.java b/src/main/java/com/nq/controller/protol/UserFuturesPositionController.java
deleted file mode 100644
index 763a371..0000000
--- a/src/main/java/com/nq/controller/protol/UserFuturesPositionController.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.nq.controller.protol;
-
-import com.nq.common.ServerResponse;
-import com.nq.service.IUserFuturesPositionService;
-import javax.servlet.http.HttpServletRequest;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-
-@Controller
-@RequestMapping({"/user/futures/position/"})
-public class UserFuturesPositionController {
- private static final Logger log = LoggerFactory.getLogger(UserFuturesPositionController.class);
-
- @Autowired
- IUserFuturesPositionService iUserFuturesPositionService;
-
- //查询所有期货持仓/平仓信息
- @RequestMapping({"list.do"})
- @ResponseBody
- public ServerResponse list(HttpServletRequest request, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize, @RequestParam(value = "state", required = false) Integer state, @RequestParam(value = "fuName", required = false) String fuName, @RequestParam(value = "fuCode", required = false) String fuCode) {
- return this.iUserFuturesPositionService.findMyFuturesPositionByNameAndCode(fuName, fuCode, state, request, pageNum, pageSize);
- }
-
- //根据期货代码查询用户最早入仓股票
- @RequestMapping({"findUserFuturesPositionByCode.do"})
- @ResponseBody
- public ServerResponse findUserFuturesPositionByCode(HttpServletRequest request, @RequestParam(value = "futuresGid", required = false) String futuresGid) {
- return this.iUserFuturesPositionService.findUserFuturesPositionByCode(request, futuresGid);
- }
-}
diff --git a/src/main/java/com/nq/controller/protol/UserIndexPositionController.java b/src/main/java/com/nq/controller/protol/UserIndexPositionController.java
deleted file mode 100644
index 67f4d3d..0000000
--- a/src/main/java/com/nq/controller/protol/UserIndexPositionController.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.nq.controller.protol;
-
-import com.nq.common.ServerResponse;
-import com.nq.service.IUserIndexPositionService;
-import javax.servlet.http.HttpServletRequest;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-@Controller
-@RequestMapping({"/user/index/position/"})
-public class UserIndexPositionController {
- private static final Logger log = LoggerFactory.getLogger(UserIndexPositionController.class);
-
- @Autowired
- IUserIndexPositionService iUserIndexPositionService;
-
- @RequestMapping({"list.do"})
- @ResponseBody
- public ServerResponse list(HttpServletRequest request, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize, @RequestParam(value = "state", required = false) Integer state, @RequestParam(value = "indexName", required = false) String indexName, @RequestParam(value = "indexCode", required = false) String indexCode) {
- return this.iUserIndexPositionService.findMyIndexPositionByNameAndCode(indexName, indexCode, state, request, pageNum, pageSize);
- }
-
- //根据指数代码查询用户最早入仓股票
- @RequestMapping({"findUserIndexPositionByCode.do"})
- @ResponseBody
- public ServerResponse findUserIndexPositionByCode(HttpServletRequest request, @RequestParam(value = "indexGid", required = false) String indexGid) {
- return this.iUserIndexPositionService.findUserIndexPositionByCode(request, indexGid);
- }
-}
-
diff --git a/src/main/java/com/nq/controller/protol/UserPositionController.java b/src/main/java/com/nq/controller/protol/UserPositionController.java
index 03a95dd..058f0a6 100644
--- a/src/main/java/com/nq/controller/protol/UserPositionController.java
+++ b/src/main/java/com/nq/controller/protol/UserPositionController.java
@@ -40,5 +40,12 @@
public ServerResponse findUserPositionByCode(HttpServletRequest request, @RequestParam(value = "stockCode", required = false) String stockCode) {
return this.iUserPositionService.findUserPositionByCode(request, stockCode);
}
+
+
+ @RequestMapping({"findByPostionSn.do"})
+ @ResponseBody
+ public ServerResponse findByPostionSn(HttpServletRequest request, @RequestParam(value = "positionSn", required = false) String stockCode) {
+ return ServerResponse.createBySuccess(iUserPositionService.findByPostionSn(stockCode));
+ }
}
diff --git a/src/main/java/com/nq/controller/protol/UserWithdrawController.java b/src/main/java/com/nq/controller/protol/UserWithdrawController.java
index dae9abc..4285ff9 100644
--- a/src/main/java/com/nq/controller/protol/UserWithdrawController.java
+++ b/src/main/java/com/nq/controller/protol/UserWithdrawController.java
@@ -46,7 +46,7 @@
serverResponse = this.iUserWithdrawService.outMoney(amt, user.getWithPwd(), accsetType,request);
} catch (Exception e) {
log.error("出金异常 e = {}", e);
- serverResponse = ServerResponse.createByErrorMsg("Withdrawal exception, please try again later");
+ serverResponse = ServerResponse.createByErrorMsg("提现异常,请稍后再试",request);
}
return serverResponse;
}
diff --git a/src/main/java/com/nq/dao/StockSettingMapper.java b/src/main/java/com/nq/dao/StockSettingMapper.java
new file mode 100644
index 0000000..473695d
--- /dev/null
+++ b/src/main/java/com/nq/dao/StockSettingMapper.java
@@ -0,0 +1,7 @@
+package com.nq.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.nq.pojo.StockSetting;
+
+public interface StockSettingMapper extends BaseMapper<StockSetting> {
+}
diff --git a/src/main/java/com/nq/dao/StockTimeSettingMapper.java b/src/main/java/com/nq/dao/StockTimeSettingMapper.java
new file mode 100644
index 0000000..ec008f7
--- /dev/null
+++ b/src/main/java/com/nq/dao/StockTimeSettingMapper.java
@@ -0,0 +1,7 @@
+package com.nq.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.nq.pojo.StockTimeSetting;
+
+public interface StockTimeSettingMapper extends BaseMapper<StockTimeSetting> {
+}
diff --git a/src/main/java/com/nq/enums/EStockType.java b/src/main/java/com/nq/enums/EStockType.java
index d4d0773..891f773 100644
--- a/src/main/java/com/nq/enums/EStockType.java
+++ b/src/main/java/com/nq/enums/EStockType.java
@@ -10,13 +10,15 @@
public enum EStockType {
- IN("IN","印度股票","14", PropertiesUtil.getProperty("IN_HTTP_API"),PropertiesUtil.getProperty("IN_KEY")),
- US("US","美国股票","5",PropertiesUtil.getProperty("US_HTTP_API"),PropertiesUtil.getProperty("US_KEY")),
- HK("HK","香港股票","39",PropertiesUtil.getProperty("HK_HTTP_API"),PropertiesUtil.getProperty("HK_KEY")),
- MAS("MAS","马来西亚股票","42",PropertiesUtil.getProperty("MAS_HTTP_API"),PropertiesUtil.getProperty("MAS_KEY")),
- TH("TH","泰国股票","41",PropertiesUtil.getProperty("TH_HTTP_API"),PropertiesUtil.getProperty("TH_KEY")),
- HG("HG","韩国股票","11",PropertiesUtil.getProperty("HG_HTTP_API"),PropertiesUtil.getProperty("HG_KEY")),
- SZHB("SZHB","数字货币","41",PropertiesUtil.getProperty("SZHB_HTTP_API"),PropertiesUtil.getProperty("SZHB_KEY"));
+
+ US("US","美国股票","5",PropertiesUtil.getProperty("US_HTTP_API"),PropertiesUtil.getProperty("US_KEY"),"USD","$"),
+ HK("HK","香港股票","39",PropertiesUtil.getProperty("HK_HTTP_API"),PropertiesUtil.getProperty("HK_KEY"),"HKD","HK$"),
+ MAS("MAS","马来西亚股票","42",PropertiesUtil.getProperty("MAS_HTTP_API"),PropertiesUtil.getProperty("MAS_KEY"),"MYR","RM");
+
+// IN("IN","印度股票","14", PropertiesUtil.getProperty("IN_HTTP_API"),PropertiesUtil.getProperty("IN_KEY")),
+// TH("TH","泰国股票","41",PropertiesUtil.getProperty("TH_HTTP_API"),PropertiesUtil.getProperty("TH_KEY")),
+// HG("HG","韩国股票","11",PropertiesUtil.getProperty("HG_HTTP_API"),PropertiesUtil.getProperty("HG_KEY")),
+// SZHB("SZHB","数字货币","41",PropertiesUtil.getProperty("SZHB_HTTP_API"),PropertiesUtil.getProperty("SZHB_KEY"));
private String code;
private String typeDesc;
public String contryId;
@@ -24,28 +26,31 @@
public String stockUrl;
public String stockKey;
+ private String symbol;
- EStockType(String code, String typeDesc, String contryId, String stockUrl, String stockKey) {
+ private String symbol1;
+
+
+ EStockType(String code, String typeDesc, String contryId, String stockUrl, String stockKey,String symbol,String symbol1) {
this.code = code;
this.typeDesc = typeDesc;
this.contryId = contryId;
this.stockUrl = stockUrl;
this.stockKey = stockKey;
+ this.symbol = symbol;
+ this.symbol1 = symbol1;
}
public static EStockType getEStockTypeByCode(String code){
if(EStockType.US.getCode().equals(code)){
return US;
- }else if(EStockType.IN.getCode().equals(code)){
- return IN;
+
}else if(EStockType.HK.getCode().equals(code)){
return HK;
}else if(EStockType.MAS.getCode().equals(code)){
return MAS;
- }else if(EStockType.SZHB.getCode().equals(code)){
- return SZHB;
- }else {
- return TH;
+ }else{
+ return MAS;
}
}
@@ -65,6 +70,22 @@
return code;
}
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public void setSymbol(String symbol) {
+ this.symbol = symbol;
+ }
+
+ public String getSymbol1() {
+ return symbol1;
+ }
+
+ public void setSymbol1(String symbol1) {
+ this.symbol1 = symbol1;
+ }
+
public String getTypeDesc() {
return typeDesc;
}
diff --git a/src/main/java/com/nq/pojo/MoneyLog.java b/src/main/java/com/nq/pojo/MoneyLog.java
index 58ec996..cb30c05 100644
--- a/src/main/java/com/nq/pojo/MoneyLog.java
+++ b/src/main/java/com/nq/pojo/MoneyLog.java
@@ -17,5 +17,7 @@
private String accectType;
private String userId;
+ private String symbol;
+
}
diff --git a/src/main/java/com/nq/pojo/StockSetting.java b/src/main/java/com/nq/pojo/StockSetting.java
new file mode 100644
index 0000000..b916581
--- /dev/null
+++ b/src/main/java/com/nq/pojo/StockSetting.java
@@ -0,0 +1,23 @@
+package com.nq.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+@Data
+public class StockSetting {
+ @TableId(type = IdType.AUTO,value = "id")
+ private Integer id;
+ // 股票code
+ private String stockCode;
+ // 股票名称
+ private String stockName;
+ // 股票调价开始时间 格式 HH:mm 时分
+ private String startTime;
+ // 股票调价结束时间 格式 HH:mm 时分
+ private String endTime;
+ // 0 为指定价格 1为百分比调价格
+ private String type;
+ // type = 0 价格 1为百分比
+ private String price;
+}
diff --git a/src/main/java/com/nq/pojo/StockTimeSetting.java b/src/main/java/com/nq/pojo/StockTimeSetting.java
new file mode 100644
index 0000000..e901628
--- /dev/null
+++ b/src/main/java/com/nq/pojo/StockTimeSetting.java
@@ -0,0 +1,23 @@
+package com.nq.pojo;
+
+
+import lombok.Data;
+
+@Data
+public class StockTimeSetting {
+ private String id;
+ // 股票类型 可以不显示
+ private String accetsType;
+ // 股票类型 做显示
+ private String accetsDesc;
+ // 上午开始时间
+ private String amStartTime;
+ // 上午结束时间
+ private String amEndTime;
+ // 下午开始时间
+ private String pmStartTime;
+ // 下午结束时间
+ private String pmEndTime;
+ // 这是星期几开始交易时间 使用盗号隔开 1,2,3,4,5,6,7
+ private String weekDay;
+}
diff --git a/src/main/java/com/nq/pojo/UserRecharge.java b/src/main/java/com/nq/pojo/UserRecharge.java
index 6df01fd..5604920 100644
--- a/src/main/java/com/nq/pojo/UserRecharge.java
+++ b/src/main/java/com/nq/pojo/UserRecharge.java
@@ -44,23 +44,15 @@
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Excel(name = "支付时间", databaseFormat = "yyyyMMddHHmmss", format = "yyyy-MM-dd HH:mm:ss")
private Date payTime;
-
/*支付通道主键id*/
private Integer payId;
-
-
/**
* 手机号码
* */
@Transient
private String userPhone;
-
-
-
private String img;
-
private String channelName;
-
private String assetsType;
diff --git a/src/main/java/com/nq/pojo/reponse/RPageInfo.java b/src/main/java/com/nq/pojo/reponse/RPageInfo.java
new file mode 100644
index 0000000..b8a6e1f
--- /dev/null
+++ b/src/main/java/com/nq/pojo/reponse/RPageInfo.java
@@ -0,0 +1,20 @@
+package com.nq.pojo.reponse;
+
+import com.github.pagehelper.PageInfo;
+import com.nq.pojo.Stock;
+
+import java.util.List;
+
+public class RPageInfo extends PageInfo {
+
+ private String stockType;
+
+
+ public String getStockType() {
+ return stockType;
+ }
+
+ public void setStockType(String stockType) {
+ this.stockType = stockType;
+ }
+}
diff --git a/src/main/java/com/nq/service/IPriceServices.java b/src/main/java/com/nq/service/IPriceServices.java
new file mode 100644
index 0000000..4b3f9bd
--- /dev/null
+++ b/src/main/java/com/nq/service/IPriceServices.java
@@ -0,0 +1,8 @@
+package com.nq.service;
+
+import java.math.BigDecimal;
+
+public interface IPriceServices {
+
+ BigDecimal getNowPrice(String stockCode);
+}
diff --git a/src/main/java/com/nq/service/IRateServices.java b/src/main/java/com/nq/service/IRateServices.java
new file mode 100644
index 0000000..b65f29c
--- /dev/null
+++ b/src/main/java/com/nq/service/IRateServices.java
@@ -0,0 +1,11 @@
+package com.nq.service;
+
+import com.nq.enums.EStockType;
+
+import java.math.BigDecimal;
+
+public interface IRateServices {
+
+ public BigDecimal currencyRate(EStockType fromStockType,EStockType tofromStockType);
+
+}
diff --git a/src/main/java/com/nq/service/IStockSettingServices.java b/src/main/java/com/nq/service/IStockSettingServices.java
new file mode 100644
index 0000000..71035b0
--- /dev/null
+++ b/src/main/java/com/nq/service/IStockSettingServices.java
@@ -0,0 +1,17 @@
+package com.nq.service;
+
+import com.nq.common.ServerResponse;
+import com.nq.pojo.StockSetting;
+
+public interface IStockSettingServices {
+
+ ServerResponse updateStockSetting(StockSetting stockSetting);
+
+
+ ServerResponse saveStockSetting(StockSetting stockSetting);
+
+
+ ServerResponse deleteStockSetting(Integer id);
+
+ ServerResponse queryAll(String stockCode);
+}
diff --git a/src/main/java/com/nq/service/IStockTimeSettingServices.java b/src/main/java/com/nq/service/IStockTimeSettingServices.java
new file mode 100644
index 0000000..11fe78f
--- /dev/null
+++ b/src/main/java/com/nq/service/IStockTimeSettingServices.java
@@ -0,0 +1,13 @@
+package com.nq.service;
+
+import com.nq.common.ServerResponse;
+import com.nq.pojo.StockTimeSetting;
+
+public interface IStockTimeSettingServices {
+
+ ServerResponse updateStockTimeSetting(StockTimeSetting stockTimeSetting);
+
+
+ ServerResponse queryStockTimeSetting();
+
+}
diff --git a/src/main/java/com/nq/service/ITradingHourService.java b/src/main/java/com/nq/service/ITradingHourService.java
new file mode 100644
index 0000000..7359865
--- /dev/null
+++ b/src/main/java/com/nq/service/ITradingHourService.java
@@ -0,0 +1,7 @@
+package com.nq.service;
+
+public interface ITradingHourService {
+ Boolean timeCheck(String stockCode);
+
+ Boolean timeCheck();
+}
diff --git a/src/main/java/com/nq/service/IUserPositionService.java b/src/main/java/com/nq/service/IUserPositionService.java
index ef121f0..1a4b1b5 100644
--- a/src/main/java/com/nq/service/IUserPositionService.java
+++ b/src/main/java/com/nq/service/IUserPositionService.java
@@ -5,22 +5,27 @@
import com.nq.pojo.UserPosition;
import com.nq.vo.position.PositionProfitVO;
import com.nq.vo.position.PositionVO;
+import com.nq.vo.position.UserPositionVO;
import java.math.BigDecimal;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
public interface IUserPositionService {
- ServerResponse buy(Integer paramInteger1, Integer paramInteger2, Integer paramInteger3, Integer paramInteger4,BigDecimal paramInteger5,BigDecimal paramInteger6, HttpServletRequest paramHttpServletRequest) throws Exception;
+ ServerResponse buy(Integer paramInteger1, Integer paramInteger2, Integer paramInteger3,
+ Integer paramInteger4,BigDecimal paramInteger5,BigDecimal paramInteger6, HttpServletRequest paramHttpServletRequest) ;
- ServerResponse sell(String paramString, int paramInt) throws Exception ;
+ ServerResponse sell(String paramString, int paramInt);
+ ServerResponse sell(String paramString, int paramInt, HttpServletRequest request);
ServerResponse allSell(HttpServletRequest request,String stockType)throws Exception;
ServerResponse lock(Integer paramInteger1, Integer paramInteger2, String paramString);
ServerResponse del(Integer paramInteger);
-
+
+
+ UserPositionVO findByPostionSn(String positionSn);
ServerResponse<PageInfo> findMyPositionByCodeAndSpell(String paramString1, String paramString2, Integer paramInteger,
HttpServletRequest paramHttpServletRequest,
int paramInt1, int paramInt2,String stockType);
@@ -64,7 +69,6 @@
ServerResponse addmargin(String paramString, int paramInt, BigDecimal marginAdd) throws Exception;
- PositionProfitVO getPositionProfitVO(UserPosition position);
ServerResponse newStockToPosition(Integer id);
diff --git a/src/main/java/com/nq/service/TradingHourService.java b/src/main/java/com/nq/service/TradingHourService.java
deleted file mode 100644
index 5af3d91..0000000
--- a/src/main/java/com/nq/service/TradingHourService.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.nq.service;
-
-public interface TradingHourService {
- Boolean timeCheck();
-}
diff --git a/src/main/java/com/nq/service/impl/PriceServicesImpl.java b/src/main/java/com/nq/service/impl/PriceServicesImpl.java
new file mode 100644
index 0000000..56f1aad
--- /dev/null
+++ b/src/main/java/com/nq/service/impl/PriceServicesImpl.java
@@ -0,0 +1,48 @@
+package com.nq.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.nq.dao.StockMapper;
+import com.nq.dao.StockSettingMapper;
+import com.nq.pojo.Stock;
+import com.nq.pojo.StockRealTimeBean;
+import com.nq.pojo.StockSetting;
+import com.nq.service.IPriceServices;
+import com.nq.utils.redis.RedisKeyUtil;
+import com.nq.utils.timeutil.TimeUtil;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+
+
+@Service
+public class PriceServicesImpl implements IPriceServices {
+
+
+
+ @Resource
+ StockSettingMapper stockSettingMapper;
+
+
+ @Resource
+ StockMapper stockMapper;
+
+ @Override
+ public BigDecimal getNowPrice(String stockCode) {
+ Stock stock = stockMapper.selectOne(new QueryWrapper<Stock>().eq("stock_code",stockCode));
+ StockSetting stockSetting = stockSettingMapper.selectOne(new QueryWrapper<StockSetting>().eq("stock_code",stockCode));
+ if(stockSetting != null){
+ if(TimeUtil.isTradingHour(stockSetting.getStartTime(),stockSetting.getEndTime())){
+ if(stockSetting.getType().equals("0")){
+ return new BigDecimal(stockSetting.getPrice());
+ }else{
+ StockRealTimeBean stockRealTimeBean = RedisKeyUtil.getCacheRealTimeStock(stock);
+ return new BigDecimal(stockRealTimeBean.getLast()).multiply(new BigDecimal(stockSetting.getPrice()));
+ }
+ }
+ }
+
+ StockRealTimeBean stockRealTimeBean = RedisKeyUtil.getCacheRealTimeStock(stock);
+ return new BigDecimal(stockRealTimeBean.getLast());
+ }
+}
diff --git a/src/main/java/com/nq/service/impl/RateServicesImpl.java b/src/main/java/com/nq/service/impl/RateServicesImpl.java
new file mode 100644
index 0000000..fb8a304
--- /dev/null
+++ b/src/main/java/com/nq/service/impl/RateServicesImpl.java
@@ -0,0 +1,49 @@
+package com.nq.service.impl;
+
+import com.nq.enums.EStockType;
+import com.nq.service.IRateServices;
+import com.nq.service.ISiteAdminService;
+import com.nq.service.ISiteSettingService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+
+@Service
+public class RateServicesImpl implements IRateServices {
+
+ @Resource
+ ISiteSettingService iSiteSettingService;
+ @Override
+ public BigDecimal currencyRate(EStockType fromStockType, EStockType tofromStockType) {
+ if(fromStockType == null || tofromStockType == null){
+ return new BigDecimal(1);
+ }
+ BigDecimal rate = iSiteSettingService.getSiteSetting().getExchangeRate();
+ BigDecimal rate1 = new BigDecimal(7.35);
+ if(fromStockType==EStockType.US){
+ if(tofromStockType==EStockType.MAS){
+ return rate;
+ }else if(tofromStockType==EStockType.HK){
+ return rate1;
+ }
+ }if(fromStockType==EStockType.HK){
+ if(tofromStockType==EStockType.MAS){
+ return new BigDecimal(1).divide(rate1,18, RoundingMode.HALF_DOWN).multiply(rate);
+ }else if(tofromStockType==EStockType.US){
+ return new BigDecimal(1).divide(rate1,18, RoundingMode.HALF_DOWN);
+ }
+ } else {
+ if(tofromStockType==EStockType.US){
+ return new BigDecimal(1).divide(rate,18, RoundingMode.HALF_DOWN);
+ }else{
+ return new BigDecimal(1).divide(rate,18, RoundingMode.HALF_DOWN).multiply(rate1);
+ }
+ }
+
+ return new BigDecimal(1);
+
+ }
+
+}
diff --git a/src/main/java/com/nq/service/impl/SiteNewsServiceImpl.java b/src/main/java/com/nq/service/impl/SiteNewsServiceImpl.java
index b24f843..8ee8059 100644
--- a/src/main/java/com/nq/service/impl/SiteNewsServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/SiteNewsServiceImpl.java
@@ -140,17 +140,11 @@
@Override
public int grabNews() {
int ret = 0;
- addNews(1, EStockType.HG.getStockUrl() +"stock-markets?key="+ EStockType.HG.getStockKey() +"&type=1");
-// addNews(2, EStockType.US.getStockUrl() +"stock-markets?key="+ EStockType.US.getStockKey() +"&type=4");
-// addNews(3, EStockType.TH.getStockUrl() +"stock-markets?key="+ EStockType.TH.getStockKey() +"&type=4");
-// addNews(4, EStockType.MAS.getStockUrl() +"stock-markets?key="+ EStockType.MAS.getStockKey() +"&type=4");
- return ret;
+ addNews(1, EStockType.US.getStockUrl() +"stock-markets?key="+ EStockType.US.getStockKey() +"&type=4");
+ addNews(2,EStockType.MAS.getStockUrl() +"stock-markets?key="+ EStockType.MAS.getStockKey() +"&type=5");
+ return ret;
}
- /*
- *抓取新闻专用
- * type:新闻类型:1、财经要闻,2、经济数据,3、全球股市,4、7*24全球,5、商品资讯,6、上市公司,7、全球央行
- * */
private int addNews(Integer type, String url){
int k = 0;
try {
@@ -168,7 +162,7 @@
Long showTime = jsonObject.getLong("time");
siteNews.setShowTime(new Date(showTime));
if(jsonObject.has("img")){
- String imgBase = convertBase64ToImage(jsonObject.getString("img"),"/www/wwwroot/dabao/"+newsId+".jpg");
+ convertBase64ToImage(jsonObject.getString("img"),PropertiesUtil.getProperty("ftp.address")+newsId+".jpg");
siteNews.setImgurl(PropertiesUtil.getProperty("ftp.server.http.prefix")+newsId+".jpg");
}
siteNews.setDescription(jsonObject.getString("content"));
diff --git a/src/main/java/com/nq/service/impl/SiteSettingServiceImpl.java b/src/main/java/com/nq/service/impl/SiteSettingServiceImpl.java
index 97505d9..1918408 100644
--- a/src/main/java/com/nq/service/impl/SiteSettingServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/SiteSettingServiceImpl.java
@@ -16,25 +16,21 @@
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
+
@Service("iSiteSettingService")
public class SiteSettingServiceImpl implements ISiteSettingService {
- @Autowired
+ @Resource
SiteSettingMapper siteSettingMapper;
@Autowired
SiteAdminIndexMapper siteAdminIndexMapper;
-
public SiteSetting getSiteSetting() {
-
SiteSetting siteSetting = null;
-
List list = this.siteSettingMapper.findAllSiteSetting();
-
if (list.size() > 0) {
-
siteSetting = (SiteSetting) list.get(0);
-
}
return siteSetting;
}
diff --git a/src/main/java/com/nq/service/impl/StockOptionServiceImpl.java b/src/main/java/com/nq/service/impl/StockOptionServiceImpl.java
index 3922e96..4f092da 100644
--- a/src/main/java/com/nq/service/impl/StockOptionServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/StockOptionServiceImpl.java
@@ -18,6 +18,7 @@
import com.nq.pojo.User;
+import com.nq.pojo.reponse.RPageInfo;
import com.nq.service.IStockOptionService;
import com.nq.service.IUserService;
@@ -30,6 +31,7 @@
import com.nq.vo.stock.StockVO;
+import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
@@ -63,17 +65,18 @@
PageHelper.startPage(pageNum, pageSize);
User user = this.iUserService.getCurrentUser(request);
- PageInfo pageInfo;
+ RPageInfo pageInfo;
List<StockOption> stockOptions = this.stockOptionMapper.findMyOptionByKeywords(user.getId(), keyWords, stockType);
- List<StockListVO> stockOptionListVOS = Lists.newArrayList();
+ List<StockListVO> stockOptionListVOS = new ArrayList<>();
for (StockOption option : stockOptions) {
StockListVO stockListVO = assembleStockOptionListVO(option);
stockOptionListVOS.add(stockListVO);
}
- pageInfo = new PageInfo(stockOptionListVOS);
+ pageInfo = new RPageInfo();
pageInfo.setList(stockOptionListVOS);
+ pageInfo.setStockType(stockType);
return ServerResponse.createBySuccess(pageInfo);
}
diff --git a/src/main/java/com/nq/service/impl/StockServiceImpl.java b/src/main/java/com/nq/service/impl/StockServiceImpl.java
index bd26147..ba5ebcb 100644
--- a/src/main/java/com/nq/service/impl/StockServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/StockServiceImpl.java
@@ -11,6 +11,7 @@
import com.nq.dao.*;
import com.nq.enums.EStockType;
import com.nq.pojo.*;
+import com.nq.pojo.reponse.RPageInfo;
import com.nq.service.*;
import com.nq.utils.http.HttpClientRequest;
import com.nq.utils.PropertiesUtil;
@@ -81,6 +82,10 @@
@Resource
StockDzMapper stockDzMapper;
+
+
+ @Autowired
+ IPriceServices iPriceServices;
public ServerResponse getMarket() {
String market_url = PropertiesUtil.getProperty("sina.market.url");
@@ -161,8 +166,12 @@
if (stockList.size() > 0){
stockListVOS.addAll(Objects.requireNonNull(StockApi.getStockReailTimes(stockList)));
}
- PageInfo pageInfo = new PageInfo(stockList);
+ for (int i = 0; i <stockListVOS.size() ; i++) {
+ stockListVOS.get(i).setNowPrice(iPriceServices.getNowPrice(stockListVOS.get(i).getCode()).toString());
+ }
+ RPageInfo pageInfo = new RPageInfo();
pageInfo.setList(stockListVOS);
+ pageInfo.setStockType(stockType);
return ServerResponse.createBySuccess(pageInfo);
}
@@ -244,16 +253,13 @@
Stock stock = stockMapper.findStockByCode(code);
Integer depositAmt = 0;
String introduction = null;
- String result = null;
- com.alibaba.fastjson2.JSONObject json = null;
-
- String gid = stock.getStockGid();
-
StockVO stockVO = StockApi.assembleInStockVO(stock);
stockVO.setDepositAmt(depositAmt);
+ stockVO.setNowPrice(iPriceServices.getNowPrice(stock.getStockCode()).toString());
stockVO.setType(stock.getStockType());
stockVO.setId(stock.getId().intValue());
stockVO.setCode(stock.getStockCode());
+ stockVO.setName(stock.getStockName());
stockVO.setSpell(stock.getStockSpell());
stockVO.setGid(stock.getStockGid().toUpperCase());
Map map = Maps.newHashMap();
@@ -442,24 +448,7 @@
@Override
public Object getKData(String pid, String interval, String stockType) {
EStockType eStockType = EStockType.getEStockTypeByCode(stockType);
- String string;
- if(eStockType == EStockType.SZHB){
-
- if(interval.equals("D")){
- interval = "1day";
- }else if(interval.equals("W")) {
- interval = "1week";
- }else if(interval.equals("M")){
- interval = "1mon";
- }else{
- interval =interval+ "min";
- }
- string = HttpUtil.get(eStockType.stockUrl + "market/history/kline?period="+interval+"&size=600&symbol="+pid);
-
- }else{
- string = HttpUtil.get(eStockType.stockUrl + "kline?pid=" + pid + "&interval=" + interval + "&key=" + eStockType.stockKey);
- }
- return string;
+ return HttpUtil.get(eStockType.stockUrl + "kline?pid=" + pid + "&interval=" + interval + "&key=" + eStockType.stockKey);
}
@Override
@@ -468,41 +457,7 @@
if (user == null) {
return ServerResponse.createByErrorMsg("Please log in");
}
-
return ServerResponse.createBySuccess();
-// List<Stock> stockList = stockMapper.findOptions(user.getId() + "");
-//// List<Stock> stockList = stockMapper.findOptions("485");
-// List<StockListVO> stockListVOS = Lists.newArrayList();
-// if (stockList.size() > 0)
-// for (Stock stock : stockList) {
-// StockListVO stockListVO = new StockListVO();
-// QueryWrapper<InStockBean> queryWrapper = new QueryWrapper<>();
-// queryWrapper.eq("id", stock.getStockCode());
-// InStockBean inStockBean = inStockMapper.selectOne(queryWrapper);
-// if (inStockBean == null) {
-// continue;
-// }
-// stockListVO.setNowPrice(inStockBean.getLast());
-// stockListVO.setToday_max(inStockBean.getHigh());
-// stockListVO.setToday_min(inStockBean.getLow());
-// stockListVO.setHcrate(BigDecimal.valueOf(Double.parseDouble(inStockBean.getChgPct())));
-// stockListVO.setBusiness_amount(inStockBean.getVolume());
-// stockListVO.setBusiness_balance(inStockBean.getAvgVolume());
-// stockListVO.setPreclose_px(inStockBean.getPrevClose());
-// stockListVO.setOpen_px(inStockBean.getOpen());
-// stockListVO.setName(stock.getStockName());
-// stockListVO.setCode(stock.getStockCode());
-// stockListVO.setSpell(stock.getStockSpell());
-// stockListVO.setGid(stock.getStockGid());
-// BigDecimal day3Rate = (BigDecimal) selectRateByDaysAndStockCode(stock.getStockCode(), 3).getData();
-// stockListVO.setDay3Rate(day3Rate);
-// stockListVO.setStock_plate(stock.getStockPlate());
-// stockListVO.setStock_type(stock.getStockType());
-// stockListVOS.add(stockListVO);
-// }
-// PageInfo pageInfo = new PageInfo(stockList);
-// pageInfo.setList(stockListVOS);
-
}
public ServerResponse<Stock> findStockByName(String name) {
diff --git a/src/main/java/com/nq/service/impl/StockSettingServicesImpl.java b/src/main/java/com/nq/service/impl/StockSettingServicesImpl.java
new file mode 100644
index 0000000..32c3f72
--- /dev/null
+++ b/src/main/java/com/nq/service/impl/StockSettingServicesImpl.java
@@ -0,0 +1,68 @@
+package com.nq.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.nq.common.ServerResponse;
+import com.nq.dao.StockMapper;
+import com.nq.dao.StockSettingMapper;
+import com.nq.pojo.Stock;
+import com.nq.pojo.StockSetting;
+import com.nq.service.IStockSettingServices;
+import org.apache.http.util.TextUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+
+@Service
+public class StockSettingServicesImpl implements IStockSettingServices {
+
+
+
+ @Resource
+ StockSettingMapper stockSettingMapper;
+
+ @Resource
+ StockMapper stockMapper;
+
+ @Override
+ public ServerResponse updateStockSetting(StockSetting stockSetting) {
+ int ref = stockSettingMapper.updateById(stockSetting);
+ if(ref == 0){
+ return ServerResponse.createByErrorMsg("修改失败");
+ }
+ return ServerResponse.createBySuccess();
+ }
+
+ @Override
+ public ServerResponse saveStockSetting(StockSetting stockSetting) {
+
+
+ Stock stock = stockMapper.findStockByCode(stockSetting.getStockCode());
+ if(stock == null){
+ return ServerResponse.createByErrorMsg("添加股票不存在");
+ }
+ int ref = stockSettingMapper.insert(stockSetting);
+ if(ref == 0){
+ return ServerResponse.createByErrorMsg("修改失败");
+ }
+ return ServerResponse.createBySuccess();
+ }
+
+ @Override
+ public ServerResponse deleteStockSetting(Integer id) {
+ int ref = stockSettingMapper.deleteById(id);
+ if(ref == 0){
+ return ServerResponse.createByErrorMsg("修改失败");
+ }
+ return ServerResponse.createBySuccess();
+ }
+
+ @Override
+ public ServerResponse queryAll(String stockCode) {
+ QueryWrapper<StockSetting> queryWrapper = new QueryWrapper<>();
+ if(!TextUtils.isEmpty(stockCode)){
+ queryWrapper.eq("stock_code",stockCode);
+ }
+ return ServerResponse.createBySuccess(stockSettingMapper.selectList(queryWrapper));
+ }
+}
diff --git a/src/main/java/com/nq/service/impl/StockTimeSettingServicesImpl.java b/src/main/java/com/nq/service/impl/StockTimeSettingServicesImpl.java
new file mode 100644
index 0000000..a179f32
--- /dev/null
+++ b/src/main/java/com/nq/service/impl/StockTimeSettingServicesImpl.java
@@ -0,0 +1,32 @@
+package com.nq.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.nq.common.ServerResponse;
+import com.nq.dao.StockTimeSettingMapper;
+import com.nq.pojo.StockTimeSetting;
+import com.nq.service.IStockTimeSettingServices;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+@Service
+public class StockTimeSettingServicesImpl implements IStockTimeSettingServices {
+
+
+ @Resource
+ StockTimeSettingMapper mapper;
+
+ @Override
+ public ServerResponse updateStockTimeSetting(StockTimeSetting stockTimeSetting) {
+ int ref = mapper.updateById(stockTimeSetting);
+ if(ref == 0){
+ return ServerResponse.createByErrorMsg("修改失败");
+ }
+ return ServerResponse.createBySuccess();
+ }
+
+ @Override
+ public ServerResponse queryStockTimeSetting() {
+ return ServerResponse.createBySuccess(mapper.selectList(new QueryWrapper<StockTimeSetting>()));
+ }
+}
diff --git a/src/main/java/com/nq/service/impl/TradingHourServiceImpl.java b/src/main/java/com/nq/service/impl/TradingHourServiceImpl.java
index 0ed6d04..52ac833 100644
--- a/src/main/java/com/nq/service/impl/TradingHourServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/TradingHourServiceImpl.java
@@ -1,10 +1,20 @@
package com.nq.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.nq.dao.StockMapper;
+import com.nq.dao.StockSettingMapper;
+import com.nq.dao.StockTimeSettingMapper;
import com.nq.dao.TradingHourMapper;
+import com.nq.pojo.Stock;
+import com.nq.pojo.StockSetting;
+import com.nq.pojo.StockTimeSetting;
import com.nq.pojo.TradingHour;
-import com.nq.service.TradingHourService;
+import com.nq.service.ITradingHourService;
+import com.nq.utils.timeutil.TimeUtil;
import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
/**
* @program: dabao
@@ -12,16 +22,44 @@
* @create: 2024-03-31 13:18
**/
@Service
-public class TradingHourServiceImpl extends ServiceImpl<TradingHourMapper, TradingHour> implements TradingHourService {
+public class TradingHourServiceImpl extends ServiceImpl<TradingHourMapper, TradingHour> implements ITradingHourService {
+
+
+
+ @Resource
+ StockTimeSettingMapper stockTimeSettingMapper;
+
+ @Resource
+ StockMapper stockMapper;
+
+
+ @Resource
+ StockSettingMapper stockSettingMapper;
/**
* 判断股票代码是否在可交易时间段
* @return
*/
@Override
+ public Boolean timeCheck(String stockCode) {
+ StockSetting stockSetting = stockSettingMapper.selectOne(new QueryWrapper<StockSetting>().eq("stock_code",stockCode));
+ Stock stock = stockMapper.selectOne(new QueryWrapper<Stock>().eq("stock_code",stockCode));
+ StockTimeSetting stockTimeSetting = stockTimeSettingMapper.selectOne(new QueryWrapper<StockTimeSetting>().eq("accets_type",stock.getStockType()));
+ if(stockSetting!= null){
+ // 说明进入盘前交易或者盘后交易时间
+ if(TimeUtil.isTradingHour(stockSetting.getStartTime(),stockSetting.getEndTime())){
+ return true;
+ }
+ }
+ if(stockTimeSetting == null){
+ return false;
+ }
+ return TimeUtil.isTradingHour(stockTimeSetting.getAmStartTime(),stockTimeSetting.getAmEndTime(),stockTimeSetting.getPmStartTime(),stockTimeSetting.getPmEndTime());
+ }
+
+ @Override
public Boolean timeCheck() {
- //TODO 加入时间判断逻辑
return true;
}
}
diff --git a/src/main/java/com/nq/service/impl/UserAssetsServices.java b/src/main/java/com/nq/service/impl/UserAssetsServices.java
index 33c7ce1..5e1a4e9 100644
--- a/src/main/java/com/nq/service/impl/UserAssetsServices.java
+++ b/src/main/java/com/nq/service/impl/UserAssetsServices.java
@@ -4,6 +4,7 @@
import com.nq.common.ServerResponse;
import com.nq.dao.MoneyLogMapper;
import com.nq.dao.UserAssetsMapper;
+import com.nq.enums.EStockType;
import com.nq.enums.EUserAssets;
import com.nq.pojo.MoneyLog;
import com.nq.pojo.UserAssets;
@@ -85,32 +86,33 @@
@Override
public Boolean availablebalanceChange(String accetType, Integer userId, EUserAssets eUserAssets, BigDecimal amount, String desc, String descType) {
- if(accetType.equals("SZHB")){
- accetType = "US";
- }
UserAssets userAssets = assetsByTypeAndUserId(accetType,userId);
String type = eUserAssets.getDesc();
- String before = userAssets.getAvailableBalance().setScale(2).toString();
+ String before = userAssets.getAvailableBalance().toString();
String accectType = userAssets.getAccectType();
if(Objects.equals(eUserAssets.getCode(), EUserAssets.BUY.getCode())){
userAssets.setAvailableBalance(userAssets.getAvailableBalance().add(amount));
userAssets.setFreezeMoney(userAssets.getFreezeMoney().add(amount.negate()));
}else if(Objects.equals(eUserAssets.getCode(), EUserAssets.CLOSE_POSITION.getCode())){
userAssets.setAvailableBalance(userAssets.getAvailableBalance().add(amount));
- userAssets.setCumulativeProfitAndLoss(userAssets.getCumulativeProfitAndLoss().add(amount));
+ userAssets.setCumulativeProfitAndLoss(userAssets.getCumulativeProfitAndLoss().add(amount.abs()));
}else if(Objects.equals(eUserAssets.getCode(), EUserAssets.CLOSE_POSITION_RETURN_SECURITY_DEPOSIT.getCode())){
userAssets.setAvailableBalance(userAssets.getAvailableBalance().add(amount));
userAssets.setFreezeMoney(userAssets.getFreezeMoney().subtract(amount));
}else if(Objects.equals(eUserAssets.getCode(), EUserAssets.CALCULATE_PROFIT_AND_LOSS.getCode())){
- userAssets.setCumulativeProfitAndLoss(userAssets.getProfitAndLoss().add(amount));
+ userAssets.setCumulativeProfitAndLoss(userAssets.getProfitAndLoss().add(amount.abs()));
}else if(Objects.equals(eUserAssets.getCode(), EUserAssets.TRANSFER.getCode())){
userAssets.setAvailableBalance(userAssets.getAvailableBalance().add(amount));
+ eUserAssets.setDesc(desc);
}else if(Objects.equals(eUserAssets.getCode(), EUserAssets.TOP_UP.getCode())){
userAssets.setAvailableBalance(userAssets.getAvailableBalance().add(amount));
}else if(Objects.equals(eUserAssets.getCode(), EUserAssets.WITHDRAW.getCode())){
userAssets.setAvailableBalance(userAssets.getAvailableBalance().add(amount));
- }
+ }else if(Objects.equals(eUserAssets.getCode(), EUserAssets.HANDLING_CHARGE.getCode())){
+ userAssets.setHandlingCharge(userAssets.getHandlingCharge().add(amount.abs()));
+ userAssets.setAvailableBalance(userAssets.getAvailableBalance().add(amount.negate()));
+ }
String after = userAssets.getAvailableBalance().toString();
MoneyLog moneyLog = new MoneyLog();
moneyLog.setDescs(eUserAssets.getDesc());
@@ -118,8 +120,9 @@
moneyLog.setAfter(after);
moneyLog.setAmount(amount.toString());
moneyLog.setAccectType(accectType);
- moneyLog.setType(type);
+ moneyLog.setType(eUserAssets.getCode());
moneyLog.setUserId(userId+"");
+ moneyLog.setSymbol(EStockType.getEStockTypeByCode(accetType).getSymbol());
moneyLogMapper.insert(moneyLog);
return userAssetsMapper.updateById(userAssets)>1;
}
diff --git a/src/main/java/com/nq/service/impl/UserBankServiceImpl.java b/src/main/java/com/nq/service/impl/UserBankServiceImpl.java
index 898ad78..5ceb463 100644
--- a/src/main/java/com/nq/service/impl/UserBankServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserBankServiceImpl.java
@@ -18,6 +18,7 @@
import java.util.Date;
+import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
@@ -27,7 +28,7 @@
@Service("iUserBankService")
public class UserBankServiceImpl implements IUserBankService {
- @Autowired
+ @Resource
UserBankMapper userBankMapper;
@Autowired
@@ -38,16 +39,9 @@
public ServerResponse addBank(UserBank bank, HttpServletRequest request) {
User user = this.iUserService.getCurrentUser(request);
- if (user == null ){
- return ServerResponse.createBySuccessMsg("Please log in first");
- }
-
UserBank dbBank = this.userBankMapper.findUserBankByUserId(user.getId());
-
if (dbBank != null) {
-
- return ServerResponse.createByErrorMsg("The bank information already exists. Do not add it again");
-
+ return ServerResponse.createByErrorMsg("银行信息已经存在。不要再加一次",request );
}
UserBank userBank = new UserBank();
@@ -68,11 +62,11 @@
int insertCount = this.userBankMapper.insert(userBank);
if (insertCount > 0) {
- return ServerResponse.createBySuccess("Add bank card successfully");
+ return ServerResponse.createBySuccess("添加银行卡成功",request );
}
- return ServerResponse.createByErrorMsg("Failed to add bank card");
+ return ServerResponse.createByErrorMsg("添加银行卡失败",request );
}
@@ -84,7 +78,7 @@
if (dbBank == null) {
- return ServerResponse.createByErrorMsg("The modification failed. The bank could not be found");
+ return ServerResponse.createByErrorMsg("修改失败。银行找不到",request );
}
@@ -102,11 +96,11 @@
if (updateCount > 0) {
- return ServerResponse.createBySuccess("Modified bank card successfully");
+ return ServerResponse.createBySuccess("修改银行卡成功",request );
}
- return ServerResponse.createByErrorMsg("Failed to modify bank card");
+ return ServerResponse.createByErrorMsg("修改银行卡失败",request );
}
public ServerResponse getBankInfo(HttpServletRequest request) {
@@ -117,7 +111,7 @@
if (dbBank == null) {
- return ServerResponse.createByErrorMsg("No bank information was added");
+ return ServerResponse.createByErrorMsg("没有添加银行信息",request );
}
@@ -140,18 +134,18 @@
public ServerResponse updateBankByAdmin(UserBank userBank) {
System.out.println(userBank.getId());
if (userBank.getId() == null) {
- return ServerResponse.createByErrorMsg("Change id Mandatory");
+ return ServerResponse.createByErrorMsg("更改id必选");
}
int updateCount = this.userBankMapper.updateByPrimaryKeySelective(userBank);
if (updateCount > 0) {
- return ServerResponse.createBySuccessMsg("Modified successfully");
+ return ServerResponse.createBySuccessMsg("修改成功");
}
- return ServerResponse.createByErrorMsg("Modification failure");
+ return ServerResponse.createByErrorMsg("修改失败");
}
diff --git a/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java b/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java
index 8560221..f469776 100644
--- a/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.nq.dao.*;
+import com.nq.enums.EStockType;
import com.nq.enums.EUserAssets;
import com.nq.pojo.*;
import com.nq.service.*;
@@ -103,72 +104,64 @@
IUserAssetsServices iUserAssetsServices;
@Autowired
- TradingHourServiceImpl tradingHourService;
+ ITradingHourService tradingHourService;
+
+ @Autowired
+ IPriceServices priceServices;
@Transactional
- public ServerResponse buy(Integer stockId, Integer buyNum, Integer buyType, Integer lever, BigDecimal profitTarget, BigDecimal stopTarget, HttpServletRequest request) throws Exception {
+ public ServerResponse buy(Integer stockId, Integer buyNum, Integer buyType, Integer lever, BigDecimal profitTarget, BigDecimal stopTarget, HttpServletRequest request) {
SiteProduct siteProduct = iSiteProductService.getProductSetting();
User user = this.iUserService.getCurrentRefreshUser(request);
if (siteProduct.getRealNameDisplay() && (StringUtils.isBlank(user.getRealName()) || StringUtils.isBlank(user.getIdCard()))) {
- return ServerResponse.createByErrorMsg("Order failed, please first real name authentication");
+ return ServerResponse.createByErrorMsg("订单失败,请先实名认证",request);
}
-
+ SiteSetting siteSetting = this.iSiteSettingService.getSiteSetting();
+ // 手续费率
+ BigDecimal siteSettingBuyFee = siteSetting.getBuyFee();
if (siteProduct.getRealNameDisplay() && user.getIsLock().intValue() == 1) {
- return ServerResponse.createByErrorMsg("Order failed, account has been locked");
- }
-
- SiteSetting siteSetting = this.iSiteSettingService.getSiteSetting();
- if (siteSetting == null) {
- log.error("下单出错,网站设置表不存在");
- return ServerResponse.createByErrorMsg("Order failed, system setting error");
+ return ServerResponse.createByErrorMsg("订单失败,帐户已被锁定",request);
}
Stock stock = stockMapper.selectByPrimaryKey(stockId);
if (stock == null) {
- return ServerResponse.createByErrorMsg("Order failed, stock code error");
+ return ServerResponse.createByErrorMsg("订单失败,股票代码不存在",request);
}
//判断股票是否在可交易时间段
- Boolean b = tradingHourService.timeCheck();
+ Boolean b = tradingHourService.timeCheck(stock.getStockCode());
if (!b) {
- return ServerResponse.createByErrorMsg("Order failed, not in the stock trading session");
+ return ServerResponse.createByErrorMsg("订单失败,不在交易时间之内",request);
}
if (stock.getIsLock() != 0) {
- return ServerResponse.createByErrorMsg("Order failed, shares cannot be traded at present");
+ return ServerResponse.createByErrorMsg("订单失败,股票被锁定",request);
}
- BigDecimal now_price;
//股票类型 现价 数据源的处理
- StockListVO stockListVO = StockApi.getStockRealTime(stock);
- now_price = new BigDecimal(stockListVO.getNowPrice());
+ BigDecimal nowPrice = priceServices.getNowPrice(stock.getStockCode());
- if (now_price.compareTo(new BigDecimal("0")) == 0) {
- return ServerResponse.createByErrorMsg("Quote 0, please try again later");
+ if (nowPrice.compareTo(new BigDecimal("0")) == 0) {
+ return ServerResponse.createByErrorMsg("报价0,请稍后再试",request);
}
- BigDecimal buy_amt = now_price.multiply(new BigDecimal(buyNum));
+ BigDecimal buyAmt = nowPrice.multiply(new BigDecimal(buyNum));
+ BigDecimal orderFree = siteSettingBuyFee.multiply(buyAmt);
UserAssets userAssets = iUserAssetsServices.assetsByTypeAndUserId(stock.getStockType(),user.getId());
- if(userAssets.getAvailableBalance().compareTo(buy_amt)<0){
- return ServerResponse.createByErrorMsg("Order failed,Insufficient balance");
-
+ if(userAssets.getAvailableBalance().compareTo(buyAmt.add(orderFree))<0){
+ return ServerResponse.createByErrorMsg("订单失败,余额不足",request);
}
-
-
UserPosition userPosition = new UserPosition();
-
if (profitTarget != null && profitTarget.compareTo(new BigDecimal("0")) > 0) {
userPosition.setProfitTargetPrice(profitTarget);
}
if (stopTarget != null && stopTarget.compareTo(new BigDecimal("0")) > 0) {
userPosition.setStopTargetPrice(stopTarget);
}
-
-
userPosition.setPositionType(user.getAccountType());
userPosition.setPositionSn(KeyUtils.getUniqueKey());
userPosition.setUserId(user.getId());
@@ -180,7 +173,7 @@
userPosition.setStockSpell(stock.getStockSpell());
userPosition.setBuyOrderId(GeneratePosition.getPositionId());
userPosition.setBuyOrderTime(new Date());
- userPosition.setBuyOrderPrice(now_price);
+ userPosition.setBuyOrderPrice(nowPrice);
userPosition.setOrderDirection((buyType.intValue() == 0) ? "买涨" : "买跌");
userPosition.setOrderNum(buyNum);
if (stock.getStockPlate() != null) {
@@ -188,31 +181,21 @@
}
userPosition.setIsLock(Integer.valueOf(0));
userPosition.setOrderLever(lever);
- userPosition.setOrderTotalPrice(buy_amt);
- BigDecimal allStayFee = BigDecimal.valueOf(0);
- userPosition.setOrderStayFee(allStayFee);
- userPosition.setOrderStayDays(1);
+ userPosition.setOrderTotalPrice(buyAmt);
+ // 手续费
- BigDecimal buy_fee_amt = BigDecimal.valueOf(0);
- log.info("用户购买手续费(配资后总资金 * 百分比) = {}", buy_fee_amt);
- userPosition.setOrderFee(buy_fee_amt);
-
- BigDecimal buy_yhs_amt = BigDecimal.valueOf(0);
- log.info("用户购买印花税(配资后总资金 * 百分比) = {}", buy_yhs_amt);
- userPosition.setOrderSpread(buy_yhs_amt);
-
- BigDecimal spread_rate_amt = new BigDecimal("0");
-
- userPosition.setSpreadRatePrice(spread_rate_amt);
+ userPosition.setOrderFee(orderFree);
+ userPosition.setOrderSpread(BigDecimal.ZERO);
+ userPosition.setSpreadRatePrice(BigDecimal.ZERO);
BigDecimal profit_and_lose = new BigDecimal("0");
userPosition.setProfitAndLose(profit_and_lose);
- BigDecimal all_profit_and_lose = profit_and_lose.subtract(buy_fee_amt).subtract(buy_yhs_amt).subtract(spread_rate_amt);
- userPosition.setAllProfitAndLose(all_profit_and_lose);
+ userPosition.setAllProfitAndLose(profit_and_lose.add(orderFree));
userPosition.setOrderStayDays(Integer.valueOf(0));
- userPosition.setOrderStayFee(new BigDecimal("0"));
- this.userPositionMapper.insert(userPosition);
- iUserAssetsServices.availablebalanceChange(stock.getStockType(),user.getId(), EUserAssets.BUY,buy_amt.negate(),"","");
- return ServerResponse.createBySuccessMsg("Order successful");
+ userPosition.setOrderStayFee(BigDecimal.ZERO);
+ userPositionMapper.insert(userPosition);
+ iUserAssetsServices.availablebalanceChange(stock.getStockType(),user.getId(), EUserAssets.BUY,buyAmt.negate(),"","");
+ iUserAssetsServices.availablebalanceChange(stock.getStockType(),user.getId(), EUserAssets.HANDLING_CHARGE,orderFree,"","");
+ return ServerResponse.createBySuccessMsg("下单成功",request);
}
@@ -226,7 +209,7 @@
if (positionSn.contains("index")) {
UserIndexPosition userIndexPosition = userIndexPositionMapper.selectIndexPositionBySn(positionSn.replace("index", ""));
if (userIndexPosition == null) {
- return ServerResponse.createByErrorMsg("指数持仓单不存在");
+ return ServerResponse.createByErrorMsg("指数持仓单不存在",request);
}
if (profitTarget != null && profitTarget > 0) {
userIndexPosition.setProfitTargetPrice(BigDecimal.valueOf(profitTarget));
@@ -234,13 +217,12 @@
if (stopTarget != null && stopTarget > 0) {
userIndexPosition.setStopTargetPrice(BigDecimal.valueOf(stopTarget));
}
- log.info("指数止盈线" + profitTarget + "-------指数止损线" + stopTarget);
update = this.userIndexPositionMapper.updateByPrimaryKeySelective(userIndexPosition);
} else {
UserPosition userPosition = this.userPositionMapper.findPositionBySn(positionSn);
if (userPosition == null) {
- return ServerResponse.createByErrorMsg("持仓记录不存在");
+ return ServerResponse.createByErrorMsg("持仓记录不存在",request);
}
if (profitTarget != null && profitTarget > 0) {
userPosition.setProfitTargetPrice(BigDecimal.valueOf(profitTarget));
@@ -252,128 +234,130 @@
update = this.userPositionMapper.updateByPrimaryKeySelective(userPosition);
}
if (update > 0) {
- return ServerResponse.createBySuccessMsg("修改成功");
+ return ServerResponse.createBySuccessMsg("修改成功",request);
} else {
- return ServerResponse.createByErrorMsg("修改失败");
+ return ServerResponse.createByErrorMsg("修改失败",request);
}
}
@Transactional
- public ServerResponse sell(String positionSn, int doType) throws Exception {
- SiteSetting siteSetting = this.iSiteSettingService.getSiteSetting();
- if (siteSetting == null) {
- log.error("平仓出错,网站设置表不存在");
- return ServerResponse.createByErrorMsg("Order failed, system setting error");
- }
- SiteProduct siteProduct = iSiteProductService.getProductSetting();
+ public ServerResponse sell(String positionSn, int doType){
UserPosition userPosition = this.userPositionMapper.findPositionBySn(positionSn);
- if (doType != 0) {
-// if (userPosition.getStockGid().contains(EStockType.US.getCode())) {
-// String am_begin = siteSetting.getTransAmBeginUs();
-// String am_end = siteSetting.getTransAmEndUs();
-// String pm_begin = siteSetting.getTransPmBeginUs();
-// String pm_end = siteSetting.getTransPmEndUs();
-// boolean am_flag = BuyAndSellUtils.isTransTime(am_begin, am_end);
-// boolean pm_flag = BuyAndSellUtils.isTransTime(pm_begin, pm_end);
-// if (!am_flag && !pm_flag) {
-// return ServerResponse.createByErrorMsg("平仓失败,不在交易时段内");
-// }
-// } else {
-// String am_begin = siteSetting.getTransAmBegin();
-// String am_end = siteSetting.getTransAmEnd();
-// String pm_begin = siteSetting.getTransPmBegin();
-// String pm_end = siteSetting.getTransPmEnd();
-// boolean am_flag = BuyAndSellUtils.isTransTime(am_begin, am_end);
-// boolean pm_flag = BuyAndSellUtils.isTransTime(pm_begin, pm_end);
-// if (!am_flag && !pm_flag) {
-// return ServerResponse.createByErrorMsg("Order failed,Out of trading hours");
-// }
-// }
-// if (siteProduct.getHolidayDisplay()) {
-// return ServerResponse.createByErrorMsg("No trading on weekends or holidays!");
-// }
- //判断股票是否在可交易时间段
- Boolean b = tradingHourService.timeCheck();
- if (!b) {
- return ServerResponse.createByErrorMsg("Order failed, not in the stock trading session");
- }
-
+ BigDecimal siitteBuyFee = iSiteSettingService.getSiteSetting().getBuyFee();
+ Boolean b = tradingHourService.timeCheck(userPosition.getStockCode());
+ if (!b) {
+ return ServerResponse.createByErrorMsg("订单失败,不在交易时间之内");
}
-
-
if (userPosition == null) {
- return ServerResponse.createByErrorMsg("Closing failed, order does not exist");
+ return ServerResponse.createByErrorMsg("平仓失败,订单不存在");
}
-
User user = this.userMapper.selectById(userPosition.getUserId());
if (user == null) {
- return ServerResponse.createByErrorMsg("Closed position failed, user does not exist");
+ return ServerResponse.createByErrorMsg("平仓失败,用户不存在");
}
-
- /*实名认证开关开启*/
- if (siteProduct.getRealNameDisplay() && user.getIsLock().intValue() == 1) {
-
- return ServerResponse.createByErrorMsg("Closing failed, user is locked");
-
- }
-
-
if (userPosition.getSellOrderId() != null) {
- return ServerResponse.createByErrorMsg("Closing failed, this order is closed");
+ return ServerResponse.createByErrorMsg("平仓失败, 订单已平仓");
}
-
if (1 == userPosition.getIsLock().intValue()) {
return ServerResponse.createByErrorMsg("this order is closed " + userPosition.getLockMsg());
}
- BigDecimal now_price;
Stock stock = stockMapper.selectOne(new QueryWrapper<Stock>().eq("stock_code", userPosition.getStockCode()));
- //股票卖出的 价格 数据源
-
- StockListVO stockListVO = StockApi.getStockRealTime(stock);
- now_price = new BigDecimal(stockListVO.getNowPrice());
- if (stockListVO.getNowPrice() == null) {
- return ServerResponse.createByErrorMsg("Failed to close position, failed to obtain stock information");
+ BigDecimal nowPrice = priceServices.getNowPrice(userPosition.getStockCode());
+ if (nowPrice.compareTo(new BigDecimal("0")) != 1) {
+ return ServerResponse.createByErrorMsg("报价0,平仓失败,请稍后再试");
}
- if (now_price.compareTo(new BigDecimal("0")) != 1) {
- log.error("股票 = {} 收到报价 = {}", userPosition.getStockName(), now_price);
- return ServerResponse.createByErrorMsg("Quote 0, closing failed, please try again later");
- }
-
userPosition.setSellOrderId(GeneratePosition.getPositionId());
- userPosition.setSellOrderPrice(now_price);
+ userPosition.setSellOrderPrice(nowPrice);
userPosition.setSellOrderTime(new Date());
+
+ BigDecimal sellOrderTotel = nowPrice.multiply(new BigDecimal(userPosition.getOrderNum()));
+ BigDecimal xsPrice = sellOrderTotel.multiply(siitteBuyFee);
userPositionMapper.updateById(userPosition);
- userAssetsServices.availablebalanceChange(stock.getStockType(),userPosition.getUserId(),EUserAssets.CLOSE_POSITION_RETURN_SECURITY_DEPOSIT,
+ userAssetsServices.availablebalanceChange(stock.getStockType(),
+ userPosition.getUserId(),EUserAssets.CLOSE_POSITION_RETURN_SECURITY_DEPOSIT,
userPosition.getOrderTotalPrice(),"","");
+ userAssetsServices.availablebalanceChange(stock.getStockType(),
+ userPosition.getUserId(),EUserAssets.HANDLING_CHARGE,
+ xsPrice,"","");
+
+ PositionProfitVO profitVO = UserPointUtil.getPositionProfitVO(userPosition,priceServices.getNowPrice(userPosition.getStockCode()));
userAssetsServices.availablebalanceChange(stock.getStockType(),userPosition.getUserId(),EUserAssets.CLOSE_POSITION,
- userPosition.getProfitAndLose() ,"","");
- return ServerResponse.createBySuccessMsg("Closed position successfully!");
+ profitVO.getAllProfitAndLose() ,"","");
+ return ServerResponse.createBySuccessMsg("平仓成功!");
+ }
+
+
+ @Transactional
+ public ServerResponse sell(String positionSn, int doType,HttpServletRequest request){
+ UserPosition userPosition = this.userPositionMapper.findPositionBySn(positionSn);
+ BigDecimal siitteBuyFee = iSiteSettingService.getSiteSetting().getBuyFee();
+ Boolean b = tradingHourService.timeCheck(userPosition.getStockCode());
+ if (!b) {
+ return ServerResponse.createByErrorMsg("订单失败,不在交易时间之内",request);
+ }
+ if (userPosition == null) {
+ return ServerResponse.createByErrorMsg("平仓失败,订单不存在",request);
+ }
+ User user = this.userMapper.selectById(userPosition.getUserId());
+ if (user == null) {
+ return ServerResponse.createByErrorMsg("平仓失败,用户不存在",request);
+ }
+ if (userPosition.getSellOrderId() != null) {
+ return ServerResponse.createByErrorMsg("平仓失败, 订单已平仓",request);
+ }
+ if (1 == userPosition.getIsLock().intValue()) {
+ return ServerResponse.createByErrorMsg("this order is closed " + userPosition.getLockMsg());
+ }
+ Stock stock = stockMapper.selectOne(new QueryWrapper<Stock>().eq("stock_code", userPosition.getStockCode()));
+ BigDecimal nowPrice = priceServices.getNowPrice(userPosition.getStockCode());
+ if (nowPrice.compareTo(new BigDecimal("0")) != 1) {
+ return ServerResponse.createByErrorMsg("报价0,平仓失败,请稍后再试",request);
+ }
+ userPosition.setSellOrderId(GeneratePosition.getPositionId());
+ userPosition.setSellOrderPrice(nowPrice);
+ userPosition.setSellOrderTime(new Date());
+
+ BigDecimal sellOrderTotel = nowPrice.multiply(new BigDecimal(userPosition.getOrderNum()));
+ BigDecimal xsPrice = sellOrderTotel.multiply(siitteBuyFee);
+ userPositionMapper.updateById(userPosition);
+ userAssetsServices.availablebalanceChange(stock.getStockType(),
+ userPosition.getUserId(),EUserAssets.CLOSE_POSITION_RETURN_SECURITY_DEPOSIT,
+ userPosition.getOrderTotalPrice(),"","");
+ userAssetsServices.availablebalanceChange(stock.getStockType(),
+ userPosition.getUserId(),EUserAssets.HANDLING_CHARGE,
+ xsPrice,"","");
+
+ PositionProfitVO profitVO = UserPointUtil.getPositionProfitVO(userPosition,priceServices.getNowPrice(userPosition.getStockCode()));
+ userAssetsServices.availablebalanceChange(stock.getStockType(),userPosition.getUserId(),EUserAssets.CLOSE_POSITION,
+ profitVO.getAllProfitAndLose() ,"","");
+ return ServerResponse.createBySuccessMsg("平仓成功!",request);
}
@Transactional
@Override
public ServerResponse allSell(HttpServletRequest request,String stockType) throws Exception{
//判断股票是否在可交易时间段
- Boolean b = tradingHourService.timeCheck();
- if (!b) {
- return ServerResponse.createByErrorMsg("Order failed, not in the stock trading session");
- }
User user = iUserService.getCurrentUser(request);
- if(user == null){
- return ServerResponse.createByErrorMsg("Please login");
- }
QueryWrapper<UserPosition> queryWrapper = new QueryWrapper<>();
- queryWrapper.eq("user_id",user.getId());
- queryWrapper.eq("stock_gid",stockType);
- queryWrapper.isNull("sell_order_id");
+ if(stockType.equals(EStockType.US.getCode())){
+ queryWrapper.eq("user_id",user.getId());
+ queryWrapper.isNull("sell_order_id");
+ queryWrapper.or().eq("stock_gid",EStockType.US.getCode());
+
+ }else{
+ queryWrapper.eq("user_id",user.getId());
+ queryWrapper.eq("stock_gid",stockType);
+ queryWrapper.isNull("sell_order_id");
+ }
+
List<UserPosition> userPositionList = userPositionMapper.selectList(queryWrapper);
for (int i = 0; i < userPositionList.size(); i++) {
sell(userPositionList.get(i).getPositionSn(),0);
}
- return ServerResponse.createBySuccessMsg("Closed position successfully!");
+ return ServerResponse.createBySuccessMsg("平仓成功!");
}
//用户追加保证金操作
@@ -519,23 +503,33 @@
return ServerResponse.createByErrorMsg("删除失败");
}
+ @Override
+ public UserPositionVO findByPostionSn(String positionSn) {
+ UserPosition userPosition = userPositionMapper.selectOne(new QueryWrapper<UserPosition>().eq("position_sn",positionSn));
+ if(userPosition == null){
+ return null;
+ }
+
+ return UserPointUtil.assembleUserPositionVO(userPosition,priceServices.getNowPrice(userPosition.getStockCode()));
+ }
+
public ServerResponse findMyPositionByCodeAndSpell(String stockCode, String stockSpell,
Integer state, HttpServletRequest request,
int pageNum, int pageSize, String stockType) {
User user = this.iUserService.getCurrentUser(request);
PageHelper.startPage(pageNum, pageSize);
-
-
- List<UserPosition> userPositions = this.userPositionMapper.
+ List<UserPosition> userPositions;
+ userPositions = userPositionMapper.
findMyPositionByCodeAndSpell(user.getId(),
stockCode, stockSpell,
state, stockType);
+
List<UserPositionVO> userPositionVOS = Lists.newArrayList();
if (userPositions.size() > 0) {
for (UserPosition position : userPositions) {
- UserPositionVO userPositionVO = assembleUserPositionVO(position);
+ UserPositionVO userPositionVO = UserPointUtil.assembleUserPositionVO(position,priceServices.getNowPrice(position.getStockCode()));
userPositionVOS.add(userPositionVO);
}
}
@@ -552,33 +546,10 @@
BigDecimal allProfitAndLose = new BigDecimal("0");
BigDecimal allFreezAmt = new BigDecimal("0");
for (UserPosition position : userPositions) {
- Stock stock = stockMapper.selectOne(new QueryWrapper<Stock>().eq("stock_code", position.getStockCode()));
- StockListVO stockListVO = StockApi.getStockRealTime(
- stock);
- if (stockListVO.getNowPrice() == null) {
- stockListVO.setNowPrice("0");
- }
- BigDecimal nowPrice = new BigDecimal(stockListVO.getNowPrice());
- if (nowPrice.compareTo(new BigDecimal("0")) != 0) {
- BigDecimal buyPrice = position.getBuyOrderPrice();
- BigDecimal subPrice = nowPrice.subtract(buyPrice);
- BigDecimal profit_and_lose = subPrice.multiply(new BigDecimal(position.getOrderNum().intValue()));
- if ("买跌".equals(position.getOrderDirection())) {
- profit_and_lose = profit_and_lose.negate();
- }
- BigDecimal total_fee = position.getOrderFee().add(position.getOrderSpread()).add(position.getOrderStayFee());
- BigDecimal position_profit = profit_and_lose.subtract(total_fee);
- allProfitAndLose = allProfitAndLose.add(position_profit);
- BigDecimal position_freez = position.getOrderTotalPrice().divide(new BigDecimal(position.getOrderLever().intValue()), 2, 4);
- allFreezAmt = allFreezAmt.add(position_freez).add(position.getMarginAdd());
- continue;
- }
- log.info("查询所有持仓单的总盈亏,现价返回0,当前为集合竞价");
- }
- //加上分仓交易保证金
- List<FundsApply> fundsApplyList = fundsApplyMapper.getUserMarginList(userId);
- for (FundsApply fundsApply : fundsApplyList) {
- allFreezAmt = allFreezAmt.add(fundsApply.getMargin());
+ BigDecimal nowPrice = priceServices.getNowPrice(position.getStockCode());
+ PositionProfitVO positionProfitVO = UserPointUtil.getPositionProfitVO(position,nowPrice);
+ allProfitAndLose.add(positionProfitVO.getAllProfitAndLose());
+ allFreezAmt.add(positionProfitVO.getProfitAndLose());
}
@@ -590,41 +561,15 @@
@Override
public PositionVO findUserPositionAllProfitAndLose(Integer userId, String stockType) {
- List<UserPosition> userPositions = this.userPositionMapper.findPositionByUserIdAndSellId(userId, stockType);
-
+ List<UserPosition> userPositions = userPositionMapper.findPositionByUserIdAndSellId(userId, stockType);
BigDecimal allProfitAndLose = new BigDecimal("0");
BigDecimal allFreezAmt = new BigDecimal("0");
for (UserPosition position : userPositions) {
- Stock stock = stockMapper.selectOne(new QueryWrapper<Stock>().eq("stock_code", position.getStockCode()));
- StockListVO stockListVO = StockApi.getStockRealTime(
- stock);
- if (stockListVO.getNowPrice() == null) {
- stockListVO.setNowPrice("0");
- }
- BigDecimal nowPrice = new BigDecimal(stockListVO.getNowPrice());
- if (nowPrice.compareTo(new BigDecimal("0")) != 0) {
- BigDecimal buyPrice = position.getBuyOrderPrice();
- BigDecimal subPrice = nowPrice.subtract(buyPrice);
- BigDecimal profit_and_lose = subPrice.multiply(new BigDecimal(position.getOrderNum().intValue()));
- if ("买跌".equals(position.getOrderDirection())) {
- profit_and_lose = profit_and_lose.negate();
- }
- BigDecimal total_fee = position.getOrderFee().add(position.getOrderSpread()).add(position.getOrderStayFee());
- BigDecimal position_profit = profit_and_lose.subtract(total_fee);
- allProfitAndLose = allProfitAndLose.add(position_profit);
- BigDecimal position_freez = position.getOrderTotalPrice().divide(new BigDecimal(position.getOrderLever().intValue()), 2, 4);
- allFreezAmt = allFreezAmt.add(position_freez).add(position.getMarginAdd());
- continue;
- }
- log.info("查询所有持仓单的总盈亏,现价返回0,当前为集合竞价");
+ BigDecimal nowPrice = priceServices.getNowPrice(position.getStockCode());
+ PositionProfitVO positionProfitVO = UserPointUtil.getPositionProfitVO(position,nowPrice);
+ allProfitAndLose.add(positionProfitVO.getAllProfitAndLose());
+ allFreezAmt.add(positionProfitVO.getProfitAndLose());
}
- //加上分仓交易保证金
- List<FundsApply> fundsApplyList = fundsApplyMapper.getUserMarginList(userId);
- for (FundsApply fundsApply : fundsApplyList) {
- allFreezAmt = allFreezAmt.add(fundsApply.getMargin());
- }
-
-
PositionVO positionVO = new PositionVO();
positionVO.setAllProfitAndLose(allProfitAndLose);
positionVO.setAllFreezAmt(allFreezAmt);
@@ -1081,7 +1026,7 @@
adminPositionVO.setStockPlate(position.getStockPlate());
- PositionProfitVO positionProfitVO = getPositionProfitVO(position);
+ PositionProfitVO positionProfitVO = UserPointUtil.getPositionProfitVO(position,priceServices.getNowPrice(position.getStockCode()));
adminPositionVO.setProfitAndLose(positionProfitVO.getProfitAndLose());
adminPositionVO.setAllProfitAndLose(positionProfitVO.getAllProfitAndLose());
adminPositionVO.setNow_price(positionProfitVO.getNowPrice());
@@ -1123,7 +1068,7 @@
agentPositionVO.setStockPlate(position.getStockPlate());
- PositionProfitVO positionProfitVO = getPositionProfitVO(position);
+ PositionProfitVO positionProfitVO = UserPointUtil.getPositionProfitVO(position,priceServices.getNowPrice(position.getStockCode()));
agentPositionVO.setProfitAndLose(positionProfitVO.getProfitAndLose());
agentPositionVO.setAllProfitAndLose(positionProfitVO.getAllProfitAndLose());
agentPositionVO.setNow_price(positionProfitVO.getNowPrice());
@@ -1132,83 +1077,8 @@
return agentPositionVO;
}
- private UserPositionVO assembleUserPositionVO(UserPosition position) {
- UserPositionVO userPositionVO = new UserPositionVO();
- userPositionVO.setId(position.getId());
- userPositionVO.setPositionType(position.getPositionType());
- userPositionVO.setPositionSn(position.getPositionSn());
- userPositionVO.setUserId(position.getUserId());
- userPositionVO.setNickName(position.getNickName());
- userPositionVO.setAgentId(position.getAgentId());
- userPositionVO.setStockName(position.getStockName());
- userPositionVO.setStockCode(position.getStockCode());
- userPositionVO.setStockGid(position.getStockGid());
- userPositionVO.setStockSpell(position.getStockSpell());
- userPositionVO.setBuyOrderId(position.getBuyOrderId());
- userPositionVO.setBuyOrderTime(position.getBuyOrderTime());
- userPositionVO.setBuyOrderPrice(position.getBuyOrderPrice());
- userPositionVO.setSellOrderId(position.getSellOrderId());
- userPositionVO.setSellOrderTime(position.getSellOrderTime());
- userPositionVO.setSellOrderPrice(position.getSellOrderPrice());
- userPositionVO.setProfitTargetPrice(position.getProfitTargetPrice());
- userPositionVO.setStopTargetPrice(position.getStopTargetPrice());
- userPositionVO.setOrderDirection(position.getOrderDirection());
- userPositionVO.setOrderNum(position.getOrderNum());
- userPositionVO.setOrderLever(position.getOrderLever());
- userPositionVO.setOrderTotalPrice(position.getOrderTotalPrice());
- userPositionVO.setOrderFee(position.getOrderFee());
- userPositionVO.setOrderSpread(position.getOrderSpread());
- userPositionVO.setOrderStayFee(position.getOrderStayFee());
- userPositionVO.setOrderStayDays(position.getOrderStayDays());
- userPositionVO.setMarginAdd(position.getMarginAdd());
- userPositionVO.setStockPlate(position.getStockPlate());
- userPositionVO.setSpreadRatePrice(position.getSpreadRatePrice());
-
- PositionProfitVO positionProfitVO = getPositionProfitVO(position);
- userPositionVO.setProfitAndLose(positionProfitVO.getProfitAndLose());
- userPositionVO.setAllProfitAndLose(positionProfitVO.getAllProfitAndLose());
- userPositionVO.setNow_price(positionProfitVO.getNowPrice());
- return userPositionVO;
- }
-
- public PositionProfitVO getPositionProfitVO(UserPosition position) {
- BigDecimal profitAndLose = new BigDecimal("0");
- BigDecimal allProfitAndLose = new BigDecimal("0");
- String nowPrice = "";
-
- if (position.getSellOrderId() != null) {
-
- BigDecimal subPrice = position.getSellOrderPrice().subtract(position.getBuyOrderPrice());
- profitAndLose = subPrice.multiply(new BigDecimal(position.getOrderNum().intValue()));
- if ("买跌".equals(position.getOrderDirection())) {
- profitAndLose = profitAndLose.negate();
- }
- allProfitAndLose = profitAndLose.subtract(position.getOrderFee()).subtract(position.getOrderSpread()).subtract(position.getOrderStayFee()).subtract(position.getSpreadRatePrice());
- } else {
- StockListVO stockListVO = new StockListVO();
- StockCoin stockCoin = new StockCoin();
- Stock stock = stockMapper.selectOne(new QueryWrapper<Stock>().eq("stock_code", position.getStockCode()));
- stockListVO = StockApi.getStockRealTime(stock);
- nowPrice = stockListVO.getNowPrice();
- if (nowPrice == null) {
- nowPrice = String.valueOf(0);
- }
- BigDecimal subPrice = (new BigDecimal(nowPrice)).subtract(position.getBuyOrderPrice());
- profitAndLose = subPrice.multiply(new BigDecimal(position.getOrderNum().intValue()));
- if ("买跌".equals(position.getOrderDirection())) {
- profitAndLose = profitAndLose.negate();
- }
- //总盈亏= 浮动盈亏 – 手续费 – 印花税 – 留仓费 – 点差费
- allProfitAndLose = profitAndLose.subtract(position.getOrderFee()).subtract(position.getOrderSpread()).subtract(position.getOrderStayFee()).subtract(position.getSpreadRatePrice());
- }
- PositionProfitVO positionProfitVO = new PositionProfitVO();
- positionProfitVO.setProfitAndLose(profitAndLose);
- positionProfitVO.setAllProfitAndLose(allProfitAndLose);
- positionProfitVO.setNowPrice(nowPrice);
- return positionProfitVO;
- }
/*股票入仓最新top列表*/
@@ -1217,7 +1087,7 @@
List<UserPositionVO> userPositionVOS = Lists.newArrayList();
if (userPositions.size() > 0) {
for (UserPosition position : userPositions) {
- UserPositionVO userPositionVO = assembleUserPositionVO(position);
+ UserPositionVO userPositionVO = UserPointUtil.assembleUserPositionVO(position,priceServices.getNowPrice(position.getStockCode()));
userPositionVOS.add(userPositionVO);
}
}
@@ -1234,7 +1104,7 @@
List<UserPositionVO> userPositionVOS = Lists.newArrayList();
UserPositionVO userPositionVO = null;
if (position != null) {
- userPositionVO = assembleUserPositionVO(position);
+ userPositionVO = UserPointUtil.assembleUserPositionVO(position,priceServices.getNowPrice(position.getStockCode()));
}
userPositionVOS.add(userPositionVO);
diff --git a/src/main/java/com/nq/service/impl/UserRechargeServiceImpl.java b/src/main/java/com/nq/service/impl/UserRechargeServiceImpl.java
index 280d90e..508966a 100644
--- a/src/main/java/com/nq/service/impl/UserRechargeServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserRechargeServiceImpl.java
@@ -2,6 +2,7 @@
import com.nq.dao.*;
+import com.nq.enums.EStockType;
import com.nq.enums.EUserAssets;
import com.nq.pojo.*;
import com.nq.service.*;
@@ -221,13 +222,9 @@
for (int i = 0; i <userRecharges.size() ; i++) {
SitePay s = sitePayMapper.selectById(userRecharges.get(i).getPayId());
- if(s.getAssetsType().equals("US")){
- userRecharges.get(i).setAssetsType("$");
- userRecharges.get(i).setChannelName("USD");
- }else{
- userRecharges.get(i).setAssetsType("RM");
- userRecharges.get(i).setChannelName("MYR");
- }
+
+ userRecharges.get(i).setAssetsType(EStockType.getEStockTypeByCode(s.getAssetsType()).getSymbol1());
+ userRecharges.get(i).setChannelName(EStockType.getEStockTypeByCode(s.getAssetsType()).getSymbol());
}
return ServerResponse.createBySuccess(pageInfo);
@@ -278,6 +275,14 @@
List<UserRecharge> userRecharges = this.userRechargeMapper.listByAdmin(agentId, userId, realName, state, begin_time, end_time);
+ for (int i = 0; i < userRecharges.size(); i++) {
+ UserRecharge u =userRecharges.get(i);
+ User user = userMapper.selectById(u.getUserId());
+ if(user != null){
+ u.setUserPhone(user.getPhone());
+ }
+
+ }
PageInfo pageInfo = new PageInfo(userRecharges);
return ServerResponse.createBySuccess(pageInfo);
diff --git a/src/main/java/com/nq/service/impl/UserServiceImpl.java b/src/main/java/com/nq/service/impl/UserServiceImpl.java
index 4668440..a3533c6 100644
--- a/src/main/java/com/nq/service/impl/UserServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserServiceImpl.java
@@ -67,6 +67,9 @@
IUserService userService;
@Autowired
+ IRateServices rateServices;
+
+ @Autowired
IUserAssetsServices userAssetsServices;
@Autowired
@@ -101,7 +104,7 @@
MoneyLogMapper mapper;
@Resource
- UserPositionMapper userPositionMapper;
+ IUserPositionService userPositionService;
@Resource
SiteAmtTransLogMapper siteAmtTransLogMapper;
@Autowired
@@ -116,10 +119,13 @@
+
+
+
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);
}
@@ -128,22 +134,22 @@
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.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);
}
@@ -172,35 +178,32 @@
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.HK.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;
@@ -229,18 +232,15 @@
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());
@@ -253,47 +253,30 @@
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);
}
@@ -312,24 +295,21 @@
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);
}
@@ -394,18 +374,16 @@
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);
@@ -416,9 +394,9 @@
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);
}
@@ -457,116 +435,14 @@
@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;
/**
* 浮动盈亏
* */
@@ -602,65 +478,88 @@
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());
- }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 rate = rateServices.currencyRate(
+ EStockType.getEStockTypeByCode(userAssets.getAccectType()),EStockType.US);
- 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 availableBalanceUSD = amt;
+ if(amt.compareTo(BigDecimal.ZERO)>0){
+ availableBalanceUSD = amt.multiply(rate);
+ }
+
+ 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 = profitAndLose;
+ if(profitAndLose.compareTo(BigDecimal.ZERO)>0){
+ profitAndLossUSD =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());
+
+ 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);
@@ -669,23 +568,16 @@
}
@Override
- public ServerResponse transfer(String fromType, String toType, String amt,HttpServletRequest paramHttpServletRequest) {
-
- User user = userService.getCurrentUser(paramHttpServletRequest);
+ 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);
}
- SiteSetting siteSetting = iSiteSettingService.getSiteSetting();
- userAssetsServices.availablebalanceChange(fromType,user.getId(), EUserAssets.TRANSFER,amtBig.negate(),"","");
-
- if(fromType.equals(EStockType.MAS.getCode())){
- amtBig = amtBig.divide(siteSetting.getExchangeRate(), BigDecimal.ROUND_CEILING);
- }else{
- amtBig = amtBig.multiply(siteSetting.getExchangeRate());
- }
- 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();
}
@@ -1013,6 +905,9 @@
user.setAuthMsg(authMsg);
}
+ if(state == 2){
+ user.setIsLock(0);
+ }
user.setIsActive(state);
int updateCount = this.userMapper.updateById(user);
@@ -1134,16 +1029,6 @@
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;
}
@@ -1175,7 +1060,6 @@
@Override
public ServerResponse queryMyOption(String code, HttpServletRequest request) {
User user = getCurrentUser(request);
-
return this.iStockOptionService.isOption(user.getId(), code);
}
diff --git a/src/main/java/com/nq/service/impl/UserStockSubscribeServiceImpl.java b/src/main/java/com/nq/service/impl/UserStockSubscribeServiceImpl.java
index 0fb782a..cb37e3b 100644
--- a/src/main/java/com/nq/service/impl/UserStockSubscribeServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserStockSubscribeServiceImpl.java
@@ -42,7 +42,7 @@
@Resource
private UserStockSubscribeMapper userStockSubscribeMapper;
- @Autowired
+ @Resource
UserMapper userMapper;
@Autowired
@@ -68,21 +68,18 @@
public ServerResponse insert(UserStockSubscribe model, HttpServletRequest request) throws Exception {
int ret = 0;
if (model == null) {
- return ServerResponse.createByErrorMsg("Parameter error");
+ return ServerResponse.createByErrorMsg("参数错误",request);
}
String property = PropertiesUtil.getProperty("user.cookie.name");
String header = request.getHeader(property);
if (header != null) {
- User user = this.iUserService.getCurrentRefreshUser(request);
- if (user == null){
- return ServerResponse.createBySuccessMsg("請先登錄");
- }
+ User user = iUserService.getCurrentRefreshUser(request);
if (model.getNewCode() != null) {
StockSubscribe stockSubscribe = stockSubscribeMapper.selectOne(new QueryWrapper<StockSubscribe>().eq("code", model.getNewCode()));
//实名认证开关
SiteProduct siteProduct = iSiteProductService.getProductSetting();
if (siteProduct.getRealNameDisplay() && (StringUtils.isBlank(user.getRealName()) || StringUtils.isBlank(user.getIdCard()))) {
- return ServerResponse.createByErrorMsg("Order failed, please first real name authentication");
+ return ServerResponse.createByErrorMsg("订单失败,请先实名认证",request);
}
// //判断休息日不能买入
// if (siteProduct.getHolidayDisplay()) {
@@ -91,47 +88,27 @@
//判断股票是否在可交易时间段
Boolean b = tradingHourService.timeCheck();
if (b) {
- return ServerResponse.createByErrorMsg("Order failed, not in the stock trading session");
+ return ServerResponse.createByErrorMsg("订单失败,不在股票交易时段",request);
}
//重复申购限制
UserStockSubscribe userStockSubscribe = userStockSubscribeMapper.selectOne(new QueryWrapper<UserStockSubscribe>().eq("new_code", model.getNewCode()).eq("user_id", user.getId()));
if (userStockSubscribe != null) {
- return ServerResponse.createByErrorMsg("请勿重复申购");
+ return ServerResponse.createByErrorMsg("请勿重复申购",request);
}
if (siteProduct.getRealNameDisplay() && user.getIsLock().intValue() == 1) {
- return ServerResponse.createByErrorMsg("Order failed, account has been locked");
+ return ServerResponse.createByErrorMsg("订单失败,帐户已被锁定",request);
}
if (stockSubscribe == null) {
- return ServerResponse.createByErrorMsg("The new stock code does not exist");
+ return ServerResponse.createByErrorMsg("新的股票代码不存在",request);
}
-// //时间判定当前时间是否是申购时间
-// SiteSetting siteSetting = this.iSiteSettingService.getSiteSetting();
-// if (siteSetting == null) {
-// log.error("下单出错,网站设置表不存在");
-// return ServerResponse.createByErrorMsg("Order failed, system setting error");
-// }
-// String am_begin = siteSetting.getTransAmBegin();
-// String am_end = siteSetting.getTransAmEnd();
-// String pm_begin = siteSetting.getTransPmBegin();
-// String pm_end = siteSetting.getTransPmEnd();
-// boolean am_flag = BuyAndSellUtils.isTransTime(am_begin, am_end);
-// boolean pm_flag = BuyAndSellUtils.isTransTime(pm_begin, pm_end);
-// log.info("是否在上午交易时间 = {} 是否在下午交易时间 = {}", Boolean.valueOf(am_flag), Boolean.valueOf(pm_flag));
-// if (!am_flag && !pm_flag) {
-// return ServerResponse.createByErrorMsg("Application failed, not in the trading session");
-// }
-// //时间判定当前时间是否是申购时间
-// if (stockSubscribe.getSubscribeTime().getTime() < System.currentTimeMillis()) {
-// return ServerResponse.createByErrorMsg("The application time has passed");
-// }
-
if (model.getApplyNums() == null || model.getApplyNums() > stockSubscribe.getOrderNumber()|| model.getApplyNums() < 500) {
- return ServerResponse.createByErrorMsg("The minimum purchase quantity is 500, the maximum is large" + stockSubscribe.getOrderNumber());
+ return ServerResponse.createByErrorMsg("最小起订量是500,最大值"
+ + stockSubscribe.getOrderNumber(),request);
}
if (stockSubscribe.getType() == 2) {
int u = userMapper.updateById(user);
if (u <= 0) {
- return ServerResponse.createByErrorMsg("Application failed due to unknown reasons");
+ return ServerResponse.createByErrorMsg("由于未知原因,申请失败",request);
}
}
model.setUserId(user.getId());
@@ -149,12 +126,12 @@
ret = userStockSubscribeMapper.insert(model);
if (ret > 0) {
- return ServerResponse.createBySuccessMsg("Successful application");
+ return ServerResponse.createBySuccessMsg("申购成功",request);
} else {
- return ServerResponse.createByErrorMsg("Application failure");
+ return ServerResponse.createByErrorMsg("申购失败",request);
}
}
- return ServerResponse.createByErrorMsg("Not logged in");
+ return ServerResponse.createByErrorMsg("申购失败",request);
}
@Override
public int update(UserStockSubscribe model) {
@@ -356,11 +333,7 @@
String property = PropertiesUtil.getProperty("user.cookie.name");
String header = request.getHeader(property);
if (header != null) {
- String userJson = RedisShardedPoolUtils.get(header);
- User user = (User) JsonUtil.string2Obj(userJson, User.class);
- if (user == null) {
- return ServerResponse.createByErrorMsg("User not logged in");
- }
+ User user = iUserService.getCurrentRefreshUser(request);
List<UserStockSubscribe> userStockSubscribe = null;
if (type==null||type.equals("")){
userStockSubscribe = this.userStockSubscribeMapper.selectList(new QueryWrapper<>(new UserStockSubscribe()).eq("user_id", user.getId()).orderByDesc("add_time"));
@@ -375,22 +348,9 @@
list.add(userStockSubscribe1);
}
}
-// PageInfo pageInfo = new PageInfo();
-// pageInfo.setList(userStockSubscribe);
-// GoogleTranslateUtil transan = new GoogleTranslateUtil();
-// //list转String
-// String json = JsonUtil.obj2String(list);
-// String translate;
-// try {
-// translate = transan.translate("zh", "en", json);
-// } catch (Exception e) {
-// throw new RuntimeException(e);
-// }
-// //String转list
-// List<UserStockSubscribe> list1 = JsonUtil.string2Obj(translate, List.class, UserStockSubscribe.class);
return ServerResponse.createBySuccess(list);
}
- return ServerResponse.createByErrorMsg("Please log in first");
+ return ServerResponse.createByErrorMsg("请先登录",request);
}
/**
* 新股申购-用户提交金额
@@ -402,55 +362,47 @@
String property = PropertiesUtil.getProperty("user.cookie.name");
String header = request.getHeader(property);
if (header != null) {
- String userJson = RedisShardedPoolUtils.get(header);
- User user = (User) JsonUtil.string2Obj(userJson, User.class);
- if (user == null) {
- return ServerResponse.createByErrorMsg("User not logged in");
- }
+ User user = iUserService.getCurrentRefreshUser(request);
if(id == null){
- return ServerResponse.createByErrorMsg("Parameter error");
+ return ServerResponse.createByErrorMsg("参数错误",request);
}
UserStockSubscribe userStockSubscribe = userStockSubscribeMapper.load(id);
log.info("userStockSubscribe:{}",userStockSubscribe);
if (userStockSubscribe != null && userStockSubscribe.getUserId().equals(user.getId())) {
StockSubscribe stockSubscribe = stockSubscribeMapper.selectOne(new QueryWrapper<>(new StockSubscribe()).eq("code", userStockSubscribe.getNewCode()));
if(userStockSubscribe.getType()== 2 ){
- return ServerResponse.createByErrorMsg("No payment is required for offline placement");
+ return ServerResponse.createByErrorMsg("未中签,无需支付",request);
}
//判断时间
if (stockSubscribe.getSubscriptionTime().getTime() < System.currentTimeMillis()) {
- return ServerResponse.createByErrorMsg("The subscription time has passed");
+ return ServerResponse.createByErrorMsg("不在认缴时间之内",request);
}
if (userStockSubscribe.getStatus() == 3) {
userStockSubscribe.setSubmitTime(DateTimeUtil.getCurrentDate());
userStockSubscribe.setStatus(4);
User user1 = userMapper.selectById(userStockSubscribe.getUserId());
-// log.info("user" + user1);
-// log.info("原可用资金"+user1.getEnableAmt());
-// log.info("enableAmt" + enableAmt);
-// log.info("可用资金" + user1.getEnableAmt()+"保证金"+userStockSubscribe.getBond()+"原djzj"+user1.getDjzj());
ret = userMapper.updateById(user1);
}
else {
- return ServerResponse.createByErrorMsg("There is no fee for unsuccessful applicants");
+ return ServerResponse.createByErrorMsg("不成功的申请者不收取任何费用",request);
}
} else {
- return ServerResponse.createByErrorMsg("New share subscription order does not exist!");
+ return ServerResponse.createByErrorMsg("新股认购订单不存在!",request);
}
if (ret > 0) {
ret = userStockSubscribeMapper.update1(userStockSubscribe);
if (ret > 0) {
- return ServerResponse.createBySuccessMsg("Successful operation");
+ return ServerResponse.createBySuccessMsg("成功操作",request);
} else {
- return ServerResponse.createByErrorMsg("Operation failure");
+ return ServerResponse.createByErrorMsg("失败操作",request);
}
}else {
- return ServerResponse.createByErrorMsg("Deduction failure");
+ return ServerResponse.createByErrorMsg("扣除失败",request);
}
}
- return ServerResponse.createByErrorMsg("Please log in first");
+ return ServerResponse.createByErrorMsg("请先登录",request);
}
/**
* 新股申购-删除
diff --git a/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java b/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
index 63ae877..64192e0 100644
--- a/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
@@ -100,66 +100,35 @@
}
if (w.equals(with_Pwd)) {
if (user.getIsLogin().intValue() == 1) {
- return ServerResponse.createByErrorMsg("User locked");
+ return ServerResponse.createByErrorMsg("用户被锁定",request);
}
-
-
-// List<UserPosition> userPositions = this.iUserPositionService.findPositionByUserIdAndSellIdIsNull(user.getId());
-//
-// if (userPositions.size() > 0) {
-// return ServerResponse.createByErrorMsg("There is no deposit with warehouse receipt");
-//
-// }
-
-
if (StringUtils.isBlank(user.getRealName()) || StringUtils.isBlank(user.getIdCard())) {
-
- return ServerResponse.createByErrorMsg("No real name authentication");
-
+ return ServerResponse.createByErrorMsg("未实名认证",request);
}
-
UserBank userBank = this.iUserBankService.findUserBankByUserId(user.getId());
-
if (userBank == null) {
-
- return ServerResponse.createByErrorMsg("No bank card added");
-
+ return ServerResponse.createByErrorMsg("未绑定银行卡",request);
}
-
-
if (user.getAccountType().intValue() == 1) {
-
- return ServerResponse.createByErrorMsg("Analog users cannot withdraw funds");
-
+ return ServerResponse.createByErrorMsg("模拟用户无法提取资金",request);
}
-
-
SiteSetting siteSetting = this.iSiteSettingService.getSiteSetting();
-
if ((new BigDecimal(amt)).compareTo(new BigDecimal(siteSetting.getWithMinAmt().intValue())) == -1) {
-
- return ServerResponse.createByErrorMsg("Analog users cannot withdraw funds" + siteSetting.getWithMinAmt());
-
+ return ServerResponse.createByErrorMsg("Analog users cannot withdraw funds" + siteSetting.getWithMinAmt(),request);
}
-
-
int with_time_begin = siteSetting.getWithTimeBegin().intValue();
-
int with_time_end = siteSetting.getWithTimeEnd().intValue();
-
SiteProduct siteProduct = iSiteProductService.getProductSetting();
if(siteProduct.getHolidayDisplay()){
- return ServerResponse.createByErrorMsg("Withdrawals are not allowed on weekends or holidays!");
+ return ServerResponse.createByErrorMsg("周末或节假日不允许提款!",request);
}
-
if (!WithDrawUtils.checkIsWithTime(with_time_begin, with_time_end)) {
- return ServerResponse.createByErrorMsg("Withdrawal failed. Withdrawal time is at" + with_time_begin + "point - " + with_time_end + "point among");
+ return ServerResponse.createByErrorMsg("撤销失败了。提现时间为" + with_time_begin + "点 - " + with_time_end + "点之间的",request);
}
-
BigDecimal useAmt = iUserAssetsServices.getAvailableBalance(accsetType,user.getId());
BigDecimal tAmt = new BigDecimal(amt);
if(useAmt.compareTo(tAmt)<0){
- return ServerResponse.createByErrorMsg("Insufficient balance");
+ return ServerResponse.createByErrorMsg("余额不足",request);
}
iUserAssetsServices.availablebalanceChange(accsetType,user.getId(), EUserAssets.WITHDRAW,tAmt.negate(),"","");
UserWithdraw userWithdraw = new UserWithdraw();
@@ -177,16 +146,14 @@
userWithdraw.setWithFee(withfee);
int insertCount = this.userWithdrawMapper.insert(userWithdraw);
if (insertCount > 0) {
-
- return ServerResponse.createBySuccessMsg("Successful withdrawal");
-
+ return ServerResponse.createBySuccessMsg("提现成功",request);
}
log.error("保存提现记录失败");
throw new Exception("用户提现,保存提现记录失败");
} else {
- return ServerResponse.createByErrorMsg("The withdrawal password is incorrect!!");
+ return ServerResponse.createByErrorMsg("提现密码不正确!",request);
}
}
diff --git a/src/main/java/com/nq/utils/UserPointUtil.java b/src/main/java/com/nq/utils/UserPointUtil.java
new file mode 100644
index 0000000..0e1b2a8
--- /dev/null
+++ b/src/main/java/com/nq/utils/UserPointUtil.java
@@ -0,0 +1,91 @@
+package com.nq.utils;
+
+
+import com.nq.pojo.UserPosition;
+import com.nq.vo.position.PositionProfitVO;
+import com.nq.vo.position.UserPositionVO;
+
+import java.math.BigDecimal;
+
+/**
+ * 仓位计算工具类
+ * */
+public class UserPointUtil {
+
+
+ /**
+ * 返回当前 仓位表 实时数据
+ * */
+ public static UserPositionVO assembleUserPositionVO(UserPosition position,BigDecimal nowPrice) {
+ UserPositionVO userPositionVO = new UserPositionVO();
+
+ userPositionVO.setId(position.getId());
+ userPositionVO.setPositionType(position.getPositionType());
+ userPositionVO.setPositionSn(position.getPositionSn());
+ userPositionVO.setUserId(position.getUserId());
+ userPositionVO.setNickName(position.getNickName());
+ userPositionVO.setAgentId(position.getAgentId());
+ userPositionVO.setStockName(position.getStockName());
+ userPositionVO.setStockCode(position.getStockCode());
+ userPositionVO.setStockGid(position.getStockGid());
+ userPositionVO.setStockSpell(position.getStockSpell());
+ userPositionVO.setBuyOrderId(position.getBuyOrderId());
+ userPositionVO.setBuyOrderTime(position.getBuyOrderTime());
+ userPositionVO.setBuyOrderPrice(position.getBuyOrderPrice());
+ userPositionVO.setSellOrderId(position.getSellOrderId());
+ userPositionVO.setSellOrderTime(position.getSellOrderTime());
+ userPositionVO.setSellOrderPrice(position.getSellOrderPrice());
+ userPositionVO.setProfitTargetPrice(position.getProfitTargetPrice());
+ userPositionVO.setStopTargetPrice(position.getStopTargetPrice());
+ userPositionVO.setOrderDirection(position.getOrderDirection());
+ userPositionVO.setOrderNum(position.getOrderNum());
+ userPositionVO.setOrderLever(position.getOrderLever());
+ userPositionVO.setOrderTotalPrice(position.getOrderTotalPrice());
+ userPositionVO.setOrderFee(position.getOrderFee());
+ userPositionVO.setOrderSpread(position.getOrderSpread());
+ userPositionVO.setOrderStayFee(position.getOrderStayFee());
+ userPositionVO.setOrderStayDays(position.getOrderStayDays());
+ userPositionVO.setMarginAdd(position.getMarginAdd());
+ userPositionVO.setStockPlate(position.getStockPlate());
+ userPositionVO.setSpreadRatePrice(position.getSpreadRatePrice());
+ PositionProfitVO positionProfitVO = getPositionProfitVO(position,nowPrice);
+ BigDecimal ss = positionProfitVO.getProfitAndLose().divide(userPositionVO.getBuyOrderPrice(),BigDecimal.ROUND_CEILING)
+ .multiply(new BigDecimal(100));
+ userPositionVO.setProfitAndLoseParent(ss+"%");
+ userPositionVO.setProfitAndLose(positionProfitVO.getProfitAndLose());
+ userPositionVO.setAllProfitAndLose(positionProfitVO.getAllProfitAndLose());
+ userPositionVO.setNow_price(positionProfitVO.getNowPrice());
+ return userPositionVO;
+ }
+
+ /**
+ * 计算仓位盈亏计算方法
+ * */
+ 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());
+ profitAndLose = subPrice.multiply(new BigDecimal(position.getOrderNum().intValue()));
+ if ("买跌".equals(position.getOrderDirection())) {
+ profitAndLose = profitAndLose.negate();
+ }
+ allProfitAndLose = profitAndLose.subtract(position.getOrderFee()).subtract(position.getOrderSpread()).subtract(position.getOrderStayFee()).subtract(position.getSpreadRatePrice());
+ } else {
+ BigDecimal subPrice = nowPrice.subtract(position.getBuyOrderPrice());
+ profitAndLose = subPrice.multiply(new BigDecimal(position.getOrderNum().intValue()));
+ if ("买跌".equals(position.getOrderDirection())) {
+ profitAndLose = profitAndLose.negate();
+ }
+ //总盈亏= 浮动盈亏 – 手续费 – 印花税 – 留仓费 – 点差费
+ allProfitAndLose = profitAndLose.subtract(position.getOrderFee()).subtract(position.getOrderSpread()).subtract(position.getOrderStayFee()).subtract(position.getSpreadRatePrice());
+ }
+ PositionProfitVO positionProfitVO = new PositionProfitVO();
+ positionProfitVO.setProfitAndLose(profitAndLose);
+ positionProfitVO.setAllProfitAndLose(allProfitAndLose);
+ positionProfitVO.setNowPrice(nowPrice.setScale(5,BigDecimal.ROUND_UP).toString());
+ return positionProfitVO;
+ }
+}
diff --git a/src/main/java/com/nq/utils/http/HttpRequest.java b/src/main/java/com/nq/utils/http/HttpRequest.java
index bbaa265..409d7b0 100644
--- a/src/main/java/com/nq/utils/http/HttpRequest.java
+++ b/src/main/java/com/nq/utils/http/HttpRequest.java
@@ -86,13 +86,10 @@
String tempLine = null;
if (httpURLConnection.getResponseCode() >= 300) {
- throw new Exception("HTTP Request is not success, Response code is " + httpURLConnection
- .getResponseCode());
}
try {
inputStream = httpURLConnection.getInputStream();
inputStreamReader = new InputStreamReader(inputStream);
- //reader = new BufferedReader(inputStreamReader);
reader = new BufferedReader(new InputStreamReader(connection.getInputStream(),"UTF-8"));
while ((tempLine = reader.readLine()) != null) {
diff --git a/src/main/java/com/nq/utils/task/YEBTask.java b/src/main/java/com/nq/utils/task/YEBTask.java
index 11e0aa4..cbef6d8 100644
--- a/src/main/java/com/nq/utils/task/YEBTask.java
+++ b/src/main/java/com/nq/utils/task/YEBTask.java
@@ -21,7 +21,7 @@
/**
* 余额宝发放利息
* */
- @Scheduled(cron = "0 0 0/1 * * ?")
+// @Scheduled(cron = "0 0 0/1 * * ?")
public void sendYEBMoney(){
echoServices.sendMoney();
}
diff --git a/src/main/java/com/nq/utils/task/news/NewsTask.java b/src/main/java/com/nq/utils/task/news/NewsTask.java
index 5066e84..ba80a08 100644
--- a/src/main/java/com/nq/utils/task/news/NewsTask.java
+++ b/src/main/java/com/nq/utils/task/news/NewsTask.java
@@ -23,7 +23,7 @@
/*
* 新聞資訊抓取
* */
- @Scheduled(cron = "0/5 * * * * ?")
+ @Scheduled(cron = "0 0/30 * * * ?")
public void NewsInfoTask() {
this.iSiteNewsService.grabNews();
diff --git a/src/main/java/com/nq/utils/task/stock/StockTask.java b/src/main/java/com/nq/utils/task/stock/StockTask.java
index 1ed3056..9d11dee 100644
--- a/src/main/java/com/nq/utils/task/stock/StockTask.java
+++ b/src/main/java/com/nq/utils/task/stock/StockTask.java
@@ -38,18 +38,6 @@
private static final Logger log = LoggerFactory.getLogger(StockTask.class);
- public void time(boolean am, boolean pm) {
- am = false;
- pm = false;
- try {
- am = BuyAndSellUtils.isTransTime("9:29", "11:31");
- pm = BuyAndSellUtils.isTransTime("12:59", "15:00");
- } catch (Exception e) {
- log.error("= {}", e);
- }
- log.info("am = {} pm = {}", Boolean.valueOf(am), Boolean.valueOf(pm));
- }
-
/**
* 同步系统所需要的股票
@@ -58,6 +46,7 @@
public void syncINStockData() {
loadAllStock(EStockType.US);
loadAllStock(EStockType.MAS);
+// loadAllStock(EStockType.HK);
}
@@ -128,16 +117,27 @@
}else{
stock.setStockGid(o.getType());
}
- if(eStockType.getCode().equals("US")){
- stock.setStockSpell(o.getSymbol());
- }else{
- stock.setStockSpell(o.getTicker());
- }
+ stock.setStockSpell(o.getSymbol());
stock.setIsLock(0);
stock.setIsShow(0);
stock.setDataBase(0);
stock.setAddTime(new Date());
stockMapper.insert1(stock);
+ }else{
+ 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.setStockSpell(o.getSymbol());
+ stock.setIsLock(0);
+ stock.setIsShow(0);
+ stock.setDataBase(0);
+ stock.setAddTime(new Date());
+ stockMapper.updateById(stock);
}
RedisKeyUtil.setCaCheKeyBaseStock(eStockType,o);
}
@@ -146,40 +146,5 @@
Exception e) {
log.error("同步出错", e);
}
- }
-
-
-
-
- /***
- * 每3同步一次数据源到数据库
- *
- */
- @Scheduled(cron = "0/3 * * * * ?")
- public void sysnInstockData(){
- QueryWrapper<Stock> queryWrapper = new QueryWrapper<>();
- queryWrapper.eq("stock_type",EStockType.SZHB.getCode());
- List<Stock> stockList = stockMapper.selectList(queryWrapper);
- for (int i = 0; i < stockList.size(); i++) {
- try {
- String hdataString = HttpClientRequest.doGet(EStockType.SZHB.stockUrl+"market/detail?symbol="+stockList.get(i).getStockCode());
- HBData hbData = new Gson().fromJson(hdataString,HBData.class);
- StockRealTimeBean stockRealTimeBean = new StockRealTimeBean();
- stockRealTimeBean.setLast(hbData.getTick().getClose()+"");
- stockRealTimeBean.setHigh(hbData.getTick().getHigh()+"");
- stockRealTimeBean.setPid(stockList.get(i).getStockCode());
- stockRealTimeBean.setLow(hbData.getTick().getLow()+"");
- stockRealTimeBean.setBid(hbData.getTick().getOpen()+"");
- stockRealTimeBean.setLast_close("0.00");
- BigDecimal sss = (new BigDecimal(hbData.getTick().getClose()).subtract(new BigDecimal(hbData.getTick().getOpen())));
- sss = sss.divide(new BigDecimal(hbData.getTick().getOpen()),BigDecimal.ROUND_CEILING);
- stockRealTimeBean.setPcp(sss.setScale(2,BigDecimal.ROUND_UP).toString());
- mandatoryLiquidationService.RealTimeDataProcess(EStockType.SZHB,stockRealTimeBean);
- }catch (Exception e){
-
- }
-
- }
-
}
}
diff --git a/src/main/java/com/nq/utils/timeutil/TimeUtil.java b/src/main/java/com/nq/utils/timeutil/TimeUtil.java
new file mode 100644
index 0000000..b87dc8b
--- /dev/null
+++ b/src/main/java/com/nq/utils/timeutil/TimeUtil.java
@@ -0,0 +1,43 @@
+package com.nq.utils.timeutil;
+
+import java.time.LocalTime;
+
+public class TimeUtil {
+
+ public static boolean isTradingHour(String amStartTime,String amEndTime,String pmStartTime,String pmEndTime){
+ LocalTime now = LocalTime.now();
+ LocalTime amTime = LocalTime.parse(amStartTime);
+ LocalTime amTime1 = LocalTime.parse(amEndTime);
+ LocalTime pmTime = LocalTime.parse(pmStartTime);
+ LocalTime pmTime1 = LocalTime.parse(pmEndTime);
+
+ if(now.isAfter(amTime) && now.isBefore(amTime1)){
+ return true;
+ }
+
+
+ if(now.isAfter(pmTime) && now.isBefore(pmTime1)){
+ return true;
+ }
+ return false;
+ }
+
+
+ public static boolean isTradingHour(String amStartTime,String amEndTime){
+ LocalTime now = LocalTime.now();
+ LocalTime amTime = LocalTime.parse(amStartTime);
+ LocalTime amTime1 = LocalTime.parse(amEndTime);
+
+ if(now.isAfter(amTime) && now.isBefore(amTime1)){
+ return true;
+ }
+
+ return false;
+ }
+
+
+// public static void main(String[] args) {
+// System.out.println(isTradingHour("00:15","12:00","12:00","24:00"));
+// }
+
+}
diff --git a/src/main/java/com/nq/utils/translate/GoogleTranslateUtil.java b/src/main/java/com/nq/utils/translate/GoogleTranslateUtil.java
index 752c8b9..a9728d9 100644
--- a/src/main/java/com/nq/utils/translate/GoogleTranslateUtil.java
+++ b/src/main/java/com/nq/utils/translate/GoogleTranslateUtil.java
@@ -74,7 +74,7 @@
* 谷歌翻译 传string 反string
*/
- public String translate(String content,String lang) throws Exception {
+ public String translate(String content,String lang) {
StringBuilder result = new StringBuilder();
if (content.length() > 1000) {
int size = content.length() /1000 ;
diff --git a/src/main/java/com/nq/vo/position/UserPositionVO.java b/src/main/java/com/nq/vo/position/UserPositionVO.java
index bca7850..b0bd3f0 100644
--- a/src/main/java/com/nq/vo/position/UserPositionVO.java
+++ b/src/main/java/com/nq/vo/position/UserPositionVO.java
@@ -1,9 +1,12 @@
package com.nq.vo.position;
+import lombok.Data;
+
import java.math.BigDecimal;
import java.util.Date;
+@Data
public class UserPositionVO {
private Integer id;
private Integer positionType;
@@ -56,447 +59,8 @@
/*追加保证金额*/
private BigDecimal marginAdd;
- public void setPositionType(Integer positionType) {
- this.positionType = positionType;
- }
-
- public void setPositionSn(String positionSn) {
- this.positionSn = positionSn;
- }
-
- public void setUserId(Integer userId) {
- this.userId = userId;
- }
-
- public void setNickName(String nickName) {
- this.nickName = nickName;
- }
-
- public void setAgentId(Integer agentId) {
- this.agentId = agentId;
- }
-
- public void setStockName(String stockName) {
- this.stockName = stockName;
- }
-
- public void setStockCode(String stockCode) {
- this.stockCode = stockCode;
- }
-
- public void setStockGid(String stockGid) {
- this.stockGid = stockGid;
- }
-
- public void setStockSpell(String stockSpell) {
- this.stockSpell = stockSpell;
- }
-
- public void setBuyOrderId(String buyOrderId) {
- this.buyOrderId = buyOrderId;
- }
-
- public void setBuyOrderTime(Date buyOrderTime) {
- this.buyOrderTime = buyOrderTime;
- }
-
- public void setBuyOrderPrice(BigDecimal buyOrderPrice) {
- this.buyOrderPrice = buyOrderPrice;
- }
-
- public void setSellOrderId(String sellOrderId) {
- this.sellOrderId = sellOrderId;
- }
-
- public void setSellOrderTime(Date sellOrderTime) {
- this.sellOrderTime = sellOrderTime;
- }
-
- public void setSellOrderPrice(BigDecimal sellOrderPrice) {
- this.sellOrderPrice = sellOrderPrice;
- }
-
- public void setProfitTargetPrice(BigDecimal profitTargetPrice) {
- this.profitTargetPrice = profitTargetPrice;
- }
-
- public void setStopTargetPrice(BigDecimal stopTargetPrice) {
- this.stopTargetPrice = stopTargetPrice;
- }
-
- public void setOrderDirection(String orderDirection) {
- this.orderDirection = orderDirection;
- }
-
- public void setOrderNum(Integer orderNum) {
- this.orderNum = orderNum;
- }
-
- public void setOrderLever(Integer orderLever) {
- this.orderLever = orderLever;
- }
-
- public void setOrderTotalPrice(BigDecimal orderTotalPrice) {
- this.orderTotalPrice = orderTotalPrice;
- }
-
- public void setOrderFee(BigDecimal orderFee) {
- this.orderFee = orderFee;
- }
-
- public void setOrderSpread(BigDecimal orderSpread) {
- this.orderSpread = orderSpread;
- }
-
- public void setOrderStayFee(BigDecimal orderStayFee) {
- this.orderStayFee = orderStayFee;
- }
-
- public void setOrderStayDays(Integer orderStayDays) {
- this.orderStayDays = orderStayDays;
- }
-
- public void setProfitAndLose(BigDecimal profitAndLose) {
- this.profitAndLose = profitAndLose;
- }
-
- public void setAllProfitAndLose(BigDecimal allProfitAndLose) {
- this.allProfitAndLose = allProfitAndLose;
- }
-
- public void setNow_price(String now_price) {
- this.now_price = now_price;
- }
-
- public void setStockPlate(String stockPlate) {
- this.stockPlate = stockPlate;
- }
-
- public boolean equals(Object o) {
- if (o == this) return true;
- if (!(o instanceof UserPositionVO)) return false;
- UserPositionVO other = (UserPositionVO) o;
- if (!other.canEqual(this)) return false;
- Object this$id = getId(), other$id = other.getId();
- if ((this$id == null) ? (other$id != null) : !this$id.equals(other$id)) return false;
- Object this$positionType = getPositionType(), other$positionType = other.getPositionType();
- if ((this$positionType == null) ? (other$positionType != null) : !this$positionType.equals(other$positionType))
- return false;
- Object this$positionSn = getPositionSn(), other$positionSn = other.getPositionSn();
- if ((this$positionSn == null) ? (other$positionSn != null) : !this$positionSn.equals(other$positionSn))
- return false;
- Object this$userId = getUserId(), other$userId = other.getUserId();
- if ((this$userId == null) ? (other$userId != null) : !this$userId.equals(other$userId)) return false;
- Object this$nickName = getNickName(), other$nickName = other.getNickName();
- if ((this$nickName == null) ? (other$nickName != null) : !this$nickName.equals(other$nickName)) return false;
- Object this$agentId = getAgentId(), other$agentId = other.getAgentId();
- if ((this$agentId == null) ? (other$agentId != null) : !this$agentId.equals(other$agentId)) return false;
- Object this$stockName = getStockName(), other$stockName = other.getStockName();
- if ((this$stockName == null) ? (other$stockName != null) : !this$stockName.equals(other$stockName))
- return false;
- Object this$stockCode = getStockCode(), other$stockCode = other.getStockCode();
- if ((this$stockCode == null) ? (other$stockCode != null) : !this$stockCode.equals(other$stockCode))
- return false;
- Object this$stockGid = getStockGid(), other$stockGid = other.getStockGid();
- if ((this$stockGid == null) ? (other$stockGid != null) : !this$stockGid.equals(other$stockGid)) return false;
- Object this$stockSpell = getStockSpell(), other$stockSpell = other.getStockSpell();
- if ((this$stockSpell == null) ? (other$stockSpell != null) : !this$stockSpell.equals(other$stockSpell))
- return false;
- Object this$buyOrderId = getBuyOrderId(), other$buyOrderId = other.getBuyOrderId();
- if ((this$buyOrderId == null) ? (other$buyOrderId != null) : !this$buyOrderId.equals(other$buyOrderId))
- return false;
- Object this$buyOrderTime = getBuyOrderTime(), other$buyOrderTime = other.getBuyOrderTime();
- if ((this$buyOrderTime == null) ? (other$buyOrderTime != null) : !this$buyOrderTime.equals(other$buyOrderTime))
- return false;
- Object this$buyOrderPrice = getBuyOrderPrice(), other$buyOrderPrice = other.getBuyOrderPrice();
- if ((this$buyOrderPrice == null) ? (other$buyOrderPrice != null) : !this$buyOrderPrice.equals(other$buyOrderPrice))
- return false;
- Object this$sellOrderId = getSellOrderId(), other$sellOrderId = other.getSellOrderId();
- if ((this$sellOrderId == null) ? (other$sellOrderId != null) : !this$sellOrderId.equals(other$sellOrderId))
- return false;
- Object this$sellOrderTime = getSellOrderTime(), other$sellOrderTime = other.getSellOrderTime();
- if ((this$sellOrderTime == null) ? (other$sellOrderTime != null) : !this$sellOrderTime.equals(other$sellOrderTime))
- return false;
- Object this$sellOrderPrice = getSellOrderPrice(), other$sellOrderPrice = other.getSellOrderPrice();
- if ((this$sellOrderPrice == null) ? (other$sellOrderPrice != null) : !this$sellOrderPrice.equals(other$sellOrderPrice))
- return false;
- Object this$profitTargetPrice = getProfitTargetPrice(), other$profitTargetPrice = other.getProfitTargetPrice();
- if ((this$profitTargetPrice == null) ? (other$profitTargetPrice != null) : !this$profitTargetPrice.equals(other$profitTargetPrice))
- return false;
- Object this$stopTargetPrice = getStopTargetPrice(), other$stopTargetPrice = other.getStopTargetPrice();
- if ((this$stopTargetPrice == null) ? (other$stopTargetPrice != null) : !this$stopTargetPrice.equals(other$stopTargetPrice))
- return false;
- Object this$orderDirection = getOrderDirection(), other$orderDirection = other.getOrderDirection();
- if ((this$orderDirection == null) ? (other$orderDirection != null) : !this$orderDirection.equals(other$orderDirection))
- return false;
- Object this$orderNum = getOrderNum(), other$orderNum = other.getOrderNum();
- if ((this$orderNum == null) ? (other$orderNum != null) : !this$orderNum.equals(other$orderNum)) return false;
- Object this$orderLever = getOrderLever(), other$orderLever = other.getOrderLever();
- if ((this$orderLever == null) ? (other$orderLever != null) : !this$orderLever.equals(other$orderLever))
- return false;
- Object this$orderTotalPrice = getOrderTotalPrice(), other$orderTotalPrice = other.getOrderTotalPrice();
- if ((this$orderTotalPrice == null) ? (other$orderTotalPrice != null) : !this$orderTotalPrice.equals(other$orderTotalPrice))
- return false;
- Object this$orderFee = getOrderFee(), other$orderFee = other.getOrderFee();
- if ((this$orderFee == null) ? (other$orderFee != null) : !this$orderFee.equals(other$orderFee)) return false;
- Object this$orderSpread = getOrderSpread(), other$orderSpread = other.getOrderSpread();
- if ((this$orderSpread == null) ? (other$orderSpread != null) : !this$orderSpread.equals(other$orderSpread))
- return false;
- Object this$orderStayFee = getOrderStayFee(), other$orderStayFee = other.getOrderStayFee();
- if ((this$orderStayFee == null) ? (other$orderStayFee != null) : !this$orderStayFee.equals(other$orderStayFee))
- return false;
- Object this$orderStayDays = getOrderStayDays(), other$orderStayDays = other.getOrderStayDays();
- if ((this$orderStayDays == null) ? (other$orderStayDays != null) : !this$orderStayDays.equals(other$orderStayDays))
- return false;
- Object this$profitAndLose = getProfitAndLose(), other$profitAndLose = other.getProfitAndLose();
- if ((this$profitAndLose == null) ? (other$profitAndLose != null) : !this$profitAndLose.equals(other$profitAndLose))
- return false;
- Object this$allProfitAndLose = getAllProfitAndLose(), other$allProfitAndLose = other.getAllProfitAndLose();
- if ((this$allProfitAndLose == null) ? (other$allProfitAndLose != null) : !this$allProfitAndLose.equals(other$allProfitAndLose))
- return false;
- Object this$now_price = getNow_price(), other$now_price = other.getNow_price();
- if ((this$now_price == null) ? (other$now_price != null) : !this$now_price.equals(other$now_price))
- return false;
- Object this$stockPlate = getStockPlate(), other$stockPlate = other.getStockPlate();
- return !((this$stockPlate == null) ? (other$stockPlate != null) : !this$stockPlate.equals(other$stockPlate));
- }
-
- protected boolean canEqual(Object other) {
- return other instanceof UserPositionVO;
- }
-
- public int hashCode() {
- int PRIME = 59;
- int result = 1;
- Object $id = getId();
- result = result * 59 + (($id == null) ? 43 : $id.hashCode());
- Object $positionType = getPositionType();
- result = result * 59 + (($positionType == null) ? 43 : $positionType.hashCode());
- Object $positionSn = getPositionSn();
- result = result * 59 + (($positionSn == null) ? 43 : $positionSn.hashCode());
- Object $userId = getUserId();
- result = result * 59 + (($userId == null) ? 43 : $userId.hashCode());
- Object $nickName = getNickName();
- result = result * 59 + (($nickName == null) ? 43 : $nickName.hashCode());
- Object $agentId = getAgentId();
- result = result * 59 + (($agentId == null) ? 43 : $agentId.hashCode());
- Object $stockName = getStockName();
- result = result * 59 + (($stockName == null) ? 43 : $stockName.hashCode());
- Object $stockCode = getStockCode();
- result = result * 59 + (($stockCode == null) ? 43 : $stockCode.hashCode());
- Object $stockGid = getStockGid();
- result = result * 59 + (($stockGid == null) ? 43 : $stockGid.hashCode());
- Object $stockSpell = getStockSpell();
- result = result * 59 + (($stockSpell == null) ? 43 : $stockSpell.hashCode());
- Object $buyOrderId = getBuyOrderId();
- result = result * 59 + (($buyOrderId == null) ? 43 : $buyOrderId.hashCode());
- Object $buyOrderTime = getBuyOrderTime();
- result = result * 59 + (($buyOrderTime == null) ? 43 : $buyOrderTime.hashCode());
- Object $buyOrderPrice = getBuyOrderPrice();
- result = result * 59 + (($buyOrderPrice == null) ? 43 : $buyOrderPrice.hashCode());
- Object $sellOrderId = getSellOrderId();
- result = result * 59 + (($sellOrderId == null) ? 43 : $sellOrderId.hashCode());
- Object $sellOrderTime = getSellOrderTime();
- result = result * 59 + (($sellOrderTime == null) ? 43 : $sellOrderTime.hashCode());
- Object $sellOrderPrice = getSellOrderPrice();
- result = result * 59 + (($sellOrderPrice == null) ? 43 : $sellOrderPrice.hashCode());
- Object $profitTargetPrice = getProfitTargetPrice();
- result = result * 59 + (($profitTargetPrice == null) ? 43 : $profitTargetPrice.hashCode());
- Object $stopTargetPrice = getStopTargetPrice();
- result = result * 59 + (($stopTargetPrice == null) ? 43 : $stopTargetPrice.hashCode());
- Object $orderDirection = getOrderDirection();
- result = result * 59 + (($orderDirection == null) ? 43 : $orderDirection.hashCode());
- Object $orderNum = getOrderNum();
- result = result * 59 + (($orderNum == null) ? 43 : $orderNum.hashCode());
- Object $orderLever = getOrderLever();
- result = result * 59 + (($orderLever == null) ? 43 : $orderLever.hashCode());
- Object $orderTotalPrice = getOrderTotalPrice();
- result = result * 59 + (($orderTotalPrice == null) ? 43 : $orderTotalPrice.hashCode());
- Object $orderFee = getOrderFee();
- result = result * 59 + (($orderFee == null) ? 43 : $orderFee.hashCode());
- Object $orderSpread = getOrderSpread();
- result = result * 59 + (($orderSpread == null) ? 43 : $orderSpread.hashCode());
- Object $orderStayFee = getOrderStayFee();
- result = result * 59 + (($orderStayFee == null) ? 43 : $orderStayFee.hashCode());
- Object $orderStayDays = getOrderStayDays();
- result = result * 59 + (($orderStayDays == null) ? 43 : $orderStayDays.hashCode());
- Object $profitAndLose = getProfitAndLose();
- result = result * 59 + (($profitAndLose == null) ? 43 : $profitAndLose.hashCode());
- Object $allProfitAndLose = getAllProfitAndLose();
- result = result * 59 + (($allProfitAndLose == null) ? 43 : $allProfitAndLose.hashCode());
- Object $now_price = getNow_price();
- result = result * 59 + (($now_price == null) ? 43 : $now_price.hashCode());
- Object $stockPlate = getStockPlate();
- return result * 59 + (($stockPlate == null) ? 43 : $stockPlate.hashCode());
- }
-
- public String toString() {
- return "UserPositionVO(id=" + getId() + ", positionType=" + getPositionType() + ", positionSn=" + getPositionSn() + ", userId=" + getUserId() + ", nickName=" + getNickName() + ", agentId=" + getAgentId() + ", stockName=" + getStockName() + ", stockCode=" + getStockCode() + ", stockGid=" + getStockGid() + ", stockSpell=" + getStockSpell() + ", buyOrderId=" + getBuyOrderId() + ", buyOrderTime=" + getBuyOrderTime() + ", buyOrderPrice=" + getBuyOrderPrice() + ", sellOrderId=" + getSellOrderId() + ", sellOrderTime=" + getSellOrderTime() + ", sellOrderPrice=" + getSellOrderPrice() + ", profitTargetPrice=" + getProfitTargetPrice() + ", stopTargetPrice=" + getStopTargetPrice() + ", orderDirection=" + getOrderDirection() + ", orderNum=" + getOrderNum() + ", orderLever=" + getOrderLever() + ", orderTotalPrice=" + getOrderTotalPrice() + ", orderFee=" + getOrderFee() + ", orderSpread=" + getOrderSpread() + ", orderStayFee=" + getOrderStayFee() + ", orderStayDays=" + getOrderStayDays() + ", profitAndLose=" + getProfitAndLose() + ", allProfitAndLose=" + getAllProfitAndLose() + ", now_price=" + getNow_price() + ", stockPlate=" + getStockPlate() + ", spreadRatePrice=" + getSpreadRatePrice() + ", marginAdd=" + getMarginAdd() + ")";
- }
-
-
- public Integer getId() {
- return this.id;
- }
-
-
- public Integer getPositionType() {
- return this.positionType;
- }
-
-
- public String getPositionSn() {
- return this.positionSn;
- }
-
-
- public Integer getUserId() {
- return this.userId;
- }
-
-
- public String getNickName() {
- return this.nickName;
- }
-
-
- public Integer getAgentId() {
- return this.agentId;
- }
-
-
- public String getStockName() {
- return this.stockName;
- }
-
-
- public String getStockCode() {
- return this.stockCode;
- }
-
-
- public String getStockGid() {
- return this.stockGid;
- }
-
-
- public String getStockSpell() {
- return this.stockSpell;
- }
-
-
- public String getBuyOrderId() {
- return this.buyOrderId;
- }
-
-
- public Date getBuyOrderTime() {
- return this.buyOrderTime;
- }
-
-
- public BigDecimal getBuyOrderPrice() {
- return this.buyOrderPrice;
- }
-
-
- public String getSellOrderId() {
- return this.sellOrderId;
- }
-
-
- public Date getSellOrderTime() {
- return this.sellOrderTime;
- }
-
-
- public BigDecimal getSellOrderPrice() {
- return this.sellOrderPrice;
- }
-
-
- public BigDecimal getProfitTargetPrice() {
- return this.profitTargetPrice;
- }
-
-
- public BigDecimal getStopTargetPrice() {
- return this.stopTargetPrice;
- }
-
-
- public String getOrderDirection() {
- return this.orderDirection;
- }
-
-
- public Integer getOrderNum() {
- return this.orderNum;
- }
-
-
- public Integer getOrderLever() {
- return this.orderLever;
- }
-
-
- public BigDecimal getOrderTotalPrice() {
- return this.orderTotalPrice;
- }
-
-
- public BigDecimal getOrderFee() {
- return this.orderFee;
- }
-
-
- public BigDecimal getOrderSpread() {
- return this.orderSpread;
- }
-
-
- public BigDecimal getOrderStayFee() {
- return this.orderStayFee;
- }
-
-
- public Integer getOrderStayDays() {
- return this.orderStayDays;
- }
-
-
- public BigDecimal getProfitAndLose() {
- return this.profitAndLose;
- }
-
-
- public BigDecimal getAllProfitAndLose() {
- return this.allProfitAndLose;
- }
-
-
- public String getNow_price() {
- return this.now_price;
- }
-
-
- public String getStockPlate() {
- return this.stockPlate;
- }
-
- public BigDecimal getSpreadRatePrice() {
- return spreadRatePrice;
- }
-
- public void setSpreadRatePrice(BigDecimal spreadRatePrice) {
- this.spreadRatePrice = spreadRatePrice;
- }
-
- public BigDecimal getMarginAdd() {
- return marginAdd;
- }
-
- public void setMarginAdd(BigDecimal marginAdd) {
- this.marginAdd = marginAdd;
- }
+ /**
+ * 盈亏百分点
+ * */
+ private String profitAndLoseParent;
}
diff --git a/src/main/java/com/nq/ws/HKWebsocketRunClient.java b/src/main/java/com/nq/ws/HKWebsocketRunClient.java
new file mode 100644
index 0000000..75511c2
--- /dev/null
+++ b/src/main/java/com/nq/ws/HKWebsocketRunClient.java
@@ -0,0 +1,51 @@
+package com.nq.ws;
+
+import com.google.gson.Gson;
+import com.nq.enums.EStockType;
+import com.nq.pojo.StockRealTimeBean;
+import com.nq.service.IMandatoryLiquidationService;
+import com.nq.service.impl.MandatoryLiquidationService;
+import com.nq.utils.ApplicationContextRegisterUtil;
+import com.nq.utils.redis.RedisKeyUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.java_websocket.client.WebSocketClient;
+import org.java_websocket.handshake.ServerHandshake;
+import org.springframework.context.ApplicationContext;
+
+import java.net.URI;
+
+@Slf4j
+public class HKWebsocketRunClient extends WebSocketClient {
+
+ public HKWebsocketRunClient(URI serverUri) {
+ super(serverUri);
+ }
+
+ @Override
+ public void onOpen(ServerHandshake serverHandshake) {
+ send(("key:"+ EStockType.HK.stockKey+":"+EStockType.HK.getContryId()).getBytes());
+ }
+
+ @Override
+ public void onMessage(String s) {
+ try {
+ StockRealTimeBean stockDetailBean = new Gson().fromJson(s, StockRealTimeBean.class);
+ RedisKeyUtil.setCacheRealTimeStock(EStockType.HK,stockDetailBean);
+ ApplicationContext act = ApplicationContextRegisterUtil.getApplicationContext();
+ MandatoryLiquidationService liquidationService = (MandatoryLiquidationService) act.getBean(IMandatoryLiquidationService.class);
+ liquidationService.RealTimeDataProcess(EStockType.HK,stockDetailBean);
+ }catch (Exception e){
+
+ }
+ }
+
+ @Override
+ public void onClose(int i, String s, boolean b) {
+ log.info("websocket HK关闭关闭"+1);
+ }
+
+ @Override
+ public void onError(Exception e) {
+ log.info("websocket 错误");
+ }
+}
diff --git a/src/main/java/com/nq/ws/WebSocketClientBeanConfig.java b/src/main/java/com/nq/ws/WebSocketClientBeanConfig.java
index e7ae59b..531cfaa 100644
--- a/src/main/java/com/nq/ws/WebSocketClientBeanConfig.java
+++ b/src/main/java/com/nq/ws/WebSocketClientBeanConfig.java
@@ -36,7 +36,7 @@
}
}
}).start();
- retMap.put(EStockType.IN.getStockKey(), websocketRunClient);
+ retMap.put(EStockType.MAS.getStockKey(), websocketRunClient);
} catch (Exception e) {
}
@@ -59,6 +59,27 @@
} catch (Exception e) {
}
+
+ try {
+ HKWebsocketRunClient hkWebsocketRunClient = new HKWebsocketRunClient(new URI(PropertiesUtil.getProperty("HK_WS_URL")));
+ hkWebsocketRunClient.connect();
+ hkWebsocketRunClient.setConnectionLostTimeout(0);
+ new Thread(() -> {
+ while (true) {
+ try {
+ Thread.sleep(8000);
+ hkWebsocketRunClient.send("heartbeat".getBytes());
+ } catch (Exception e) {
+ hkWebsocketRunClient.reconnect();
+ hkWebsocketRunClient.setConnectionLostTimeout(0);
+ }
+ }
+ }).start();
+ retMap.put(EStockType.HK.getStockKey(), hkWebsocketRunClient);
+ } catch (Exception e) {
+ }
+
+
return retMap;
}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 4627ac6..fe15f3e 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -8,6 +8,7 @@
ftp.server.ip=45.204.85.67
ftp.user=ftp_stock
ftp.pass=123456
+ftp.address =/www/wwwroot/ftp_stock/
ftp.server.http.prefix=https://img.3falcon.com/
@@ -25,7 +26,7 @@
#cookie config start
user.cookie.name=USERTOKEN
-agent.cookie.name=agenttoken
+agent.cookie.name=Agenttoken
admin.cookie.name=admintoken
agent.key.prefix=Mi
@@ -37,18 +38,23 @@
IN_WS_URL = ws://api-in-ws.js-stock.top
IN_KEY = r3ZAgtcYzuBizmqge2hK
-US_HTTP_API = http://ws-us.js-stock.top/
+US_HTTP_API = http://api-us.js-stock.top/
US_WS_URL = ws://ws-us.js-stock.top
US_KEY = jZFrku4RGQjP87Hmq5tm
HK_HTTP_API = http://test.js-stock.top/
-HK_WS_URL = ws://api-in-ws.js-stock.top
-HK_KEY = GBZAcUPLKZzDMDjvV9Ea
+HK_WS_URL = ws://test-ws.js-stock.top
+HK_KEY = mG8QQDdjGuLjLnrryd0B
+
+
+#HK_HTTP_API = http://api-v1.js-stock.top/
+#HK_WS_URL = ws://api-v1-ws.js-stock.top
+#HK_KEY = QgiqrYYZem1WWXWbHeT7
HG_HTTP_API = http://test.js-stock.top/
-HG_WS_URL = ws://api-in-ws.js-stock.top
-HG_KEY = GBZAcUPLKZzDMDjvV9Ea
+HG_WS_URL = ws://test-ws.js-stock.top
+HG_KEY = mG8QQDdjGuLjLnrryd0B
@@ -65,6 +71,9 @@
SZHB_KEY = GBZAcUPLKZzDMDjvV9Ea
+
+
+
#?? ?? - ????
admin.auth.email.subject=???? - ??????
#?? ?? - ????
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 6a60c69..d53b32c 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -122,7 +122,8 @@
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
- url: jdbc:mysql://45.204.85.67:7306/stock?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ url: jdbc:mysql://127.0.0.1:7306/stock?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+# url: jdbc:mysql://127.0.0.1:3306/cgstock?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: 123456
druid:
diff --git a/src/main/resources/mapper/UserRechargeMapper.xml b/src/main/resources/mapper/UserRechargeMapper.xml
index 3f5580d..2f36d6c 100644
--- a/src/main/resources/mapper/UserRechargeMapper.xml
+++ b/src/main/resources/mapper/UserRechargeMapper.xml
@@ -15,7 +15,8 @@
<result column="add_time" property="addTime"/>
<result column="pay_time" property="payTime"/>
<result column="pay_id" property="payId"/>
- <result column="img" property="img"/>
+ <result column="img" property="img"/>
+ <result column="assets_type" property="assetsType"/>
</resultMap>
<sql id="Base_Column_List" >
id, user_id, nick_name, agent_id, order_sn, pay_sn, pay_channel, pay_amt, order_status,
@@ -25,12 +26,12 @@
insert into user_recharge (id, user_id, nick_name,
agent_id, order_sn, pay_sn,
pay_channel, pay_amt, order_status,
- order_desc, add_time, pay_time,pay_id
+ order_desc, add_time, pay_time,pay_id,img
)
values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{nickName,jdbcType=VARCHAR},
#{agentId,jdbcType=INTEGER}, #{orderSn,jdbcType=VARCHAR}, #{paySn,jdbcType=VARCHAR},
#{payChannel,jdbcType=VARCHAR}, #{payAmt,jdbcType=DECIMAL}, #{orderStatus,jdbcType=INTEGER},
- #{orderDesc,jdbcType=VARCHAR}, #{addTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP}, #{payId,jdbcType=INTEGER}
+ #{orderDesc,jdbcType=VARCHAR}, #{addTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP}, #{payId,jdbcType=INTEGER}, #{img,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.nq.pojo.UserRecharge" >
diff --git a/target/classes/application.properties b/target/classes/application.properties
index 4627ac6..fe15f3e 100644
--- a/target/classes/application.properties
+++ b/target/classes/application.properties
@@ -8,6 +8,7 @@
ftp.server.ip=45.204.85.67
ftp.user=ftp_stock
ftp.pass=123456
+ftp.address =/www/wwwroot/ftp_stock/
ftp.server.http.prefix=https://img.3falcon.com/
@@ -25,7 +26,7 @@
#cookie config start
user.cookie.name=USERTOKEN
-agent.cookie.name=agenttoken
+agent.cookie.name=Agenttoken
admin.cookie.name=admintoken
agent.key.prefix=Mi
@@ -37,18 +38,23 @@
IN_WS_URL = ws://api-in-ws.js-stock.top
IN_KEY = r3ZAgtcYzuBizmqge2hK
-US_HTTP_API = http://ws-us.js-stock.top/
+US_HTTP_API = http://api-us.js-stock.top/
US_WS_URL = ws://ws-us.js-stock.top
US_KEY = jZFrku4RGQjP87Hmq5tm
HK_HTTP_API = http://test.js-stock.top/
-HK_WS_URL = ws://api-in-ws.js-stock.top
-HK_KEY = GBZAcUPLKZzDMDjvV9Ea
+HK_WS_URL = ws://test-ws.js-stock.top
+HK_KEY = mG8QQDdjGuLjLnrryd0B
+
+
+#HK_HTTP_API = http://api-v1.js-stock.top/
+#HK_WS_URL = ws://api-v1-ws.js-stock.top
+#HK_KEY = QgiqrYYZem1WWXWbHeT7
HG_HTTP_API = http://test.js-stock.top/
-HG_WS_URL = ws://api-in-ws.js-stock.top
-HG_KEY = GBZAcUPLKZzDMDjvV9Ea
+HG_WS_URL = ws://test-ws.js-stock.top
+HG_KEY = mG8QQDdjGuLjLnrryd0B
@@ -65,6 +71,9 @@
SZHB_KEY = GBZAcUPLKZzDMDjvV9Ea
+
+
+
#?? ?? - ????
admin.auth.email.subject=???? - ??????
#?? ?? - ????
diff --git a/target/classes/application.yml b/target/classes/application.yml
index 6a60c69..d53b32c 100644
--- a/target/classes/application.yml
+++ b/target/classes/application.yml
@@ -122,7 +122,8 @@
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
- url: jdbc:mysql://45.204.85.67:7306/stock?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ url: jdbc:mysql://127.0.0.1:7306/stock?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+# url: jdbc:mysql://127.0.0.1:3306/cgstock?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: 123456
druid:
diff --git a/target/classes/mapper/UserRechargeMapper.xml b/target/classes/mapper/UserRechargeMapper.xml
index 3f5580d..2f36d6c 100644
--- a/target/classes/mapper/UserRechargeMapper.xml
+++ b/target/classes/mapper/UserRechargeMapper.xml
@@ -15,7 +15,8 @@
<result column="add_time" property="addTime"/>
<result column="pay_time" property="payTime"/>
<result column="pay_id" property="payId"/>
- <result column="img" property="img"/>
+ <result column="img" property="img"/>
+ <result column="assets_type" property="assetsType"/>
</resultMap>
<sql id="Base_Column_List" >
id, user_id, nick_name, agent_id, order_sn, pay_sn, pay_channel, pay_amt, order_status,
@@ -25,12 +26,12 @@
insert into user_recharge (id, user_id, nick_name,
agent_id, order_sn, pay_sn,
pay_channel, pay_amt, order_status,
- order_desc, add_time, pay_time,pay_id
+ order_desc, add_time, pay_time,pay_id,img
)
values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{nickName,jdbcType=VARCHAR},
#{agentId,jdbcType=INTEGER}, #{orderSn,jdbcType=VARCHAR}, #{paySn,jdbcType=VARCHAR},
#{payChannel,jdbcType=VARCHAR}, #{payAmt,jdbcType=DECIMAL}, #{orderStatus,jdbcType=INTEGER},
- #{orderDesc,jdbcType=VARCHAR}, #{addTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP}, #{payId,jdbcType=INTEGER}
+ #{orderDesc,jdbcType=VARCHAR}, #{addTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP}, #{payId,jdbcType=INTEGER}, #{img,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.nq.pojo.UserRecharge" >
diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
index 9dc04c5..815a359 100644
--- a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
+++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
@@ -1,6 +1,5 @@
com\nq\utils\smsUtil\smsUtil.class
com\nq\pojo\Bank.class
-com\nq\service\IAgentDistributionUserService.class
com\nq\service\ISiteAdminService.class
com\nq\utils\redis\RedisShardedPoolUtils.class
com\nq\vo\indexposition\IndexPositionVO.class
@@ -18,7 +17,6 @@
com\nq\service\SiteAdminIndexService.class
com\nq\dao\StockMapper.class
com\nq\controller\backend\AdminSiteFuturesSettingController.class
-com\nq\dao\UserAssetsMapper.class
com\nq\service\impl\SiteAdminServiceImpl.class
com\nq\pojo\FundsApply.class
com\nq\service\IUserIndexPositionService.class
@@ -28,12 +26,10 @@
com\nq\utils\sms\ali\AliyunSmsConst.class
com\nq\utils\StockListVO.class
com\nq\service\ISiteInfoService.class
-com\nq\vo\agent\AgentAgencyFeeVO.class
com\nq\pay\PayUtil.class
com\nq\vo\dk\DkModelVo.class
com\nq\ws\USWebsocketRunClient.class
com\nq\service\impl\FundsLeverServiceImpl.class
-com\nq\pojo\SiteAmtTransLog.class
com\nq\vo\indexposition\AgentIndexPositionVO.class
com\nq\dao\DkMapper.class
com\nq\utils\stock\qq\QqStockApi$1.class
@@ -48,7 +44,6 @@
com\nq\vo\stock\MarketVO.class
com\nq\dao\FundLogMapper.class
com\nq\pojo\HBData.class
-com\nq\vo\pay\GuoPayVO.class
com\nq\vo\user\UserBankInfoVO.class
com\nq\utils\stock\sina\vo\SinaStockMinData.class
com\nq\utils\KeyUtils.class
@@ -60,7 +55,6 @@
com\nq\vo\stock\k\echarts\EchartsDataVO.class
com\nq\utils\ip\IpUtils.class
com\nq\pojo\SiteFuturesSetting.class
-com\nq\vo\agent\AgentSecondInfoVO.class
com\nq\dao\FundsSecuritiesInfoMapper.class
com\nq\controller\agent\AgentFuturesPositionController.class
com\nq\utils\HolidayUtil.class
@@ -76,11 +70,9 @@
com\nq\dao\SiteInfoMapper.class
com\nq\config\MyCorsFilter.class
com\nq\controller\backend\AdminFuturesPositionController.class
-com\nq\service\impl\SitePayServiceImpl.class
com\nq\utils\redis\RedisKeyConstant.class
com\nq\common\converter\MyJsonMapper.class
com\nq\vo\stockfutures\FuturesVO.class
-com\nq\utils\ip\JuheIpApi.class
com\nq\pojo\FundsDealerInstitutions.class
com\nq\utils\sms\ali\AliyunSms.class
com\nq\service\impl\FundsApplyServiceImpl.class
@@ -98,14 +90,11 @@
com\nq\dao\UserRechargeMapper.class
com\nq\pojo\PayChnnel.class
com\nq\pojo\StockRealTimeBean.class
-com\nq\pojo\AgentDistributionUser.class
com\nq\service\IStockIndexService.class
com\nq\utils\ip\ipUtil.class
-com\nq\controller\protol\UserPayController.class
com\nq\pojo\SiteAdminIndex.class
com\nq\utils\SignAPI.class
com\nq\utils\Md5Util.class
-com\nq\controller\backend\AdminPendingorder.class
com\nq\utils\stock\sina\StockApi.class
com\nq\service\impl\SiteAdminIndexServiceImpl.class
com\nq\pojo\QhBean.class
@@ -125,13 +114,11 @@
com\nq\vo\stock\k\MinDataVO.class
com\nq\service\IUserFundsPositionService.class
com\nq\vo\agent\AgentLoginResultVO.class
-com\nq\controller\protol\UserFundsController.class
com\nq\dao\AgentUserMapper.class
com\nq\controller\BankController.class
com\nq\service\StockDzService.class
com\nq\common\ResponseCode.class
com\nq\service\impl\StockDzServiceImpl.class
-com\nq\dao\SiteNewsMapper.class
com\nq\dao\UserStockSubscribeMapper.class
com\nq\pojo\SiteInfo.class
com\nq\service\ISiteTaskLogService.class
@@ -142,15 +129,12 @@
com\nq\utils\ApplicationContextRegisterUtil.class
com\nq\service\impl\RealTimeServiceImpl.class
com\nq\common\interceptor\ApiAgentAuthorityInterceptor.class
-com\nq\service\RealTimeService.class
-com\nq\controller\ArticleApiController.class
com\nq\service\impl\MandatoryLiquidationService.class
com\nq\dao\SiteSettingMapper.class
com\nq\controller\UserApiController.class
com\nq\pojo\UserIndexPosition.class
com\nq\vo\position\PositionVO.class
com\nq\vo\futuresposition\UserFuturesPositionVO.class
-com\nq\controller\protol\UserFuturesPositionController.class
com\nq\utils\stock\sina\StockApi$3.class
com\nq\pojo\UserFundsPosition.class
com\nq\controller\backend\AdminSiteBannerController.class
@@ -173,7 +157,6 @@
com\nq\controller\AdminApiController.class
com\nq\pojo\SiteSpread.class
com\nq\service\impl\PayChnnelServices.class
-com\nq\controller\backend\AdminRechargeController.class
com\nq\dao\SiteFuturesSettingMapper.class
com\nq\pojo\FundsSetting.class
com\nq\vo\position\PositionProfitVO.class
@@ -183,7 +166,6 @@
com\nq\pojo\User.class
com\nq\service\impl\FileUploadServiceImpl.class
com\nq\service\IAgentUserService.class
-com\nq\controller\backend\AdminFundsDealerInstitutionsController.class
com\nq\dao\StockMarketsDayMapper.class
com\nq\controller\backend\AdminPendingOrderController.class
com\nq\pojo\SiteTaskLog.class
@@ -198,20 +180,16 @@
com\nq\service\impl\UserIndexPositionServiceImpl.class
com\nq\pojo\StockSubscribe.class
com\nq\utils\pay\CmcPayTool.class
-com\nq\dao\PayChnnelMapper.class
com\nq\dao\SiteTaskLogMapper.class
com\nq\dao\UserWithdrawMapper.class
com\nq\service\IStockSubscribeService.class
com\nq\pojo\UserRecharge.class
com\nq\utils\ip\juhe\AddressResult.class
com\nq\utils\task\stock\StockTask.class
-com\nq\controller\PayController.class
-com\nq\controller\StockFuturesApiController.class
com\nq\pojo\FundsLever.class
com\nq\service\IFundsAppendService.class
com\nq\service\IUserRechargeService.class
com\nq\controller\dk\DkController.class
-com\nq\dao\StockDzMapper.class
com\nq\service\impl\UserRechargeServiceImpl.class
com\nq\service\impl\StockCoinServiceImpl.class
com\nq\dao\RealTimeMapper.class
@@ -220,7 +198,6 @@
com\nq\pojo\FundsTradingAccount.class
com\nq\service\impl\SiteSettingServiceImpl.class
com\nq\dao\SitePayMapper.class
-com\nq\controller\backend\AdminStockCoinController.class
com\nq\service\UserPendingorderService.class
com\nq\controller\backend\AdminLogsController.class
com\nq\service\impl\UserPositionServiceImpl.class
@@ -232,7 +209,6 @@
com\nq\controller\protol\UserOptionController.class
com\nq\utils\SymmetricCryptoUtil.class
com\nq\vo\admin\AdminPendingorderVO.class
-com\nq\service\impl\UserAssetsServices.class
com\nq\service\IStockOptionService.class
com\nq\service\impl\AgentDistributionUserServiceImpl.class
com\nq\service\IUserService.class
@@ -242,13 +218,13 @@
com\nq\dao\SiteSmsLogMapper.class
com\nq\utils\stock\pinyin\GetPyByChinese.class
com\nq\security\xss\HandlerExecutionChainWrapper$ControllerXssInterceptor$1.class
-com\nq\service\IPayService.class
com\nq\controller\backend\AdminUserController.class
com\nq\service\IFundsTradingAccountService.class
com\nq\dao\UserPositionMapper.class
com\nq\config\StockPoll.class
com\nq\controller\backend\AdminAgentController.class
com\nq\annotation\SameUrlData.class
+com\nq\service\IPriceServices.class
com\nq\controller\agent\AgentController.class
com\nq\service\impl\FundsAppendServiceImpl.class
com\nq\service\ISiteAmtTransLogService.class
@@ -268,19 +244,15 @@
com\nq\controller\backend\AdminController.class
com\nq\utils\http\HttpClientRequest.class
com\nq\controller\VerifyCodeController.class
-com\nq\controller\backend\AdminIndexPositionController.class
com\nq\service\impl\FundsTradingAccountServiceImpl.class
com\nq\service\impl\StockServiceImpl.class
com\nq\StockApplication.class
-com\nq\controller\backend\AdminSiteProductController.class
com\nq\pojo\SiteSmsLog.class
com\nq\utils\stock\GetStayDays.class
com\nq\service\IBankServices.class
com\nq\security\xss\DispatcherServletWrapper.class
-com\nq\controller\backend\AdminWithDrawController.class
com\nq\dao\UserCashDetailMapper.class
com\nq\service\ISiteProductService.class
-com\nq\dao\SiteIndexSettingMapper.class
com\nq\service\IFundsDealerInstitutionsService.class
com\nq\pojo\UserStockSubscribe.class
com\nq\pojo\HBData$TickBean.class
@@ -309,13 +281,11 @@
com\nq\utils\ip\Mandate.class
com\nq\vo\admin\AdminCountVO.class
com\nq\controller\PayApiController.class
-com\nq\pojo\StockMarket.class
com\nq\pojo\UserPosition.class
com\nq\service\IEchoServices.class
com\nq\controller\backend\AdminStockFuturesController.class
com\nq\dao\BankMapper.class
com\nq\service\impl\FundsDealerInstitutionsServiceImpl.class
-com\nq\pojo\SiteProduct.class
com\nq\service\IFundsSettingService.class
com\nq\utils\task\YEBTask.class
com\nq\dao\InStockMapper.class
@@ -325,9 +295,7 @@
com\nq\utils\Pager.class
com\nq\enums\EStockType.class
com\nq\service\ISiteNewsService.class
-com\nq\service\TradingHourService.class
com\nq\utils\stock\WithDrawUtils.class
-com\nq\pojo\SiteMessage.class
com\nq\utils\stock\sina\StockApi$1.class
com\nq\dao\UserIndexPositionMapper.class
com\nq\service\impl\BankServices.class
@@ -342,18 +310,14 @@
com\nq\pojo\UserFuturesPosition.class
com\nq\service\impl\GoogleAuthenticator.class
com\nq\utils\ftp\FTPUtil.class
-com\nq\pojo\StockDz.class
com\nq\vo\agent\AgentUserListVO.class
-com\nq\pojo\SiteNews.class
com\nq\dao\AgentAgencyFeeMapper.class
com\nq\service\impl\UserFuturesPositionServiceImpl.class
-com\nq\pojo\SiteSetting.class
com\nq\service\ISiteSpreadService.class
com\nq\service\IUserPositionService.class
com\nq\config\WebMvcConfig.class
com\nq\service\IFileUploadService.class
com\nq\service\ISiteSmsLogService.class
-com\nq\controller\agent\AgentWithdrawController.class
com\nq\dao\SiteAdminMapper.class
com\nq\vo\stock\MarketVOResult.class
com\nq\dao\TradingHourMapper.class
@@ -377,19 +341,17 @@
com\nq\utils\translate\GoogleTranslateUtil.class
com\nq\utils\redis\RedisPoolUtil.class
com\nq\service\impl\EchoServices.class
-com\nq\utils\StringUtils.class
com\nq\pojo\AgentUser.class
com\nq\pojo\UserBank.class
+com\nq\service\impl\PriceServicesImpl.class
com\nq\vo\stock\StockUsVO.class
com\nq\vo\agent\AgentInfoVO.class
com\nq\controller\backend\AdminSiteSettingController.class
com\nq\pojo\StockFutures.class
com\nq\service\impl\SiteArticleServiceImpl.class
com\nq\dao\DkJGMapper.class
-com\nq\pojo\Stock.class
com\nq\controller\agent\AgentPositionController.class
com\nq\config\GoogleCodeConfig.class
-com\nq\controller\protol\UserIndexPositionController.class
com\nq\dao\FundsLeverMapper.class
com\nq\vo\futuresposition\AdminFuturesPositionVO.class
com\nq\pojo\UserAssets.class
@@ -402,8 +364,6 @@
com\nq\controller\RealTimeController.class
com\nq\vo\position\UserPendingorderVO.class
com\nq\service\ISmsService.class
-com\nq\vo\position\AdminPositionVO.class
-com\nq\controller\backend\AdminFundsSettingController.class
com\nq\utils\SignUtil.class
com\nq\pojo\ReponseBase.class
com\nq\service\impl\StockOptionServiceImpl.class
@@ -412,7 +372,6 @@
com\nq\dao\FundsApplyMapper.class
com\nq\utils\http\HttpRequest.class
com\nq\pojo\reponse\RUserAssets.class
-com\nq\controller\StockIndexApiController.class
com\nq\controller\StockApiController.class
com\nq\utils\stock\GeneratePosition.class
com\nq\service\impl\UserPendingorderServiceImpl.class
@@ -422,7 +381,6 @@
com\nq\service\ISiteSettingService.class
com\nq\common\Const.class
com\nq\pojo\DkModel.class
-com\nq\pojo\SiteInNew.class
com\nq\utils\email\SendHTMLMail.class
com\nq\service\impl\SiteAmtTransLogServiceImpl.class
com\nq\vo\indexposition\IndexPositionProfitVO.class
@@ -433,6 +391,7 @@
com\nq\service\impl\SiteSpreadServiceImpl.class
com\nq\dao\SiteBannerMapper.class
com\nq\service\impl\SiteMessageServiceImpl.class
+com\nq\service\ITradingHourService.class
com\nq\enums\EUserAssets.class
com\nq\pojo\UserPendingorder.class
com\nq\controller\backend\AdminPositionController.class
@@ -441,7 +400,6 @@
com\nq\service\impl\UserBankServiceImpl.class
com\nq\service\IFundsApplyService.class
com\nq\service\impl\UserServiceImpl.class
-com\nq\pojo\SiteAdmin.class
com\nq\utils\email\MailSender$1.class
com\nq\controller\agent\AgentUserController.class
com\nq\service\ISitePayService.class
diff --git a/target/stock-0.0.1-SNAPSHOT.jar.original b/target/stock-0.0.1-SNAPSHOT.jar.original
index b291e50..b3acdee 100644
--- a/target/stock-0.0.1-SNAPSHOT.jar.original
+++ b/target/stock-0.0.1-SNAPSHOT.jar.original
Binary files differ
--
Gitblit v1.9.3