Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
isoft_psa
Project
Project
Details
Activity
Releases
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
王飞
isoft_psa
Commits
394170c5
Commit
394170c5
authored
Apr 08, 2025
by
lwy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
工时管理
parent
64b120e5
Changes
18
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
580 additions
and
114 deletions
+580
-114
TimesheetController.java
...c/main/java/com/ruoyi/controller/TimesheetController.java
+53
-6
Timesheet.java
ruoyi-psa/src/main/java/com/ruoyi/domain/Timesheet.java
+7
-2
AddTimesheetDTO.java
...a/src/main/java/com/ruoyi/domain/dto/AddTimesheetDTO.java
+8
-0
AddWorkDTO.java
ruoyi-psa/src/main/java/com/ruoyi/domain/dto/AddWorkDTO.java
+1
-1
CheckTimesheetDTO.java
...src/main/java/com/ruoyi/domain/dto/CheckTimesheetDTO.java
+24
-0
EmployeeTimesheetDTO.java
.../main/java/com/ruoyi/domain/dto/EmployeeTimesheetDTO.java
+30
-0
WorkDetailDTO.java
...psa/src/main/java/com/ruoyi/domain/dto/WorkDetailDTO.java
+7
-1
TimesheetMapper.java
...i-psa/src/main/java/com/ruoyi/mapper/TimesheetMapper.java
+7
-0
ITimesheetService.java
...sa/src/main/java/com/ruoyi/service/ITimesheetService.java
+14
-0
TimesheetServiceImpl.java
...ain/java/com/ruoyi/service/impl/TimesheetServiceImpl.java
+313
-76
TimesheetMapper.xml
...a/src/main/resources/mapper/timesheet/TimesheetMapper.xml
+50
-28
ProjectMember.java
.../src/main/java/com/ruoyi/system/domain/ProjectMember.java
+10
-0
ProjectMemberMapper.java
...ain/java/com/ruoyi/system/mapper/ProjectMemberMapper.java
+10
-0
SysUserRoleMapper.java
.../main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java
+9
-0
IProjectMemberService.java
.../java/com/ruoyi/system/service/IProjectMemberService.java
+9
-0
ProjectMemberServiceImpl.java
...m/ruoyi/system/service/impl/ProjectMemberServiceImpl.java
+5
-0
ProjectMemberMapper.xml
...src/main/resources/mapper/project/ProjectMemberMapper.xml
+17
-0
SysUserRoleMapper.xml
...em/src/main/resources/mapper/system/SysUserRoleMapper.xml
+6
-0
No files found.
ruoyi-psa/src/main/java/com/ruoyi/controller/TimesheetController.java
View file @
394170c5
...
@@ -6,8 +6,11 @@ import javax.servlet.http.HttpServletResponse;
...
@@ -6,8 +6,11 @@ import javax.servlet.http.HttpServletResponse;
import
com.ruoyi.domain.Timesheet
;
import
com.ruoyi.domain.Timesheet
;
import
com.ruoyi.domain.dto.AddTimesheetDTO
;
import
com.ruoyi.domain.dto.AddTimesheetDTO
;
import
com.ruoyi.domain.dto.CheckTimesheetDTO
;
import
com.ruoyi.domain.dto.TimesheetDTO
;
import
com.ruoyi.domain.dto.TimesheetDTO
;
import
com.ruoyi.service.ITimesheetService
;
import
com.ruoyi.service.ITimesheetService
;
import
com.ruoyi.system.domain.ProjectMember
;
import
com.ruoyi.system.service.IProjectMemberService
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
...
@@ -27,6 +30,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
...
@@ -27,6 +30,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
* @author ruoyi
* @author ruoyi
* @date 2025-03-11
* @date 2025-03-11
*/
*/
@RestController
@RestController
@RequestMapping
(
"/timesheet/timesheet"
)
@RequestMapping
(
"/timesheet/timesheet"
)
public
class
TimesheetController
extends
BaseController
public
class
TimesheetController
extends
BaseController
...
@@ -34,8 +38,11 @@ public class TimesheetController extends BaseController
...
@@ -34,8 +38,11 @@ public class TimesheetController extends BaseController
@Autowired
@Autowired
private
ITimesheetService
timesheetService
;
private
ITimesheetService
timesheetService
;
/*查询个人工时*/
@Autowired
@PreAuthorize
(
"@ss.hasPermi('timesheet:timesheet:list')"
)
private
IProjectMemberService
projectMemberService
;
/*查询工时*/
//@PreAuthorize("@ss.hasPermi('timesheet:timesheet:list')")
@GetMapping
(
"/pTimesheetList"
)
@GetMapping
(
"/pTimesheetList"
)
public
ResponseEntity
<
List
<
TimesheetDTO
>>
getProjectTimesheetList
(
public
ResponseEntity
<
List
<
TimesheetDTO
>>
getProjectTimesheetList
(
@ModelAttribute
Timesheet
timesheet
,
@ModelAttribute
Timesheet
timesheet
,
...
@@ -47,7 +54,7 @@ public class TimesheetController extends BaseController
...
@@ -47,7 +54,7 @@ public class TimesheetController extends BaseController
timesheet
.
setStartTime
(
startTime
);
timesheet
.
setStartTime
(
startTime
);
timesheet
.
setEndTime
(
endTime
);
timesheet
.
setEndTime
(
endTime
);
timesheet
.
setManagerName
(
managerName
);
// 设置 managerName
timesheet
.
setManagerName
(
managerName
);
// 设置 managerName
System
.
out
.
println
(
"timesheet.getManagerName()---------------"
+
timesheet
.
getManagerName
());
List
<
TimesheetDTO
>
result
=
timesheetService
.
getProjectTimesheetList
(
timesheet
);
List
<
TimesheetDTO
>
result
=
timesheetService
.
getProjectTimesheetList
(
timesheet
);
return
ResponseEntity
.
ok
(
result
);
return
ResponseEntity
.
ok
(
result
);
}
}
...
@@ -55,7 +62,7 @@ public class TimesheetController extends BaseController
...
@@ -55,7 +62,7 @@ public class TimesheetController extends BaseController
/*
/*
* 填报工时--查询个人填报
* 填报工时--查询个人填报
*/
*/
@PreAuthorize
(
"@ss.hasPermi('timesheet:timesheet:lis
t')"
)
// @PreAuthorize("@ss.hasPermi('timesheet:timesheet:submi
t')")
@GetMapping
(
"/personalTimesheet/{employId}"
)
@GetMapping
(
"/personalTimesheet/{employId}"
)
public
ResponseEntity
<
List
<
AddTimesheetDTO
>>
getPersonalTimesheet
(
@PathVariable
(
"employId"
)
Long
employId
)
{
public
ResponseEntity
<
List
<
AddTimesheetDTO
>>
getPersonalTimesheet
(
@PathVariable
(
"employId"
)
Long
employId
)
{
List
<
AddTimesheetDTO
>
result
=
timesheetService
.
getPersonalTimesheet
(
employId
);
List
<
AddTimesheetDTO
>
result
=
timesheetService
.
getPersonalTimesheet
(
employId
);
...
@@ -66,15 +73,47 @@ public class TimesheetController extends BaseController
...
@@ -66,15 +73,47 @@ public class TimesheetController extends BaseController
* 批量插入工时记录
* 批量插入工时记录
*
*
*/
*/
@PreAuthorize
(
"@ss.hasPermi('timesheet:timesheet:add')"
)
//
@PreAuthorize("@ss.hasPermi('timesheet:timesheet:add')")
@Log
(
title
=
"插入工时记录"
,
businessType
=
BusinessType
.
INSERT
)
@Log
(
title
=
"插入工时记录"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
(
"/batchInsert"
)
@PostMapping
(
"/batchInsert"
)
public
AjaxResult
batchInsertTimesheet
(
@RequestBody
AddTimesheetDTO
addTimesheetDTO
)
{
public
AjaxResult
batchInsertTimesheet
(
@RequestBody
AddTimesheetDTO
addTimesheetDTO
)
{
logger
.
info
(
"Received batch insert request: {}"
,
addTimesheetDTO
);
System
.
out
.
println
(
"批量插入对象 = "
+
addTimesheetDTO
);
int
result
=
timesheetService
.
insertTimesheetList
(
addTimesheetDTO
);
int
result
=
timesheetService
.
insertTimesheetList
(
addTimesheetDTO
);
return
toAjax
(
result
);
return
toAjax
(
result
);
}
}
/**
* 工时审批--按周分组查询
*
* @return 按周分组的工时审批列表
*/
//@PreAuthorize("@ss.hasPermi('timesheet:timesheet:check')")
@GetMapping
(
"/checkTimesheetList"
)
public
ResponseEntity
<
List
<
CheckTimesheetDTO
>>
getTimesheetCheck
(
@ModelAttribute
Timesheet
query
)
{
// query.setManagerId(Long.valueOf(query.getManagerId()));
List
<
CheckTimesheetDTO
>
result
=
timesheetService
.
getTimesheetCheck
(
query
);
return
ResponseEntity
.
ok
(
result
);
}
/**
* 根据项目编号和经理ID查询项目成员的用户ID和昵称
*
* @param projectNumber 项目编号
* @param managerId 经理ID
* @return 项目成员列表
*/
@GetMapping
(
"/getEmployNameListByManagerId"
)
public
AjaxResult
selectEmployNameListByManagerId
(
@RequestParam
(
required
=
false
)
String
projectNumber
,
@RequestParam
Long
managerId
)
{
logger
.
info
(
"Received projectNumber: {}"
,
projectNumber
);
logger
.
info
(
"Received managerId: {}"
,
managerId
);
// 处理逻辑
List
<
ProjectMember
>
list
=
projectMemberService
.
selectEmployNameListByManagerId
(
projectNumber
,
managerId
);
return
success
(
list
);
}
/**
/**
* 查询工时记录列表
* 查询工时记录列表
*/
*/
...
@@ -132,6 +171,14 @@ public class TimesheetController extends BaseController
...
@@ -132,6 +171,14 @@ public class TimesheetController extends BaseController
return
toAjax
(
timesheetService
.
updateTimesheet
(
timesheet
));
return
toAjax
(
timesheetService
.
updateTimesheet
(
timesheet
));
}
}
// @PreAuthorize("@ss.hasPermi('timesheet:timesheet:edit')")
@Log
(
title
=
"更新审批状态和备注"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
(
"/updateApprovalStateAndNote"
)
public
AjaxResult
updateApprovalStateAndNote
(
@RequestBody
CheckTimesheetDTO
checkTimesheetDTO
)
{
int
result
=
timesheetService
.
updateWeekTimesheet
(
checkTimesheetDTO
);
return
toAjax
(
result
);
}
/**
/**
* 删除工时记录
* 删除工时记录
*/
*/
...
...
ruoyi-psa/src/main/java/com/ruoyi/domain/Timesheet.java
View file @
394170c5
...
@@ -39,14 +39,16 @@ public class Timesheet extends BaseEntity
...
@@ -39,14 +39,16 @@ public class Timesheet extends BaseEntity
/** 项目名称 */
/** 项目名称 */
@Excel
(
name
=
"项目名称"
)
@Excel
(
name
=
"项目名称"
)
@TableField
(
exist
=
false
)
private
String
projectName
;
private
String
projectName
;
/** 项目经理编号 */
/** 项目经理编号 */
@Excel
(
name
=
"项目经理编号"
)
/*
@Excel(name = "项目经理编号")
private
Long
managerId
;
private Long managerId;
*/
/** 事业部负责人编号 */
/** 事业部负责人编号 */
@Excel
(
name
=
"事业部负责人编号"
)
@Excel
(
name
=
"事业部负责人编号"
)
@TableField
(
exist
=
false
)
private
Long
departmentLeaderId
;
private
Long
departmentLeaderId
;
/** 工时 */
/** 工时 */
...
@@ -92,6 +94,9 @@ public class Timesheet extends BaseEntity
...
@@ -92,6 +94,9 @@ public class Timesheet extends BaseEntity
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
Date
endTime
;
private
Date
endTime
;
@TableField
(
exist
=
false
)
private
Long
projectManagerId
;
/* @TableField(exist = false)
/* @TableField(exist = false)
private Date startTime;
private Date startTime;
...
...
ruoyi-psa/src/main/java/com/ruoyi/domain/dto/AddTimesheetDTO.java
View file @
394170c5
package
com
.
ruoyi
.
domain
.
dto
;
package
com
.
ruoyi
.
domain
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
@Data
@Data
public
class
AddTimesheetDTO
{
public
class
AddTimesheetDTO
{
...
@@ -26,6 +28,12 @@ public class AddTimesheetDTO {
...
@@ -26,6 +28,12 @@ public class AddTimesheetDTO {
private
String
approvalNote
;
private
String
approvalNote
;
@JsonFormat
(
pattern
=
"yyyy/MM/dd"
)
private
Date
startTime
;
@JsonFormat
(
pattern
=
"yyyy/MM/dd"
)
private
Date
endTime
;
private
BigDecimal
totalHours
;
private
BigDecimal
totalHours
;
...
...
ruoyi-psa/src/main/java/com/ruoyi/domain/dto/AddWorkDTO.java
View file @
394170c5
...
@@ -8,7 +8,7 @@ import java.math.BigDecimal;
...
@@ -8,7 +8,7 @@ import java.math.BigDecimal;
import
java.util.Date
;
import
java.util.Date
;
@Data
@Data
public
class
AddWorkDTO
{
public
class
AddWorkDTO
{
@JsonFormat
(
pattern
=
"yyyy
-MM-
dd"
)
@JsonFormat
(
pattern
=
"yyyy
/MM/
dd"
)
@Excel
(
name
=
"工作日期"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"工作日期"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
workTime
;
private
Date
workTime
;
...
...
ruoyi-psa/src/main/java/com/ruoyi/domain/dto/CheckTimesheetDTO.java
0 → 100644
View file @
394170c5
package
com
.
ruoyi
.
domain
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
java.util.Date
;
import
java.util.List
;
@Data
public
class
CheckTimesheetDTO
{
private
String
projectNumber
;
private
String
projectName
;
@JsonFormat
(
pattern
=
"yyyy/MM/dd"
)
private
Date
startTime
;
@JsonFormat
(
pattern
=
"yyyy/MM/dd"
)
private
Date
endTime
;
private
List
<
EmployeeTimesheetDTO
>
employeeTimesheetList
;
}
ruoyi-psa/src/main/java/com/ruoyi/domain/dto/EmployeeTimesheetDTO.java
0 → 100644
View file @
394170c5
package
com
.
ruoyi
.
domain
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
@Data
public
class
EmployeeTimesheetDTO
{
private
Long
employId
;
private
String
employName
;
private
String
approvalState
;
private
String
approvalNote
;
private
BigDecimal
totalHours
;
@JsonFormat
(
pattern
=
"yyyy/MM/dd"
)
private
Date
startTime
;
@JsonFormat
(
pattern
=
"yyyy/MM/dd"
)
private
Date
endTime
;
private
List
<
WorkDetailDTO
>
workDetailList
;
}
ruoyi-psa/src/main/java/com/ruoyi/domain/dto/WorkDetailDTO.java
View file @
394170c5
...
@@ -9,7 +9,9 @@ import java.util.Date;
...
@@ -9,7 +9,9 @@ import java.util.Date;
@Data
@Data
public
class
WorkDetailDTO
{
public
class
WorkDetailDTO
{
@JsonFormat
(
pattern
=
"MM-dd"
)
private
Long
id
;
@JsonFormat
(
pattern
=
"MM/dd"
)
@Excel
(
name
=
"工作日期"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"工作日期"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
workTime
;
private
Date
workTime
;
...
@@ -19,4 +21,8 @@ public class WorkDetailDTO {
...
@@ -19,4 +21,8 @@ public class WorkDetailDTO {
this
.
workTime
=
workTime
;
this
.
workTime
=
workTime
;
this
.
hours
=
hours
;
this
.
hours
=
hours
;
}
}
public
WorkDetailDTO
()
{
// 默认构造函数
}
}
}
ruoyi-psa/src/main/java/com/ruoyi/mapper/TimesheetMapper.java
View file @
394170c5
...
@@ -29,6 +29,13 @@ public interface TimesheetMapper
...
@@ -29,6 +29,13 @@ public interface TimesheetMapper
List
<
Timesheet
>
selectPersonalTimesheet
(
@Param
(
"employId"
)
Long
employId
,
@Param
(
"workTime"
)
Date
workTime
,
@Param
(
"projectNumber"
)
String
projectNumber
);
List
<
Timesheet
>
selectPersonalTimesheet
(
@Param
(
"employId"
)
Long
employId
,
@Param
(
"workTime"
)
Date
workTime
,
@Param
(
"projectNumber"
)
String
projectNumber
);
/**
* 工时审批--获取审批
* @return
*/
List
<
Timesheet
>
selectTimesheetByManagerId
(
Timesheet
query
);
/**
/**
* 查询工时记录
* 查询工时记录
*
*
...
...
ruoyi-psa/src/main/java/com/ruoyi/service/ITimesheetService.java
View file @
394170c5
...
@@ -2,6 +2,7 @@ package com.ruoyi.service;
...
@@ -2,6 +2,7 @@ package com.ruoyi.service;
import
com.ruoyi.domain.Timesheet
;
import
com.ruoyi.domain.Timesheet
;
import
com.ruoyi.domain.dto.AddTimesheetDTO
;
import
com.ruoyi.domain.dto.AddTimesheetDTO
;
import
com.ruoyi.domain.dto.CheckTimesheetDTO
;
import
com.ruoyi.domain.dto.TimesheetDTO
;
import
com.ruoyi.domain.dto.TimesheetDTO
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -37,6 +38,10 @@ public interface ITimesheetService
...
@@ -37,6 +38,10 @@ public interface ITimesheetService
public
List
<
Date
>
getWorkingDaysFromAPI
();
public
List
<
Date
>
getWorkingDaysFromAPI
();
/*
* 工时审批--获取审批
* */
public
List
<
CheckTimesheetDTO
>
getTimesheetCheck
(
Timesheet
query
);
/**
/**
* 查询工时记录
* 查询工时记录
*
*
...
@@ -77,6 +82,13 @@ public interface ITimesheetService
...
@@ -77,6 +82,13 @@ public interface ITimesheetService
*/
*/
public
int
updateTimesheet
(
Timesheet
timesheet
);
public
int
updateTimesheet
(
Timesheet
timesheet
);
/**
* 按周修改工时记录
*
* @return 结果
*/
public
int
updateWeekTimesheet
(
CheckTimesheetDTO
checkTimesheetDTO
);
/**
/**
* 批量删除工时记录
* 批量删除工时记录
*
*
...
@@ -97,4 +109,6 @@ public interface ITimesheetService
...
@@ -97,4 +109,6 @@ public interface ITimesheetService
// 自定义方法获取星期几
// 自定义方法获取星期几
public
String
getDayOfWeek
(
Date
date
);
public
String
getDayOfWeek
(
Date
date
);
}
}
ruoyi-psa/src/main/java/com/ruoyi/service/impl/TimesheetServiceImpl.java
View file @
394170c5
This diff is collapsed.
Click to expand it.
ruoyi-psa/src/main/resources/mapper/timesheet/TimesheetMapper.xml
View file @
394170c5
...
@@ -9,9 +9,6 @@
...
@@ -9,9 +9,6 @@
<result
property=
"employId"
column=
"employ_id"
/>
<result
property=
"employId"
column=
"employ_id"
/>
<result
property=
"employName"
column=
"employ_name"
/>
<result
property=
"employName"
column=
"employ_name"
/>
<result
property=
"projectNumber"
column=
"project_number"
/>
<result
property=
"projectNumber"
column=
"project_number"
/>
<result
property=
"projectName"
column=
"project_name"
/>
<result
property=
"managerId"
column=
"manager_id"
/>
<result
property=
"departmentLeaderId"
column=
"department_leader_id"
/>
<result
property=
"hours"
column=
"hours"
/>
<result
property=
"hours"
column=
"hours"
/>
<result
property=
"workTime"
column=
"work_time"
/>
<result
property=
"workTime"
column=
"work_time"
/>
<result
property=
"workWeek"
column=
"work_week"
/>
<result
property=
"workWeek"
column=
"work_week"
/>
...
@@ -28,16 +25,18 @@
...
@@ -28,16 +25,18 @@
<!--查询工时-->
<!--查询工时-->
<select
id=
"selectTimesheetGroupByProject"
parameterType=
"Timesheet"
resultMap=
"TimesheetResult"
>
<select
id=
"selectTimesheetGroupByProject"
parameterType=
"Timesheet"
resultMap=
"TimesheetResult"
>
select tm.id, tm.employ_id, tm.employ_name, tm.project_number, tm.project_name, tm.manager_id, tm.department_leader_id, tm.hours, tm.work_time,
select tm.id, tm.employ_id, tm.employ_name, tm.project_number, pm.project_name as projectName,
tm.work_week, tm.create_time, tm.update_time, tm.approval_note, tm.approval_state, su1.nick_name as managerName, su2.nick_name as departmentLeaderName
pm.project_manager_id as projectManagerId, tm.hours, tm.work_time, pm.department_leader_id as departmentLeaderId,
tm.work_week, tm.create_time, tm.update_time, tm.approval_note, tm.approval_state, su1.nick_name as managerName,
su2.nick_name as departmentLeaderName
from timesheet tm
from timesheet tm
left join sys_user su1 on su1.user_id = tm.manager_id
join project_manage pm on pm.project_number = tm.project_number
left join sys_user su2 on su2.user_id = tm.department_leader
_id
join project_member pmem on pmem.user_id = tm.employ
_id
left join
project_manage pm on pm.project_number = tm.project_number
left join
sys_user su1 on su1.user_id = pm.project_manager_id
left join
project_member pmem on pmem.user_id = tm.employ
_id
left join
sys_user su2 on su2.user_id = pm.department_leader
_id
where tm.deleted = 0 and tm.approval_state = '1'
where tm.deleted = 0 and tm.approval_state = '1'
<if
test=
"projectName != null and projectName != ''"
>
<if
test=
"projectName != null and projectName != ''"
>
and
t
m.project_name like concat('%', #{projectName}, '%')
and
p
m.project_name like concat('%', #{projectName}, '%')
</if>
</if>
<if
test=
"managerName != null and managerName != ''"
>
<if
test=
"managerName != null and managerName != ''"
>
and su1.nick_name like concat('%', #{managerName}, '%')
and su1.nick_name like concat('%', #{managerName}, '%')
...
@@ -51,25 +50,26 @@
...
@@ -51,25 +50,26 @@
<if
test=
"endTime != null"
>
<if
test=
"endTime != null"
>
and tm.work_time
<
= #{endTime}
and tm.work_time
<
= #{endTime}
</if>
</if>
<!-- <if test="startTime != null and startTime.id != ''">
<if
test=
"endTime != null"
>
and tm.work_time >= #{startTime}
</if>
<if test="endTime != null and endTime.id != ''">
and tm.work_time
<
= #{endTime}
and tm.work_time
<
= #{endTime}
</if>-->
</if>
<if
test=
"departmentLeaderId != null"
>
and pm.department_leader_id = #{departmentLeaderId}
</if>
order by tm.work_time asc
order by tm.work_time asc
</select>
</select>
<!--获取工时填报基本信息-->
<!--获取工时填报基本信息-->
<select
id=
"selectPersonalTimesheet"
resultMap=
"TimesheetResult"
>
<select
id=
"selectPersonalTimesheet"
resultMap=
"TimesheetResult"
>
SELECT tm.id, tm.employ_id, tm.employ_name
, tm.project_number, tm.project_name, tm.manager_i
d,
SELECT tm.id, tm.employ_id, tm.employ_name
as employName, tm.project_number, pm.project_name as projectName, pm.project_manager_id as projectManagerI
d,
tm.department_leader_i
d, tm.hours, tm.work_time, tm.work_week, tm.create_time,
pm.department_leader_id as departmentLeaderI
d, tm.hours, tm.work_time, tm.work_week, tm.create_time,
tm.update_time, tm.approval_note, tm.approval_state, su1.nick_name as managerName, su2.nick_name as departmentLeaderName
tm.update_time, tm.approval_note, tm.approval_state, su1.nick_name as managerName, su2.nick_name as departmentLeaderName
FROM timesheet tm
FROM timesheet tm
JOIN project_member pmem ON pmem.user_id = tm.employ_id
JOIN project_member pmem ON pmem.user_id = tm.employ_id
JOIN project_manage pm ON pm.project_number = tm.project_number
JOIN project_manage pm ON pm.project_number = tm.project_number
LEFT JOIN sys_user su1 ON su1.user_id =
tm.
manager_id
LEFT JOIN sys_user su1 ON su1.user_id =
pm.project_
manager_id
LEFT JOIN sys_user su2 ON su2.user_id =
t
m.department_leader_id
LEFT JOIN sys_user su2 ON su2.user_id =
p
m.department_leader_id
WHERE tm.deleted = 0
WHERE tm.deleted = 0
<if
test=
"employId != null and employId != ''"
>
<if
test=
"employId != null and employId != ''"
>
and pmem.user_id = #{employId}
and pmem.user_id = #{employId}
...
@@ -83,6 +83,34 @@
...
@@ -83,6 +83,34 @@
ORDER BY tm.work_time ASC
ORDER BY tm.work_time ASC
</select>
</select>
<!-- 根据 manager 查询工时记录 -->
<select
id=
"selectTimesheetByManagerId"
parameterType=
"Timesheet"
resultMap=
"TimesheetResult"
>
SELECT tm.id, tm.employ_id, tm.employ_name, tm.project_number, pm.project_name as projectName, pm.project_manager_id as projectManagerId,
tm.hours, tm.work_time, tm.work_week, tm.create_time,
tm.update_time, tm.approval_note, tm.approval_state, su1.nick_name as managerName, su2.nick_name as departmentLeaderName
FROM timesheet tm
JOIN project_manage pm ON pm.project_number = tm.project_number
LEFT JOIN sys_user su1 ON su1.user_id = pm.project_manager_id
LEFT JOIN sys_user su2 ON su2.user_id = tm.department_leader_id
WHERE tm.deleted = 0
<if
test=
"employId != null and employId != ''"
>
and tm.employ_id = #{employId}
</if>
<if
test=
"startTime != null"
>
and tm.work_time
>
= #{startTime}
</if>
<if
test=
"endTime != null"
>
and tm.work_time
<
= #{endTime}
</if>
<if
test=
"projectManagerId != null and projectManagerId != ''"
>
and pm.project_manager_id = #{projectManagerId}
</if>
<if
test=
"employName != null and employName != ''"
>
and tm.employ_name like concat('%', #{employName}, '%')
</if>
ORDER BY tm.work_time ASC
</select>
<select
id=
"selectTimesheetById"
parameterType=
"Long"
resultMap=
"TimesheetResult"
>
<select
id=
"selectTimesheetById"
parameterType=
"Long"
resultMap=
"TimesheetResult"
>
<include
refid=
"selectTimesheetVo"
/>
<include
refid=
"selectTimesheetVo"
/>
where id = #{id}
where id = #{id}
...
@@ -94,9 +122,6 @@
...
@@ -94,9 +122,6 @@
<if
test=
"employId != null"
>
employ_id,
</if>
<if
test=
"employId != null"
>
employ_id,
</if>
<if
test=
"employName != null and employName != ''"
>
employ_name,
</if>
<if
test=
"employName != null and employName != ''"
>
employ_name,
</if>
<if
test=
"projectNumber != null and projectNumber != ''"
>
project_number,
</if>
<if
test=
"projectNumber != null and projectNumber != ''"
>
project_number,
</if>
<if
test=
"projectName != null and projectName != ''"
>
project_name,
</if>
<if
test=
"managerId != null"
>
manager_id,
</if>
<if
test=
"departmentLeaderId != null"
>
department_leader_id,
</if>
<if
test=
"hours != null"
>
hours,
</if>
<if
test=
"hours != null"
>
hours,
</if>
<if
test=
"workTime != null"
>
work_time,
</if>
<if
test=
"workTime != null"
>
work_time,
</if>
<if
test=
"workWeek != null and workWeek != ''"
>
work_week,
</if>
<if
test=
"workWeek != null and workWeek != ''"
>
work_week,
</if>
...
@@ -110,9 +135,6 @@
...
@@ -110,9 +135,6 @@
<if
test=
"employId != null"
>
#{employId},
</if>
<if
test=
"employId != null"
>
#{employId},
</if>
<if
test=
"employName != null and employName != ''"
>
#{employName},
</if>
<if
test=
"employName != null and employName != ''"
>
#{employName},
</if>
<if
test=
"projectNumber != null and projectNumber != ''"
>
#{projectNumber},
</if>
<if
test=
"projectNumber != null and projectNumber != ''"
>
#{projectNumber},
</if>
<if
test=
"projectName != null and projectName != ''"
>
#{projectName},
</if>
<if
test=
"managerId != null"
>
#{managerId},
</if>
<if
test=
"departmentLeaderId != null"
>
#{departmentLeaderId},
</if>
<if
test=
"hours != null"
>
#{hours},
</if>
<if
test=
"hours != null"
>
#{hours},
</if>
<if
test=
"workTime != null"
>
#{workTime},
</if>
<if
test=
"workTime != null"
>
#{workTime},
</if>
<if
test=
"workWeek != null and workWeek != ''"
>
#{workWeek},
</if>
<if
test=
"workWeek != null and workWeek != ''"
>
#{workWeek},
</if>
...
@@ -130,9 +152,6 @@
...
@@ -130,9 +152,6 @@
<if
test=
"employId != null"
>
employ_id = #{employId},
</if>
<if
test=
"employId != null"
>
employ_id = #{employId},
</if>
<if
test=
"employName != null and employName != ''"
>
employ_name = #{employName},
</if>
<if
test=
"employName != null and employName != ''"
>
employ_name = #{employName},
</if>
<if
test=
"projectNumber != null and projectNumber != ''"
>
project_number = #{projectNumber},
</if>
<if
test=
"projectNumber != null and projectNumber != ''"
>
project_number = #{projectNumber},
</if>
<if
test=
"projectName != null and projectName != ''"
>
project_name = #{projectName},
</if>
<if
test=
"managerId != null"
>
manager_id = #{managerId},
</if>
<if
test=
"departmentLeaderId != null"
>
department_leader_id = #{departmentLeaderId},
</if>
<if
test=
"hours != null"
>
hours = #{hours},
</if>
<if
test=
"hours != null"
>
hours = #{hours},
</if>
<if
test=
"workTime != null"
>
work_time = #{workTime},
</if>
<if
test=
"workTime != null"
>
work_time = #{workTime},
</if>
<if
test=
"workWeek != null and workWeek != ''"
>
work_week = #{workWeek},
</if>
<if
test=
"workWeek != null and workWeek != ''"
>
work_week = #{workWeek},
</if>
...
@@ -143,6 +162,9 @@
...
@@ -143,6 +162,9 @@
<if
test=
"deleted != null"
>
deleted = #{deleted},
</if>
<if
test=
"deleted != null"
>
deleted = #{deleted},
</if>
</trim>
</trim>
where id = #{id}
where id = #{id}
<if
test=
"approvalState != null"
>
and approval_state = 3
</if>
</update>
</update>
<delete
id=
"deleteTimesheetById"
parameterType=
"Long"
>
<delete
id=
"deleteTimesheetById"
parameterType=
"Long"
>
...
...
ruoyi-system/src/main/java/com/ruoyi/system/domain/ProjectMember.java
View file @
394170c5
package
com
.
ruoyi
.
system
.
domain
;
package
com
.
ruoyi
.
system
.
domain
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
com.ruoyi.common.core.domain.BaseEntity
;
import
com.ruoyi.common.core.domain.BaseEntity
;
...
@@ -20,4 +22,12 @@ public class ProjectMember extends BaseEntity
...
@@ -20,4 +22,12 @@ public class ProjectMember extends BaseEntity
/** 用户id关联用户表主键id */
/** 用户id关联用户表主键id */
private
Long
userId
;
private
Long
userId
;
@TableField
(
exist
=
false
)
private
String
employName
;
@TableField
(
exist
=
false
)
private
Integer
employId
;
@TableField
(
exist
=
false
)
private
String
projectNumber
;
}
}
ruoyi-system/src/main/java/com/ruoyi/system/mapper/ProjectMemberMapper.java
View file @
394170c5
...
@@ -82,4 +82,14 @@ public interface ProjectMemberMapper
...
@@ -82,4 +82,14 @@ public interface ProjectMemberMapper
* @return 项目成员列表
* @return 项目成员列表
*/
*/
List
<
ProjectMember
>
selectProjectMemberListByUserId
(
@Param
(
"userId"
)
Long
userId
);
List
<
ProjectMember
>
selectProjectMemberListByUserId
(
@Param
(
"userId"
)
Long
userId
);
/**
* 根据项目编号和经理ID查询项目成员的用户ID和昵称
*
* @param projectNumber 项目编号
* @param managerId 经理ID
* @return 项目成员列表
*/
List
<
ProjectMember
>
selectEmployNameListByManagerId
(
@Param
(
"projectNumber"
)
String
projectNumber
,
@Param
(
"managerId"
)
Long
managerId
);
}
}
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java
View file @
394170c5
...
@@ -59,4 +59,13 @@ public interface SysUserRoleMapper
...
@@ -59,4 +59,13 @@ public interface SysUserRoleMapper
* @return 结果
* @return 结果
*/
*/
public
int
deleteUserRoleInfos
(
@Param
(
"roleId"
)
Long
roleId
,
@Param
(
"userIds"
)
Long
[]
userIds
);
public
int
deleteUserRoleInfos
(
@Param
(
"roleId"
)
Long
roleId
,
@Param
(
"userIds"
)
Long
[]
userIds
);
/**
* 通过用户ID查询角色ID
*
* @param userId 用户ID
* @return 角色ID列表
*/
public
List
<
Long
>
selectRoleIdsByUserId
(
Long
userId
);
}
}
ruoyi-system/src/main/java/com/ruoyi/system/service/IProjectMemberService.java
View file @
394170c5
...
@@ -66,4 +66,13 @@ public interface IProjectMemberService
...
@@ -66,4 +66,13 @@ public interface IProjectMemberService
* */
* */
public
void
batchInsertProjectMembers
(
Long
projectId
,
List
<
Long
>
memberIds
);
public
void
batchInsertProjectMembers
(
Long
projectId
,
List
<
Long
>
memberIds
);
/**
* 根据项目编号和经理ID查询项目成员的用户ID和昵称
*
* @param projectNumber 项目编号
* @param managerId 经理ID
* @return 项目成员列表
*/
public
List
<
ProjectMember
>
selectEmployNameListByManagerId
(
String
projectNumber
,
Long
managerId
);
}
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ProjectMemberServiceImpl.java
View file @
394170c5
...
@@ -98,4 +98,9 @@ public class ProjectMemberServiceImpl implements IProjectMemberService
...
@@ -98,4 +98,9 @@ public class ProjectMemberServiceImpl implements IProjectMemberService
projectMemberMapper
.
batchInsertProjectMembers
(
projectId
,
memberIds
);
projectMemberMapper
.
batchInsertProjectMembers
(
projectId
,
memberIds
);
}
}
}
}
@Override
public
List
<
ProjectMember
>
selectEmployNameListByManagerId
(
String
projectNumber
,
Long
managerId
)
{
return
projectMemberMapper
.
selectEmployNameListByManagerId
(
projectNumber
,
managerId
);
}
}
}
ruoyi-system/src/main/resources/mapper/project/ProjectMemberMapper.xml
View file @
394170c5
...
@@ -74,4 +74,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -74,4 +74,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"userId != null"
>
user_id = #{userId}
</if>
<if
test=
"userId != null"
>
user_id = #{userId}
</if>
</where>
</where>
</select>
</select>
<!--根据项目经理ID查询成员姓名-->
<select
id=
"selectEmployNameListByManagerId"
resultType=
"com.ruoyi.system.domain.ProjectMember"
>
SELECT su.user_id as employId, su.nick_name as employName, p.project_number as projectNumber
FROM sys_user su
JOIN project_member pm ON su.user_id = pm.user_id
JOIN project_manage p ON pm.project_id = p.id
<where>
<if
test=
"managerId != null"
>
p.project_manager_id = #{managerId}
</if>
<if
test=
"projectNumber != null"
>
AND p.project_number = #{projectNumber}
</if>
</where>
</select>
</mapper>
</mapper>
ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml
View file @
394170c5
...
@@ -41,4 +41,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -41,4 +41,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{userId}
#{userId}
</foreach>
</foreach>
</delete>
</delete>
<select
id=
"selectRoleIdsByUserId"
parameterType=
"Long"
resultType=
"Long"
>
SELECT role_id
FROM sys_user_role
WHERE user_id = #{userId}
</select>
</mapper>
</mapper>
\ No newline at end of file
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