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
65a1aeaf
Commit
65a1aeaf
authored
May 16, 2019
by
shj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导航栏修改,测试化验加工费展示与修改,添加数据库查询接口,前端展示数据库列表(具体某项费用的),保证展示的数据库列表中已经删除了存在与该项预算费用的条目,因此不会出现条目冲突
parent
7c4b42bb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
185 additions
and
5 deletions
+185
-5
BudgetHandler.java
src/main/java/handlers/BudgetHandler.java
+30
-0
DatabaseQueryHandler.java
src/main/java/handlers/DatabaseQueryHandler.java
+77
-0
DetailHandler.java
src/main/java/handlers/DetailHandler.java
+42
-0
IDetailService.java
src/main/java/service/IDetailService.java
+2
-0
DetailService.java
src/main/java/service/impl/DetailService.java
+9
-0
budgetDetail.jsp
src/main/webapp/budgetDetail.jsp
+0
-0
history.jsp
src/main/webapp/history.jsp
+1
-1
index.jsp
src/main/webapp/index.jsp
+1
-1
modifyRules.jsp
src/main/webapp/modifyRules.jsp
+1
-1
test.jsp
src/main/webapp/test.jsp
+21
-1
usercenter.jsp
src/main/webapp/usercenter.jsp
+1
-1
No files found.
src/main/java/handlers/BudgetHandler.java
View file @
65a1aeaf
...
...
@@ -409,6 +409,36 @@ public class BudgetHandler {
}
@RequestMapping
(
"/Modify/TestAndProcess"
)
public
void
modifyTestAndProcess
(
Integer
mode
,
TestAndProcess
testAndProcess
,
Integer
nums
,
Integer
curd
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
IOException
{
System
.
out
.
println
(
"/Modify/TestAndProcess"
);
if
(
nums
<
0
)
return
;
String
sessionID
=
getSessionID
(
request
.
getCookies
());
Budget
budget
=
retrieveBudget
(
sessionID
);
if
(
budget
==
null
)
{
response
.
sendError
(
444
,
"budget not exists"
);
return
;
}
Map
<
TestAndProcess
,
Integer
>
items
=
null
;
items
=
budget
.
getTestAndProcesses
();
//删除
if
(
curd
.
equals
(
1
))
{
items
.
remove
(
testAndProcess
);
}
else
{
if
(
curd
.
equals
(
2
))
//增改
{
items
.
remove
(
testAndProcess
);
items
.
put
(
testAndProcess
,
nums
);
}
else
items
.
put
(
testAndProcess
,
nums
);
}
afterUpdate
(
budget
);
serializeBudget
(
budget
,
getFilePath
(
sessionID
));
}
@Autowired
private
IInternationalCommunicationDao
internationalCommunicationDao
;
...
...
src/main/java/handlers/DatabaseQueryHandler.java
0 → 100644
View file @
65a1aeaf
package
handlers
;
import
beans.Budget
;
import
beans.Consultation
;
import
beans.Equipment
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
dao.IConsultationDao
;
import
dao.IEquipmentDao
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Map
;
@Controller
@RequestMapping
(
"/Database/Query"
)
public
class
DatabaseQueryHandler
{
@Autowired
private
IEquipmentDao
equipmentDao
;
@RequestMapping
(
"/Equipment"
)
public
void
queryEquipment
(
HttpServletRequest
request
,
HttpServletResponse
response
){
try
{
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setContentType
(
"text/html;charset=utf-8"
);
PrintWriter
writer
=
response
.
getWriter
();
JSONObject
object
=
new
JSONObject
();
List
<
Equipment
>
equipments
=
equipmentDao
.
selectAll
();
List
<
JSONObject
>
list
=
new
LinkedList
<>();
for
(
Equipment
item
:
equipments
)
{
JSONObject
obj
=
new
JSONObject
();
obj
.
put
(
"id"
,
item
.
getId
());
obj
.
put
(
"name"
,
item
.
getName
());
obj
.
put
(
"price"
,
item
.
getPrice
());
obj
.
put
(
"nums"
,
0
);
list
.
add
(
obj
);
}
object
.
put
(
"data"
,
list
);
writer
.
write
(
JSON
.
toJSONString
(
object
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
@Autowired
private
IConsultationDao
consultationDao
;
@RequestMapping
(
"/Consultation"
)
public
void
queryConsultation
(
HttpServletRequest
request
,
HttpServletResponse
response
){
try
{
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setContentType
(
"text/html;charset=utf-8"
);
PrintWriter
writer
=
response
.
getWriter
();
JSONObject
object
=
new
JSONObject
();
List
<
Consultation
>
consultations
=
consultationDao
.
selectAll
();
List
<
JSONObject
>
list
=
new
LinkedList
<>();
for
(
Consultation
item
:
consultations
)
{
JSONObject
obj
=
new
JSONObject
();
obj
.
put
(
"id"
,
item
.
getId
());
obj
.
put
(
"name"
,
item
.
getName
());
obj
.
put
(
"price"
,
item
.
getPrice
());
obj
.
put
(
"nums"
,
0
);
list
.
add
(
obj
);
}
object
.
put
(
"data"
,
list
);
writer
.
write
(
JSON
.
toJSONString
(
object
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
src/main/java/handlers/DetailHandler.java
View file @
65a1aeaf
...
...
@@ -95,6 +95,16 @@ public class DetailHandler {
object
.
put
(
"material"
,
sub
);
req_sofar
+=
req
;
sum_sofar
+=
sum
;
//测试化验加工费
sub
=
new
JSONObject
();
req
=
budget
.
getRequirement
().
getTest
();
sum
=
detailService
.
sumTestAndProcess
(
budget
.
getTestAndProcesses
());
sub
.
put
(
"req"
,
req
);
sub
.
put
(
"sum"
,
sum
);
sub
.
put
(
"diff"
,
req
-
sum
);
object
.
put
(
"testAndProcess"
,
sub
);
req_sofar
+=
req
;
sum_sofar
+=
sum
;
//差旅费
sub
=
new
JSONObject
();
req
=
budget
.
getRequirement
().
getTravel
();
...
...
@@ -229,6 +239,38 @@ public class DetailHandler {
}
}
@RequestMapping
(
"/TestAndProcess"
)
public
void
detailTest
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
try
{
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setContentType
(
"text/html;charset=utf-8"
);
PrintWriter
writer
=
response
.
getWriter
();
JSONObject
object
=
new
JSONObject
();
String
sessionID
=
BudgetHandler
.
getSessionID
(
request
.
getCookies
());
Budget
budget
=
BudgetHandler
.
retrieveBudget
(
sessionID
);
if
(
budget
==
null
)
{
response
.
getWriter
().
write
(
"equipment list error"
);
response
.
sendError
(
444
,
"budget not exists"
);
return
;
}
Map
<
TestAndProcess
,
Integer
>
testAndProcesses
=
budget
.
getTestAndProcesses
();
List
<
JSONObject
>
list
=
new
LinkedList
<>();
for
(
TestAndProcess
item
:
testAndProcesses
.
keySet
())
{
JSONObject
obj
=
new
JSONObject
();
obj
.
put
(
"id"
,
item
.
getId
());
obj
.
put
(
"name"
,
item
.
getName
());
obj
.
put
(
"price"
,
item
.
getPrice
());
obj
.
put
(
"nums"
,
testAndProcesses
.
get
(
item
));
list
.
add
(
obj
);
}
object
.
put
(
"data"
,
list
);
writer
.
write
(
JSON
.
toJSONString
(
object
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
@RequestMapping
(
"/International"
)
public
void
detailInternational
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
...
...
src/main/java/service/IDetailService.java
View file @
65a1aeaf
...
...
@@ -21,4 +21,6 @@ public interface IDetailService {
double
sumMaterial
(
Map
<
Material
,
Integer
>
materials
);
double
sumInternational
(
Map
<
InternationalCommunication
,
Integer
>
internationalCommunications
);
double
sumTestAndProcess
(
Map
<
TestAndProcess
,
Integer
>
testAndProcesses
);
}
src/main/java/service/impl/DetailService.java
View file @
65a1aeaf
...
...
@@ -79,4 +79,13 @@ public class DetailService implements IDetailService {
}
return
sum
;
}
@Override
public
double
sumTestAndProcess
(
Map
<
TestAndProcess
,
Integer
>
testAndProcesses
)
{
double
sum
=
0.0
;
for
(
TestAndProcess
item
:
testAndProcesses
.
keySet
())
{
sum
+=(
item
.
computeUnitPrice
()*
testAndProcesses
.
get
(
item
));
}
return
sum
;
}
}
src/main/webapp/budgetDetail.jsp
View file @
65a1aeaf
This diff is collapsed.
Click to expand it.
src/main/webapp/history.jsp
View file @
65a1aeaf
...
...
@@ -45,7 +45,7 @@
<ul
class=
"nav navbar-nav"
>
<li><a
href=
"${pageContext.request.contextPath}/"
>
创建预算
</a></li>
<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}/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}/Test"
>
测试
</a></li>
...
...
src/main/webapp/index.jsp
View file @
65a1aeaf
...
...
@@ -36,7 +36,7 @@
<ul
class=
"nav navbar-nav"
>
<li
class=
"active"
><a
href=
"${pageContext.request.contextPath}/"
>
创建预算
</a></li>
<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}/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}/Test"
>
测试
</a></li>
...
...
src/main/webapp/modifyRules.jsp
View file @
65a1aeaf
...
...
@@ -46,7 +46,7 @@
<ul
class=
"nav navbar-nav"
>
<li><a
href=
"${pageContext.request.contextPath}/"
>
创建预算
</a></li>
<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}/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}/Test"
>
测试
</a></li>
...
...
src/main/webapp/test.jsp
View file @
65a1aeaf
...
...
@@ -47,7 +47,7 @@
<ul
class=
"nav navbar-nav"
>
<li><a
href=
"${pageContext.request.contextPath}/"
>
创建预算
</a></li>
<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}/Budget/Detail"
>
修改预算
</a></li>
--%
>
<li><a
href=
"${pageContext.request.contextPath}/Rule/"
>
修改规则
</a></li>
<li><a
href=
"${pageContext.request.contextPath}/Budget/Download"
>
导出最新预算
</a></li>
<li
class=
"active"
><a
href=
"${pageContext.request.contextPath}/Test"
>
测试
</a></li>
...
...
@@ -101,6 +101,26 @@ ${pageContext.request.contextPath}<br>
<button
class=
"btn btn-danger"
onclick=
"logout()"
>
退出登录
</button>
<div
id=
"forTest"
>
<select
v-model=
"selectedIndex"
>
<option
v-for=
"(item,index) in items"
:value=
"index"
>
{{item.name}}
</option>
</select>
<td><input
type=
"text"
v-model=
"items[selectedIndex].name"
></td>
<td><input
type=
"text"
v-model=
"items[selectedIndex].age"
></td>
</div>
<script
type=
"text/javascript"
>
var
vueTest
=
new
Vue
({
el
:
"#forTest"
,
data
:{
items
:[{
name
:
'zhangsan'
,
age
:
24
,
tel
:
110
},
{
name
:
'lisi'
,
age
:
20
,
tel
:
120
},
{
name
:
'wangwu'
,
age
:
21
,
tel
:
119
}],
text
:
"111"
,
selectedIndex
:
0
}
});
</script>
<script
type=
"text/javascript"
>
function
logout
()
{
if
(
confirm
(
"确认退出登录?"
)){
...
...
src/main/webapp/usercenter.jsp
View file @
65a1aeaf
...
...
@@ -45,7 +45,7 @@
<ul
class=
"nav navbar-nav"
>
<li><a
href=
"${pageContext.request.contextPath}/"
>
创建预算
</a></li>
<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}/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}/Test"
>
测试
</a></li>
...
...
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