Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
BudgetManagementSystem
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王利雷
BudgetManagementSystem
Commits
a3de9b40
Commit
a3de9b40
authored
May 23, 2019
by
shj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
预算属性修改:包括预算名称、预算分配等数据,页面的实现与接口
parent
9bff1093
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
101 additions
and
7 deletions
+101
-7
IUserBudgetDao.java
src/main/java/dao/IUserBudgetDao.java
+2
-0
IUserBudgetDao.xml
src/main/java/dao/IUserBudgetDao.xml
+4
-0
BudgetHandler.java
src/main/java/handlers/BudgetHandler.java
+72
-0
DetailHandler.java
src/main/java/handlers/DetailHandler.java
+7
-0
IUserBudgetService.java
src/main/java/service/IUserBudgetService.java
+2
-0
UserBudgetService.java
src/main/java/service/impl/UserBudgetService.java
+5
-0
budgetDetail.jsp
src/main/webapp/budgetDetail.jsp
+1
-1
budgetSetting.jsp
src/main/webapp/budgetSetting.jsp
+0
-0
history.jsp
src/main/webapp/history.jsp
+5
-3
index.jsp
src/main/webapp/index.jsp
+1
-1
modifyRules.jsp
src/main/webapp/modifyRules.jsp
+1
-1
usercenter.jsp
src/main/webapp/usercenter.jsp
+1
-1
No files found.
src/main/java/dao/IUserBudgetDao.java
View file @
a3de9b40
...
...
@@ -13,4 +13,6 @@ public interface IUserBudgetDao {
void
deleteUserBudget
(
@Param
(
"userid"
)
Integer
userid
,
@Param
(
"budgetid"
)
Long
budgetId
);
void
updateBudgetName
(
@Param
(
"budgetid"
)
Long
id
,
@Param
(
"budgetname"
)
String
budgetName
);
UserBudget
selectBudgetByBudgetid
(
@Param
(
"budgetid"
)
Long
budgetId
);
}
src/main/java/dao/IUserBudgetDao.xml
View file @
a3de9b40
...
...
@@ -14,4 +14,7 @@
<update
id=
"updateBudgetName"
>
update user_budget set budgetname=#{budgetname} where budgetid=#{budgetid}
</update>
<select
id=
"selectBudgetByBudgetid"
resultType=
"beans.UserBudget"
>
select * from user_budget where budgetid=#{budgetid}
</select>
</mapper>
\ No newline at end of file
src/main/java/handlers/BudgetHandler.java
View file @
a3de9b40
...
...
@@ -259,6 +259,78 @@ public class BudgetHandler {
return
modelAndView
;
}
@RequestMapping
(
"/Setting/{budgetId}"
)
public
ModelAndView
budgetSettingById
(
@PathVariable
(
"budgetId"
)
Long
budgetId
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
if
(
budgetId
==
null
)
return
new
ModelAndView
(
"/"
);
ModelAndView
modelAndView
=
new
ModelAndView
();
modelAndView
.
setViewName
(
"/budgetSetting.jsp"
);
modelAndView
.
addObject
(
"budget"
,
retrieveBudget
(
budgetId
.
toString
()));
Cookie
sessionID
=
CookieUtil
.
getCookieByName
(
request
.
getCookies
(),
"sessionID"
);
if
(
sessionID
==
null
)
{
sessionID
=
new
Cookie
(
"sessionID"
,
budgetId
.
toString
());
}
else
{
sessionID
.
setValue
(
budgetId
.
toString
());
}
sessionID
.
setPath
(
"/"
);
response
.
addCookie
(
sessionID
);
UserBudget
userBudget
=
userBudgetService
.
getBudgetByBudgetid
(
budgetId
);
modelAndView
.
addObject
(
"name"
,
userBudget
.
getBudgetname
());
return
modelAndView
;
}
@RequestMapping
(
"/Setting.do"
)
public
void
doBudgetSettingById
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
IOException
{
try
{
String
sessionID
=
getSessionID
(
request
.
getCookies
());
if
(
sessionID
==
null
)
return
;
Integer
totalBudget
=
Integer
.
valueOf
(
request
.
getParameter
(
"total"
));
String
[]
items
=
request
.
getParameterValues
(
"items"
);
Budget
budget
=
retrieveBudget
(
sessionID
);
if
(
budget
==
null
)
return
;
budget
.
getRequirement
().
setTotal
(
totalBudget
);
if
(
items
!=
null
&&
items
.
length
!=
0
)
{
for
(
String
item
:
items
)
{
Double
number
=
Double
.
valueOf
(
request
.
getParameter
(
item
+
"-number"
));
if
(
item
.
contains
(
"equipment"
))
{
budget
.
getRequirement
().
setEquip
(
number
);
}
else
if
(
item
.
contains
(
"material"
))
{
budget
.
getRequirement
().
setMaterial
(
number
);
}
else
if
(
item
.
contains
(
"test"
))
{
budget
.
getRequirement
().
setTest
(
number
);
}
else
if
(
item
.
contains
(
"power"
))
{
budget
.
getRequirement
().
setPower
(
number
);
}
else
if
(
item
.
contains
(
"travel"
))
{
budget
.
getRequirement
().
setTravel
(
number
);
}
else
if
(
item
.
contains
(
"conference"
))
{
budget
.
getRequirement
().
setConference
(
number
);
}
else
if
(
item
.
contains
(
"international"
))
{
budget
.
getRequirement
().
setInternational
(
number
);
}
else
if
(
item
.
contains
(
"property"
))
{
budget
.
getRequirement
().
setProperty
(
number
);
}
else
if
(
item
.
contains
(
"labour"
))
{
budget
.
getRequirement
().
setLabour
(
number
);
}
else
if
(
item
.
contains
(
"consultation"
))
{
budget
.
getRequirement
().
setConsultation
(
number
);
}
else
if
(
item
.
contains
(
"others"
))
{
budget
.
getRequirement
().
setOthers
(
number
);
}
}
}
serializeBudget
(
budget
,
getFilePath
(
sessionID
));
String
budgetName
=
request
.
getParameter
(
"name"
);
userBudgetService
.
changeBudgetName
(
budget
.
getId
(),
budgetName
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
response
.
sendRedirect
(
request
.
getContextPath
()+
"/Budget/HistoryPage"
);
}
@RequestMapping
(
"/Delete/{budgetId}"
)
public
void
deleteBudgetById
(
@PathVariable
(
"budgetId"
)
Long
budgetId
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
if
(
budgetId
==
null
)
return
;
...
...
src/main/java/handlers/DetailHandler.java
View file @
a3de9b40
...
...
@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
service.IDetailService
;
import
service.IUserBudgetService
;
import
util.SalaryCalculator
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -57,6 +58,8 @@ public class DetailHandler {
@Autowired
private
IDetailService
detailService
;
@Autowired
private
IUserBudgetService
userBudgetService
;
@RequestMapping
(
"/Stats"
)
public
void
getStats
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
...
...
@@ -75,6 +78,7 @@ public class DetailHandler {
double
req_sofar
=
0.0
,
sum_sofar
=
0.0
,
req
,
sum
;
//设备费
JSONObject
sub
=
new
JSONObject
();
req
=
budget
.
getRequirement
().
getEquip
();
...
...
@@ -199,6 +203,9 @@ public class DetailHandler {
object
.
put
(
"sum"
,
sum_sofar
);
object
.
put
(
"diff"
,
budget
.
getRequirement
().
getTotal
()-
sum_sofar
);
UserBudget
userBudget
=
userBudgetService
.
getBudgetByBudgetid
(
Long
.
valueOf
(
sessionID
));
object
.
put
(
"name"
,
userBudget
.
getBudgetname
());
writer
.
write
(
object
.
toJSONString
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
...
...
src/main/java/service/IUserBudgetService.java
View file @
a3de9b40
...
...
@@ -15,4 +15,6 @@ public interface IUserBudgetService {
void
deleteUserBudget
(
Integer
userid
,
Long
budgetId
);
void
changeBudgetName
(
Long
id
,
String
budgetName
);
UserBudget
getBudgetByBudgetid
(
Long
budgetId
);
}
src/main/java/service/impl/UserBudgetService.java
View file @
a3de9b40
...
...
@@ -34,4 +34,9 @@ public class UserBudgetService implements IUserBudgetService {
public
void
changeBudgetName
(
Long
id
,
String
budgetName
)
{
userBudgetDao
.
updateBudgetName
(
id
,
budgetName
);
}
@Override
public
UserBudget
getBudgetByBudgetid
(
Long
budgetId
)
{
return
userBudgetDao
.
selectBudgetByBudgetid
(
budgetId
);
}
}
src/main/webapp/budgetDetail.jsp
View file @
a3de9b40
...
...
@@ -56,7 +56,7 @@
<li><a
href=
"${pageContext.request.contextPath}/"
>
创建预算
</a></li>
<li><a
href=
"${pageContext.request.contextPath}/Budget/HistoryPage"
>
历史预算
</a></li>
<li><a
href=
"${pageContext.request.contextPath}/Rule/"
>
修改规则
</a></li>
<
li><a
href=
"${pageContext.request.contextPath}/Budget/Download"
>
导出最新预算
</a></li
>
<
%
--
<
li
><a
href=
"${pageContext.request.contextPath}/Budget/Download"
>
导出最新预算
</a></li>
--%
>
<li><a
href=
"${pageContext.request.contextPath}/Test"
>
测试
</a></li>
<li><a
href=
"${pageContext.request.contextPath}/usercenter.jsp"
>
用户中心
</a></li>
<li
class=
"active"
><a
href=
"${pageContext.request.contextPath}/Budget/Detail"
>
修改预算
</a></li>
...
...
src/main/webapp/budgetSetting.jsp
0 → 100644
View file @
a3de9b40
This diff is collapsed.
Click to expand it.
src/main/webapp/history.jsp
View file @
a3de9b40
...
...
@@ -47,7 +47,7 @@
<li
class=
"active"
><a
href=
"${pageContext.request.contextPath}/Budget/HistoryPage"
>
历史预算
</a></li>
<
%
--
<
li
><a
href=
"${pageContext.request.contextPath}/Budget/Detail"
>
修改预算
</a></li>
--%>
<li><a
href=
"${pageContext.request.contextPath}/Rule/"
>
修改规则
</a></li>
<
li><a
href=
"${pageContext.request.contextPath}/Budget/Download"
>
导出最新预算
</a></li
>
<
%
--
<
li
><a
href=
"${pageContext.request.contextPath}/Budget/Download"
>
导出最新预算
</a></li>
--%
>
<li><a
href=
"${pageContext.request.contextPath}/Test"
>
测试
</a></li>
<li><a
href=
"${pageContext.request.contextPath}/usercenter.jsp"
>
用户中心
</a></li>
</ul>
...
...
@@ -80,9 +80,11 @@
<td>
{{budget.date}}
</td>
<td>
<a
v-bind:href=
"'${pageContext.request.contextPath}/Budget/Detail/'+budget.id"
>
<button
class=
"btn btn-success"
>
查看详情
</button>
<button
class=
"btn btn-info"
>
查看详情
</button>
</a>
<a
v-bind:href=
"'${pageContext.request.contextPath}/Budget/Setting/'+budget.id"
>
<button
class=
"btn btn-success"
>
修改预算属性
</button>
</a>
<button
class=
"btn btn-info"
>
修改属性
</button>
<a
v-bind:href=
"'${pageContext.request.contextPath}/Budget/Download/csv/'+budget.id"
>
<button
class=
"btn btn-success"
>
下载费用清单
</button>
</a>
...
...
src/main/webapp/index.jsp
View file @
a3de9b40
...
...
@@ -40,7 +40,7 @@
<li><a
href=
"${pageContext.request.contextPath}/Budget/HistoryPage"
>
历史预算
</a></li>
<
%
--
<
li
><a
href=
"${pageContext.request.contextPath}/Budget/Detail"
>
修改预算
</a></li>
--%>
<li><a
href=
"${pageContext.request.contextPath}/Rule/"
>
修改规则
</a></li>
<
li><a
href=
"${pageContext.request.contextPath}/Budget/Download"
>
导出最新预算
</a></li
>
<
%
--
<
li
><a
href=
"${pageContext.request.contextPath}/Budget/Download"
>
导出最新预算
</a></li>
--%
>
<li><a
href=
"${pageContext.request.contextPath}/Test"
>
测试
</a></li>
<li><a
href=
"${pageContext.request.contextPath}/usercenter.jsp"
>
用户中心
</a></li>
</ul>
...
...
src/main/webapp/modifyRules.jsp
View file @
a3de9b40
...
...
@@ -48,7 +48,7 @@
<li><a
href=
"${pageContext.request.contextPath}/Budget/HistoryPage"
>
历史预算
</a></li>
<
%
--
<
li
><a
href=
"${pageContext.request.contextPath}/Budget/Detail"
>
修改预算
</a></li>
--%>
<li
class=
"active"
><a
href=
"${pageContext.request.contextPath}/Rule/"
>
修改规则
</a></li>
<
li><a
href=
"${pageContext.request.contextPath}/Budget/Download"
>
导出最新预算
</a></li
>
<
%
--
<
li
><a
href=
"${pageContext.request.contextPath}/Budget/Download"
>
导出最新预算
</a></li>
--%
>
<li><a
href=
"${pageContext.request.contextPath}/Test"
>
测试
</a></li>
<li><a
href=
"${pageContext.request.contextPath}/usercenter.jsp"
>
用户中心
</a></li>
</ul>
...
...
src/main/webapp/usercenter.jsp
View file @
a3de9b40
...
...
@@ -47,7 +47,7 @@
<li><a
href=
"${pageContext.request.contextPath}/Budget/HistoryPage"
>
历史预算
</a></li>
<
%
--
<
li
><a
href=
"${pageContext.request.contextPath}/Budget/Detail"
>
修改预算
</a></li>
--%>
<li><a
href=
"${pageContext.request.contextPath}/Rule/"
>
修改规则
</a></li>
<
li><a
href=
"${pageContext.request.contextPath}/Budget/Download"
>
导出最新预算
</a></li
>
<
%
--
<
li
><a
href=
"${pageContext.request.contextPath}/Budget/Download"
>
导出最新预算
</a></li>
--%
>
<li><a
href=
"${pageContext.request.contextPath}/Test"
>
测试
</a></li>
<li
class=
"active"
><a
href=
"${pageContext.request.contextPath}/usercenter.jsp"
>
用户中心
</a></li>
</ul>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment