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
56ecbbe6
Commit
56ecbbe6
authored
Apr 22, 2019
by
shj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
劳务费增删改,专职人员五险一金计算
parent
b45184a0
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
427 additions
and
121 deletions
+427
-121
Conference.java
src/main/java/beans/Conference.java
+16
-2
Labour.java
src/main/java/beans/Labour.java
+33
-0
BudgetHandler.java
src/main/java/handlers/BudgetHandler.java
+38
-53
DetailHandler.java
src/main/java/handlers/DetailHandler.java
+40
-0
BudgetService.java
src/main/java/service/impl/BudgetService.java
+60
-55
DetailService.java
src/main/java/service/impl/DetailService.java
+1
-1
SalaryCalculator.java
src/main/java/util/SalaryCalculator.java
+112
-0
budgetDetail.jsp
src/main/webapp/budgetDetail.jsp
+69
-10
GongjijinTest.java
src/test/java/GongjijinTest.java
+18
-0
JsonTest.java
src/test/java/JsonTest.java
+40
-0
No files found.
src/main/java/beans/Conference.java
View file @
56ecbbe6
...
...
@@ -4,8 +4,19 @@ package beans;
* 会议费
*/
public
class
Conference
extends
Item
{
@Deprecated
private
int
experts
;
private
int
people
;
private
int
days
;
public
int
getDays
()
{
return
days
;
}
public
void
setDays
(
int
days
)
{
this
.
days
=
days
;
}
public
int
getPeople
()
{
return
people
;
...
...
@@ -25,7 +36,7 @@ public class Conference extends Item {
@Override
public
double
computeUnitPrice
()
{
return
getPrice
()*
getPeople
();
return
getPrice
()*
getPeople
()
*
getDays
()
;
}
@Override
...
...
@@ -33,9 +44,12 @@ public class Conference extends Item {
return
"Conference{"
+
"experts="
+
experts
+
", people="
+
people
+
", days="
+
days
+
"} "
+
super
.
toString
();
}
public
double
cost
(
Pair
pair
,
Consultation
consultation
)
@Deprecated
public
double
cost
(
Pair
pair
,
Consultation
consultation
)
{
if
(
pair
==
null
||
pair
.
getDays
()<=
0
||
pair
.
getPeople
()<=
0
||
(
consultation
==
null
&&
getExperts
()!=
0
))
return
0.0
;
...
...
src/main/java/beans/Labour.java
View file @
56ecbbe6
package
beans
;
import
util.SalaryCalculator
;
/**
* 劳务费
*/
public
class
Labour
extends
Item
{
private
int
priority
;
private
int
people
;
private
int
months
;
public
int
getPeople
()
{
return
people
;
}
public
void
setPeople
(
int
people
)
{
this
.
people
=
people
;
}
public
int
getMonths
()
{
return
months
;
}
public
void
setMonths
(
int
months
)
{
this
.
months
=
months
;
}
@Override
public
String
toString
()
{
return
"Labour{"
+
"priority="
+
priority
+
", people="
+
people
+
", months="
+
months
+
"} "
+
super
.
toString
();
}
...
...
@@ -20,4 +42,15 @@ public class Labour extends Item{
public
void
setPriority
(
int
priority
)
{
this
.
priority
=
priority
;
}
@Override
public
double
computeUnitPrice
()
{
double
base
=
0
;
if
(
getName
().
equals
(
"专职"
)){
base
=
SalaryCalculator
.
getOrgCost
(
getPrice
());
}
else
base
=
getPrice
();
return
base
*
getPeople
()*
getMonths
();
}
}
src/main/java/handlers/BudgetHandler.java
View file @
56ecbbe6
...
...
@@ -376,8 +376,8 @@ public class BudgetHandler {
@Autowired
private
IPropertyDao
propertyDao
;
/**
*
* @param mode
* @param property
* @param nums
...
...
@@ -391,25 +391,25 @@ public class BudgetHandler {
/*if (mode.equals(0))//修改预算
{*/
if
(
nums
<
0
)
return
;
String
sessionID
=
getSessionID
(
request
.
getCookies
());
Budget
budget
=
retrieveBudget
(
sessionID
);
if
(
nums
<
0
)
return
;
String
sessionID
=
getSessionID
(
request
.
getCookies
());
Budget
budget
=
retrieveBudget
(
sessionID
);
assert
budget
!=
null
;
assert
budget
!=
null
;
Map
<
Property
,
Integer
>
items
=
null
;
items
=
budget
.
getProperties
();
if
(!
checkService
.
checkProperty
(
property
))
return
;
if
(
curd
.
equals
(
0
))
{
items
.
put
(
property
,
nums
);
}
else
if
(
curd
.
equals
(
1
))
{
items
.
remove
(
property
);
}
else
{
items
.
remove
(
property
);
items
.
put
(
property
,
nums
);
}
afterUpdate
(
budget
);
serializeBudget
(
budget
,
getFilePath
(
sessionID
));
Map
<
Property
,
Integer
>
items
=
null
;
items
=
budget
.
getProperties
();
if
(!
checkService
.
checkProperty
(
property
))
return
;
if
(
curd
.
equals
(
0
))
{
items
.
put
(
property
,
nums
);
}
else
if
(
curd
.
equals
(
1
))
{
items
.
remove
(
property
);
}
else
{
items
.
remove
(
property
);
items
.
put
(
property
,
nums
);
}
afterUpdate
(
budget
);
serializeBudget
(
budget
,
getFilePath
(
sessionID
));
}
...
...
@@ -418,51 +418,35 @@ public class BudgetHandler {
/**
* 修改预算中的劳务费、规则中的劳务费
*
* @param mode
* @param id
* @param name
* @param price
* @param labour
* @param nums
* @param curd
* @param request
* @param response
*/
@RequestMapping
(
"/Modify/Labour"
)
public
void
modifyLabour
(
Integer
mode
,
Integer
id
,
String
name
,
Double
price
,
Integer
nums
,
Integer
curd
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
public
void
modifyLabour
(
Integer
mode
,
Labour
labour
,
Integer
nums
,
Integer
curd
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
System
.
out
.
println
(
"/Modify/Labour"
);
if
(
mode
.
equals
(
0
))
//修改预算
{
if
(
nums
<
0
)
return
;
String
sessionID
=
getSessionID
(
request
.
getCookies
());
Budget
budget
=
retrieveBudget
(
sessionID
);
if
(
nums
<
0
)
return
;
String
sessionID
=
getSessionID
(
request
.
getCookies
());
Budget
budget
=
retrieveBudget
(
sessionID
);
assert
budget
!=
null
;
assert
budget
!=
null
;
Map
<
Labour
,
Integer
>
items
=
null
;
items
=
budget
.
getLabour
();
Labour
mod
=
labourDao
.
selectById
(
id
);
if
(
mod
!=
null
)
items
.
put
(
mod
,
nums
);
serializeBudget
(
budget
,
getFilePath
(
sessionID
));
}
else
//修改规则
{
Labour
item
=
new
Labour
();
item
.
setId
(
id
);
item
.
setName
(
name
);
item
.
setPrice
(
price
);
if
(
curd
.
equals
(
0
))
//增
{
labourDao
.
insertLabour
(
item
);
}
else
if
(
curd
.
equals
(
1
))
//删
{
labourDao
.
deleteLabour
(
item
);
}
else
//改
{
labourDao
.
updateLabour
(
item
);
}
Map
<
Labour
,
Integer
>
items
=
null
;
items
=
budget
.
getLabour
();
if
(
curd
.
equals
(
0
))
{
items
.
put
(
labour
,
nums
);
}
else
if
(
curd
.
equals
(
1
))
{
items
.
remove
(
labour
);
}
else
{
items
.
remove
(
labour
);
items
.
put
(
labour
,
nums
);
}
afterUpdate
(
budget
);
serializeBudget
(
budget
,
getFilePath
(
sessionID
));
}
...
...
@@ -627,9 +611,10 @@ public class BudgetHandler {
/**
* 预算修改的善后工作
*
* @param budget
*/
private
void
afterUpdate
(
Budget
budget
){
private
void
afterUpdate
(
Budget
budget
)
{
budget
.
setIndirects
(
budget
.
computeIndirect
());
}
...
...
@@ -830,7 +815,7 @@ public class BudgetHandler {
}
writer
.
newLine
();
writer
.
write
(
"劳务费,费用名称,费用标准,数量,小计"
);
writer
.
write
(
"劳务费,费用名称,费用标准,数量,小计
(五险一金)
"
);
writer
.
newLine
();
items
=
(
Map
)
budget
.
getLabour
();
for
(
Item
item
:
items
.
keySet
())
{
...
...
src/main/java/handlers/DetailHandler.java
View file @
56ecbbe6
...
...
@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
service.IDetailService
;
import
util.SalaryCalculator
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -105,6 +106,16 @@ public class DetailHandler {
object
.
put
(
"property"
,
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
);
...
...
@@ -255,4 +266,33 @@ public class DetailHandler {
e
.
printStackTrace
();
}
}
@RequestMapping
(
"/Labour"
)
public
void
labourDetail
(
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
);
Map
<
Labour
,
Integer
>
labourIntegerMap
=
budget
.
getLabour
();
List
<
JSONObject
>
list
=
new
LinkedList
<>();
for
(
Labour
item
:
labourIntegerMap
.
keySet
())
{
JSONObject
obj
=
new
JSONObject
();
obj
.
put
(
"id"
,
item
.
getId
());
obj
.
put
(
"name"
,
item
.
getName
());
obj
.
put
(
"price"
,
item
.
getPrice
());
obj
.
put
(
"tax"
,
item
.
computeUnitPrice
()/(
item
.
getMonths
()*
item
.
getPeople
()));
obj
.
put
(
"people"
,
item
.
getPeople
());
obj
.
put
(
"months"
,
item
.
getMonths
());
obj
.
put
(
"nums"
,
labourIntegerMap
.
get
(
item
));
list
.
add
(
obj
);
}
object
.
put
(
"data"
,
list
);
writer
.
write
(
JSON
.
toJSONString
(
object
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
src/main/java/service/impl/BudgetService.java
View file @
56ecbbe6
...
...
@@ -119,28 +119,27 @@ public class BudgetService implements IBudgetService {
*/
@Override
public
Map
<
Equipment
,
Integer
>
doEquipment
(
Double
number
)
{
Map
<
Equipment
,
Integer
>
map
=
new
HashMap
<>();
Map
<
Equipment
,
Integer
>
map
=
new
HashMap
<>();
List
<
Equipment
>
equipments
=
equipmentDao
.
selectAll
();
if
(
equipments
!=
null
&&
equipments
.
size
()>
0
)
{
Collections
.
sort
(
equipments
,
new
Comparator
<
Equipment
>()
{
if
(
equipments
!=
null
&&
equipments
.
size
()
>
0
)
{
Collections
.
sort
(
equipments
,
new
Comparator
<
Equipment
>()
{
@Override
public
int
compare
(
Equipment
o1
,
Equipment
o2
)
{
double
diff
=
o1
.
getPrice
()-
o2
.
getPrice
();
return
(
int
)
diff
;
double
diff
=
o1
.
getPrice
()
-
o2
.
getPrice
();
return
(
int
)
diff
;
}
});
for
(
Equipment
equipment
:
equipments
)
{
map
.
put
(
equipment
,
0
);
map
.
put
(
equipment
,
0
);
}
Equipment
equipment
=
equipments
.
get
(
0
);
double
sum
=
0.0
;
int
i
=
0
;
while
(
sum
<
number
)
{
sum
+=
equipment
.
getPrice
();
double
sum
=
0.0
;
int
i
=
0
;
while
(
sum
<
number
)
{
sum
+=
equipment
.
getPrice
();
i
++;
}
map
.
put
(
equipment
,
i
);
map
.
put
(
equipment
,
i
);
}
return
map
;
}
...
...
@@ -189,31 +188,28 @@ public class BudgetService implements IBudgetService {
*/
@Override
public
Map
<
Travel
,
Pair
>
doTravel
(
Double
number
)
{
Map
<
Travel
,
Pair
>
result
=
new
HashMap
<>();
Map
<
Travel
,
Pair
>
result
=
new
HashMap
<>();
List
<
Travel
>
travels
=
travelDao
.
selectAll
();
if
(
travels
!=
null
&&
travels
.
size
()!=
0
)
{
double
sofar
=
0.0
;
if
(
travels
!=
null
&&
travels
.
size
()
!=
0
)
{
double
sofar
=
0.0
;
for
(
Travel
travel
:
travels
)
{
if
(
sofar
<
number
)
{
Pair
pair
=
new
Pair
(
1
,
1
);
result
.
put
(
travel
,
pair
);
sofar
+=
travel
.
cost
(
pair
);
if
(
sofar
<
number
)
{
Pair
pair
=
new
Pair
(
1
,
1
);
result
.
put
(
travel
,
pair
);
sofar
+=
travel
.
cost
(
pair
);
}
}
while
(
sofar
<
number
)
{
while
(
sofar
<
number
)
{
for
(
Travel
travel
:
result
.
keySet
())
{
Pair
pair
=
result
.
get
(
travel
);
double
oldCost
=
travel
.
cost
(
pair
);
pair
.
setDays
(
pair
.
getDays
()
+
1
);
double
newCost
=
travel
.
cost
(
pair
);
sofar
+=(
newCost
-
oldCost
);
System
.
out
.
println
(
"oldCost:"
+
oldCost
);
System
.
out
.
println
(
"newCost:"
+
newCost
);
System
.
out
.
println
(
"sofar:"
+
sofar
);
if
(
sofar
>=
number
)
{
Pair
pair
=
result
.
get
(
travel
);
double
oldCost
=
travel
.
cost
(
pair
);
pair
.
setDays
(
pair
.
getDays
()
+
1
);
double
newCost
=
travel
.
cost
(
pair
);
sofar
+=
(
newCost
-
oldCost
);
System
.
out
.
println
(
"oldCost:"
+
oldCost
);
System
.
out
.
println
(
"newCost:"
+
newCost
);
System
.
out
.
println
(
"sofar:"
+
sofar
);
if
(
sofar
>=
number
)
{
System
.
out
.
println
(
result
);
return
result
;
}
...
...
@@ -224,6 +220,7 @@ public class BudgetService implements IBudgetService {
}
/////////////////////////////////////////////////////////待解决
/**
* 合成会议费
*
...
...
@@ -232,35 +229,32 @@ public class BudgetService implements IBudgetService {
*/
@Override
public
Map
<
Conference
,
Pair
>
doConference
(
Double
number
)
{
Map
<
Conference
,
Pair
>
map
=
new
HashMap
<>();
Map
<
Conference
,
Pair
>
map
=
new
HashMap
<>();
List
<
Conference
>
conferences
=
conferenceDao
.
selectAll
();
List
<
Consultation
>
consultations
=
consultationDao
.
selectAll
();
Consultation
consultation
=
null
;
if
(
consultations
!=
null
&&
consultations
.
size
()>
0
)
{
Consultation
consultation
=
null
;
if
(
consultations
!=
null
&&
consultations
.
size
()
>
0
)
{
for
(
Consultation
item
:
consultations
)
{
consultation
=
item
;
consultation
=
item
;
break
;
}
}
double
sum
=
0.0
;
double
sum
=
0.0
;
for
(
Conference
conference
:
conferences
)
{
if
(
sum
<
number
)
{
if
(
sum
<
number
)
{
Pair
value
=
new
Pair
(
1
,
1
);
map
.
put
(
conference
,
value
);
sum
+=
conference
.
cost
(
value
,
consultation
);
map
.
put
(
conference
,
value
);
sum
+=
conference
.
cost
(
value
,
consultation
);
}
}
while
(
sum
<
number
)
{
while
(
sum
<
number
)
{
for
(
Conference
conference
:
map
.
keySet
())
{
Pair
pair
=
map
.
get
(
conference
);
double
oldCost
=
conference
.
cost
(
pair
,
consultation
);
pair
.
setPeople
(
pair
.
getPeople
()
+
1
);
double
newCost
=
conference
.
cost
(
pair
,
consultation
);
sum
+=(
newCost
-
oldCost
);
if
(
sum
>=
number
)
return
map
;
double
oldCost
=
conference
.
cost
(
pair
,
consultation
);
pair
.
setPeople
(
pair
.
getPeople
()
+
1
);
double
newCost
=
conference
.
cost
(
pair
,
consultation
);
sum
+=
(
newCost
-
oldCost
);
if
(
sum
>=
number
)
return
map
;
}
}
return
map
;
...
...
@@ -298,8 +292,20 @@ public class BudgetService implements IBudgetService {
*/
@Override
public
Map
<
Labour
,
Integer
>
doLabour
(
Double
number
)
{
List
<
Labour
>
labour
=
labourDao
.
selectAll
();
return
generateMap
((
List
)
labour
,
number
);
List
<
Labour
>
list
=
labourDao
.
selectAll
();
Map
<
Labour
,
Integer
>
result
=
new
HashMap
<>();
try
{
Labour
labour
=
list
.
get
(
0
);
labour
.
setPeople
(
1
);
labour
.
setMonths
(
1
);
while
(
labour
.
computeUnitPrice
()<
number
){
labour
.
setMonths
(
labour
.
getMonths
()+
1
);
}
result
.
put
(
labour
,
1
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
result
;
}
/**
...
...
@@ -342,11 +348,10 @@ public class BudgetService implements IBudgetService {
@Override
public
Map
<
Consultation
,
Integer
>
doConsultation
(
int
n
)
{
List
<
Consultation
>
consultations
=
consultationDao
.
selectAll
();
Map
<
Consultation
,
Integer
>
map
=
new
HashMap
<>();
if
(
consultations
!=
null
&&
consultations
.
size
()>
0
)
{
Map
<
Consultation
,
Integer
>
map
=
new
HashMap
<>();
if
(
consultations
!=
null
&&
consultations
.
size
()
>
0
)
{
Consultation
consultation
=
consultations
.
get
(
0
);
map
.
put
(
consultation
,
n
);
map
.
put
(
consultation
,
n
);
}
return
map
;
}
...
...
src/main/java/service/impl/DetailService.java
View file @
56ecbbe6
...
...
@@ -30,7 +30,7 @@ public class DetailService implements IDetailService {
public
double
sumLabour
(
Map
<
Labour
,
Integer
>
labours
)
{
double
sum
=
0.0
;
for
(
Labour
labour
:
labours
.
keySet
())
{
sum
+=(
labour
.
ge
tPrice
()*
labours
.
get
(
labour
));
sum
+=(
labour
.
computeUni
tPrice
()*
labours
.
get
(
labour
));
}
return
sum
;
}
...
...
src/main/java/util/SalaryCalculator.java
0 → 100644
View file @
56ecbbe6
package
util
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.nio.charset.StandardCharsets
;
/**
* 五险一金计算器(简易版)
* 没有考虑社保汇缴基数和公积金汇缴基数的变动,两者均采用税前工资
*/
public
class
SalaryCalculator
{
private
static
double
yanglao
=
0.19
;
private
static
double
yiliao
=
0.10
;
private
static
double
shiye
=
0.008
;
private
static
double
gongjijin
=
0.12
;
private
static
double
gongshang
=
0.004
;
private
static
double
shengyu
=
0.008
;
/**
* 根据税前工资,计算用人成本
* @param preTaxSalary
* @return
*/
public
static
double
getOrgCost
(
double
preTaxSalary
){
return
preTaxSalary
+
getWuxianyijin
(
preTaxSalary
);
}
/**
* 根据税前工资,计算企业应缴纳的五险一金
* @param preTaxSalary
* @return
*/
public
static
double
getWuxianyijin
(
double
preTaxSalary
){
double
shebaoBase
=
getShebaoBase
(
preTaxSalary
);
double
gongjijinBase
=
getGongjijinBase
(
preTaxSalary
);
return
shebaoBase
*
getShebaoPercentage
()+
gongjijinBase
*
getGongjijinPercentage
();
}
private
static
double
getGongjijinPercentage
()
{
return
gongjijin
;
}
private
static
double
getShebaoPercentage
()
{
return
yanglao
+
yiliao
+
shiye
+
gongshang
+
shengyu
;
}
private
static
double
getGongjijinBase
(
double
preTaxSalary
)
{
return
(
preTaxSalary
>
25401
)?
25401
:((
preTaxSalary
<
2273
)?
2273
:
preTaxSalary
);
}
private
static
double
getShebaoBase
(
double
preTaxSalary
)
{
return
(
preTaxSalary
>
25401
)?
25401
:((
preTaxSalary
<
5080
)?
5080
:
preTaxSalary
);
}
private
static
double
getAllPercentage
()
{
return
yanglao
+
yiliao
+
shiye
+
gongjijin
+
gongshang
+
shengyu
;
}
public
static
double
getYanglao
()
{
return
yanglao
;
}
public
static
void
setYanglao
(
double
yanglao
)
{
SalaryCalculator
.
yanglao
=
yanglao
;
}
public
static
double
getYiliao
()
{
return
yiliao
;
}
public
static
void
setYiliao
(
double
yiliao
)
{
SalaryCalculator
.
yiliao
=
yiliao
;
}
public
static
double
getShiye
()
{
return
shiye
;
}
public
static
void
setShiye
(
double
shiye
)
{
SalaryCalculator
.
shiye
=
shiye
;
}
public
static
double
getGongjijin
()
{
return
gongjijin
;
}
public
static
void
setGongjijin
(
double
gongjijin
)
{
SalaryCalculator
.
gongjijin
=
gongjijin
;
}
public
static
double
getGongshang
()
{
return
gongshang
;
}
public
static
void
setGongshang
(
double
gongshang
)
{
SalaryCalculator
.
gongshang
=
gongshang
;
}
public
static
double
getShengyu
()
{
return
shengyu
;
}
public
static
void
setShengyu
(
double
shengyu
)
{
SalaryCalculator
.
shengyu
=
shengyu
;
}
}
src/main/webapp/budgetDetail.jsp
View file @
56ecbbe6
...
...
@@ -83,7 +83,7 @@
<li><a
href=
"#conference"
data-toggle=
"tab"
onclick=
"conferenceVue.showlist()"
>
会议费(包含咨询费)
</a></li>
<li><a
href=
"#international"
data-toggle=
"tab"
>
国际交流合作费
</a></li>
<li><a
href=
"#property"
data-toggle=
"tab"
onclick=
"propertyVue.showlist()"
>
出版/文献/信息传播/知识产权事务费
</a></li>
<li><a
href=
"#labour"
data-toggle=
"tab"
>
劳务费
</a></li>
<li><a
href=
"#labour"
data-toggle=
"tab"
onclick=
"labourVue.showlist()"
>
劳务费
</a></li>
<li><a
href=
"#consultation"
data-toggle=
"tab"
>
咨询费
</a></li>
<li><a
href=
"#others"
data-toggle=
"tab"
>
其他费用
</a></li>
<li><a
href=
"#indirect"
data-toggle=
"tab"
onclick=
"indirectVue.showlist()"
>
间接费用
</a></li>
...
...
@@ -252,10 +252,11 @@
<tr>
<th
hidden
>
编号
</th>
<th>
名称
</th>
<th>
专家类型
</th>
<th>
需要专家人数
</th>
<th
hidden
>
专家类型
</th>
<th
hidden
>
需要专家人数
</th>
<th>
单价
</th>
<th>
参会人数
</th>
<th>
天数
</th>
<th>
会议次数
</th>
<th>
操作
</th>
</tr>
...
...
@@ -264,7 +265,7 @@
<tbody>
<tr
v-for=
"item in items"
v-bind:title=
"item.name"
>
<td><input
type=
"text"
readonly
v-model=
"item.name"
></td>
<td>
<
%
--
<
td
>
<select
class=
"form-control"
v-model=
"item.expertType"
>
<option
disabled
value=
""
>
请选择其中一项
</option>
<option>
专家
</option>
...
...
@@ -272,10 +273,11 @@
<option>
C
</option>
</select>
</td>
<td><input
type=
"number"
v-model=
"item.experts"
></td>
<td><input
type=
"number"
v-model=
"item.experts"
></td>
--%>
<td><input
type=
"number"
v-model=
"item.price"
></td>
<td><input
type=
"number"
v-model=
"item.people"
></td>
<td><input
type=
"number"
v-model=
"item.days"
></td>
<td><input
type=
"number"
v-model=
"item.nums"
></td>
<td>
<button
class=
"btn btn-success"
@
click=
"update(item)"
>
确认
</button>
<button
class=
"btn btn-danger"
@
click=
"del(item)"
>
删除
</button>
...
...
@@ -343,15 +345,25 @@
<table
class=
"table table-hover"
>
<thead>
<tr>
<th>
编号
</th>
<th>
名称
</th>
<th>
单价
</th>
<th>
数量
</th>
<th
hidden
>
编号
</th>
<th>
类型
</th>
<th>
劳务费(每人每月)
</th>
<th>
人
</th>
<th>
月
</th>
</tr>
</thead>
<tbody>
<tr
v-for=
"item in items"
v-bind:title=
"item.name"
>
<td><input
type=
"text"
readonly
v-model=
"item.name"
></td>
<td><input
type=
"number"
v-model=
"item.price"
>
五险一金:{{item.tax}}
</td>
<td><input
type=
"number"
v-model=
"item.people"
></td>
<td><input
type=
"number"
v-model=
"item.months"
></td>
<td>
<button
class=
"btn btn-success"
@
click=
"update(item)"
>
确认
</button>
<button
class=
"btn btn-danger"
@
click=
"del(item)"
>
删除
</button>
</td>
</tr>
</tbody>
</table>
...
...
@@ -644,6 +656,53 @@
});
var
labourVue
=
new
Vue
({
el
:
"#labour"
,
data
:
{
items
:
[],
sample
:
{
name
:
"sample"
,
price
:
0
,
nums
:
0
}
},
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/Labour"
).
then
(
function
(
data
)
{
this
.
items
=
data
.
body
.
data
;
console
.
log
(
"showlist"
);
updateBudgetPage
(
"labour"
)
},
function
(
error
)
{
console
.
log
(
error
)
}
)
},
doUpdate
:
function
(
item
,
curd
)
{
this
.
$http
.
post
(
"${pageContext.request.contextPath}/Budget/Modify/Labour"
,
{
name
:
item
.
name
,
price
:
item
.
price
,
people
:
item
.
people
,
months
:
item
.
months
,
nums
:
item
.
nums
,
curd
:
curd
},
{
emulateJSON
:
true
}
).
then
(
function
(
value
)
{
this
.
showlist
();
});
}
},
created
:
function
()
{
}
});
/**
* 更新差值
...
...
src/test/java/GongjijinTest.java
0 → 100644
View file @
56ecbbe6
import
org.junit.Test
;
import
util.SalaryCalculator
;
import
java.util.ArrayList
;
public
class
GongjijinTest
{
@Test
public
void
gongjijinTest
(){
ArrayList
<
Double
>
list
=
new
ArrayList
<
Double
>();
for
(
int
i
=
1
;
i
<
10
;
i
++)
list
.
add
((
double
)(
i
*
1000
));
for
(
Double
salary
:
list
)
{
System
.
out
.
println
(
SalaryCalculator
.
getOrgCost
(
salary
));
}
System
.
out
.
println
(
SalaryCalculator
.
getOrgCost
(
100000
));
}
}
src/test/java/JsonTest.java
View file @
56ecbbe6
...
...
@@ -4,6 +4,14 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONObject
;
import
org.junit.Test
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.nio.charset.StandardCharsets
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -25,4 +33,36 @@ public class JsonTest {
}
System
.
out
.
println
(
JSON
.
toJSONString
(
map
.
entrySet
()));
}
@Test
public
void
urlTest
(){
URLConnection
urlConnection
=
null
;
BufferedReader
bufferedReader
=
null
;
try
{
URL
url
=
new
URL
(
"http://salarycalculator.sinaapp.com/calculate?city=beijing&origin_salary=8000&base_3j=8000&base_gjj=8000&is_gjj=true&is_exgjj=false&factor_exgjj=0.08"
);
urlConnection
=
url
.
openConnection
();
urlConnection
.
connect
();
bufferedReader
=
new
BufferedReader
(
new
InputStreamReader
(
urlConnection
.
getInputStream
(),
StandardCharsets
.
UTF_8
));
StringBuilder
builder
=
new
StringBuilder
();
String
line
=
null
;
while
((
line
=
bufferedReader
.
readLine
())!=
null
)
{
builder
.
append
(
line
);
}
System
.
out
.
println
(
builder
.
toString
());
JSONObject
object
=
JSON
.
parseObject
(
builder
.
toString
());
System
.
out
.
println
(
object
.
getDouble
(
"org_allpay"
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
bufferedReader
!=
null
)
{
try
{
bufferedReader
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
}
}
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