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
eefc3b0e
Commit
eefc3b0e
authored
Mar 27, 2019
by
shj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
差旅费增删改完成,代码重构
parent
cf8dd7ca
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
14 deletions
+23
-14
Travel.java
src/main/java/beans/Travel.java
+2
-11
DetailHandler.java
src/main/java/handlers/DetailHandler.java
+4
-3
IDetailService.java
src/main/java/service/IDetailService.java
+4
-0
CheckService.java
src/main/java/service/impl/CheckService.java
+2
-0
DetailService.java
src/main/java/service/impl/DetailService.java
+11
-0
budgetDetail.jsp
src/main/webapp/budgetDetail.jsp
+0
-0
No files found.
src/main/java/beans/Travel.java
View file @
eefc3b0e
...
...
@@ -21,15 +21,6 @@ public class Travel extends Item {
return
getPrice
()
+
getFood
()
+
getAccommodation
()
+
getTraffic
();
}
@Override
public
String
getName
()
{
return
getDest
();
}
@Override
public
void
setName
(
String
name
)
{
setDest
(
name
);
}
@Override
public
String
toString
()
{
...
...
@@ -42,11 +33,11 @@ public class Travel extends Item {
}
public
String
getDest
()
{
return
dest
;
return
getName
()
;
}
public
void
setDest
(
String
dest
)
{
this
.
dest
=
dest
;
setName
(
dest
)
;
}
public
double
getFood
()
{
...
...
src/main/java/handlers/DetailHandler.java
View file @
eefc3b0e
...
...
@@ -72,15 +72,16 @@ public class DetailHandler {
sub
.
put
(
"sum"
,
sum
);
sub
.
put
(
"diff"
,
req
-
sum
);
object
.
put
(
"equipment"
,
sub
);
req_sofar
+=
req
;
sum_sofar
+=
sum
;
sub
=
new
JSONObject
();
req
=
budget
.
getRequirement
().
get
Equip
();
sum
=
detailService
.
sum
Equipment
(
budget
.
getEquipment
s
());
req
=
budget
.
getRequirement
().
get
Travel
();
sum
=
detailService
.
sum
Travel
(
budget
.
getTravel
s
());
sub
.
put
(
"req"
,
req
);
sub
.
put
(
"sum"
,
sum
);
sub
.
put
(
"diff"
,
req
-
sum
);
object
.
put
(
"travel"
,
sub
);
req_sofar
+=
req
;
sum_sofar
+=
sum
;
object
.
put
(
"req"
,
req_sofar
);
object
.
put
(
"sum"
,
sum_sofar
);
...
...
src/main/java/service/IDetailService.java
View file @
eefc3b0e
package
service
;
import
beans.Equipment
;
import
beans.Pair
;
import
beans.Travel
;
import
java.util.Map
;
public
interface
IDetailService
{
double
sumEquipment
(
Map
<
Equipment
,
Integer
>
equipments
);
double
sumTravel
(
Map
<
Travel
,
Pair
>
travels
);
}
src/main/java/service/impl/CheckService.java
View file @
eefc3b0e
...
...
@@ -10,6 +10,8 @@ import service.ICheckService;
public
class
CheckService
implements
ICheckService
{
@Override
public
boolean
checkEquipment
(
Equipment
equipment
)
{
if
(
equipment
==
null
||
equipment
.
getName
()==
null
)
return
false
;
return
true
;
}
...
...
src/main/java/service/impl/DetailService.java
View file @
eefc3b0e
package
service
.
impl
;
import
beans.Equipment
;
import
beans.Pair
;
import
beans.Travel
;
import
org.springframework.stereotype.Service
;
import
service.IDetailService
;
...
...
@@ -16,4 +18,13 @@ public class DetailService implements IDetailService {
}
return
sum
;
}
@Override
public
double
sumTravel
(
Map
<
Travel
,
Pair
>
travels
)
{
double
sum
=
0.0
;
for
(
Travel
travel
:
travels
.
keySet
())
{
sum
+=
travel
.
cost
(
travels
.
get
(
travel
));
}
return
sum
;
}
}
src/main/webapp/budgetDetail.jsp
View file @
eefc3b0e
This diff is collapsed.
Click to expand it.
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