Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
Z
zentao
Project
Project
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
zentao
zentao
Commits
14aa8584
Commit
14aa8584
authored
Mar 12, 2021
by
liming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 项目成本表
parent
9acf3fa5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
92 additions
and
27 deletions
+92
-27
UserInfoVO.java
.../anplus/admincontrol/controller/report/vo/UserInfoVO.java
+20
-0
ReportMapper.java
...a/com/anplus/admincontrol/mapper/report/ReportMapper.java
+11
-1
ReportService.java
...com/anplus/admincontrol/service/report/ReportService.java
+43
-18
ReportyMapper.xml
...ontrol/src/main/resources/mapper/report/ReportyMapper.xml
+18
-8
No files found.
admin-control/src/main/java/com/anplus/admincontrol/controller/report/vo/UserInfoVO.java
0 → 100644
View file @
14aa8584
package
com
.
anplus
.
admincontrol
.
controller
.
report
.
vo
;
import
lombok.*
;
import
java.math.BigDecimal
;
import
java.util.Date
;
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Builder
public
class
UserInfoVO
{
private
Long
id
;
private
BigDecimal
wages
;
private
Date
joinDate
;
private
BigDecimal
baseHoursCost
;
private
BigDecimal
floatHoursCost
;
}
\ No newline at end of file
admin-control/src/main/java/com/anplus/admincontrol/mapper/report/ReportMapper.java
View file @
14aa8584
package
com
.
anplus
.
admincontrol
.
mapper
.
report
;
import
com.anplus.admincontrol.controller.report.dto.ProjectCostReportDTO
;
import
com.anplus.admincontrol.controller.report.dto.StaffDailyReportDTO
;
import
com.anplus.admincontrol.controller.report.vo.ProjectCostReportVO
;
import
com.anplus.admincontrol.controller.report.vo.StaffDailyReportVO
;
import
com.anplus.admincontrol.controller.report.vo.UserInfoVO
;
import
org.apache.ibatis.annotations.Param
;
import
java.math.BigDecimal
;
import
java.util.List
;
public
interface
ReportMapper
{
List
<
StaffDailyReportVO
>
getStaffDailyReport
(
@Param
(
"params"
)
StaffDailyReportDTO
params
,
@Param
(
"separator"
)
String
separator
);
List
<
StaffDailyReportVO
>
getStaffDailyReport
(
@Param
(
"params"
)
StaffDailyReportDTO
params
,
@Param
(
"separator"
)
String
separator
);
List
<
ProjectCostReportVO
>
getProjectCostReport
(
@Param
(
"params"
)
ProjectCostReportDTO
params
);
BigDecimal
getYearWorkHours
();
List
<
UserInfoVO
>
getUserInfo
();
}
admin-control/src/main/java/com/anplus/admincontrol/service/report/ReportService.java
View file @
14aa8584
...
...
@@ -4,13 +4,19 @@ import com.anplus.admincontrol.controller.report.dto.ProjectCostReportDTO;
import
com.anplus.admincontrol.controller.report.dto.StaffDailyReportDTO
;
import
com.anplus.admincontrol.controller.report.vo.ProjectCostReportVO
;
import
com.anplus.admincontrol.controller.report.vo.StaffDailyReportVO
;
import
com.anplus.admincontrol.controller.report.vo.UserInfoVO
;
import
com.anplus.admincontrol.mapper.report.ReportMapper
;
import
com.dao.mapper.zt.ZtUserWagesMapper
;
import
com.dao.model.zt.ZtUserWages
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Service
public
class
ReportService
{
...
...
@@ -22,25 +28,44 @@ public class ReportService {
}
public
List
<
ProjectCostReportVO
>
getProjectCostReport
(
ProjectCostReportDTO
params
)
{
List
<
ProjectCostReportVO
>
list
=
new
ArrayList
<>();
ProjectCostReportVO
project1
=
ProjectCostReportVO
.
builder
().
key
(
"1"
).
name
(
"项目1"
).
hours
(
BigDecimal
.
valueOf
(
100
))
.
baseHoursCost
(
BigDecimal
.
valueOf
(
150000
)).
floatHoursCost
(
BigDecimal
.
valueOf
(
140000
)).
build
();
List
<
ProjectCostReportVO
>
result
=
new
ArrayList
<>();
List
<
ProjectCostReportVO
>
baseList
=
reportMapper
.
getProjectCostReport
(
params
);
//获取最新年假期数量
BigDecimal
yearWorkHours
=
reportMapper
.
getYearWorkHours
();
//获取人员薪水
List
<
UserInfoVO
>
userInfoList
=
reportMapper
.
getUserInfo
();
Map
<
Long
,
UserInfoVO
>
userInfoMap
=
new
HashMap
<>(
userInfoList
.
size
());
for
(
UserInfoVO
item
:
userInfoList
)
{
userInfoMap
.
put
(
item
.
getId
(),
item
);
if
(
item
.
getWages
()
!=
null
&&
item
.
getWages
().
compareTo
(
BigDecimal
.
ZERO
)
!=
0
){
item
.
setBaseHoursCost
(
item
.
getWages
().
divide
(
yearWorkHours
,
1
,
RoundingMode
.
HALF_UP
));
}
else
{
item
.
setBaseHoursCost
(
BigDecimal
.
ZERO
);
}
}
project1
.
setChildren
(
new
ArrayList
<>());
project1
.
getChildren
().
add
(
ProjectCostReportVO
.
builder
().
key
(
"1-1"
).
name
(
"乔彬"
).
hours
(
BigDecimal
.
valueOf
(
60
))
.
baseHoursCost
(
BigDecimal
.
valueOf
(
80000
)).
floatHoursCost
(
BigDecimal
.
valueOf
(
70000
)).
build
());
project1
.
getChildren
().
add
(
ProjectCostReportVO
.
builder
().
key
(
"1-2"
).
name
(
"李栋"
).
hours
(
BigDecimal
.
valueOf
(
40
))
.
baseHoursCost
(
BigDecimal
.
valueOf
(
70000
)).
floatHoursCost
(
BigDecimal
.
valueOf
(
70000
)).
build
());
for
(
ProjectCostReportVO
item
:
baseList
)
{
if
(
result
.
size
()==
0
||
result
.
get
(
result
.
size
()-
1
).
getProjectId
()
!=
item
.
getProjectId
()
){
result
.
add
(
ProjectCostReportVO
.
builder
().
key
(
item
.
getProjectId
().
toString
()).
projectId
(
item
.
getProjectId
()).
name
(
item
.
getProjectName
())
.
hours
(
BigDecimal
.
ZERO
).
baseHoursCost
(
BigDecimal
.
ZERO
).
floatHoursCost
(
BigDecimal
.
ZERO
)
.
children
(
new
ArrayList
<>()).
build
());
}
ProjectCostReportVO
project
=
result
.
get
(
result
.
size
()-
1
);
item
.
setKey
(
item
.
getProjectId
()
+
"-"
+
item
.
getUserId
());
item
.
setName
(
item
.
getUserName
());
if
(
userInfoMap
.
containsKey
(
item
.
getUserId
())){
item
.
setBaseHoursCost
(
userInfoMap
.
get
(
item
.
getUserId
()).
getBaseHoursCost
().
multiply
(
item
.
getHours
()).
setScale
(
0
,
RoundingMode
.
HALF_UP
));
}
else
{
item
.
setBaseHoursCost
(
BigDecimal
.
ZERO
);
}
project
.
setBaseHoursCost
(
project
.
getBaseHoursCost
().
add
(
item
.
getBaseHoursCost
()));
project
.
getChildren
().
add
(
item
);
if
(
item
.
getHours
()!=
null
){
project
.
setHours
(
project
.
getHours
().
add
(
item
.
getHours
()));
}
ProjectCostReportVO
project2
=
ProjectCostReportVO
.
builder
().
key
(
"2"
).
name
(
"项目2"
).
hours
(
BigDecimal
.
valueOf
(
90
))
.
baseHoursCost
(
BigDecimal
.
valueOf
(
100000
)).
floatHoursCost
(
BigDecimal
.
valueOf
(
120000
)).
build
();
project2
.
setChildren
(
new
ArrayList
<>());
project2
.
getChildren
().
add
(
ProjectCostReportVO
.
builder
().
key
(
"2-1"
).
name
(
"张凯"
).
hours
(
BigDecimal
.
valueOf
(
90
))
.
baseHoursCost
(
BigDecimal
.
valueOf
(
100000
)).
floatHoursCost
(
BigDecimal
.
valueOf
(
120000
)).
build
());
list
.
add
(
project1
);
list
.
add
(
project2
);
return
list
;
}
return
result
;
}
}
admin-control/src/main/resources/mapper/report/ReportyMapper.xml
View file @
14aa8584
...
...
@@ -40,15 +40,25 @@
</select>
<select
id=
"getProjectCostReport"
resultType=
"com.anplus.admincontrol.controller.report.vo.ProjectCostReportVO"
>
select t3.id as project_id,t3.name as project_name,t4.id as user_id,t4.realname as user_name,sum(round(ifnull(t1.consumed,0),1)) as hours
from zt_taskestimate t1
left join zt_task t2 on t1.task = t2.id
left join zt_project t3 on t2.project = t3.id
left join zt_user t4 on t1.account = t4.account
where t2.deleted = '0' and t3.deleted = '0'
and t3.id not in (select project_id from project_charge where statistics_status = 0)
group by t3.id,t3.name,t4.id,t4.realname
select * from (
select t3.id as project_id,t3.name as project_name,t4.id as user_id,t4.realname as user_name,sum(round(ifnull(t1.consumed,0),1)) as hours
from zt_taskestimate t1
left join zt_task t2 on t1.task = t2.id
left join zt_project t3 on t2.project = t3.id
left join zt_user t4 on t1.account = t4.account
where t2.deleted = '0' and t3.deleted = '0'
and t3.id not in (select project_id from project_charge where statistics_status = 0)
group by t3.id,t3.name,t4.id,t4.realname
) r1 order by project_id,hours desc
</select>
<select
id=
"getYearWorkHours"
resultType=
"java.math.BigDecimal"
>
select (365-sum(duration)) * (select value_str from sys_param where code = 'STANDARD_DAILY_CONSUME')as work_hours from holidays where year = YEAR(NOW())
</select>
<select
id=
"getUserInfo"
resultType=
"com.anplus.admincontrol.controller.report.vo.UserInfoVO"
>
select t1.id,t1.join,t2.wages
from zt_user t1
left join zt_user_wages t2 on t1.id = t2.user_id
</select>
</mapper>
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