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
c929ff56
Commit
c929ff56
authored
Apr 01, 2019
by
shj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Vue真的超好用der
parent
96cd9b7c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
82 deletions
+26
-82
BudgetHandler.java
src/main/java/handlers/BudgetHandler.java
+2
-80
DetailHandler.java
src/main/java/handlers/DetailHandler.java
+11
-2
IDetailService.java
src/main/java/service/IDetailService.java
+3
-0
DetailService.java
src/main/java/service/impl/DetailService.java
+10
-0
budgetDetail.jsp
src/main/webapp/budgetDetail.jsp
+0
-0
No files found.
src/main/java/handlers/BudgetHandler.java
View file @
c929ff56
...
...
@@ -234,9 +234,9 @@ public class BudgetHandler {
@Autowired
private
ICheckService
checkService
;
@RequestMapping
(
"/Modify/Equip"
)
@RequestMapping
(
"/Modify/Equip
ment
"
)
public
void
modifyEquip
(
Integer
mode
,
Equipment
equipment
,
Integer
nums
,
Integer
curd
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
System
.
out
.
println
(
"/Modify/Equip"
);
System
.
out
.
println
(
"/Modify/Equip
ment
"
);
if
(
nums
<
0
)
return
;
String
sessionID
=
getSessionID
(
request
.
getCookies
());
...
...
@@ -252,56 +252,10 @@ public class BudgetHandler {
{
equipments
.
remove
(
equipment
);
equipments
.
put
(
equipment
,
nums
);
/*for (Equipment item : equipments.keySet()) {
if(item.equals(equipment))
{
item.setPrice(equipment.getPrice());
equipments.put(item,nums);
break;
}
}*/
}
else
equipments
.
put
(
equipment
,
nums
);
serializeBudget
(
budget
,
getFilePath
(
sessionID
));
/*if (mode.equals(0))//修改预算
{
if (nums < 0) return;
String sessionID = getSessionID(request.getCookies());
Budget budget = retrieveBudget(sessionID);
assert budget != null;
Map<Equipment, Integer> items = budget.getEquipments();
Equipment mod=equipmentDao.selectById(id);
if(mod!=null)
items.put(mod,nums);
try {
double sum=0.0;
for (Equipment equipment : items.keySet()) {
sum+=(equipment.getPrice()*items.get(equipment));
}
response.getWriter().print(sum);
} catch (IOException e) {
e.printStackTrace();
}
serializeBudget(budget, getFilePath(sessionID));
} else//修改规则
{
Equipment equipment = new Equipment();
equipment.setId(id);
equipment.setName(name);
equipment.setPrice(price);
if (curd.equals(0))//增
{
equipmentDao.insertEquipment(equipment);
} else if (curd.equals(1))//删
{
equipmentDao.deleteEquipment(equipment);
} else//改
{
equipmentDao.updateEquipment(equipment);
}
}*/
}
...
...
@@ -455,23 +409,6 @@ public class BudgetHandler {
items
.
put
(
property
,
nums
);
}
serializeBudget
(
budget
,
getFilePath
(
sessionID
));
/*} *//*else//修改规则
{
Property item = new Property();
item.setId(id);
item.setName(name);
item.setPrice(price);
if (curd.equals(0))//增
{
propertyDao.insertProperty(item);
} else if (curd.equals(1))//删
{
propertyDao.deleteProperty(item);
} else//改
{
propertyDao.updateProperty(item);
}
}*/
}
...
...
@@ -682,22 +619,7 @@ public class BudgetHandler {
items
.
remove
(
travel
);
items
.
put
(
travel
,
pair
);
}
serializeBudget
(
budget
,
getFilePath
(
sessionID
));
/*else//修改规则
{
if (curd.equals(0))//增
{
travelDao.insertTravel(travel);
} else if (curd.equals(1))//删
{
travelDao.deleteTravel(travel);
} else//改
{
travelDao.updateTravel(travel);
}
}*/
}
...
...
src/main/java/handlers/DetailHandler.java
View file @
c929ff56
...
...
@@ -83,6 +83,15 @@ public class DetailHandler {
object
.
put
(
"travel"
,
sub
);
req_sofar
+=
req
;
sum_sofar
+=
sum
;
sub
=
new
JSONObject
();
req
=
budget
.
getRequirement
().
getLabour
();
sum
=
detailService
.
sumLabour
(
budget
.
getLabour
());
sub
.
put
(
"req"
,
req
);
sub
.
put
(
"sum"
,
sum
);
sub
.
put
(
"diff"
,
req
-
sum
);
object
.
put
(
"labour"
,
sub
);
req_sofar
+=
req
;
sum_sofar
+=
sum
;
object
.
put
(
"req"
,
req_sofar
);
object
.
put
(
"sum"
,
sum_sofar
);
object
.
put
(
"diff"
,
req_sofar
-
sum_sofar
);
...
...
@@ -113,7 +122,7 @@ public class DetailHandler {
obj
.
put
(
"nums"
,
equipments
.
get
(
item
));
list
.
add
(
obj
);
}
object
.
put
(
"
equipments
"
,
list
);
object
.
put
(
"
data
"
,
list
);
writer
.
write
(
JSON
.
toJSONString
(
object
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
...
...
@@ -144,7 +153,7 @@ public class DetailHandler {
obj
.
put
(
"days"
,
travels
.
get
(
item
).
getDays
());
list
.
add
(
obj
);
}
object
.
put
(
"
travels
"
,
list
);
object
.
put
(
"
data
"
,
list
);
writer
.
write
(
JSON
.
toJSONString
(
object
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
...
...
src/main/java/service/IDetailService.java
View file @
c929ff56
package
service
;
import
beans.Equipment
;
import
beans.Labour
;
import
beans.Pair
;
import
beans.Travel
;
...
...
@@ -11,4 +12,6 @@ public interface IDetailService {
double
sumEquipment
(
Map
<
Equipment
,
Integer
>
equipments
);
double
sumTravel
(
Map
<
Travel
,
Pair
>
travels
);
double
sumLabour
(
Map
<
Labour
,
Integer
>
labour
);
}
src/main/java/service/impl/DetailService.java
View file @
c929ff56
package
service
.
impl
;
import
beans.Equipment
;
import
beans.Labour
;
import
beans.Pair
;
import
beans.Travel
;
import
org.springframework.stereotype.Service
;
...
...
@@ -27,4 +28,13 @@ public class DetailService implements IDetailService {
}
return
sum
;
}
@Override
public
double
sumLabour
(
Map
<
Labour
,
Integer
>
labours
)
{
double
sum
=
0.0
;
for
(
Labour
labour
:
labours
.
keySet
())
{
sum
+=(
labour
.
getPrice
()*
labours
.
get
(
labour
));
}
return
sum
;
}
}
src/main/webapp/budgetDetail.jsp
View file @
c929ff56
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