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
20041b92
Commit
20041b92
authored
May 19, 2019
by
shj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
间接费可以修改
parent
3e339799
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
119 additions
and
1 deletion
+119
-1
BudgetHandler.java
src/main/java/handlers/BudgetHandler.java
+28
-0
DetailHandler.java
src/main/java/handlers/DetailHandler.java
+30
-0
IDetailService.java
src/main/java/service/IDetailService.java
+6
-0
DetailService.java
src/main/java/service/impl/DetailService.java
+27
-0
budgetDetail.jsp
src/main/webapp/budgetDetail.jsp
+28
-1
No files found.
src/main/java/handlers/BudgetHandler.java
View file @
20041b92
...
...
@@ -689,6 +689,34 @@ public class BudgetHandler {
}
@RequestMapping
(
"/Modify/Indirect"
)
public
void
modifyIndirect
(
Integer
mode
,
Indirect
indirect
,
Integer
nums
,
Integer
curd
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
IOException
{
System
.
out
.
println
(
"/Modify/Indirect"
);
if
(
nums
<
0
)
return
;
String
sessionID
=
getSessionID
(
request
.
getCookies
());
Budget
budget
=
retrieveBudget
(
sessionID
);
if
(
budget
==
null
)
{
response
.
sendError
(
444
,
"budget not exists"
);
return
;
}
Map
<
Indirect
,
Integer
>
items
=
null
;
items
=
budget
.
getIndirects
();
if
(
curd
.
equals
(
0
))
{
items
.
put
(
indirect
,
nums
);
}
else
if
(
curd
.
equals
(
1
))
{
items
.
remove
(
indirect
);
}
else
{
items
.
remove
(
indirect
);
items
.
put
(
indirect
,
nums
);
}
serializeBudget
(
budget
,
getFilePath
(
sessionID
));
}
/**
* 预算修改的善后工作
*
...
...
src/main/java/handlers/DetailHandler.java
View file @
20041b92
...
...
@@ -115,6 +115,16 @@ public class DetailHandler {
object
.
put
(
"travel"
,
sub
);
req_sofar
+=
req
;
sum_sofar
+=
sum
;
//燃料动力费
sub
=
new
JSONObject
();
req
=
budget
.
getRequirement
().
getPower
();
sum
=
detailService
.
sumPower
(
budget
.
getPowers
());
sub
.
put
(
"req"
,
req
);
sub
.
put
(
"sum"
,
sum
);
sub
.
put
(
"diff"
,
req
-
sum
);
object
.
put
(
"power"
,
sub
);
req_sofar
+=
req
;
sum_sofar
+=
sum
;
//国际交流合作费
sub
=
new
JSONObject
();
req
=
budget
.
getRequirement
().
getInternational
();
...
...
@@ -165,6 +175,26 @@ public class DetailHandler {
object
.
put
(
"consultation"
,
sub
);
req_sofar
+=
req
;
sum_sofar
+=
sum
;
//其他费用
sub
=
new
JSONObject
();
req
=
budget
.
getRequirement
().
getOthers
();
sum
=
detailService
.
sumOthers
(
budget
.
getOthers
());
sub
.
put
(
"req"
,
req
);
sub
.
put
(
"sum"
,
sum
);
sub
.
put
(
"diff"
,
req
-
sum
);
object
.
put
(
"others"
,
sub
);
req_sofar
+=
req
;
sum_sofar
+=
sum
;
//间接费用
sub
=
new
JSONObject
();
req
=
budget
.
getRequirement
().
getIndirect
();
sum
=
detailService
.
sumIndirect
(
budget
.
getIndirects
());
sub
.
put
(
"req"
,
req
);
sub
.
put
(
"sum"
,
sum
);
sub
.
put
(
"diff"
,
req
-
sum
);
object
.
put
(
"indirect"
,
sub
);
req_sofar
+=
req
;
sum_sofar
+=
sum
;
object
.
put
(
"req"
,
budget
.
getRequirement
().
getTotal
());
object
.
put
(
"sum"
,
sum_sofar
);
object
.
put
(
"diff"
,
budget
.
getRequirement
().
getTotal
()-
sum_sofar
);
...
...
src/main/java/service/IDetailService.java
View file @
20041b92
...
...
@@ -23,4 +23,10 @@ public interface IDetailService {
double
sumInternational
(
Map
<
InternationalCommunication
,
Integer
>
internationalCommunications
);
double
sumTestAndProcess
(
Map
<
TestAndProcess
,
Integer
>
testAndProcesses
);
double
sumPower
(
Map
<
Power
,
Integer
>
powers
);
double
sumOthers
(
Map
<
Others
,
Integer
>
others
);
double
sumIndirect
(
Map
<
Indirect
,
Integer
>
indirects
);
}
src/main/java/service/impl/DetailService.java
View file @
20041b92
...
...
@@ -88,4 +88,31 @@ public class DetailService implements IDetailService {
}
return
sum
;
}
@Override
public
double
sumPower
(
Map
<
Power
,
Integer
>
powers
)
{
double
sum
=
0.0
;
for
(
Power
item
:
powers
.
keySet
())
{
sum
+=(
item
.
computeUnitPrice
()*
powers
.
get
(
item
));
}
return
sum
;
}
@Override
public
double
sumOthers
(
Map
<
Others
,
Integer
>
others
)
{
double
sum
=
0.0
;
for
(
Others
item
:
others
.
keySet
())
{
sum
+=(
item
.
computeUnitPrice
()*
others
.
get
(
item
));
}
return
sum
;
}
@Override
public
double
sumIndirect
(
Map
<
Indirect
,
Integer
>
indirects
)
{
double
sum
=
0.0
;
for
(
Indirect
item
:
indirects
.
keySet
())
{
sum
+=(
item
.
computeUnitPrice
()*
indirects
.
get
(
item
));
}
return
sum
;
}
}
src/main/webapp/budgetDetail.jsp
View file @
20041b92
...
...
@@ -536,14 +536,18 @@
<th>
名称
</th>
<th>
费用
</th>
<th>
数量
</th>
<th>
操作
</th>
</tr>
</thead>
<tbody
id=
"indirect-body"
>
<tr
v-for=
"item in items"
>
<td>
{{item.name}}
</td>
<td>
{{item.price}}
</td>
<td>
<input
type=
"number"
v-model=
"item.price"
class=
"form-control"
>
</td>
<td>
{{item.nums}}
</td>
<td>
<button
class=
"btn btn-success"
@
click=
"update(item)"
>
确认
</button>
</td>
</tr>
</tbody>
...
...
@@ -896,15 +900,38 @@
items
:
[]
},
methods
:
{
update
:
function
(
item
)
{
this
.
doUpdate
(
item
,
2
);
},
del
:
function
(
item
)
{
this
.
doUpdate
(
item
,
1
);
},
add
:
function
(
item
)
{
this
.
doUpdate
(
item
,
0
);
},
showlist
:
function
()
{
this
.
$http
.
get
(
"${pageContext.request.contextPath}/Budget/Detail/Indirect"
).
then
(
function
(
data
)
{
this
.
items
=
data
.
body
.
data
;
console
.
log
(
"indirect-showlist"
);
updateBudgetPage
(
"indirect"
)
},
function
(
error
)
{
console
.
log
(
error
)
}
)
},
doUpdate
:
function
(
item
,
curd
)
{
this
.
$http
.
post
(
"${pageContext.request.contextPath}/Budget/Modify/Indirect"
,
{
name
:
item
.
name
,
price
:
item
.
price
,
nums
:
item
.
nums
,
curd
:
curd
},
{
emulateJSON
:
true
}
).
then
(
function
(
value
)
{
this
.
showlist
();
});
}
},
created
:
function
()
{
...
...
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