8 files modified
4 files added
| New file |
| | |
| | | package com.yami.trading.admin.controller.dz; |
| | | |
| | | import com.yami.trading.bean.dz.StockDz; |
| | | import com.yami.trading.common.constants.Constants; |
| | | import com.yami.trading.common.domain.Result; |
| | | import com.yami.trading.service.dz.StockDzService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @RestController |
| | | @CrossOrigin |
| | | @Api(tags = "后台ETF暗池订单") |
| | | @RequestMapping("etfDarkPools") |
| | | @Slf4j |
| | | public class AdminETFDarkPoolsController { |
| | | |
| | | @Resource |
| | | StockDzService stockDzService; |
| | | |
| | | /** |
| | | * @Description: 获取大宗列表 |
| | | * @Param: |
| | | * @return: |
| | | */ |
| | | @ApiOperation("获取大宗列表") |
| | | @PostMapping({"getDzListByAdmin.do"}) |
| | | public Result getDzListByAdmin(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum, |
| | | @RequestParam(value = "pageSize", defaultValue = "5") int pageSize, |
| | | @RequestParam(value = "keywords", required = false)String keywords) { |
| | | return stockDzService.getDzListByAdmin(pageNum, pageSize, keywords, Constants.indices_dark); |
| | | } |
| | | |
| | | /** |
| | | * @Description: 新增大宗 |
| | | * @Param: |
| | | * @return: |
| | | */ |
| | | @ApiOperation("新增大宗") |
| | | @PostMapping({"addByAdmin.do"}) |
| | | public Result addByAdmin(@RequestParam(value = "stockCode") String stockCode, |
| | | @RequestParam(value = "stockNum") String stockNum, |
| | | @RequestParam(value = "password", required = false) String password, |
| | | @RequestParam(value = "startTime") String startTime, |
| | | @RequestParam(value = "endTime") String endTime, |
| | | @RequestParam(value = "discount", required = false) String discount, |
| | | @RequestParam(value = "period") Integer period, |
| | | @RequestParam(value = "nowPrice") String nowPrice, |
| | | @RequestParam(value = "switchType", defaultValue = "0") Integer switchType) { |
| | | return stockDzService.addByAdmin(stockCode, stockNum, password, startTime, endTime, discount, period,nowPrice,switchType, Constants.indices_dark); |
| | | } |
| | | |
| | | /** |
| | | * 删除大宗 |
| | | */ |
| | | @ApiOperation("删除大宗") |
| | | @PostMapping({"deleteByAdmin.do"}) |
| | | public Result deleteByAdmin(@RequestParam(value = "id") String id) { |
| | | return stockDzService.deleteByAdmin(id); |
| | | } |
| | | |
| | | /** |
| | | * 修改大宗 |
| | | */ |
| | | @ApiOperation("修改大宗") |
| | | @PostMapping({"updateByAdmin.do"}) |
| | | public Result updateByAdmin(StockDz model) { |
| | | return stockDzService.updByAdmin(model); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("大宗交易审核列表") |
| | | @PostMapping({"getDzCheckList.do"}) |
| | | @ResponseBody |
| | | public Result getDzCheckList(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum, |
| | | @RequestParam(value = "pageSize", defaultValue = "15") int pageSize, |
| | | @RequestParam(value = "state", required = false) String state, |
| | | @RequestParam(value = "stockCode", required = false)String stockCode) { |
| | | return stockDzService.getDzCheckList(pageNum, pageSize, state, stockCode, Constants.indices_dark); |
| | | } |
| | | |
| | | @ApiOperation("大宗审核") |
| | | @PostMapping({"dzCheck.do"}) |
| | | @ResponseBody |
| | | public Result check(@RequestParam(value = "id") String id, |
| | | @RequestParam(value = "checkType") Integer checkType, |
| | | @RequestParam(value = "orderNum", required = false) Double orderNum) { |
| | | if(checkType != 2 && (id == null || checkType == null || orderNum == null)){ |
| | | return Result.failed("参数不能为空"); |
| | | } |
| | | return stockDzService.dzCheck(id, checkType, orderNum); |
| | | } |
| | | |
| | | } |
| | |
| | | @RequestParam(value = "period") Integer period, |
| | | @RequestParam(value = "nowPrice") String nowPrice, |
| | | @RequestParam(value = "switchType", defaultValue = "0") Integer switchType) { |
| | | return stockDzService.addByAdmin(stockCode, stockNum, password, startTime, endTime, discount, period,nowPrice,switchType); |
| | | return stockDzService.addByAdmin(stockCode, stockNum, password, startTime, endTime, discount, period,nowPrice,switchType, Constants.indices); |
| | | } |
| | | |
| | | /** |
| New file |
| | |
| | | package com.yami.trading.admin.controller.dz; |
| | | |
| | | import com.yami.trading.bean.dz.StockDz; |
| | | import com.yami.trading.common.constants.Constants; |
| | | import com.yami.trading.common.domain.Result; |
| | | import com.yami.trading.service.dz.StockDzService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @RestController |
| | | @CrossOrigin |
| | | @Api(tags = "后台美股暗池订单") |
| | | @RequestMapping("stockDarkPools") |
| | | @Slf4j |
| | | public class AdminStockDarkPoolsController { |
| | | |
| | | @Resource |
| | | StockDzService stockDzService; |
| | | |
| | | /** |
| | | * @Description: 获取大宗列表 |
| | | * @Param: |
| | | * @return: |
| | | */ |
| | | @ApiOperation("获取大宗列表") |
| | | @PostMapping({"getDzListByAdmin.do"}) |
| | | public Result getDzListByAdmin(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum, |
| | | @RequestParam(value = "pageSize", defaultValue = "5") int pageSize, |
| | | @RequestParam(value = "keywords", required = false)String keywords) { |
| | | return stockDzService.getDzListByAdmin(pageNum, pageSize, keywords, Constants.US_DARK); |
| | | } |
| | | |
| | | /** |
| | | * @Description: 新增大宗 |
| | | * @Param: |
| | | * @return: |
| | | */ |
| | | @ApiOperation("新增大宗") |
| | | @PostMapping({"addByAdmin.do"}) |
| | | public Result addByAdmin(@RequestParam(value = "stockCode") String stockCode, |
| | | @RequestParam(value = "stockNum") String stockNum, |
| | | @RequestParam(value = "password", required = false) String password, |
| | | @RequestParam(value = "startTime") String startTime, |
| | | @RequestParam(value = "endTime") String endTime, |
| | | @RequestParam(value = "discount", required = false) String discount, |
| | | @RequestParam(value = "period") Integer period, |
| | | @RequestParam(value = "nowPrice") String nowPrice, |
| | | @RequestParam(value = "switchType", defaultValue = "0") Integer switchType) { |
| | | return stockDzService.addByAdmin(stockCode, stockNum, password, startTime, endTime, discount, period,nowPrice,switchType, Constants.US_DARK); |
| | | } |
| | | |
| | | /** |
| | | * 删除大宗 |
| | | */ |
| | | @ApiOperation("删除大宗") |
| | | @PostMapping({"deleteByAdmin.do"}) |
| | | public Result deleteByAdmin(@RequestParam(value = "id") String id) { |
| | | return stockDzService.deleteByAdmin(id); |
| | | } |
| | | |
| | | /** |
| | | * 修改大宗 |
| | | */ |
| | | @ApiOperation("修改大宗") |
| | | @PostMapping({"updateByAdmin.do"}) |
| | | public Result updateByAdmin(StockDz model) { |
| | | return stockDzService.updByAdmin(model); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("大宗交易审核列表") |
| | | @PostMapping({"getDzCheckList.do"}) |
| | | @ResponseBody |
| | | public Result getDzCheckList(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum, |
| | | @RequestParam(value = "pageSize", defaultValue = "15") int pageSize, |
| | | @RequestParam(value = "state", required = false) String state, |
| | | @RequestParam(value = "stockCode", required = false)String stockCode) { |
| | | return stockDzService.getDzCheckList(pageNum, pageSize, state, stockCode, Constants.US_DARK); |
| | | } |
| | | |
| | | @ApiOperation("大宗审核") |
| | | @PostMapping({"dzCheck.do"}) |
| | | @ResponseBody |
| | | public Result check(@RequestParam(value = "id") String id, |
| | | @RequestParam(value = "checkType") Integer checkType, |
| | | @RequestParam(value = "orderNum", required = false) Double orderNum) { |
| | | if(checkType != 2 && (id == null || checkType == null || orderNum == null)){ |
| | | return Result.failed("参数不能为空"); |
| | | } |
| | | return stockDzService.dzCheck(id, checkType, orderNum); |
| | | } |
| | | |
| | | } |
| | |
| | | @RequestParam(value = "period") Integer period, |
| | | @RequestParam(value = "nowPrice") String nowPrice, |
| | | @RequestParam(value = "switchType", defaultValue = "0") Integer switchType) { |
| | | return stockDzService.addByAdmin(stockCode, stockNum, password, startTime, endTime, discount, period,nowPrice,switchType); |
| | | return stockDzService.addByAdmin(stockCode, stockNum, password, startTime, endTime, discount, period,nowPrice,switchType, Constants.US_STOCKS); |
| | | } |
| | | |
| | | /** |
| New file |
| | |
| | | package com.yami.trading.api.controller.dz; |
| | | |
| | | import com.yami.trading.bean.dz.ExchangeApplyOrderDz; |
| | | import com.yami.trading.common.constants.Constants; |
| | | import com.yami.trading.common.domain.Result; |
| | | import com.yami.trading.common.exception.YamiShopBindException; |
| | | import com.yami.trading.security.common.util.SecurityUtils; |
| | | import com.yami.trading.service.dz.StockDzService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.concurrent.locks.Lock; |
| | | import java.util.concurrent.locks.ReentrantLock; |
| | | |
| | | @RestController |
| | | @CrossOrigin |
| | | @Api(tags = "ETF暗池") |
| | | @RequestMapping("api/etfDarkPools") |
| | | @Slf4j |
| | | public class ApiETFDarkPoolsController { |
| | | |
| | | @Resource |
| | | StockDzService stockDzService; |
| | | |
| | | private static final ThreadLocal<Boolean> orderCreated = ThreadLocal.withInitial(() -> false); |
| | | private final Lock lock = new ReentrantLock(); |
| | | |
| | | |
| | | @ApiOperation("大宗交易列表") |
| | | @PostMapping({"getDzList.do"}) |
| | | @ResponseBody |
| | | public Result getDzList(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum, |
| | | @RequestParam(value = "pageSize", defaultValue = "5") int pageSize, |
| | | @RequestParam(value = "orderBy", required = false) String orderBy, |
| | | @RequestParam(value = "keyWords", required = false) String keyWords) { |
| | | return stockDzService.getDzList(pageNum, pageSize, orderBy,keyWords, Constants.indices_dark); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation("大宗下单") |
| | | @GetMapping({"buyStockDz.do"}) |
| | | @ResponseBody |
| | | public Result buyDz(@RequestParam("dzId") String dzId, |
| | | @RequestParam(value = "password", required = false) String password, |
| | | @RequestParam("num") double num) { |
| | | lock.lock(); |
| | | try { |
| | | if (orderCreated.get()) { |
| | | throw new YamiShopBindException("当前交易人数过多,请稍后重试"); |
| | | } |
| | | orderCreated.set(true); |
| | | String partyId = SecurityUtils.getCurrentUserId(); |
| | | if (partyId == null || partyId.isEmpty()) { |
| | | throw new YamiShopBindException("请先登录"); |
| | | } |
| | | return stockDzService.buyDz(dzId, password, num, partyId); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
| | | } finally{ |
| | | lock.unlock(); |
| | | orderCreated.set(false); |
| | | } |
| | | throw new YamiShopBindException("订单异常,请稍后重试"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation("大宗交易持仓订单列表") |
| | | @PostMapping({"getDzOrderList.do"}) |
| | | @ResponseBody |
| | | public Result getDzOrderList(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum, |
| | | @RequestParam(value = "pageSize", defaultValue = "5") int pageSize) { |
| | | String partyId = SecurityUtils.getCurrentUserId(); |
| | | if (partyId == null || partyId.isEmpty()) { |
| | | throw new YamiShopBindException("请先登录"); |
| | | } |
| | | return stockDzService.getDzOrderList(pageNum, pageSize, ExchangeApplyOrderDz.STATE_POSITION, partyId, Constants.indices_dark); |
| | | } |
| | | |
| | | @ApiOperation("大宗交易历史订单列表") |
| | | @PostMapping({"getDzHistoryList.do"}) |
| | | @ResponseBody |
| | | public Result getDzHistoryList(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum, |
| | | @RequestParam(value = "pageSize", defaultValue = "5") int pageSize) { |
| | | String partyId = SecurityUtils.getCurrentUserId(); |
| | | if (partyId == null || partyId.isEmpty()) { |
| | | throw new YamiShopBindException("请先登录"); |
| | | } |
| | | return stockDzService.getDzOrderList(pageNum, pageSize, null, partyId, Constants.indices_dark); |
| | | } |
| | | |
| | | @ApiOperation("大宗平仓") |
| | | @GetMapping({"closeStockDz.do"}) |
| | | @ResponseBody |
| | | public Result closeStockDz(@RequestParam("id") String id, |
| | | @RequestParam(value = "num", required = false) Double num) { |
| | | lock.lock(); |
| | | try { |
| | | if (orderCreated.get()) { |
| | | throw new YamiShopBindException("当前交易人数过多,请稍后重试"); |
| | | } |
| | | orderCreated.set(true); |
| | | String partyId = SecurityUtils.getCurrentUserId(); |
| | | if (partyId == null || partyId.isEmpty()) { |
| | | throw new YamiShopBindException("请先登录"); |
| | | } |
| | | return stockDzService.closeDz(id, num, partyId); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
| | | } finally{ |
| | | lock.unlock(); |
| | | orderCreated.set(false); |
| | | } |
| | | throw new YamiShopBindException("订单异常,请稍后重试"); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.yami.trading.api.controller.dz; |
| | | |
| | | import com.yami.trading.bean.dz.ExchangeApplyOrderDz; |
| | | import com.yami.trading.common.constants.Constants; |
| | | import com.yami.trading.common.domain.Result; |
| | | import com.yami.trading.common.exception.YamiShopBindException; |
| | | import com.yami.trading.security.common.util.SecurityUtils; |
| | | import com.yami.trading.service.dz.StockDzService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.concurrent.locks.Lock; |
| | | import java.util.concurrent.locks.ReentrantLock; |
| | | |
| | | @RestController |
| | | @CrossOrigin |
| | | @Api(tags = "美股暗池") |
| | | @RequestMapping("api/stockDarkPools") |
| | | @Slf4j |
| | | public class ApiStockDarkPoolsController { |
| | | |
| | | @Resource |
| | | StockDzService stockDzService; |
| | | |
| | | private static final ThreadLocal<Boolean> orderCreated = ThreadLocal.withInitial(() -> false); |
| | | private final Lock lock = new ReentrantLock(); |
| | | |
| | | /** |
| | | * 大宗交易 列表 |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @param orderBy |
| | | * @param keyWords 搜索内容 |
| | | * @return |
| | | */ |
| | | @ApiOperation("大宗交易列表") |
| | | @PostMapping({"getDzList.do"}) |
| | | @ResponseBody |
| | | public Result getDzList(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum, |
| | | @RequestParam(value = "pageSize", defaultValue = "5") int pageSize, |
| | | @RequestParam(value = "orderBy", required = false) String orderBy, |
| | | @RequestParam(value = "keyWords", required = false) String keyWords) { |
| | | return stockDzService.getDzList(pageNum, pageSize, orderBy,keyWords, Constants.US_DARK); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("大宗下单") |
| | | @GetMapping({"buyStockDz.do"}) |
| | | @ResponseBody |
| | | public Result buyDz(@RequestParam("dzId") String dzId, |
| | | @RequestParam(value = "password", required = false) String password, |
| | | @RequestParam("num") double num) { |
| | | lock.lock(); |
| | | try { |
| | | if (orderCreated.get()) { |
| | | throw new YamiShopBindException("当前交易人数过多,请稍后重试"); |
| | | } |
| | | orderCreated.set(true); |
| | | String partyId = SecurityUtils.getCurrentUserId(); |
| | | if (partyId == null || partyId.isEmpty()) { |
| | | throw new YamiShopBindException("请先登录"); |
| | | } |
| | | return stockDzService.buyDz(dzId, password, num, partyId); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
| | | } finally{ |
| | | lock.unlock(); |
| | | orderCreated.set(false); |
| | | } |
| | | throw new YamiShopBindException("订单异常,请稍后重试"); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation("大宗交易持仓订单列表") |
| | | @PostMapping({"getDzOrderList.do"}) |
| | | @ResponseBody |
| | | public Result getDzOrderList(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum, |
| | | @RequestParam(value = "pageSize", defaultValue = "5") int pageSize) { |
| | | String partyId = SecurityUtils.getCurrentUserId(); |
| | | if (partyId == null || partyId.isEmpty()) { |
| | | throw new YamiShopBindException("请先登录"); |
| | | } |
| | | return stockDzService.getDzOrderList(pageNum, pageSize, ExchangeApplyOrderDz.STATE_POSITION, partyId, Constants.US_DARK); |
| | | } |
| | | |
| | | @ApiOperation("大宗交易历史订单列表") |
| | | @PostMapping({"getDzHistoryList.do"}) |
| | | @ResponseBody |
| | | public Result getDzHistoryList(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum, |
| | | @RequestParam(value = "pageSize", defaultValue = "5") int pageSize) { |
| | | String partyId = SecurityUtils.getCurrentUserId(); |
| | | if (partyId == null || partyId.isEmpty()) { |
| | | throw new YamiShopBindException("请先登录"); |
| | | } |
| | | return stockDzService.getDzOrderList(pageNum, pageSize, null, partyId, Constants.US_DARK); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("大宗平仓") |
| | | @GetMapping({"closeStockDz.do"}) |
| | | @ResponseBody |
| | | public Result closeStockDz(@RequestParam("id") String id, |
| | | @RequestParam(value = "num", required = false) Double num) { |
| | | lock.lock(); |
| | | try { |
| | | if (orderCreated.get()) { |
| | | throw new YamiShopBindException("当前交易人数过多,请稍后重试"); |
| | | } |
| | | orderCreated.set(true); |
| | | String partyId = SecurityUtils.getCurrentUserId(); |
| | | if (partyId == null || partyId.isEmpty()) { |
| | | throw new YamiShopBindException("请先登录"); |
| | | } |
| | | return stockDzService.closeDz(id, num, partyId); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
| | | } finally{ |
| | | lock.unlock(); |
| | | orderCreated.set(false); |
| | | } |
| | | throw new YamiShopBindException("订单异常,请稍后重试"); |
| | | } |
| | | |
| | | } |
| | |
| | | @PostMapping({"getDzOrderList.do"}) |
| | | @ResponseBody |
| | | public Result getDzOrderList(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum, |
| | | @RequestParam(value = "pageSize", defaultValue = "5") int pageSize, |
| | | @RequestParam(value = "state", required = false) String state) { |
| | | @RequestParam(value = "pageSize", defaultValue = "5") int pageSize) { |
| | | String partyId = SecurityUtils.getCurrentUserId(); |
| | | if (partyId == null || partyId.isEmpty()) { |
| | | throw new YamiShopBindException("请先登录"); |
| | |
| | | |
| | | private String stockCode; |
| | | |
| | | //美股US_STOCKS ETF indices |
| | | //美股大宗 US-stocks 美股暗池 US_DARK ETF大宗 indices ETF暗池 indices-dark |
| | | private String stockType; |
| | | |
| | | private String stockSpell; |
| | |
| | | @ApiModelProperty("浮动盈亏") |
| | | private double profitLoss; |
| | | |
| | | @ApiModelProperty("浮动盈亏比例") |
| | | private double profitLossPercentage; |
| | | |
| | | } |
| | |
| | | public final static String indices = "indices"; |
| | | |
| | | /** |
| | | * ETF暗池 |
| | | */ |
| | | public final static String indices_dark = "indices-dark"; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 大宗商品 |
| | | */ |
| | | public final static String commodities = "commodities"; |
| | |
| | | public final static String US_STOCKS = "US-stocks"; |
| | | |
| | | /** |
| | | * 美股暗池 |
| | | */ |
| | | public final static String US_DARK = "US-dark"; |
| | | |
| | | /** |
| | | * 港股 |
| | | */ |
| | | public final static String HK_STOCKS = "HK-stocks"; |
| | |
| | | |
| | | Result getDzList(int pageNum, int pageSize, String orderBy, String keyWords, String stockType); |
| | | |
| | | Result addByAdmin(String stockCode, String stockNum, String password, String startTime, String endTime, String discount,Integer period,String nowPrice,Integer switchType); |
| | | Result addByAdmin(String stockCode, String stockNum, String password, String startTime, String endTime, String discount,Integer period,String nowPrice,Integer switchType, String stockType); |
| | | |
| | | Result getDzListByAdmin(int pageNum, int pageSize, String keywords, String stockType); |
| | | |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.DecimalFormat; |
| | | import java.util.*; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Result addByAdmin(String stockCode, String stockNum, String password, String startTime, String endTime, String discount,Integer period,String nowPrice,Integer switchType) { |
| | | if (stockCode == null || stockCode.isEmpty() ||stockNum == null || stockNum.isEmpty() || startTime == null || startTime.isEmpty() ||endTime == null || endTime.isEmpty() || period == null || nowPrice == null){ |
| | | public Result addByAdmin(String stockCode, String stockNum, String password, String startTime, String endTime, String discount,Integer period,String nowPrice,Integer switchType, String stockType) { |
| | | if (stockCode == null || stockCode.isEmpty() ||stockNum == null || stockNum.isEmpty() || startTime == null || startTime.isEmpty() ||endTime == null || endTime.isEmpty() || nowPrice == null){ |
| | | return Result.failed("参数不能为空"); |
| | | } |
| | | |
| | |
| | | StockDz stockDz = new StockDz(); |
| | | stockDz.setStockName(item.getSymbolFullName()); |
| | | stockDz.setStockCode(item.getSymbol()); |
| | | stockDz.setStockType(item.getType()); |
| | | stockDz.setStockType(stockType); |
| | | stockDz.setStockSpell(item.getSymbolData()); |
| | | stockDz.setIsLock(0); |
| | | stockDz.setIsShow(1); |
| | |
| | | } |
| | | model.setStockName(item.getSymbolFullName()); |
| | | model.setStockCode(item.getSymbol()); |
| | | model.setStockType(item.getType()); |
| | | model.setStockType(stockDz.getStockType()); |
| | | model.setStockSpell(item.getSymbolData()); |
| | | return stockDzMapper.updateById(model) > 0 ? Result.succeed("修改成功") : Result.failed("修改失败"); |
| | | } |
| | |
| | | DecimalFormat df = new DecimalFormat("#.##"); |
| | | String resultStr = df.format(profitLoss); |
| | | dz.setProfitLoss(Double.parseDouble(resultStr)); |
| | | |
| | | double profitPercentage = (profitLoss / dz.getVolume()) * 100; |
| | | String resultPer = df.format(profitPercentage); |
| | | dz.setProfitLossPercentage(Double.parseDouble(resultPer)); |
| | | }); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | Date now = new Date(); |
| | | if (stockDz.getPeriod() > 0) { |
| | | if (stockDz.getPeriod() != null && stockDz.getPeriod() > 0) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(order.getCreateTime()); |
| | | calendar.add(Calendar.DATE, stockDz.getPeriod()); |
| | |
| | | Date resultTime = calendar.getTime(); |
| | | |
| | | if(now.getTime() < resultTime.getTime()){ |
| | | throw new YamiShopBindException("Lock-up period:" + stockDz.getPeriod()); |
| | | throw new YamiShopBindException("锁仓中"); |
| | | } |
| | | } |
| | | |
| | |
| | | return Result.succeed("平仓成功"); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
| | | return Result.failed("操作失败:" + e.getMessage()); |
| | | return Result.failed(e.getMessage()); |
| | | } |
| | | } |
| | | |