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
b77a3c79
Commit
b77a3c79
authored
May 29, 2019
by
shj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据库备份;数据库查询接口;优化说明文件;
parent
d32a44a4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
148 additions
and
6 deletions
+148
-6
budgetmanagementsystem-5-29.sql
database/budgetmanagementsystem-5-29.sql
+0
-0
pom.xml
pom.xml
+6
-0
IInternationalCommunicationDao.xml
src/main/java/dao/IInternationalCommunicationDao.xml
+2
-1
BudgetHandler.java
src/main/java/handlers/BudgetHandler.java
+43
-2
DatabaseQueryHandler.java
src/main/java/handlers/DatabaseQueryHandler.java
+2
-0
DetailHandler.java
src/main/java/handlers/DetailHandler.java
+33
-0
CheckService.java
src/main/java/service/impl/CheckService.java
+2
-2
BudgetExportUtil.java
src/main/java/util/BudgetExportUtil.java
+30
-1
budgetDetail.jsp
src/main/webapp/budgetDetail.jsp
+0
-0
MyTest.java
src/test/java/MyTest.java
+30
-0
No files found.
database/budgetmanagementsystem-5-29.sql
0 → 100644
View file @
b77a3c79
This diff is collapsed.
Click to expand it.
pom.xml
View file @
b77a3c79
...
...
@@ -161,6 +161,12 @@
<version>
4.1.0
</version>
</dependency>
<dependency>
<groupId>
com.hierynomus
</groupId>
<artifactId>
sshj
</artifactId>
<version>
0.27.0
</version>
</dependency>
</dependencies>
...
...
src/main/java/dao/IInternationalCommunicationDao.xml
View file @
b77a3c79
...
...
@@ -9,7 +9,8 @@
select * from internationalcommunication where id=#{id}
</select>
<insert
id=
"insertInternational"
>
insert into budgetmanagementsystem.internationalcommunication(name,price) values (#{name},#{price})
insert into budgetmanagementsystem.internationalcommunication(name,price,accommodation,food,traffic)
values (#{name},#{price},#{accommodation},#{food},#{traffic})
</insert>
<update
id=
"updateInternational"
>
update budgetmanagementsystem.internationalcommunication set name=#{name},price=#{price} where id=#{id}
...
...
src/main/java/handlers/BudgetHandler.java
View file @
b77a3c79
...
...
@@ -482,17 +482,25 @@ public class BudgetHandler {
for
(
Equipment
item
:
keySet
)
{
if
(
item
.
equals
(
equipment
)){
item
.
setPrice
(
equipment
.
getPrice
());
item
.
setType
(
equipment
.
getType
());
item
.
setComment
(
equipment
.
getComment
());
}
}
//更新value
equipments
.
put
(
equipment
,
nums
);
}
else
if
(
curd
.
equals
(
0
))
{
equipments
.
put
(
equipment
,
nums
);
else
{
equipmentDao
.
insertEquipment
(
equipment
);
}
else
if
(
curd
.
equals
(
3
)){
Equipment
add
=
equipmentDao
.
selectByName
(
equipment
.
getName
());
equipments
.
remove
(
add
);
equipments
.
put
(
add
,
nums
);
System
.
out
.
println
(
"add form database:"
+
add
.
getComment
());
}
else
if
(
curd
.
equals
(
4
)){
equipmentDao
.
deleteEquipment
(
equipment
);
System
.
out
.
println
(
"delete form database:"
+
equipment
.
getName
());
}
}
serializeBudget
(
budget
,
getFilePath
(
sessionID
));
...
...
@@ -618,8 +626,11 @@ public class BudgetHandler {
{
items
.
remove
(
internationalCommunication
);
items
.
put
(
internationalCommunication
,
nums
);
}
else
}
else
if
(
curd
.
equals
(
0
))
{
items
.
put
(
internationalCommunication
,
nums
);
internationalCommunicationDao
.
insertInternational
(
internationalCommunication
);
}
}
afterUpdate
(
budget
);
serializeBudget
(
budget
,
getFilePath
(
sessionID
));
...
...
@@ -855,6 +866,36 @@ public class BudgetHandler {
}
@RequestMapping
(
"/Modify/Others"
)
public
void
modifyOthers
(
Integer
mode
,
Others
others
,
Integer
nums
,
Integer
curd
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
IOException
{
System
.
out
.
println
(
"/Modify/Others"
);
if
(
nums
<
0
)
return
;
String
sessionID
=
getSessionID
(
request
.
getCookies
());
Budget
budget
=
retrieveBudget
(
sessionID
);
if
(
budget
==
null
)
{
response
.
sendError
(
444
,
"budget not exists"
);
return
;
}
Map
<
Others
,
Integer
>
items
=
null
;
items
=
budget
.
getOthers
();
if
(
curd
.
equals
(
0
))
{
items
.
put
(
others
,
nums
);
}
else
if
(
curd
.
equals
(
1
))
{
items
.
remove
(
others
);
}
else
{
items
.
remove
(
others
);
items
.
put
(
others
,
nums
);
}
afterUpdate
(
budget
);
serializeBudget
(
budget
,
getFilePath
(
sessionID
));
}
/**
* 预算修改的善后工作
*
...
...
src/main/java/handlers/DatabaseQueryHandler.java
View file @
b77a3c79
...
...
@@ -35,6 +35,8 @@ public class DatabaseQueryHandler {
JSONObject
obj
=
new
JSONObject
();
obj
.
put
(
"id"
,
item
.
getId
());
obj
.
put
(
"name"
,
item
.
getName
());
obj
.
put
(
"type"
,
item
.
getType
());
obj
.
put
(
"comment"
,
item
.
getComment
());
obj
.
put
(
"price"
,
item
.
getPrice
());
obj
.
put
(
"nums"
,
0
);
list
.
add
(
obj
);
...
...
src/main/java/handlers/DetailHandler.java
View file @
b77a3c79
...
...
@@ -233,6 +233,8 @@ public class DetailHandler {
JSONObject
obj
=
new
JSONObject
();
obj
.
put
(
"id"
,
item
.
getId
());
obj
.
put
(
"name"
,
item
.
getName
());
obj
.
put
(
"type"
,
item
.
getType
());
obj
.
put
(
"comment"
,
item
.
getComment
());
obj
.
put
(
"price"
,
item
.
getPrice
());
obj
.
put
(
"nums"
,
equipments
.
get
(
item
));
list
.
add
(
obj
);
...
...
@@ -543,4 +545,35 @@ public class DetailHandler {
e
.
printStackTrace
();
}
}
@RequestMapping
(
"/Others"
)
public
void
showOthers
(
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
(
"indirect list error"
);
return
;
}
Map
<
Others
,
Integer
>
others
=
budget
.
getOthers
();
List
<
JSONObject
>
list
=
new
LinkedList
<>();
for
(
Others
item
:
others
.
keySet
())
{
JSONObject
obj
=
new
JSONObject
();
obj
.
put
(
"id"
,
item
.
getId
());
obj
.
put
(
"name"
,
item
.
getName
());
obj
.
put
(
"price"
,
item
.
getPrice
());
obj
.
put
(
"nums"
,
others
.
get
(
item
));
list
.
add
(
obj
);
}
object
.
put
(
"data"
,
list
);
writer
.
write
(
object
.
toJSONString
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
src/main/java/service/impl/CheckService.java
View file @
b77a3c79
...
...
@@ -22,9 +22,9 @@ public class CheckService implements ICheckService {
if
(
material
==
null
||
material
.
getName
()
==
null
)
{
return
201
;
}
if
(
material
.
computeUnitPrice
()
>=
10000
)
{
/*
if (material.computeUnitPrice() >= 10000) {
return 202;
}
}
*/
return
isValid
;
}
...
...
src/main/java/util/BudgetExportUtil.java
View file @
b77a3c79
...
...
@@ -44,7 +44,7 @@ public class BudgetExportUtil {
StringBuilder
line
=
new
StringBuilder
();
line
.
append
(
"("
).
append
(
i
).
append
(
")"
);
line
.
append
(
equipment
.
get
Typ
e
())
line
.
append
(
equipment
.
get
Nam
e
())
.
append
(
num
).
append
(
"台,每台"
)
.
append
(
price
).
append
(
"元,共计"
)
.
append
(
num
*
price
).
append
(
"元"
);
...
...
@@ -113,6 +113,35 @@ public class BudgetExportUtil {
run
.
addTab
();
run
.
setText
(
"测试化验加工费:"
+
detailService
.
sumTestAndProcess
(
budget
.
getTestAndProcesses
())+
"万元。【具体用途自行填写】"
);
Map
<
TestAndProcess
,
Integer
>
testAndProcesses
=
budget
.
getTestAndProcesses
();
i
=
0
;
for
(
TestAndProcess
item
:
testAndProcesses
.
keySet
())
{
i
++;
int
num
=
testAndProcesses
.
get
(
item
);
double
price
=
item
.
getPrice
();
paragraph
=
document
.
createParagraph
();
run
=
paragraph
.
createRun
();
run
.
addTab
();
StringBuilder
line
=
new
StringBuilder
();
line
.
append
(
"("
).
append
(
i
).
append
(
")"
);
line
.
append
(
item
.
getName
())
.
append
(
num
).
append
(
"次,每次"
)
.
append
(
price
).
append
(
"元,共计"
)
.
append
(
num
*
price
).
append
(
"元"
);
run
.
setText
(
line
.
toString
());
line
=
new
StringBuilder
();
line
.
append
(
"用途:【自行填写】,购买"
)
.
append
(
num
).
append
(
"服务,"
)
.
append
(
"单价"
).
append
(
price
).
append
(
"元,共需"
).
append
(
num
*
price
).
append
(
"元。"
);
paragraph
=
document
.
createParagraph
();
run
=
paragraph
.
createRun
();
run
.
addTab
();
run
.
setText
(
line
.
toString
());
}
//燃料动力费
paragraph
=
document
.
createParagraph
();
...
...
src/main/webapp/budgetDetail.jsp
View file @
b77a3c79
This diff is collapsed.
Click to expand it.
src/test/java/MyTest.java
View file @
b77a3c79
...
...
@@ -2,6 +2,11 @@ import beans.Budget;
import
beans.Conference
;
import
beans.Equipment
;
import
beans.Item
;
import
handlers.BudgetHandler
;
import
net.schmizz.sshj.SSHClient
;
import
net.schmizz.sshj.sftp.SFTPClient
;
import
net.schmizz.sshj.xfer.FileSystemFile
;
import
org.jsoup.select.Evaluator
;
import
org.junit.Test
;
import
java.io.*
;
...
...
@@ -496,4 +501,29 @@ public class MyTest implements Serializable {
System
.
out
.
println
(
e1
.
equals
(
c1
));
System
.
out
.
println
(
e1
.
equals
(
e2
));
}
@Test
public
void
directoryTest
()
throws
ClassNotFoundException
{
System
.
out
.
println
();
System
.
getProperty
(
"user.home"
);
}
@Test
public
void
SFTPTestUp
()
throws
IOException
{
final
SSHClient
ssh
=
new
SSHClient
();
ssh
.
loadKnownHosts
(
new
File
(
"C:\\Users\\Song\\.ssh\\known_hosts"
));
ssh
.
connect
(
"47.92.3.69"
);
try
{
ssh
.
authPublickey
(
"root"
);
final
String
src
=
"F:\\Workspace\\BudgetManagementSystem\\pom.xml"
;
final
SFTPClient
sftp
=
ssh
.
newSFTPClient
();
try
{
sftp
.
put
(
new
FileSystemFile
(
src
),
"/tmp"
);
}
finally
{
sftp
.
close
();
}
}
finally
{
ssh
.
disconnect
();
}
}
}
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