From b7d22827c478bc295f4285dd49cbd5e1c9ce6127 Mon Sep 17 00:00:00 2001 From: Asus <2227102688@qq.com> Date: Sun, 6 Apr 2025 22:42:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E4=BA=86Income.java,Expense.?= =?UTF-8?q?java,DataDict.java,Security.java,first.java,StockHolding.java?= =?UTF-8?q?=E5=AE=9E=E4=BD=93=E7=B1=BB=E4=BB=A5=E5=8F=8A=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=99=A8=EF=BC=8Cjsp=E5=92=8C=E5=AF=B9=E5=BA=94=E7=9A=84show?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- applicationContext.xml | 0 .../ssm/controller/DataDictController.java | 17 +++ src/com/ssm/controller/ExpenseController.java | 17 +++ .../controller/SecurityAccountController.java | 17 +++ .../controller/StockHoldingController.java | 17 +++ src/com/ssm/entity/DataDict.java | 39 +++++ src/com/ssm/entity/Expense.java | 49 +++++++ src/com/ssm/entity/Income.java | 136 ++++++------------ src/com/ssm/entity/SecurityAccount.java | 39 +++++ src/com/ssm/entity/StockHolding.java | 39 +++++ src/springmvc.xml | 24 +++- web/WEB-INF/view/showDataDict.jsp | 7 + web/WEB-INF/view/showDatadic.jsp | 16 --- web/WEB-INF/view/showExpense.jsp | 7 + web/WEB-INF/view/showIncome.jsp | 14 +- web/WEB-INF/view/showSecurityAccount.jsp | 7 + web/WEB-INF/view/showStockHolding.jsp | 7 + web/WEB-INF/web.xml | 37 ++++- web/addDataDict.jsp | 20 +++ web/addExpense.jsp | 21 +++ web/addIncome.jsp | 64 ++------- web/addSecurityAccount.jsp | 16 +++ web/addStockHolding.jsp | 16 +++ 23 files changed, 451 insertions(+), 175 deletions(-) create mode 100644 applicationContext.xml create mode 100644 src/com/ssm/controller/DataDictController.java create mode 100644 src/com/ssm/controller/ExpenseController.java create mode 100644 src/com/ssm/controller/SecurityAccountController.java create mode 100644 src/com/ssm/controller/StockHoldingController.java create mode 100644 src/com/ssm/entity/DataDict.java create mode 100644 src/com/ssm/entity/Expense.java create mode 100644 src/com/ssm/entity/SecurityAccount.java create mode 100644 src/com/ssm/entity/StockHolding.java create mode 100644 web/WEB-INF/view/showDataDict.jsp delete mode 100644 web/WEB-INF/view/showDatadic.jsp create mode 100644 web/WEB-INF/view/showExpense.jsp create mode 100644 web/WEB-INF/view/showSecurityAccount.jsp create mode 100644 web/WEB-INF/view/showStockHolding.jsp create mode 100644 web/addDataDict.jsp create mode 100644 web/addExpense.jsp create mode 100644 web/addSecurityAccount.jsp create mode 100644 web/addStockHolding.jsp diff --git a/applicationContext.xml b/applicationContext.xml new file mode 100644 index 0000000..e69de29 diff --git a/src/com/ssm/controller/DataDictController.java b/src/com/ssm/controller/DataDictController.java new file mode 100644 index 0000000..7bcea3c --- /dev/null +++ b/src/com/ssm/controller/DataDictController.java @@ -0,0 +1,17 @@ +// DataDictController.java +package com.ssm.controller; +import com.ssm.entity.DataDict; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +public class DataDictController { + @RequestMapping("/submitDataDict") + public String handleDataDict(DataDict dataDict) { + System.out.println("新增字典项: " + + "键=" + dataDict.getKey() + + ", 值=" + dataDict.getValue() + + ", 类型=" + dataDict.getType()); + return "showDataDict"; + } +} diff --git a/src/com/ssm/controller/ExpenseController.java b/src/com/ssm/controller/ExpenseController.java new file mode 100644 index 0000000..61b7488 --- /dev/null +++ b/src/com/ssm/controller/ExpenseController.java @@ -0,0 +1,17 @@ +// ExpenseController.java +package com.ssm.controller; +import com.ssm.entity.Expense; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +public class ExpenseController { + @RequestMapping("/submitExpense") + public String handleExpense(Expense expense) { + System.out.println("收到支出信息: " + + "金额=" + expense.getAmount() + + ", 类别=" + expense.getCategory() + + ", 备注=" + expense.getRemarks()); + return "showExpense"; + } +} \ No newline at end of file diff --git a/src/com/ssm/controller/SecurityAccountController.java b/src/com/ssm/controller/SecurityAccountController.java new file mode 100644 index 0000000..e020143 --- /dev/null +++ b/src/com/ssm/controller/SecurityAccountController.java @@ -0,0 +1,17 @@ +// SecurityAccountController.java +package com.ssm.controller; +import com.ssm.entity.SecurityAccount; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +public class SecurityAccountController { + @RequestMapping("/submitSecurityAccount") + public String handleSecurityAccount(SecurityAccount account) { + System.out.println("创建证券账户: " + + "账户ID=" + account.getAccountId() + + ", 持有人=" + account.getOwnerName() + + ", 券商=" + account.getBroker()); + return "showSecurityAccount"; + } +} \ No newline at end of file diff --git a/src/com/ssm/controller/StockHoldingController.java b/src/com/ssm/controller/StockHoldingController.java new file mode 100644 index 0000000..cd03c06 --- /dev/null +++ b/src/com/ssm/controller/StockHoldingController.java @@ -0,0 +1,17 @@ +// StockHoldingController.java +package com.ssm.controller; +import com.ssm.entity.StockHolding; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +public class StockHoldingController { + @RequestMapping("/submitStockHolding") + public String handleStockHolding(StockHolding stock) { + System.out.println("记录持股信息: " + + "股票代码=" + stock.getSymbol() + + ", 数量=" + stock.getQuantity() + + ", 买入价=" + stock.getPurchasePrice()); + return "showStockHolding"; + } +} diff --git a/src/com/ssm/entity/DataDict.java b/src/com/ssm/entity/DataDict.java new file mode 100644 index 0000000..321c039 --- /dev/null +++ b/src/com/ssm/entity/DataDict.java @@ -0,0 +1,39 @@ +package com.ssm.entity; +public class DataDict { + private Integer dictId; + private String key; + private String value; + private String type; + + public Integer getDictId() { + return dictId; + } + + public void setDictId(Integer dictId) { + this.dictId = dictId; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } +} diff --git a/src/com/ssm/entity/Expense.java b/src/com/ssm/entity/Expense.java new file mode 100644 index 0000000..4decbb1 --- /dev/null +++ b/src/com/ssm/entity/Expense.java @@ -0,0 +1,49 @@ +package com.ssm.entity; +import java.util.Date; +public class Expense { + private Integer id; + private Double amount; + private Date date; + private String category; + private String remarks; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Double getAmount() { + return amount; + } + + public void setAmount(Double amount) { + this.amount = amount; + } + + public Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } +} diff --git a/src/com/ssm/entity/Income.java b/src/com/ssm/entity/Income.java index a246762..13f9545 100644 --- a/src/com/ssm/entity/Income.java +++ b/src/com/ssm/entity/Income.java @@ -1,93 +1,49 @@ package com.ssm.entity; - -import org.springframework.format.annotation.DateTimeFormat; - import java.util.Date; - public class Income { - private Integer id; // 编号 - private User user; // 收入用户 - private Datadic incometype; // 收入类型 - private String source; // 来源 - private Integer money; // 金额 - private String content; // 备注 - @DateTimeFormat(pattern = "yyyy-mm-dd HH:mm:ss") - private Date incometime; // 收入时间 - @DateTimeFormat(pattern = "yyyy-mm-dd HH:mm:ss") - private Date createtime; // 创建时间 - @DateTimeFormat(pattern = "yyyy-mm-dd HH:mm:ss") - private Date updatetime; // 更新时间 - - public Integer getId() { - return id; - } - public void setId(Integer id) { - this.id = id; - } - public String getSource() { - return source; - } - public void setSource(String source) { - this.source = source; - } - public Integer getMoney() { - return money; - } - public void setMoney(Integer money) { - this.money = money; - } - public String getContent() { - return content; - } - public void setContent(String content) { - this.content = content; - } - public Date getIncometime() { - return incometime; - } - public void setIncometime(Date incometime) { - this.incometime = incometime; - } - public Date getCreatetime() { - return createtime; - } - public void setCreatetime(Date createtime) { - this.createtime = createtime; - } - public Date getUpdatetime() { - return updatetime; - } - public void setUpdatetime(Date updatetime) { - this.updatetime = updatetime; - } - - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } - - public Datadic getIncometype() { - return incometype; - } - - public void setIncometype(Datadic incometype) { - this.incometype = incometype; - } - - @Override - public String toString() { - return "Income{" + - "id=" + id + - // 输出收入用户名 - ", username='" + user.getUsername() + '\'' + - // 输出收入类型 - ", incometype=" + incometype.getDatadicvalue() + - ", source=" + source + - ", money='" + money + '\'' + - ", incometime='" + incometime + '\'' + - '}'; - } -} + private Integer id; + private Double amount; + private Date date; + private String category; + private String description; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Double getAmount() { + return amount; + } + + public void setAmount(Double amount) { + this.amount = amount; + } + + public Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } +} \ No newline at end of file diff --git a/src/com/ssm/entity/SecurityAccount.java b/src/com/ssm/entity/SecurityAccount.java new file mode 100644 index 0000000..71f1ae9 --- /dev/null +++ b/src/com/ssm/entity/SecurityAccount.java @@ -0,0 +1,39 @@ +package com.ssm.entity; +public class SecurityAccount { + private String accountId; + private String ownerName; + private Double balance; + private String broker; + + public String getAccountId() { + return accountId; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public String getOwnerName() { + return ownerName; + } + + public void setOwnerName(String ownerName) { + this.ownerName = ownerName; + } + + public Double getBalance() { + return balance; + } + + public void setBalance(Double balance) { + this.balance = balance; + } + + public String getBroker() { + return broker; + } + + public void setBroker(String broker) { + this.broker = broker; + } +} \ No newline at end of file diff --git a/src/com/ssm/entity/StockHolding.java b/src/com/ssm/entity/StockHolding.java new file mode 100644 index 0000000..3598405 --- /dev/null +++ b/src/com/ssm/entity/StockHolding.java @@ -0,0 +1,39 @@ +package com.ssm.entity; +public class StockHolding { + private String stockId; + private String symbol; + private Integer quantity; + private Double purchasePrice; + + public String getStockId() { + return stockId; + } + + public void setStockId(String stockId) { + this.stockId = stockId; + } + + public String getSymbol() { + return symbol; + } + + public void setSymbol(String symbol) { + this.symbol = symbol; + } + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + public Double getPurchasePrice() { + return purchasePrice; + } + + public void setPurchasePrice(Double purchasePrice) { + this.purchasePrice = purchasePrice; + } +} diff --git a/src/springmvc.xml b/src/springmvc.xml index e61a833..626409b 100644 --- a/src/springmvc.xml +++ b/src/springmvc.xml @@ -1,12 +1,28 @@ + xsi:schemaLocation=" + http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/mvc + http://www.springframework.org/schema/mvc/spring-mvc.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context.xsd"> - + + + + + + + - - + + + + + diff --git a/web/WEB-INF/view/showDataDict.jsp b/web/WEB-INF/view/showDataDict.jsp new file mode 100644 index 0000000..2482cc5 --- /dev/null +++ b/web/WEB-INF/view/showDataDict.jsp @@ -0,0 +1,7 @@ +<%@ page contentType="text/html;charset=UTF-8" %> + + +

Success! 字典项已保存!

+继续添加 + + \ No newline at end of file diff --git a/web/WEB-INF/view/showDatadic.jsp b/web/WEB-INF/view/showDatadic.jsp deleted file mode 100644 index b394df5..0000000 --- a/web/WEB-INF/view/showDatadic.jsp +++ /dev/null @@ -1,16 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> - - - - -展示收入类型信息 - - -Success! -
-收入类型编号:${datadicInfo.id} -
-收入类型名称:${datadicInfo.datadicvalue} - - \ No newline at end of file diff --git a/web/WEB-INF/view/showExpense.jsp b/web/WEB-INF/view/showExpense.jsp new file mode 100644 index 0000000..000f83d --- /dev/null +++ b/web/WEB-INF/view/showExpense.jsp @@ -0,0 +1,7 @@ +<%@ page contentType="text/html;charset=UTF-8" %> + + +

Success! 支出信息已成功记录!

+继续添加 + + \ No newline at end of file diff --git a/web/WEB-INF/view/showIncome.jsp b/web/WEB-INF/view/showIncome.jsp index fbe6e67..2930208 100644 --- a/web/WEB-INF/view/showIncome.jsp +++ b/web/WEB-INF/view/showIncome.jsp @@ -1,15 +1,7 @@ -<%@ page language="java" contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> - +<%@ page contentType="text/html;charset=UTF-8" %> - - -展示Controller接收及响应数据 - -Success! -
-收入信息已在控制台输出! - +

Success! 收入信息已成功记录!

+继续添加 \ No newline at end of file diff --git a/web/WEB-INF/view/showSecurityAccount.jsp b/web/WEB-INF/view/showSecurityAccount.jsp new file mode 100644 index 0000000..d798727 --- /dev/null +++ b/web/WEB-INF/view/showSecurityAccount.jsp @@ -0,0 +1,7 @@ +<%@ page contentType="text/html;charset=UTF-8" %> + + +

Success! 证券账户已创建!

+继续添加 + + \ No newline at end of file diff --git a/web/WEB-INF/view/showStockHolding.jsp b/web/WEB-INF/view/showStockHolding.jsp new file mode 100644 index 0000000..be6fbe4 --- /dev/null +++ b/web/WEB-INF/view/showStockHolding.jsp @@ -0,0 +1,7 @@ +<%@ page contentType="text/html;charset=UTF-8" %> + + +

Success! 持股信息已记录!

+继续添加 + + \ No newline at end of file diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml index 182b4dd..53662ed 100644 --- a/web/WEB-INF/web.xml +++ b/web/WEB-INF/web.xml @@ -1,10 +1,40 @@ + + + + encodingFilter + org.springframework.web.filter.CharacterEncodingFilter + + encoding + UTF-8 + + + forceEncoding + true + + + + encodingFilter + /* + + + + + contextConfigLocation + classpath:java + + + org.springframework.web.context.ContextLoaderListener + + + - DispatcherServlet + dispatcher org.springframework.web.servlet.DispatcherServlet contextConfigLocation @@ -13,8 +43,7 @@ 1 - DispatcherServlet - + dispatcher / \ No newline at end of file diff --git a/web/addDataDict.jsp b/web/addDataDict.jsp new file mode 100644 index 0000000..90c5c4e --- /dev/null +++ b/web/addDataDict.jsp @@ -0,0 +1,20 @@ +<%@ page contentType="text/html;charset=UTF-8" %> + + + 添加数据字典 + + +

新增字典项

+
+ 键名:
+ 键值:
+ 类型: +
+ +
+ + \ No newline at end of file diff --git a/web/addExpense.jsp b/web/addExpense.jsp new file mode 100644 index 0000000..95591bf --- /dev/null +++ b/web/addExpense.jsp @@ -0,0 +1,21 @@ +<%@ page contentType="text/html;charset=UTF-8" %> + + + 添加支出记录 + + +

新增支出

+
+ 金额:
+ 日期:
+ 类别: +
+ 备注:
+ +
+ + \ No newline at end of file diff --git a/web/addIncome.jsp b/web/addIncome.jsp index 901ca91..636c674 100644 --- a/web/addIncome.jsp +++ b/web/addIncome.jsp @@ -1,57 +1,21 @@ -<%@ page language="java" contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> - +<%@ page contentType="text/html;charset=UTF-8" %> - -添加收入信息 + 添加收入记录 -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
收入编号:
收入用户:
收入类型:
来源:
金额:
收入时间:
备注:
- -
+

新增收入

+ + 金额:
+ 日期:
+ 类别: +
+ 描述:
+
\ No newline at end of file diff --git a/web/addSecurityAccount.jsp b/web/addSecurityAccount.jsp new file mode 100644 index 0000000..790d2fa --- /dev/null +++ b/web/addSecurityAccount.jsp @@ -0,0 +1,16 @@ +<%@ page contentType="text/html;charset=UTF-8" %> + + + 添加证券账户 + + +

新增证券账户

+
+ 账户ID:
+ 持有人:
+ 初始资金:
+ 券商名称:
+ +
+ + \ No newline at end of file diff --git a/web/addStockHolding.jsp b/web/addStockHolding.jsp new file mode 100644 index 0000000..bae8fd0 --- /dev/null +++ b/web/addStockHolding.jsp @@ -0,0 +1,16 @@ +<%@ page contentType="text/html;charset=UTF-8" %> + + + 添加持股记录 + + +

新增持股

+
+ 股票代码:
+ 数量:
+ 买入价格:
+ 账户ID:
+ +
+ + \ No newline at end of file