diff --git a/src/main/java/com/sztzjy/forex/trading_trading/controller/WarningController.java b/src/main/java/com/sztzjy/forex/trading_trading/controller/WarningController.java index 46395d5..bd02205 100644 --- a/src/main/java/com/sztzjy/forex/trading_trading/controller/WarningController.java +++ b/src/main/java/com/sztzjy/forex/trading_trading/controller/WarningController.java @@ -2,6 +2,8 @@ package com.sztzjy.forex.trading_trading.controller; import cn.hutool.core.util.IdUtil; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import com.sztzjy.forex.trading_trading.entity.*; import com.sztzjy.forex.trading_trading.mappers.AlertHoldDurationMapper; import com.sztzjy.forex.trading_trading.mappers.AlertHoldDurationRecordMapper; @@ -60,9 +62,11 @@ public class WarningController { //查询保证金预警记录 @GetMapping("/getMarginWarningRecord") @ApiOperation("查询保证金预警记录") - public ResultEntity> getMarginWarningRecord(@ApiParam("姓名")@RequestParam String userName, - @ApiParam("任务ID")@RequestParam String trainingId) { - return new ResultEntity<>(wainingService.getMarginWarningRecord(trainingId, userName)); + public ResultEntity> getMarginWarningRecord(@ApiParam("姓名")@RequestParam String userName, + @ApiParam("任务ID")@RequestParam String trainingId, + @ApiParam("首页页码")@RequestParam Integer index, + @ApiParam("页面条数")@RequestParam Integer size) { + return new ResultEntity<>(wainingService.getMarginWarningRecord(index, size,userName, trainingId)); } //启用或停止保证金预警状态 @@ -85,28 +89,33 @@ public class WarningController { @PostMapping("/addMarketWarning") @ApiOperation("新增行情预警") public void addMarketWarning(@ApiParam("行情预警对象")@RequestBody MarketWarning marketWarning, - @ApiParam("任务ID")@RequestParam String tariningId, + @ApiParam("任务ID")@RequestParam String trainingId, @ApiParam("姓名")@RequestParam String name) { - wainingService.addMarketWarning(marketWarning, tariningId, name); + wainingService.addMarketWarning(marketWarning, trainingId, name); } //查询行情预警 @GetMapping("/getMarketWarning") @ApiOperation("查询行情预警") - public ResultEntity> getMarketWarning(@ApiParam("姓名")@RequestParam String name, - @ApiParam("任务ID")@RequestParam String tariningId) { + public ResultEntity> getMarketWarning(@ApiParam("姓名")@RequestParam String name, + @ApiParam("任务ID")@RequestParam String trainingId, + @ApiParam("首页页码")@RequestParam Integer index, + @ApiParam("页面条数")@RequestParam Integer size) { + PageHelper.startPage(index,size); MarketWarningExample marketWarningExample = new MarketWarningExample(); - marketWarningExample.createCriteria().andNameEqualTo(name).andTariningidEqualTo(tariningId); - return new ResultEntity<>(marketWarningMapper.selectByExample(marketWarningExample)); + marketWarningExample.createCriteria().andNameEqualTo(name).andTariningidEqualTo(trainingId); + List marketWarnings = marketWarningMapper.selectByExample(marketWarningExample); + PageInfo pageInfo = new PageInfo<>(marketWarnings); + return new ResultEntity<>(pageInfo); } //查询行情预警记录 @GetMapping("/getMarketWarningRecord") @ApiOperation("查询行情预警记录") public ResultEntity> getMarketWarningRecord(@ApiParam("姓名")@RequestParam String name, - @ApiParam("任务ID")@RequestParam String tariningId) { + @ApiParam("任务ID")@RequestParam String trainingId) { MarketWarningRecordExample marketWarningRecordExample = new MarketWarningRecordExample(); - marketWarningRecordExample.createCriteria().andNameEqualTo(name).andTariningidEqualTo(tariningId); + marketWarningRecordExample.createCriteria().andNameEqualTo(name).andTariningidEqualTo(trainingId); return new ResultEntity<>(marketWarningRecordMapper.selectByExample(marketWarningRecordExample)); } @@ -138,20 +147,10 @@ public class WarningController { @PostMapping("/addAlertHoldDuration") @ApiOperation("新增持仓时长预警") public void addAlertHoldDuration(@ApiParam("持仓时长预警对象")@RequestBody AlertHoldDuration alertHoldDuration, - @ApiParam("任务ID")@RequestParam String tariningId, - @ApiParam("姓名")@RequestParam String name) { - alertHoldDuration.setName(name); - alertHoldDuration.setTrainingid(tariningId); - AlertHoldDurationRecord ahdr = new AlertHoldDurationRecord(); - BeanUtils.copyProperties(alertHoldDuration,ahdr); - ahdr.setId(IdUtil.simpleUUID()); - ahdr.setDurationid(alertHoldDuration.getId()); - ahdr.setWariningTime(alertHoldDuration.getSetTime()); - //TODO 设置记录表的持仓时长和交易时间两个参数 -// ahdr.setHoldDuration("持仓时长"); -// ahdr.setWariningTime("预警时间"); - alertHoldDurationMapper.insert(alertHoldDuration); - alertHoldDurationRecordMapper.insert(ahdr); + @ApiParam("任务ID")@RequestParam String trainingId, + @ApiParam("姓名")@RequestParam String name, + @ApiParam("交易记录表ID")@RequestParam String stashId) { + wainingService.addAlertHoldDuration(alertHoldDuration,trainingId,name,stashId); } //删除持仓时长预警 @@ -177,4 +176,8 @@ public class WarningController { public void deleteAlertHoldDurationRecordMapper(@ApiParam("id")@RequestParam String id) { alertHoldDurationRecordMapper.deleteByPrimaryKey(id); } + + //查询持仓时长预警记录表 + + //查询持仓时长预警表 } diff --git a/src/main/java/com/sztzjy/forex/trading_trading/entity/AlertHoldDuration.java b/src/main/java/com/sztzjy/forex/trading_trading/entity/AlertHoldDuration.java index 67336fc..792d8b6 100644 --- a/src/main/java/com/sztzjy/forex/trading_trading/entity/AlertHoldDuration.java +++ b/src/main/java/com/sztzjy/forex/trading_trading/entity/AlertHoldDuration.java @@ -8,16 +8,34 @@ public class AlertHoldDuration { * This field was generated by MyBatis Generator. * This field corresponds to the database column sys_alert_hold_duration.id * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ private String id; + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column sys_alert_hold_duration.stashId + * + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 + */ + private String stashid; + + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column sys_alert_hold_duration.memberId + * + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 + */ + private String memberid; + /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column sys_alert_hold_duration.trainingId * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ private String trainingid; @@ -26,7 +44,7 @@ public class AlertHoldDuration { * This field was generated by MyBatis Generator. * This field corresponds to the database column sys_alert_hold_duration.name * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ private String name; @@ -35,7 +53,7 @@ public class AlertHoldDuration { * This field was generated by MyBatis Generator. * This field corresponds to the database column sys_alert_hold_duration.symbol * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ private String symbol; @@ -44,7 +62,7 @@ public class AlertHoldDuration { * This field was generated by MyBatis Generator. * This field corresponds to the database column sys_alert_hold_duration.warining_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ private String wariningHoldDuration; @@ -53,7 +71,7 @@ public class AlertHoldDuration { * This field was generated by MyBatis Generator. * This field corresponds to the database column sys_alert_hold_duration.status * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ private Integer status; @@ -62,7 +80,7 @@ public class AlertHoldDuration { * This field was generated by MyBatis Generator. * This field corresponds to the database column sys_alert_hold_duration.set_time * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ private Date setTime; @@ -72,7 +90,7 @@ public class AlertHoldDuration { * * @return the value of sys_alert_hold_duration.id * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public String getId() { return id; @@ -84,19 +102,67 @@ public class AlertHoldDuration { * * @param id the value for sys_alert_hold_duration.id * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public void setId(String id) { this.id = id == null ? null : id.trim(); } + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column sys_alert_hold_duration.stashId + * + * @return the value of sys_alert_hold_duration.stashId + * + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 + */ + public String getStashid() { + return stashid; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column sys_alert_hold_duration.stashId + * + * @param stashid the value for sys_alert_hold_duration.stashId + * + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 + */ + public void setStashid(String stashid) { + this.stashid = stashid == null ? null : stashid.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column sys_alert_hold_duration.memberId + * + * @return the value of sys_alert_hold_duration.memberId + * + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 + */ + public String getMemberid() { + return memberid; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column sys_alert_hold_duration.memberId + * + * @param memberid the value for sys_alert_hold_duration.memberId + * + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 + */ + public void setMemberid(String memberid) { + this.memberid = memberid == null ? null : memberid.trim(); + } + /** * This method was generated by MyBatis Generator. * This method returns the value of the database column sys_alert_hold_duration.trainingId * * @return the value of sys_alert_hold_duration.trainingId * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public String getTrainingid() { return trainingid; @@ -108,7 +174,7 @@ public class AlertHoldDuration { * * @param trainingid the value for sys_alert_hold_duration.trainingId * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public void setTrainingid(String trainingid) { this.trainingid = trainingid == null ? null : trainingid.trim(); @@ -120,7 +186,7 @@ public class AlertHoldDuration { * * @return the value of sys_alert_hold_duration.name * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public String getName() { return name; @@ -132,7 +198,7 @@ public class AlertHoldDuration { * * @param name the value for sys_alert_hold_duration.name * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public void setName(String name) { this.name = name == null ? null : name.trim(); @@ -144,7 +210,7 @@ public class AlertHoldDuration { * * @return the value of sys_alert_hold_duration.symbol * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public String getSymbol() { return symbol; @@ -156,7 +222,7 @@ public class AlertHoldDuration { * * @param symbol the value for sys_alert_hold_duration.symbol * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public void setSymbol(String symbol) { this.symbol = symbol == null ? null : symbol.trim(); @@ -168,7 +234,7 @@ public class AlertHoldDuration { * * @return the value of sys_alert_hold_duration.warining_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public String getWariningHoldDuration() { return wariningHoldDuration; @@ -180,7 +246,7 @@ public class AlertHoldDuration { * * @param wariningHoldDuration the value for sys_alert_hold_duration.warining_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public void setWariningHoldDuration(String wariningHoldDuration) { this.wariningHoldDuration = wariningHoldDuration == null ? null : wariningHoldDuration.trim(); @@ -192,7 +258,7 @@ public class AlertHoldDuration { * * @return the value of sys_alert_hold_duration.status * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public Integer getStatus() { return status; @@ -204,7 +270,7 @@ public class AlertHoldDuration { * * @param status the value for sys_alert_hold_duration.status * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public void setStatus(Integer status) { this.status = status; @@ -216,7 +282,7 @@ public class AlertHoldDuration { * * @return the value of sys_alert_hold_duration.set_time * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public Date getSetTime() { return setTime; @@ -228,7 +294,7 @@ public class AlertHoldDuration { * * @param setTime the value for sys_alert_hold_duration.set_time * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public void setSetTime(Date setTime) { this.setTime = setTime; diff --git a/src/main/java/com/sztzjy/forex/trading_trading/entity/AlertHoldDurationExample.java b/src/main/java/com/sztzjy/forex/trading_trading/entity/AlertHoldDurationExample.java index bc946f1..baea148 100644 --- a/src/main/java/com/sztzjy/forex/trading_trading/entity/AlertHoldDurationExample.java +++ b/src/main/java/com/sztzjy/forex/trading_trading/entity/AlertHoldDurationExample.java @@ -9,7 +9,7 @@ public class AlertHoldDurationExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ protected String orderByClause; @@ -17,7 +17,7 @@ public class AlertHoldDurationExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ protected boolean distinct; @@ -25,7 +25,7 @@ public class AlertHoldDurationExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ protected List oredCriteria; @@ -33,7 +33,7 @@ public class AlertHoldDurationExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public AlertHoldDurationExample() { oredCriteria = new ArrayList<>(); @@ -43,7 +43,7 @@ public class AlertHoldDurationExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; @@ -53,7 +53,7 @@ public class AlertHoldDurationExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public String getOrderByClause() { return orderByClause; @@ -63,7 +63,7 @@ public class AlertHoldDurationExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public void setDistinct(boolean distinct) { this.distinct = distinct; @@ -73,7 +73,7 @@ public class AlertHoldDurationExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public boolean isDistinct() { return distinct; @@ -83,7 +83,7 @@ public class AlertHoldDurationExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public List getOredCriteria() { return oredCriteria; @@ -93,7 +93,7 @@ public class AlertHoldDurationExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public void or(Criteria criteria) { oredCriteria.add(criteria); @@ -103,7 +103,7 @@ public class AlertHoldDurationExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); @@ -115,7 +115,7 @@ public class AlertHoldDurationExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); @@ -129,7 +129,7 @@ public class AlertHoldDurationExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); @@ -140,7 +140,7 @@ public class AlertHoldDurationExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public void clear() { oredCriteria.clear(); @@ -152,7 +152,7 @@ public class AlertHoldDurationExample { * This class was generated by MyBatis Generator. * This class corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ protected abstract static class GeneratedCriteria { protected List criteria; @@ -265,6 +265,146 @@ public class AlertHoldDurationExample { return (Criteria) this; } + public Criteria andStashidIsNull() { + addCriterion("stashId is null"); + return (Criteria) this; + } + + public Criteria andStashidIsNotNull() { + addCriterion("stashId is not null"); + return (Criteria) this; + } + + public Criteria andStashidEqualTo(String value) { + addCriterion("stashId =", value, "stashid"); + return (Criteria) this; + } + + public Criteria andStashidNotEqualTo(String value) { + addCriterion("stashId <>", value, "stashid"); + return (Criteria) this; + } + + public Criteria andStashidGreaterThan(String value) { + addCriterion("stashId >", value, "stashid"); + return (Criteria) this; + } + + public Criteria andStashidGreaterThanOrEqualTo(String value) { + addCriterion("stashId >=", value, "stashid"); + return (Criteria) this; + } + + public Criteria andStashidLessThan(String value) { + addCriterion("stashId <", value, "stashid"); + return (Criteria) this; + } + + public Criteria andStashidLessThanOrEqualTo(String value) { + addCriterion("stashId <=", value, "stashid"); + return (Criteria) this; + } + + public Criteria andStashidLike(String value) { + addCriterion("stashId like", value, "stashid"); + return (Criteria) this; + } + + public Criteria andStashidNotLike(String value) { + addCriterion("stashId not like", value, "stashid"); + return (Criteria) this; + } + + public Criteria andStashidIn(List values) { + addCriterion("stashId in", values, "stashid"); + return (Criteria) this; + } + + public Criteria andStashidNotIn(List values) { + addCriterion("stashId not in", values, "stashid"); + return (Criteria) this; + } + + public Criteria andStashidBetween(String value1, String value2) { + addCriterion("stashId between", value1, value2, "stashid"); + return (Criteria) this; + } + + public Criteria andStashidNotBetween(String value1, String value2) { + addCriterion("stashId not between", value1, value2, "stashid"); + return (Criteria) this; + } + + public Criteria andMemberidIsNull() { + addCriterion("memberId is null"); + return (Criteria) this; + } + + public Criteria andMemberidIsNotNull() { + addCriterion("memberId is not null"); + return (Criteria) this; + } + + public Criteria andMemberidEqualTo(String value) { + addCriterion("memberId =", value, "memberid"); + return (Criteria) this; + } + + public Criteria andMemberidNotEqualTo(String value) { + addCriterion("memberId <>", value, "memberid"); + return (Criteria) this; + } + + public Criteria andMemberidGreaterThan(String value) { + addCriterion("memberId >", value, "memberid"); + return (Criteria) this; + } + + public Criteria andMemberidGreaterThanOrEqualTo(String value) { + addCriterion("memberId >=", value, "memberid"); + return (Criteria) this; + } + + public Criteria andMemberidLessThan(String value) { + addCriterion("memberId <", value, "memberid"); + return (Criteria) this; + } + + public Criteria andMemberidLessThanOrEqualTo(String value) { + addCriterion("memberId <=", value, "memberid"); + return (Criteria) this; + } + + public Criteria andMemberidLike(String value) { + addCriterion("memberId like", value, "memberid"); + return (Criteria) this; + } + + public Criteria andMemberidNotLike(String value) { + addCriterion("memberId not like", value, "memberid"); + return (Criteria) this; + } + + public Criteria andMemberidIn(List values) { + addCriterion("memberId in", values, "memberid"); + return (Criteria) this; + } + + public Criteria andMemberidNotIn(List values) { + addCriterion("memberId not in", values, "memberid"); + return (Criteria) this; + } + + public Criteria andMemberidBetween(String value1, String value2) { + addCriterion("memberId between", value1, value2, "memberid"); + return (Criteria) this; + } + + public Criteria andMemberidNotBetween(String value1, String value2) { + addCriterion("memberId not between", value1, value2, "memberid"); + return (Criteria) this; + } + public Criteria andTrainingidIsNull() { addCriterion("trainingId is null"); return (Criteria) this; @@ -670,7 +810,7 @@ public class AlertHoldDurationExample { * This class was generated by MyBatis Generator. * This class corresponds to the database table sys_alert_hold_duration * - * @mbg.generated do_not_delete_during_merge Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated do_not_delete_during_merge Fri Jul 21 17:12:37 CST 2023 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { @@ -682,7 +822,7 @@ public class AlertHoldDurationExample { * This class was generated by MyBatis Generator. * This class corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ public static class Criterion { private String condition; diff --git a/src/main/java/com/sztzjy/forex/trading_trading/entity/AlertHoldDurationRecord.java b/src/main/java/com/sztzjy/forex/trading_trading/entity/AlertHoldDurationRecord.java index 5c0124e..a2d6551 100644 --- a/src/main/java/com/sztzjy/forex/trading_trading/entity/AlertHoldDurationRecord.java +++ b/src/main/java/com/sztzjy/forex/trading_trading/entity/AlertHoldDurationRecord.java @@ -8,7 +8,7 @@ public class AlertHoldDurationRecord { * This field was generated by MyBatis Generator. * This field corresponds to the database column sys_alert_hold_duration_record.id * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ private String id; @@ -17,16 +17,34 @@ public class AlertHoldDurationRecord { * This field was generated by MyBatis Generator. * This field corresponds to the database column sys_alert_hold_duration_record.durationID * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ private String durationid; + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column sys_alert_hold_duration_record.stashId + * + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 + */ + private String stashid; + + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column sys_alert_hold_duration_record.mamberId + * + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 + */ + private String mamberid; + /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column sys_alert_hold_duration_record.tariningId * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ private String tariningid; @@ -35,7 +53,7 @@ public class AlertHoldDurationRecord { * This field was generated by MyBatis Generator. * This field corresponds to the database column sys_alert_hold_duration_record.name * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ private String name; @@ -44,7 +62,7 @@ public class AlertHoldDurationRecord { * This field was generated by MyBatis Generator. * This field corresponds to the database column sys_alert_hold_duration_record.symbol * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ private String symbol; @@ -53,7 +71,7 @@ public class AlertHoldDurationRecord { * This field was generated by MyBatis Generator. * This field corresponds to the database column sys_alert_hold_duration_record.direction * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ private String direction; @@ -62,7 +80,7 @@ public class AlertHoldDurationRecord { * This field was generated by MyBatis Generator. * This field corresponds to the database column sys_alert_hold_duration_record.trading_hour * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ private Date tradingHour; @@ -71,7 +89,7 @@ public class AlertHoldDurationRecord { * This field was generated by MyBatis Generator. * This field corresponds to the database column sys_alert_hold_duration_record.hold_duration * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ private String holdDuration; @@ -80,7 +98,7 @@ public class AlertHoldDurationRecord { * This field was generated by MyBatis Generator. * This field corresponds to the database column sys_alert_hold_duration_record.warining_hold_duration * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ private String wariningHoldDuration; @@ -89,7 +107,7 @@ public class AlertHoldDurationRecord { * This field was generated by MyBatis Generator. * This field corresponds to the database column sys_alert_hold_duration_record.warining_time * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ private Date wariningTime; @@ -99,7 +117,7 @@ public class AlertHoldDurationRecord { * * @return the value of sys_alert_hold_duration_record.id * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public String getId() { return id; @@ -111,7 +129,7 @@ public class AlertHoldDurationRecord { * * @param id the value for sys_alert_hold_duration_record.id * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public void setId(String id) { this.id = id == null ? null : id.trim(); @@ -123,7 +141,7 @@ public class AlertHoldDurationRecord { * * @return the value of sys_alert_hold_duration_record.durationID * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public String getDurationid() { return durationid; @@ -135,19 +153,67 @@ public class AlertHoldDurationRecord { * * @param durationid the value for sys_alert_hold_duration_record.durationID * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public void setDurationid(String durationid) { this.durationid = durationid == null ? null : durationid.trim(); } + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column sys_alert_hold_duration_record.stashId + * + * @return the value of sys_alert_hold_duration_record.stashId + * + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 + */ + public String getStashid() { + return stashid; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column sys_alert_hold_duration_record.stashId + * + * @param stashid the value for sys_alert_hold_duration_record.stashId + * + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 + */ + public void setStashid(String stashid) { + this.stashid = stashid == null ? null : stashid.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column sys_alert_hold_duration_record.mamberId + * + * @return the value of sys_alert_hold_duration_record.mamberId + * + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 + */ + public String getMamberid() { + return mamberid; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column sys_alert_hold_duration_record.mamberId + * + * @param mamberid the value for sys_alert_hold_duration_record.mamberId + * + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 + */ + public void setMamberid(String mamberid) { + this.mamberid = mamberid == null ? null : mamberid.trim(); + } + /** * This method was generated by MyBatis Generator. * This method returns the value of the database column sys_alert_hold_duration_record.tariningId * * @return the value of sys_alert_hold_duration_record.tariningId * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public String getTariningid() { return tariningid; @@ -159,7 +225,7 @@ public class AlertHoldDurationRecord { * * @param tariningid the value for sys_alert_hold_duration_record.tariningId * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public void setTariningid(String tariningid) { this.tariningid = tariningid == null ? null : tariningid.trim(); @@ -171,7 +237,7 @@ public class AlertHoldDurationRecord { * * @return the value of sys_alert_hold_duration_record.name * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public String getName() { return name; @@ -183,7 +249,7 @@ public class AlertHoldDurationRecord { * * @param name the value for sys_alert_hold_duration_record.name * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public void setName(String name) { this.name = name == null ? null : name.trim(); @@ -195,7 +261,7 @@ public class AlertHoldDurationRecord { * * @return the value of sys_alert_hold_duration_record.symbol * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public String getSymbol() { return symbol; @@ -207,7 +273,7 @@ public class AlertHoldDurationRecord { * * @param symbol the value for sys_alert_hold_duration_record.symbol * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public void setSymbol(String symbol) { this.symbol = symbol == null ? null : symbol.trim(); @@ -219,7 +285,7 @@ public class AlertHoldDurationRecord { * * @return the value of sys_alert_hold_duration_record.direction * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public String getDirection() { return direction; @@ -231,7 +297,7 @@ public class AlertHoldDurationRecord { * * @param direction the value for sys_alert_hold_duration_record.direction * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public void setDirection(String direction) { this.direction = direction == null ? null : direction.trim(); @@ -243,7 +309,7 @@ public class AlertHoldDurationRecord { * * @return the value of sys_alert_hold_duration_record.trading_hour * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public Date getTradingHour() { return tradingHour; @@ -255,7 +321,7 @@ public class AlertHoldDurationRecord { * * @param tradingHour the value for sys_alert_hold_duration_record.trading_hour * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public void setTradingHour(Date tradingHour) { this.tradingHour = tradingHour; @@ -267,7 +333,7 @@ public class AlertHoldDurationRecord { * * @return the value of sys_alert_hold_duration_record.hold_duration * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public String getHoldDuration() { return holdDuration; @@ -279,7 +345,7 @@ public class AlertHoldDurationRecord { * * @param holdDuration the value for sys_alert_hold_duration_record.hold_duration * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public void setHoldDuration(String holdDuration) { this.holdDuration = holdDuration == null ? null : holdDuration.trim(); @@ -291,7 +357,7 @@ public class AlertHoldDurationRecord { * * @return the value of sys_alert_hold_duration_record.warining_hold_duration * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public String getWariningHoldDuration() { return wariningHoldDuration; @@ -303,7 +369,7 @@ public class AlertHoldDurationRecord { * * @param wariningHoldDuration the value for sys_alert_hold_duration_record.warining_hold_duration * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public void setWariningHoldDuration(String wariningHoldDuration) { this.wariningHoldDuration = wariningHoldDuration == null ? null : wariningHoldDuration.trim(); @@ -315,7 +381,7 @@ public class AlertHoldDurationRecord { * * @return the value of sys_alert_hold_duration_record.warining_time * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public Date getWariningTime() { return wariningTime; @@ -327,7 +393,7 @@ public class AlertHoldDurationRecord { * * @param wariningTime the value for sys_alert_hold_duration_record.warining_time * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public void setWariningTime(Date wariningTime) { this.wariningTime = wariningTime; diff --git a/src/main/java/com/sztzjy/forex/trading_trading/entity/AlertHoldDurationRecordExample.java b/src/main/java/com/sztzjy/forex/trading_trading/entity/AlertHoldDurationRecordExample.java index 94010b1..a0780cb 100644 --- a/src/main/java/com/sztzjy/forex/trading_trading/entity/AlertHoldDurationRecordExample.java +++ b/src/main/java/com/sztzjy/forex/trading_trading/entity/AlertHoldDurationRecordExample.java @@ -9,7 +9,7 @@ public class AlertHoldDurationRecordExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ protected String orderByClause; @@ -17,7 +17,7 @@ public class AlertHoldDurationRecordExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ protected boolean distinct; @@ -25,7 +25,7 @@ public class AlertHoldDurationRecordExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ protected List oredCriteria; @@ -33,7 +33,7 @@ public class AlertHoldDurationRecordExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public AlertHoldDurationRecordExample() { oredCriteria = new ArrayList<>(); @@ -43,7 +43,7 @@ public class AlertHoldDurationRecordExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; @@ -53,7 +53,7 @@ public class AlertHoldDurationRecordExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public String getOrderByClause() { return orderByClause; @@ -63,7 +63,7 @@ public class AlertHoldDurationRecordExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public void setDistinct(boolean distinct) { this.distinct = distinct; @@ -73,7 +73,7 @@ public class AlertHoldDurationRecordExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public boolean isDistinct() { return distinct; @@ -83,7 +83,7 @@ public class AlertHoldDurationRecordExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public List getOredCriteria() { return oredCriteria; @@ -93,7 +93,7 @@ public class AlertHoldDurationRecordExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public void or(Criteria criteria) { oredCriteria.add(criteria); @@ -103,7 +103,7 @@ public class AlertHoldDurationRecordExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); @@ -115,7 +115,7 @@ public class AlertHoldDurationRecordExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); @@ -129,7 +129,7 @@ public class AlertHoldDurationRecordExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); @@ -140,7 +140,7 @@ public class AlertHoldDurationRecordExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public void clear() { oredCriteria.clear(); @@ -152,7 +152,7 @@ public class AlertHoldDurationRecordExample { * This class was generated by MyBatis Generator. * This class corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ protected abstract static class GeneratedCriteria { protected List criteria; @@ -335,6 +335,146 @@ public class AlertHoldDurationRecordExample { return (Criteria) this; } + public Criteria andStashidIsNull() { + addCriterion("stashId is null"); + return (Criteria) this; + } + + public Criteria andStashidIsNotNull() { + addCriterion("stashId is not null"); + return (Criteria) this; + } + + public Criteria andStashidEqualTo(String value) { + addCriterion("stashId =", value, "stashid"); + return (Criteria) this; + } + + public Criteria andStashidNotEqualTo(String value) { + addCriterion("stashId <>", value, "stashid"); + return (Criteria) this; + } + + public Criteria andStashidGreaterThan(String value) { + addCriterion("stashId >", value, "stashid"); + return (Criteria) this; + } + + public Criteria andStashidGreaterThanOrEqualTo(String value) { + addCriterion("stashId >=", value, "stashid"); + return (Criteria) this; + } + + public Criteria andStashidLessThan(String value) { + addCriterion("stashId <", value, "stashid"); + return (Criteria) this; + } + + public Criteria andStashidLessThanOrEqualTo(String value) { + addCriterion("stashId <=", value, "stashid"); + return (Criteria) this; + } + + public Criteria andStashidLike(String value) { + addCriterion("stashId like", value, "stashid"); + return (Criteria) this; + } + + public Criteria andStashidNotLike(String value) { + addCriterion("stashId not like", value, "stashid"); + return (Criteria) this; + } + + public Criteria andStashidIn(List values) { + addCriterion("stashId in", values, "stashid"); + return (Criteria) this; + } + + public Criteria andStashidNotIn(List values) { + addCriterion("stashId not in", values, "stashid"); + return (Criteria) this; + } + + public Criteria andStashidBetween(String value1, String value2) { + addCriterion("stashId between", value1, value2, "stashid"); + return (Criteria) this; + } + + public Criteria andStashidNotBetween(String value1, String value2) { + addCriterion("stashId not between", value1, value2, "stashid"); + return (Criteria) this; + } + + public Criteria andMamberidIsNull() { + addCriterion("mamberId is null"); + return (Criteria) this; + } + + public Criteria andMamberidIsNotNull() { + addCriterion("mamberId is not null"); + return (Criteria) this; + } + + public Criteria andMamberidEqualTo(String value) { + addCriterion("mamberId =", value, "mamberid"); + return (Criteria) this; + } + + public Criteria andMamberidNotEqualTo(String value) { + addCriterion("mamberId <>", value, "mamberid"); + return (Criteria) this; + } + + public Criteria andMamberidGreaterThan(String value) { + addCriterion("mamberId >", value, "mamberid"); + return (Criteria) this; + } + + public Criteria andMamberidGreaterThanOrEqualTo(String value) { + addCriterion("mamberId >=", value, "mamberid"); + return (Criteria) this; + } + + public Criteria andMamberidLessThan(String value) { + addCriterion("mamberId <", value, "mamberid"); + return (Criteria) this; + } + + public Criteria andMamberidLessThanOrEqualTo(String value) { + addCriterion("mamberId <=", value, "mamberid"); + return (Criteria) this; + } + + public Criteria andMamberidLike(String value) { + addCriterion("mamberId like", value, "mamberid"); + return (Criteria) this; + } + + public Criteria andMamberidNotLike(String value) { + addCriterion("mamberId not like", value, "mamberid"); + return (Criteria) this; + } + + public Criteria andMamberidIn(List values) { + addCriterion("mamberId in", values, "mamberid"); + return (Criteria) this; + } + + public Criteria andMamberidNotIn(List values) { + addCriterion("mamberId not in", values, "mamberid"); + return (Criteria) this; + } + + public Criteria andMamberidBetween(String value1, String value2) { + addCriterion("mamberId between", value1, value2, "mamberid"); + return (Criteria) this; + } + + public Criteria andMamberidNotBetween(String value1, String value2) { + addCriterion("mamberId not between", value1, value2, "mamberid"); + return (Criteria) this; + } + public Criteria andTariningidIsNull() { addCriterion("tariningId is null"); return (Criteria) this; @@ -880,7 +1020,7 @@ public class AlertHoldDurationRecordExample { * This class was generated by MyBatis Generator. * This class corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated do_not_delete_during_merge Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated do_not_delete_during_merge Fri Jul 21 17:10:02 CST 2023 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { @@ -892,7 +1032,7 @@ public class AlertHoldDurationRecordExample { * This class was generated by MyBatis Generator. * This class corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ public static class Criterion { private String condition; diff --git a/src/main/java/com/sztzjy/forex/trading_trading/entity/MarketWarning.java b/src/main/java/com/sztzjy/forex/trading_trading/entity/MarketWarning.java index 638743c..7edd555 100644 --- a/src/main/java/com/sztzjy/forex/trading_trading/entity/MarketWarning.java +++ b/src/main/java/com/sztzjy/forex/trading_trading/entity/MarketWarning.java @@ -1,7 +1,11 @@ package com.sztzjy.forex.trading_trading.entity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.util.Date; +@ApiModel("行情预警") public class MarketWarning { /** * @@ -19,6 +23,7 @@ public class MarketWarning { * * @mbg.generated Tue Jul 18 09:41:46 CST 2023 */ + @ApiModelProperty("任务id") private String tariningid; /** @@ -28,6 +33,7 @@ public class MarketWarning { * * @mbg.generated Tue Jul 18 09:41:46 CST 2023 */ + @ApiModelProperty("姓名") private String name; /** @@ -37,6 +43,7 @@ public class MarketWarning { * * @mbg.generated Tue Jul 18 09:41:46 CST 2023 */ + @ApiModelProperty("交易品种") private String symbol; /** @@ -46,6 +53,7 @@ public class MarketWarning { * * @mbg.generated Tue Jul 18 09:41:46 CST 2023 */ + @ApiModelProperty("交易方向") private String direction; /** @@ -55,6 +63,7 @@ public class MarketWarning { * * @mbg.generated Tue Jul 18 09:41:46 CST 2023 */ + @ApiModelProperty("上破价") private Double upperBreakPrice; /** @@ -64,6 +73,7 @@ public class MarketWarning { * * @mbg.generated Tue Jul 18 09:41:46 CST 2023 */ + @ApiModelProperty("下破价") private Double lowerBreakPrice; /** @@ -73,6 +83,7 @@ public class MarketWarning { * * @mbg.generated Tue Jul 18 09:41:46 CST 2023 */ + @ApiModelProperty("状态") private Integer status; /** @@ -82,6 +93,7 @@ public class MarketWarning { * * @mbg.generated Tue Jul 18 09:41:46 CST 2023 */ + @ApiModelProperty("预警时间") private Date time; /** diff --git a/src/main/java/com/sztzjy/forex/trading_trading/mappers/AlertHoldDurationMapper.java b/src/main/java/com/sztzjy/forex/trading_trading/mappers/AlertHoldDurationMapper.java index 9f17463..c2fa316 100644 --- a/src/main/java/com/sztzjy/forex/trading_trading/mappers/AlertHoldDurationMapper.java +++ b/src/main/java/com/sztzjy/forex/trading_trading/mappers/AlertHoldDurationMapper.java @@ -12,7 +12,7 @@ public interface AlertHoldDurationMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ long countByExample(AlertHoldDurationExample example); @@ -20,7 +20,7 @@ public interface AlertHoldDurationMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ int deleteByExample(AlertHoldDurationExample example); @@ -28,7 +28,7 @@ public interface AlertHoldDurationMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ int deleteByPrimaryKey(String id); @@ -36,7 +36,7 @@ public interface AlertHoldDurationMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ int insert(AlertHoldDuration record); @@ -44,7 +44,7 @@ public interface AlertHoldDurationMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ int insertSelective(AlertHoldDuration record); @@ -52,7 +52,7 @@ public interface AlertHoldDurationMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ List selectByExample(AlertHoldDurationExample example); @@ -60,7 +60,7 @@ public interface AlertHoldDurationMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ AlertHoldDuration selectByPrimaryKey(String id); @@ -68,7 +68,7 @@ public interface AlertHoldDurationMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ int updateByExampleSelective(@Param("record") AlertHoldDuration record, @Param("example") AlertHoldDurationExample example); @@ -76,7 +76,7 @@ public interface AlertHoldDurationMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ int updateByExample(@Param("record") AlertHoldDuration record, @Param("example") AlertHoldDurationExample example); @@ -84,7 +84,7 @@ public interface AlertHoldDurationMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ int updateByPrimaryKeySelective(AlertHoldDuration record); @@ -92,7 +92,7 @@ public interface AlertHoldDurationMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration * - * @mbg.generated Tue Jul 18 14:16:52 CST 2023 + * @mbg.generated Fri Jul 21 17:12:37 CST 2023 */ int updateByPrimaryKey(AlertHoldDuration record); } \ No newline at end of file diff --git a/src/main/java/com/sztzjy/forex/trading_trading/mappers/AlertHoldDurationRecordMapper.java b/src/main/java/com/sztzjy/forex/trading_trading/mappers/AlertHoldDurationRecordMapper.java index dfb6faa..67bbcde 100644 --- a/src/main/java/com/sztzjy/forex/trading_trading/mappers/AlertHoldDurationRecordMapper.java +++ b/src/main/java/com/sztzjy/forex/trading_trading/mappers/AlertHoldDurationRecordMapper.java @@ -12,7 +12,7 @@ public interface AlertHoldDurationRecordMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ long countByExample(AlertHoldDurationRecordExample example); @@ -20,7 +20,7 @@ public interface AlertHoldDurationRecordMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ int deleteByExample(AlertHoldDurationRecordExample example); @@ -28,7 +28,7 @@ public interface AlertHoldDurationRecordMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ int deleteByPrimaryKey(String id); @@ -36,7 +36,7 @@ public interface AlertHoldDurationRecordMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ int insert(AlertHoldDurationRecord record); @@ -44,7 +44,7 @@ public interface AlertHoldDurationRecordMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ int insertSelective(AlertHoldDurationRecord record); @@ -52,7 +52,7 @@ public interface AlertHoldDurationRecordMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ List selectByExample(AlertHoldDurationRecordExample example); @@ -60,7 +60,7 @@ public interface AlertHoldDurationRecordMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ AlertHoldDurationRecord selectByPrimaryKey(String id); @@ -68,7 +68,7 @@ public interface AlertHoldDurationRecordMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ int updateByExampleSelective(@Param("record") AlertHoldDurationRecord record, @Param("example") AlertHoldDurationRecordExample example); @@ -76,7 +76,7 @@ public interface AlertHoldDurationRecordMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ int updateByExample(@Param("record") AlertHoldDurationRecord record, @Param("example") AlertHoldDurationRecordExample example); @@ -84,7 +84,7 @@ public interface AlertHoldDurationRecordMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ int updateByPrimaryKeySelective(AlertHoldDurationRecord record); @@ -92,7 +92,7 @@ public interface AlertHoldDurationRecordMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table sys_alert_hold_duration_record * - * @mbg.generated Tue Jul 18 14:16:22 CST 2023 + * @mbg.generated Fri Jul 21 17:10:02 CST 2023 */ int updateByPrimaryKey(AlertHoldDurationRecord record); } \ No newline at end of file diff --git a/src/main/java/com/sztzjy/forex/trading_trading/service/ReportService.java b/src/main/java/com/sztzjy/forex/trading_trading/service/ReportService.java index 5a7d291..e9d7d33 100644 --- a/src/main/java/com/sztzjy/forex/trading_trading/service/ReportService.java +++ b/src/main/java/com/sztzjy/forex/trading_trading/service/ReportService.java @@ -9,8 +9,6 @@ import org.springframework.stereotype.Service; import org.springframework.util.Assert; import javax.servlet.http.HttpServletResponse; -import java.io.FileOutputStream; -import java.io.IOException; import java.io.InputStream; import java.util.List; @@ -63,24 +61,14 @@ public class ReportService { reportExample.createCriteria().andMemberIdEqualTo(memberId).andTrainingIdEqualTo(trainingId); Double reportScore = member.getReportScore(); List reportWithBLOBs = reportsMapper.selectByExampleWithBLOBs(reportExample); - try { if (reportScore == null) { - String filePath = SERVER_DIRECTORY + fileName; // 完整的服务器文件路径 - byte[] buffer = new byte[1024]; - FileOutputStream fileOutputStream = new FileOutputStream(filePath); - int bytesRead; - while ((bytesRead = fileInputStream.read(buffer)) != -1) { - fileOutputStream.write(buffer, 0, bytesRead); - } - fileOutputStream.close(); - fileInputStream.close(); + String filePath = fileUtil.upload(fileName, fileInputStream); if (!reportWithBLOBs.isEmpty()) { ReportWithBLOBs resultReport = reportWithBLOBs.get(0); resultReport.setFilePath(filePath); resultReport.setFileName(fileName); resultReport.setTrainingId(trainingId); reportsMapper.updateByExampleSelective(resultReport, reportExample); - return "修改成功"; } else { ReportWithBLOBs report = new ReportWithBLOBs(); report.setFileName(filePath); @@ -89,14 +77,58 @@ public class ReportService { report.setTrainingId(trainingId); reportsMapper.insert(report); } + return "上传成功"; } - } catch (IOException e) { - e.printStackTrace(); - } return "老师已评分,禁止上传"; } + +// // 指定服务器目录 +// public String uploadReport(InputStream fileInputStream, String fileName, String memberId,String trainingId) { +// MemberExample memberExample = new MemberExample(); +// memberExample.createCriteria().andMemberIdEqualTo(memberId).andTrainingIdEqualTo(trainingId); +// List members = memberMapper.selectByExample(memberExample); +// Member member = members.get(0); +// ReportExample reportExample = new ReportExample(); +// reportExample.createCriteria().andMemberIdEqualTo(memberId).andTrainingIdEqualTo(trainingId); +// Integer reportScore = member.getReportScore(); +// List reportWithBLOBs = reportsMapper.selectByExampleWithBLOBs(reportExample); +// try { +// if (reportScore == null) { +// String filePath = SERVER_DIRECTORY + fileName; // 完整的服务器文件路径 +// byte[] buffer = new byte[1024]; +// FileOutputStream fileOutputStream = new FileOutputStream(filePath); +// int bytesRead; +// while ((bytesRead = fileInputStream.read(buffer)) != -1) { +// fileOutputStream.write(buffer, 0, bytesRead); +// } +// fileOutputStream.close(); +// fileInputStream.close(); +// if (!reportWithBLOBs.isEmpty()) { +// ReportWithBLOBs resultReport = reportWithBLOBs.get(0); +// resultReport.setFilePath(filePath); +// resultReport.setFileName(fileName); +// resultReport.setTrainingId(trainingId); +// reportsMapper.updateByExampleSelective(resultReport, reportExample); +// } else { +// ReportWithBLOBs report = new ReportWithBLOBs(); +// report.setFileName(filePath); +// report.setFilePath(fileName); +// report.setMemberId(memberId); +// report.setTrainingId(trainingId); +// reportsMapper.insert(report); +// } +// return "上传成功"; +// } +// } catch (IOException e) { +// e.printStackTrace(); +// } +// return "老师已评分,禁止上传"; +// } + + + public void review(String reportId,Double score){ Report report = reportsMapper.selectByPrimaryKey(reportId); Assert.isTrue(report!=null&&report.getMemberId()!=null,"报告不存在"); diff --git a/src/main/java/com/sztzjy/forex/trading_trading/service/WainingService.java b/src/main/java/com/sztzjy/forex/trading_trading/service/WainingService.java index 6a4d127..d6cb0a2 100644 --- a/src/main/java/com/sztzjy/forex/trading_trading/service/WainingService.java +++ b/src/main/java/com/sztzjy/forex/trading_trading/service/WainingService.java @@ -1,7 +1,8 @@ package com.sztzjy.forex.trading_trading.service; import cn.hutool.core.util.IdUtil; -import com.sztzjy.forex.trading_trading.controller.TakeStashController; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import com.sztzjy.forex.trading_trading.entity.*; import com.sztzjy.forex.trading_trading.mappers.*; import com.sztzjy.forex.trading_trading.util.ForexMarketDateUtil; @@ -9,11 +10,11 @@ import com.sztzjy.forex.trading_trading.util.RedisUtil; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.messaging.simp.SimpMessagingTemplate; +import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; import java.sql.Timestamp; -import java.util.Date; -import java.util.List; +import java.util.*; @Service public class WainingService { @@ -33,7 +34,14 @@ public class WainingService { private ForexMarketDateUtil forexMarketDateUtil; @Autowired private RedisUtil redisUtil; + @Autowired + private AlertHoldDurationMapper alertHoldDurationMapper; + @Autowired + private AlertHoldDurationRecordMapper alertHoldDurationRecordMapper; + @Autowired + private TakeStashMapper takeStashMapper; + //保证金比较接口 public String compareMarginLevels(String memberId, String trainingId) { String message = "保证金已到达预警水平!"; MemberExample memberExample = new MemberExample(); @@ -153,59 +161,179 @@ public class WainingService { // } //查询保证金预警记录表 - public List getMarginWarningRecord(String userName, String trainingId) { + public PageInfo getMarginWarningRecord(Integer index, Integer size, String userName, String trainingId) { + PageHelper.startPage(index, size); MarginWarningRecordExample marginWarningRecordExample = new MarginWarningRecordExample(); marginWarningRecordExample.createCriteria().andTrainingidEqualTo(trainingId).andNameEqualTo(userName); - return marginWarningRecordMapper.selectByExample(marginWarningRecordExample); + List marginWarningRecords = marginWarningRecordMapper.selectByExample(marginWarningRecordExample); + return new PageInfo<>(marginWarningRecords); + } + + //启用或者关闭保证金预警 + public void setMarginWarningStatus(Integer status, String id) { + MarginWarning marginWarning = marginWarningMapper.selectByPrimaryKey(id); + marginWarning.setStatus((status == 1) ? 1 : 0); + marginWarningMapper.updateByPrimaryKeySelective(marginWarning); } +// // 新增行情预警,并在达到预警值时将数据存入记录表 +// public void addMarketWarning(MarketWarning marketWarning, String trainingId, String name) { +// MarketWarningRecord marketWarningRecord = new MarketWarningRecord(); +// marketWarning.setTime(new Timestamp(new Date().getTime())); +// marketWarning.setTariningid(trainingId); +// marketWarning.setName(name); +// marketWarningMapper.insert(marketWarning); +// BeanUtils.copyProperties(marketWarning, marketWarningRecord); +// marketWarningRecord.setMarketWarningId(marketWarning.getId()); +// marketWarningRecord.setId(IdUtil.simpleUUID()); +// +//// 1.从redis中取出当前价位 +// ForexMarketData forexMarketDateByCode = forexMarketDateUtil.getForexMarketDateByCode(marketWarning.getSymbol()); +// if (forexMarketDateByCode != null) { +// Double buyPic = forexMarketDateByCode.getBuyPic(); +// String sellPic = forexMarketDateByCode.getSellPic(); +// Double sellPicValue = Double.parseDouble(sellPic); +//// 2.判断新增的预警是买还是卖 +// String direction = marketWarning.getDirection(); +// Double upperBreakPrice = marketWarning.getUpperBreakPrice(); +// Double lowerBreakPrice = marketWarning.getLowerBreakPrice(); +// String message = "预警通知:价格已达到预警值"; +// if (direction.equals("买")) { +//// 3.拿redis的价位和新增的高价低价做比较,==的时候就弹出提示,并且存入行情预警记录表 +// if (buyPic.equals(upperBreakPrice) || buyPic.equals(lowerBreakPrice)) { +// simpMessagingTemplate.convertAndSend("/topic/alerts", message); +// marketWarningRecord.setWarningPrice(buyPic); +// marketWarningRecord.setWarningTime((new Timestamp(new Date().getTime()))); +// } +// } else { +// if (sellPicValue.equals(upperBreakPrice) || sellPicValue.equals(lowerBreakPrice)) { +// simpMessagingTemplate.convertAndSend("/topic/alerts", message); +// marketWarningRecord.setWarningPrice(sellPicValue); +// marketWarningRecord.setWarningTime((new Timestamp(new Date().getTime()))); +// } +// } +// } +// marketWarningRecordMapper.insert(marketWarningRecord); +// } + // 新增行情预警,并在达到预警值时将数据存入记录表 - public void addMarketWarning(MarketWarning marketWarning, String tariningId, String name) { + public void addMarketWarning(MarketWarning marketWarning, String trainingId, String name) { + // 记录表需要设置预警水平和预警时间 为报警时候的值 + String marketWarningId = marketWarning.getId(); MarketWarningRecord marketWarningRecord = new MarketWarningRecord(); - Date currentDate = new Date(); - Timestamp currentTimestamp = new Timestamp(currentDate.getTime()); - marketWarning.setTime(currentTimestamp); - marketWarningMapper.insert(marketWarning); - marketWarning.setTariningid(tariningId); + marketWarning.setTime(new Timestamp(new Date().getTime())); + marketWarning.setTariningid(trainingId); marketWarning.setName(name); + marketWarningMapper.insert(marketWarning); BeanUtils.copyProperties(marketWarning, marketWarningRecord); - marketWarningRecord.setMarketWarningId(marketWarning.getId()); + marketWarningRecord.setMarketWarningId(marketWarningId); marketWarningRecord.setId(IdUtil.simpleUUID()); + marketWarningRecordMapper.insert(marketWarningRecord); + HashMap objectObjectHashMap = new HashMap<>(); + objectObjectHashMap.put("marketWarningId", marketWarningId); + redisUtil.hmset("marketWarningRecord_" + marketWarningId + "_", objectObjectHashMap); + ComparativeTransactionPrice(); + } -// 1.从redis中取出当前价位 - ForexMarketData forexMarketDateByCode = forexMarketDateUtil.getForexMarketDateByCode(marketWarning.getSymbol()); - if (forexMarketDateByCode != null) { - Double buyPic = forexMarketDateByCode.getBuyPic(); - String sellPic = forexMarketDateByCode.getSellPic(); - Double sellPicValue = Double.parseDouble(sellPic); + //行情预警,监控用户设置的交易品种当前的交易价格,10S一次 + @Scheduled(fixedRate = 10000) + public void ComparativeTransactionPrice() { +// 从redis取出所有的marketWarning + Set marketWarningSet = redisUtil.keys("marketWarningRecord*"); +// 从redis取出所有的交易品种的参数 + List forexDateList = redisUtil.get("ForexDateList"); + Map forexMarketDateMap = forexMarketDateUtil.getForexMarketDateMap(forexDateList); +// 遍历拿到value 为存入的marketWarningID + for (String key : marketWarningSet) { + Map marketWarningMap = redisUtil.hmget(key); + String marketWarningId = (String) marketWarningMap.get("marketWarningId"); + MarketWarningRecordExample marketWarningRecordExample = new MarketWarningRecordExample(); + marketWarningRecordExample.createCriteria().andMarketWarningIdEqualTo(marketWarningId); + List marketWarningRecords = marketWarningRecordMapper.selectByExample(marketWarningRecordExample); + for (MarketWarningRecord marketWarningRecord : marketWarningRecords) { + ForexMarketData forexMarketData = forexMarketDateMap.get(marketWarningRecord.getSymbol()); + String sellPic = forexMarketData.getSellPic(); + Double buyPic = forexMarketData.getBuyPic(); + Double sellPicValue = Double.parseDouble(sellPic); // 2.判断新增的预警是买还是卖 - String direction = marketWarning.getDirection(); - Double upperBreakPrice = marketWarning.getUpperBreakPrice(); - Double lowerBreakPrice = marketWarning.getLowerBreakPrice(); - String message = "预警通知:价格已达到预警值"; - if (direction.equals("买")) { + Double upperBreakPrice = marketWarningRecord.getUpperBreakPrice(); + Double lowerBreakPrice = marketWarningRecord.getLowerBreakPrice(); + String direction = marketWarningRecord.getDirection(); + String message = "预警通知:价格已达到预警值"; + if (direction.equals("买")) { // 3.拿redis的价位和新增的高价低价做比较,==的时候就弹出提示,并且存入行情预警记录表 - if (buyPic.equals(upperBreakPrice) || buyPic.equals(lowerBreakPrice)) { - simpMessagingTemplate.convertAndSend("/topic/alerts", message); - marketWarningRecord.setWarningPrice(buyPic); - - } - } else { - if (sellPicValue.equals(upperBreakPrice) || sellPicValue.equals(lowerBreakPrice)) { - simpMessagingTemplate.convertAndSend("/topic/alerts", message); - marketWarningRecord.setWarningPrice(sellPicValue); + if (buyPic.equals(upperBreakPrice) || buyPic.equals(lowerBreakPrice)) { + simpMessagingTemplate.convertAndSend("/topic/alerts", message); + marketWarningRecord.setWarningPrice(buyPic); + marketWarningRecord.setWarningTime((new Timestamp(new Date().getTime()))); + marketWarningRecordMapper.updateByExampleSelective(marketWarningRecord, marketWarningRecordExample); + redisUtil.del(key); + } + } else { + if (sellPicValue.equals(upperBreakPrice) || sellPicValue.equals(lowerBreakPrice)) { + simpMessagingTemplate.convertAndSend("/topic/alerts", message); + marketWarningRecord.setWarningPrice(sellPicValue); + marketWarningRecord.setWarningTime((new Timestamp(new Date().getTime()))); + marketWarningRecordMapper.updateByExampleSelective(marketWarningRecord, marketWarningRecordExample); + redisUtil.del(key); + } } } } - marketWarningRecordMapper.insert(marketWarningRecord); } - //启用或者关闭保证金预警 - public void setMarginWarningStatus(Integer status, String id) { - MarginWarning marginWarning = marginWarningMapper.selectByPrimaryKey(id); - marginWarning.setStatus((status == 1) ? 1 : 0); - marginWarningMapper.updateByPrimaryKeySelective(marginWarning); + //新增持仓时长预警 + public void addAlertHoldDuration(AlertHoldDuration alertHoldDuration, String trainingId, String name, String stashId) { + TakeStash takeStash = takeStashMapper.selectByPrimaryKey(stashId); + alertHoldDuration.setName(name); + alertHoldDuration.setTrainingid(trainingId); + alertHoldDuration.setSetTime(new Timestamp(new Date().getTime())); + alertHoldDuration.setStashid(stashId); + alertHoldDurationMapper.insert(alertHoldDuration); + String durationId = alertHoldDuration.getId(); + AlertHoldDurationRecord ahdr = new AlertHoldDurationRecord(); + BeanUtils.copyProperties(alertHoldDuration, ahdr); + ahdr.setId(IdUtil.simpleUUID()); + ahdr.setDurationid(durationId); + ahdr.setDirection(takeStash.getBuySellType()); + ahdr.setTradingHour(takeStash.getTimeTransaction()); + HashMap objectObjectHashMap = new HashMap<>(); + objectObjectHashMap.put("takeStashId",stashId); + objectObjectHashMap.put("durationId",durationId); + alertHoldDurationRecordMapper.insert(ahdr); + redisUtil.hmset("AlertHoldDurationTakeStashId" + stashId + "_", objectObjectHashMap); + b(); } -} + //持仓时长预警对比定时任务 +// @Scheduled(fixedRate = 10000) + public void b(){ +// Set alertHoldDurationTakeStashId = redisUtil.keys("AlertHoldDurationTakeStashId"); +// for (String takeStashId : alertHoldDurationTakeStashId) { +// Map hmget = redisUtil.hmget(takeStashId); +// String resultTakeStashId = (String) hmget.get("takeStashId"); +// String durationId = (String)hmget.get("durationId"); +// AlertHoldDurationRecordExample alertHoldDurationRecordExample = new AlertHoldDurationRecordExample(); +// alertHoldDurationRecordExample.createCriteria().andStashidEqualTo(resultTakeStashId); +// List alertHoldDurations = alertHoldDurationMapper.selectByExample(alertHoldDurationExample); +// for (AlertHoldDuration alertHoldDuration : alertHoldDurations) { +// String wariningHoldDuration = alertHoldDuration.getWariningHoldDuration(); +// Date setTime = alertHoldDuration.getSetTime(); +// Calendar calendar = Calendar.getInstance(); +// calendar.setTime(setTime); +// calendar.add(Calendar.DAY_OF_YEAR, Integer.parseInt(wariningHoldDuration)); +// //相加后的时间 +// Date time = calendar.getTime(); +// Timestamp timestamp = new Timestamp(new Date().getTime()); +// if ("当前时间等于或大于预警值就将时间存库然后发送消息给前端"){ +//// TODO 设置记录表的持仓时长和交易时间两个参数 +// // ahdr.setHoldDuration("持仓时长"); +//// ahdr.setWariningTime("预警时间"); +// } +// } +// +// } + + } +} diff --git a/src/main/resources/mappers/AlertHoldDurationMapper.xml b/src/main/resources/mappers/AlertHoldDurationMapper.xml index 5a0b429..01cae39 100644 --- a/src/main/resources/mappers/AlertHoldDurationMapper.xml +++ b/src/main/resources/mappers/AlertHoldDurationMapper.xml @@ -5,9 +5,11 @@ + + @@ -19,7 +21,7 @@ @@ -53,7 +55,7 @@ @@ -87,15 +89,16 @@ - id, trainingId, name, symbol, warining_hold_duration, status, set_time + id, stashId, memberId, trainingId, name, symbol, warining_hold_duration, status, + set_time select @@ -118,7 +120,7 @@ select @@ -129,7 +131,7 @@ delete from sys_alert_hold_duration_record where id = #{id,jdbcType=VARCHAR} @@ -138,7 +140,7 @@ delete from sys_alert_hold_duration_record @@ -149,22 +151,24 @@ - insert into sys_alert_hold_duration_record (id, durationID, tariningId, - name, symbol, direction, - trading_hour, hold_duration, warining_hold_duration, - warining_time) - values (#{id,jdbcType=VARCHAR}, #{durationid,jdbcType=VARCHAR}, #{tariningid,jdbcType=VARCHAR}, - #{name,jdbcType=VARCHAR}, #{symbol,jdbcType=VARCHAR}, #{direction,jdbcType=VARCHAR}, - #{tradingHour,jdbcType=TIMESTAMP}, #{holdDuration,jdbcType=VARCHAR}, #{wariningHoldDuration,jdbcType=VARCHAR}, - #{wariningTime,jdbcType=TIMESTAMP}) + insert into sys_alert_hold_duration_record (id, durationID, stashId, + mamberId, tariningId, name, + symbol, direction, trading_hour, + hold_duration, warining_hold_duration, warining_time + ) + values (#{id,jdbcType=VARCHAR}, #{durationid,jdbcType=VARCHAR}, #{stashid,jdbcType=VARCHAR}, + #{mamberid,jdbcType=VARCHAR}, #{tariningid,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, + #{symbol,jdbcType=VARCHAR}, #{direction,jdbcType=VARCHAR}, #{tradingHour,jdbcType=TIMESTAMP}, + #{holdDuration,jdbcType=VARCHAR}, #{wariningHoldDuration,jdbcType=VARCHAR}, #{wariningTime,jdbcType=TIMESTAMP} + ) insert into sys_alert_hold_duration_record @@ -174,6 +178,12 @@ durationID, + + stashId, + + + mamberId, + tariningId, @@ -206,6 +216,12 @@ #{durationid,jdbcType=VARCHAR}, + + #{stashid,jdbcType=VARCHAR}, + + + #{mamberid,jdbcType=VARCHAR}, + #{tariningid,jdbcType=VARCHAR}, @@ -236,7 +252,7 @@ select count(*) from sys_alert_hold_duration_record @@ -247,7 +263,7 @@ update sys_alert_hold_duration_record @@ -257,6 +273,12 @@ durationID = #{record.durationid,jdbcType=VARCHAR}, + + stashId = #{record.stashid,jdbcType=VARCHAR}, + + + mamberId = #{record.mamberid,jdbcType=VARCHAR}, + tariningId = #{record.tariningid,jdbcType=VARCHAR}, @@ -290,11 +312,13 @@ update sys_alert_hold_duration_record set id = #{record.id,jdbcType=VARCHAR}, durationID = #{record.durationid,jdbcType=VARCHAR}, + stashId = #{record.stashid,jdbcType=VARCHAR}, + mamberId = #{record.mamberid,jdbcType=VARCHAR}, tariningId = #{record.tariningid,jdbcType=VARCHAR}, name = #{record.name,jdbcType=VARCHAR}, symbol = #{record.symbol,jdbcType=VARCHAR}, @@ -311,13 +335,19 @@ update sys_alert_hold_duration_record durationID = #{durationid,jdbcType=VARCHAR}, + + stashId = #{stashid,jdbcType=VARCHAR}, + + + mamberId = #{mamberid,jdbcType=VARCHAR}, + tariningId = #{tariningid,jdbcType=VARCHAR}, @@ -349,10 +379,12 @@ update sys_alert_hold_duration_record set durationID = #{durationid,jdbcType=VARCHAR}, + stashId = #{stashid,jdbcType=VARCHAR}, + mamberId = #{mamberid,jdbcType=VARCHAR}, tariningId = #{tariningid,jdbcType=VARCHAR}, name = #{name,jdbcType=VARCHAR}, symbol = #{symbol,jdbcType=VARCHAR},