From 27cf8f5964beebe8f8863e3590166c29d155572f Mon Sep 17 00:00:00 2001 From: laixingyu Date: Tue, 19 Dec 2023 01:05:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E4=BA=A4=E6=98=93?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E7=9B=B8=E5=85=B3=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/OperationsController.java | 9 +- .../com/ruoyi/booksystem/domain/Account.java | 43 ++- .../ruoyi/booksystem/domain/Operations.java | 75 ++-- .../ruoyi/booksystem/domain/Statistics.java | 51 ++- .../booksystem/domain/StatisticsRemain.java | 51 ++- .../src/views/booksystem/account/index.vue | 135 ++----- .../src/views/booksystem/operations/index.vue | 328 ++++++++---------- .../booksystem/statisticremain/index.vue | 99 ++---- .../src/views/booksystem/statistics/index.vue | 81 +---- .../views/booksystem/statistictotal/index.vue | 139 +------- 10 files changed, 338 insertions(+), 673 deletions(-) diff --git a/book-system/src/main/java/com/ruoyi/booksystem/controller/OperationsController.java b/book-system/src/main/java/com/ruoyi/booksystem/controller/OperationsController.java index 6a6ef4c..479611b 100644 --- a/book-system/src/main/java/com/ruoyi/booksystem/controller/OperationsController.java +++ b/book-system/src/main/java/com/ruoyi/booksystem/controller/OperationsController.java @@ -2,6 +2,9 @@ package com.ruoyi.booksystem.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.utils.SecurityUtils; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -23,7 +26,7 @@ import com.ruoyi.common.core.page.TableDataInfo; /** * 当日操作Controller - * + * * @author ruoyi * @date 2023-12-18 */ @@ -77,6 +80,10 @@ public class OperationsController extends BaseController @PostMapping public AjaxResult add(@RequestBody Operations operations) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + System.out.println("[AccountBookController] userName: " + loginUser.getUsername() + " userId: " + loginUser.getUserId()); + operations.setUserId(loginUser.getUserId()); + //插入一条后,要更新持仓表 return toAjax(operationsService.insertOperations(operations)); } diff --git a/book-system/src/main/java/com/ruoyi/booksystem/domain/Account.java b/book-system/src/main/java/com/ruoyi/booksystem/domain/Account.java index 4db857e..a952924 100644 --- a/book-system/src/main/java/com/ruoyi/booksystem/domain/Account.java +++ b/book-system/src/main/java/com/ruoyi/booksystem/domain/Account.java @@ -10,7 +10,7 @@ import com.ruoyi.common.core.domain.BaseEntity; /** * 交易账户对象 account - * + * * @author ruoyi * @date 2023-12-18 */ @@ -27,9 +27,8 @@ public class Account extends BaseEntity private Date tradeDay; /** 交易日星期 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "交易日星期", width = 30, dateFormat = "yyyy-MM-dd") - private Date weekDay; + @Excel(name = "交易日星期") + private String weekDay; /** 净资产 */ @Excel(name = "净资产") @@ -55,84 +54,84 @@ public class Account extends BaseEntity @Excel(name = "用户id") private Long userId; - public void setId(Long id) + public void setId(Long id) { this.id = id; } - public Long getId() + public Long getId() { return id; } - public void setTradeDay(Date tradeDay) + public void setTradeDay(Date tradeDay) { this.tradeDay = tradeDay; } - public Date getTradeDay() + public Date getTradeDay() { return tradeDay; } - public void setWeekDay(Date weekDay) + public void setWeekDay(String weekDay) { this.weekDay = weekDay; } - public Date getWeekDay() + public String getWeekDay() { return weekDay; } - public void setAssets(BigDecimal assets) + public void setAssets(BigDecimal assets) { this.assets = assets; } - public BigDecimal getAssets() + public BigDecimal getAssets() { return assets; } - public void setTotalAssets(BigDecimal totalAssets) + public void setTotalAssets(BigDecimal totalAssets) { this.totalAssets = totalAssets; } - public BigDecimal getTotalAssets() + public BigDecimal getTotalAssets() { return totalAssets; } - public void setProfit(BigDecimal profit) + public void setProfit(BigDecimal profit) { this.profit = profit; } - public BigDecimal getProfit() + public BigDecimal getProfit() { return profit; } - public void setAssetsDiff(BigDecimal assetsDiff) + public void setAssetsDiff(BigDecimal assetsDiff) { this.assetsDiff = assetsDiff; } - public BigDecimal getAssetsDiff() + public BigDecimal getAssetsDiff() { return assetsDiff; } - public void setTotalDiff(BigDecimal totalDiff) + public void setTotalDiff(BigDecimal totalDiff) { this.totalDiff = totalDiff; } - public BigDecimal getTotalDiff() + public BigDecimal getTotalDiff() { return totalDiff; } - public void setUserId(Long userId) + public void setUserId(Long userId) { this.userId = userId; } - public Long getUserId() + public Long getUserId() { return userId; } diff --git a/book-system/src/main/java/com/ruoyi/booksystem/domain/Operations.java b/book-system/src/main/java/com/ruoyi/booksystem/domain/Operations.java index 3043e84..c78297d 100644 --- a/book-system/src/main/java/com/ruoyi/booksystem/domain/Operations.java +++ b/book-system/src/main/java/com/ruoyi/booksystem/domain/Operations.java @@ -10,7 +10,7 @@ import com.ruoyi.common.core.domain.BaseEntity; /** * 当日操作对象 operations - * + * * @author ruoyi * @date 2023-12-18 */ @@ -35,9 +35,8 @@ public class Operations extends BaseEntity private Date tradeDay; /** 交易日星期 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "交易日星期", width = 30, dateFormat = "yyyy-MM-dd") - private Date weekDay; + @Excel(name = "交易日星期") + private String weekDay; /** 操作(含账户转入转出) */ @Excel(name = "操作", readConverterExp = "含=账户转入转出") @@ -87,156 +86,156 @@ public class Operations extends BaseEntity @Excel(name = "备注") private String bz; - public void setId(Long id) + public void setId(Long id) { this.id = id; } - public Long getId() + public Long getId() { return id; } - public void setCode(String code) + public void setCode(String code) { this.code = code; } - public String getCode() + public String getCode() { return code; } - public void setName(String name) + public void setName(String name) { this.name = name; } - public String getName() + public String getName() { return name; } - public void setTradeDay(Date tradeDay) + public void setTradeDay(Date tradeDay) { this.tradeDay = tradeDay; } - public Date getTradeDay() + public Date getTradeDay() { return tradeDay; } - public void setWeekDay(Date weekDay) + public void setWeekDay(String weekDay) { this.weekDay = weekDay; } - public Date getWeekDay() + public String getWeekDay() { return weekDay; } - public void setOperate(String operate) + public void setOperate(String operate) { this.operate = operate; } - public String getOperate() + public String getOperate() { return operate; } - public void setDealPrice(BigDecimal dealPrice) + public void setDealPrice(BigDecimal dealPrice) { this.dealPrice = dealPrice; } - public BigDecimal getDealPrice() + public BigDecimal getDealPrice() { return dealPrice; } - public void setVolumn(Long volumn) + public void setVolumn(Long volumn) { this.volumn = volumn; } - public Long getVolumn() + public Long getVolumn() { return volumn; } - public void setAmount(BigDecimal amount) + public void setAmount(BigDecimal amount) { this.amount = amount; } - public BigDecimal getAmount() + public BigDecimal getAmount() { return amount; } - public void setTax(BigDecimal tax) + public void setTax(BigDecimal tax) { this.tax = tax; } - public BigDecimal getTax() + public BigDecimal getTax() { return tax; } - public void setFee(BigDecimal fee) + public void setFee(BigDecimal fee) { this.fee = fee; } - public BigDecimal getFee() + public BigDecimal getFee() { return fee; } - public void setOther(BigDecimal other) + public void setOther(BigDecimal other) { this.other = other; } - public BigDecimal getOther() + public BigDecimal getOther() { return other; } - public void setOperateDiff(BigDecimal operateDiff) + public void setOperateDiff(BigDecimal operateDiff) { this.operateDiff = operateDiff; } - public BigDecimal getOperateDiff() + public BigDecimal getOperateDiff() { return operateDiff; } - public void setPreId(Long preId) + public void setPreId(Long preId) { this.preId = preId; } - public Long getPreId() + public Long getPreId() { return preId; } - public void setUserId(Long userId) + public void setUserId(Long userId) { this.userId = userId; } - public Long getUserId() + public Long getUserId() { return userId; } - public void setDealLogic(String dealLogic) + public void setDealLogic(String dealLogic) { this.dealLogic = dealLogic; } - public String getDealLogic() + public String getDealLogic() { return dealLogic; } - public void setBz(String bz) + public void setBz(String bz) { this.bz = bz; } - public String getBz() + public String getBz() { return bz; } diff --git a/book-system/src/main/java/com/ruoyi/booksystem/domain/Statistics.java b/book-system/src/main/java/com/ruoyi/booksystem/domain/Statistics.java index 6ccf2e2..e11ebaa 100644 --- a/book-system/src/main/java/com/ruoyi/booksystem/domain/Statistics.java +++ b/book-system/src/main/java/com/ruoyi/booksystem/domain/Statistics.java @@ -10,7 +10,7 @@ import com.ruoyi.common.core.domain.BaseEntity; /** * 单笔操作统计对象 statistics - * + * * @author ruoyi * @date 2023-12-18 */ @@ -35,9 +35,8 @@ public class Statistics extends BaseEntity private Date tradeDay; /** 交易日星期 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "交易日星期", width = 30, dateFormat = "yyyy-MM-dd") - private Date weekDay; + @Excel(name = "交易日星期") + private String weekDay; /** 操作id */ @Excel(name = "操作id") @@ -63,102 +62,102 @@ public class Statistics extends BaseEntity @Excel(name = "备注") private String bz; - public void setId(Long id) + public void setId(Long id) { this.id = id; } - public Long getId() + public Long getId() { return id; } - public void setCode(String code) + public void setCode(String code) { this.code = code; } - public String getCode() + public String getCode() { return code; } - public void setName(String name) + public void setName(String name) { this.name = name; } - public String getName() + public String getName() { return name; } - public void setTradeDay(Date tradeDay) + public void setTradeDay(Date tradeDay) { this.tradeDay = tradeDay; } - public Date getTradeDay() + public Date getTradeDay() { return tradeDay; } - public void setWeekDay(Date weekDay) + public void setWeekDay(String weekDay) { this.weekDay = weekDay; } - public Date getWeekDay() + public String getWeekDay() { return weekDay; } - public void setOperationsId(String operationsId) + public void setOperationsId(String operationsId) { this.operationsId = operationsId; } - public String getOperationsId() + public String getOperationsId() { return operationsId; } - public void setProfit(BigDecimal profit) + public void setProfit(BigDecimal profit) { this.profit = profit; } - public BigDecimal getProfit() + public BigDecimal getProfit() { return profit; } - public void setDiff(Long diff) + public void setDiff(Long diff) { this.diff = diff; } - public Long getDiff() + public Long getDiff() { return diff; } - public void setOperateionId(Long operateionId) + public void setOperateionId(Long operateionId) { this.operateionId = operateionId; } - public Long getOperateionId() + public Long getOperateionId() { return operateionId; } - public void setUserId(Long userId) + public void setUserId(Long userId) { this.userId = userId; } - public Long getUserId() + public Long getUserId() { return userId; } - public void setBz(String bz) + public void setBz(String bz) { this.bz = bz; } - public String getBz() + public String getBz() { return bz; } diff --git a/book-system/src/main/java/com/ruoyi/booksystem/domain/StatisticsRemain.java b/book-system/src/main/java/com/ruoyi/booksystem/domain/StatisticsRemain.java index cd50201..31c3672 100644 --- a/book-system/src/main/java/com/ruoyi/booksystem/domain/StatisticsRemain.java +++ b/book-system/src/main/java/com/ruoyi/booksystem/domain/StatisticsRemain.java @@ -10,7 +10,7 @@ import com.ruoyi.common.core.domain.BaseEntity; /** * 当日持仓统计对象 statistics_remain - * + * * @author ruoyi * @date 2023-12-18 */ @@ -35,9 +35,8 @@ public class StatisticsRemain extends BaseEntity private Date tradeDay; /** 交易日星期 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "交易日星期", width = 30, dateFormat = "yyyy-MM-dd") - private Date weekDay; + @Excel(name = "交易日星期") + private String weekDay; /** 总盈亏 */ @Excel(name = "总盈亏") @@ -63,102 +62,102 @@ public class StatisticsRemain extends BaseEntity @Excel(name = "备注") private String bz; - public void setId(Long id) + public void setId(Long id) { this.id = id; } - public Long getId() + public Long getId() { return id; } - public void setCode(String code) + public void setCode(String code) { this.code = code; } - public String getCode() + public String getCode() { return code; } - public void setName(String name) + public void setName(String name) { this.name = name; } - public String getName() + public String getName() { return name; } - public void setTradeDay(Date tradeDay) + public void setTradeDay(Date tradeDay) { this.tradeDay = tradeDay; } - public Date getTradeDay() + public Date getTradeDay() { return tradeDay; } - public void setWeekDay(Date weekDay) + public void setWeekDay(String weekDay) { this.weekDay = weekDay; } - public Date getWeekDay() + public String getWeekDay() { return weekDay; } - public void setTotalProfit(BigDecimal totalProfit) + public void setTotalProfit(BigDecimal totalProfit) { this.totalProfit = totalProfit; } - public BigDecimal getTotalProfit() + public BigDecimal getTotalProfit() { return totalProfit; } - public void setTotalDiff(BigDecimal totalDiff) + public void setTotalDiff(BigDecimal totalDiff) { this.totalDiff = totalDiff; } - public BigDecimal getTotalDiff() + public BigDecimal getTotalDiff() { return totalDiff; } - public void setTotalDiffOverall(BigDecimal totalDiffOverall) + public void setTotalDiffOverall(BigDecimal totalDiffOverall) { this.totalDiffOverall = totalDiffOverall; } - public BigDecimal getTotalDiffOverall() + public BigDecimal getTotalDiffOverall() { return totalDiffOverall; } - public void setRemaining(BigDecimal remaining) + public void setRemaining(BigDecimal remaining) { this.remaining = remaining; } - public BigDecimal getRemaining() + public BigDecimal getRemaining() { return remaining; } - public void setUserId(Long userId) + public void setUserId(Long userId) { this.userId = userId; } - public Long getUserId() + public Long getUserId() { return userId; } - public void setBz(String bz) + public void setBz(String bz) { this.bz = bz; } - public String getBz() + public String getBz() { return bz; } diff --git a/ruoyi-ui/src/views/booksystem/account/index.vue b/ruoyi-ui/src/views/booksystem/account/index.vue index a6eb9be..07eb210 100644 --- a/ruoyi-ui/src/views/booksystem/account/index.vue +++ b/ruoyi-ui/src/views/booksystem/account/index.vue @@ -9,68 +9,6 @@ placeholder="选择交易日期"> - - - - - - - - - - - - - - - - - - - - - - 搜索 重置 @@ -125,43 +63,37 @@ - - - - + - - - - + + + + + + + + + + + + + + + + + + - + - - - - @@ -258,7 +183,11 @@ export default { form: {}, // 表单校验 rules: { - } + }, + //计算星期 + weekOptions :['周日','周一', '周二', '周三', '周四', '周五', '周六'], + checkedWeek: [], + }; }, created() { @@ -361,7 +290,17 @@ export default { this.download('booksystem/account/export', { ...this.queryParams }, `account_${new Date().getTime()}.xlsx`) - } + }, + handleChange(value) + { + let currentDate = new Date(this.queryParams.tradeDay); + const getWeek = currentDate.getDay(); + const weekArr=['周日','周一', '周二', '周三', '周四', '周五', '周六'] + if(!value) return + let week = weekArr[getWeek] + this.form.weekDay = week; + console.log(' to handleDateChange week is: ',week) + }, } }; diff --git a/ruoyi-ui/src/views/booksystem/operations/index.vue b/ruoyi-ui/src/views/booksystem/operations/index.vue index cb96de0..232b9d4 100644 --- a/ruoyi-ui/src/views/booksystem/operations/index.vue +++ b/ruoyi-ui/src/views/booksystem/operations/index.vue @@ -27,104 +27,6 @@ placeholder="选择交易日期"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 搜索 重置 @@ -179,7 +81,6 @@ - @@ -187,11 +88,7 @@ {{ parseTime(scope.row.tradeDay, '{y}-{m}-{d}') }} - - - + @@ -201,29 +98,28 @@ - - - - + + + + + + + + + + + + + + + + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +