Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
rpc-staff
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 86075df9
authored
Jan 26, 2026
by
林冲
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
单元测试
1 parent
924059b2
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
10 deletions
rpc-dj-staff-api/src/main/java/cn/com/glsx/dj/staff/dto/StaffSalaryAppealApplyRecordDTO.java
rpc-dj-staff-api/src/main/java/cn/com/glsx/dj/staff/dto/salaryappealapply/StaffSalaryAppealSummaryDTO.java
rpc-dj-staff/src/main/java/cn/com/glsx/dj/staff/service/StaffSalaryAppealApplyRecordService.java
rpc-dj-staff/src/main/resources/META-INF/orm/StaffSalaryAppealApplyRecordMapper.xml
rpc-dj-staff-api/src/main/java/cn/com/glsx/dj/staff/dto/StaffSalaryAppealApplyRecordDTO.java
View file @
86075df
...
@@ -31,6 +31,11 @@ public class StaffSalaryAppealApplyRecordDTO extends StaffSalaryAppealApplyRecor
...
@@ -31,6 +31,11 @@ public class StaffSalaryAppealApplyRecordDTO extends StaffSalaryAppealApplyRecor
private
String
applyEndTime
;
private
String
applyEndTime
;
/**
/**
* 是否超管
*/
private
Boolean
isSuper
;
/**
* 查询条件:登录手机号
* 查询条件:登录手机号
*/
*/
private
String
loginPhone
;
private
String
loginPhone
;
...
...
rpc-dj-staff-api/src/main/java/cn/com/glsx/dj/staff/dto/salaryappealapply/StaffSalaryAppealSummaryDTO.java
View file @
86075df
...
@@ -40,7 +40,7 @@ public class StaffSalaryAppealSummaryDTO implements Serializable {
...
@@ -40,7 +40,7 @@ public class StaffSalaryAppealSummaryDTO implements Serializable {
private
BigDecimal
padDeductionAmount
;
private
BigDecimal
padDeductionAmount
;
@ApiModelProperty
(
"缺失日报日期"
)
@ApiModelProperty
(
"缺失日报日期"
)
private
List
<
String
>
missingDailyReportDates
;
private
List
<
Integer
>
missingDailyReportDates
;
@ApiModelProperty
(
"是否允许发起考勤申诉"
)
@ApiModelProperty
(
"是否允许发起考勤申诉"
)
private
Boolean
attendanceAppealable
;
private
Boolean
attendanceAppealable
;
...
...
rpc-dj-staff/src/main/java/cn/com/glsx/dj/staff/service/StaffSalaryAppealApplyRecordService.java
View file @
86075df
...
@@ -32,6 +32,7 @@ import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
...
@@ -32,6 +32,7 @@ import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import
cn.com.glsx.framework.core.enums.DefaultErrorEnum
;
import
cn.com.glsx.framework.core.enums.DefaultErrorEnum
;
import
cn.com.glsx.framework.core.enums.StatusEnum
;
import
cn.com.glsx.framework.core.enums.StatusEnum
;
import
cn.com.glsx.framework.core.exception.RpcServiceException
;
import
cn.com.glsx.framework.core.exception.RpcServiceException
;
import
cn.hutool.core.lang.Assert
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -46,6 +47,7 @@ import tk.mybatis.mapper.entity.Example;
...
@@ -46,6 +47,7 @@ import tk.mybatis.mapper.entity.Example;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.util.*
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -92,9 +94,26 @@ public class StaffSalaryAppealApplyRecordService {
...
@@ -92,9 +94,26 @@ public class StaffSalaryAppealApplyRecordService {
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
rollbackFor
=
RpcServiceException
.
class
)
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
rollbackFor
=
RpcServiceException
.
class
)
public
Boolean
createAppeal
(
StaffSalaryAppealApplyRecordDTO
dto
)
{
public
Boolean
createAppeal
(
StaffSalaryAppealApplyRecordDTO
dto
)
{
log
.
info
(
"createAppeal start, dto:{}"
,
dto
);
log
.
info
(
"createAppeal start, dto:{}"
,
dto
);
Assert
.
notEmpty
(
dto
.
getStaffPhone
(),
"员工手机号不能为空"
);
Assert
.
notNull
(
dto
.
getAppealType
(),
"员工手机号不能为空"
);
Assert
.
notEmpty
(
dto
.
getAppealMonth
(),
"申诉月份不能为空"
);
Assert
.
notNull
(
dto
.
getSceneType
(),
"业务场景不能为空"
);
Assert
.
notNull
(
dto
.
getMerchantId
(),
"所属门店不能为空"
);
if
(
Objects
.
equals
(
dto
.
getAppealType
(),
1
))
{
Assert
.
notNull
(
dto
.
getActualAttendanceDays
(),
"实际出勤天数不能为空"
);
// Assert.notNull(dto.getApplyActualAttendanceDays(), "申请修改实际出勤天数不能为空");
}
else
if
(
Objects
.
equals
(
dto
.
getAppealType
(),
2
))
{
Assert
.
notNull
(
dto
.
getPadRecordNum
(),
"平板录音数不能为空"
);
Assert
.
notNull
(
dto
.
getShopCount
(),
"触客数不能为空"
);
Assert
.
notNull
(
dto
.
getApplyPadRecordNum
(),
"申诉修改平板录音数"
);
}
else
{
log
.
error
(
"申诉类型不存在, {}"
,
dto
.
getAppealType
());
throw
new
RpcServiceException
(
RpcErrorEnum
.
BUSINESS_ERROR
,
"申诉类型不存在"
);
}
// 保存主表
// 保存主表
StaffSalaryAppealApplyRecord
record
=
new
StaffSalaryAppealApplyRecord
();
StaffSalaryAppealApplyRecord
record
=
new
StaffSalaryAppealApplyRecord
();
BeanUtils
.
copyProperties
(
dto
,
record
);
BeanUtils
.
copyProperties
(
dto
,
record
);
record
.
setDealStatus
(
1
);
record
.
setCreatedDate
(
new
Date
());
record
.
setCreatedDate
(
new
Date
());
record
.
setUpdatedDate
(
new
Date
());
record
.
setUpdatedDate
(
new
Date
());
record
.
setDeletedFlag
(
"N"
);
record
.
setDeletedFlag
(
"N"
);
...
@@ -325,19 +344,26 @@ public class StaffSalaryAppealApplyRecordService {
...
@@ -325,19 +344,26 @@ public class StaffSalaryAppealApplyRecordService {
public
Boolean
webReply
(
StaffSalaryAppealApplyRecordDTO
dto
)
{
public
Boolean
webReply
(
StaffSalaryAppealApplyRecordDTO
dto
)
{
log
.
info
(
"webReply start, dto:{}"
,
dto
);
log
.
info
(
"webReply start, dto:{}"
,
dto
);
try
{
try
{
Assert
.
notNull
(
dto
.
getId
(),
"申诉记录ID不能为空"
);
if
(
Objects
.
equals
(
dto
.
getAppealType
(),
1
))
{
Assert
.
notNull
(
dto
.
getConfirmActualAttendanceDays
(),
"实际出勤天数不能为空"
);
}
if
(
Objects
.
equals
(
dto
.
getAppealType
(),
2
))
{
Assert
.
notNull
(
dto
.
getConfirmPadRecordNum
(),
"平板录音数不能为空"
);
}
StaffSalaryAppealApplyRecord
record
=
staffSalaryAppealApplyRecordMapper
.
selectByPrimaryKey
(
dto
.
getId
());
StaffSalaryAppealApplyRecord
record
=
staffSalaryAppealApplyRecordMapper
.
selectByPrimaryKey
(
dto
.
getId
());
if
(
record
==
null
)
{
if
(
record
==
null
)
{
log
.
error
(
"不存在的申诉记录,id:{}"
,
dto
.
getId
());
log
.
error
(
"不存在的申诉记录,id:{}"
,
dto
.
getId
());
throw
new
RpcServiceException
(
DefaultErrorEnum
.
DATABASE_ERROR
,
"申诉记录不存在"
);
throw
new
RpcServiceException
(
DefaultErrorEnum
.
DATABASE_ERROR
,
"申诉记录不存在"
);
}
}
if
(
Objects
.
equals
(
record
.
getDealStatus
(),
2
))
{
Assert
.
isTrue
(!
Objects
.
equals
(
record
.
getDealStatus
(),
1
),
"申诉单已处理"
);
throw
new
RpcServiceException
(
DefaultErrorEnum
.
DATA_INVALID
,
"申诉已处理"
);
}
record
.
setConfirmActualAttendanceDays
(
dto
.
getConfirmActualAttendanceDays
());
record
.
setConfirmActualAttendanceDays
(
dto
.
getConfirmActualAttendanceDays
());
record
.
setConfirmPadRecordNum
(
dto
.
getConfirmPadRecordNum
());
record
.
setConfirmPadRecordNum
(
dto
.
getConfirmPadRecordNum
());
record
.
setReplyContent
(
dto
.
getReplyContent
());
record
.
setReplyContent
(
dto
.
getReplyContent
());
record
.
setDealStatus
(
2
);
// 2:已处理
record
.
setDealStatus
(
2
);
// 2:已处理
record
.
setReplyDate
(
new
Date
());
record
.
setReplyDate
(
new
Date
());
record
.
setReplyPhone
(
dto
.
getReplyPhone
());
record
.
setReplyName
(
dto
.
getReplyName
());
record
.
setUpdatedBy
(
dto
.
getUpdatedBy
());
record
.
setUpdatedBy
(
dto
.
getUpdatedBy
());
record
.
setUpdatedDate
(
new
Date
());
record
.
setUpdatedDate
(
new
Date
());
...
@@ -422,7 +448,7 @@ public class StaffSalaryAppealApplyRecordService {
...
@@ -422,7 +448,7 @@ public class StaffSalaryAppealApplyRecordService {
result
.
setDailyReportDays
(
dailyReportDays
.
size
());
result
.
setDailyReportDays
(
dailyReportDays
.
size
());
// 计算打卡缺失的日
// 计算打卡缺失的日
List
<
String
>
missingDays
=
calculateMissingDays
(
firstDay
,
lastDay
,
dailyReportDays
);
List
<
Integer
>
missingDays
=
calculateMissingDays
(
firstDay
,
lastDay
,
dailyReportDays
);
result
.
setMissingDailyReportDates
(
missingDays
);
result
.
setMissingDailyReportDates
(
missingDays
);
// 日报扣款金额 = 缺卡天数 * 每天扣款金额
// 日报扣款金额 = 缺卡天数 * 每天扣款金额
...
@@ -516,17 +542,28 @@ public class StaffSalaryAppealApplyRecordService {
...
@@ -516,17 +542,28 @@ public class StaffSalaryAppealApplyRecordService {
* @param firstDay 第一天 yyyy-MM-dd
* @param firstDay 第一天 yyyy-MM-dd
* @param lastDay 最后一天 yyyy-MM-dd
* @param lastDay 最后一天 yyyy-MM-dd
* @param existingDays 已存在的日期列表 yyyy-MM-dd
* @param existingDays 已存在的日期列表 yyyy-MM-dd
* @return 缺失的日期列表
yyyy-MM-
dd
* @return 缺失的日期列表 dd
*/
*/
private
List
<
String
>
calculateMissingDays
(
String
firstDay
,
String
lastDay
,
List
<
String
>
existingDays
)
{
public
List
<
Integer
>
calculateMissingDays
(
String
firstDay
,
String
lastDay
,
List
<
String
>
existingDays
)
{
// 获取 yyyy-MM-dd 的完整日期列表
List
<
String
>
allDays
=
DateUtils
.
getDateRangeList
(
firstDay
,
lastDay
);
List
<
String
>
allDays
=
DateUtils
.
getDateRangeList
(
firstDay
,
lastDay
);
if
(
CollectionUtils
.
isEmpty
(
existingDays
))
{
if
(
CollectionUtils
.
isEmpty
(
existingDays
))
{
return
allDays
;
// 如果没有已存在日期,直接返回所有 dayOfMonth
return
allDays
.
stream
()
.
map
(
day
->
LocalDate
.
parse
(
day
).
getDayOfMonth
())
.
collect
(
Collectors
.
toList
());
}
}
// 返回所有日期中不在已存在日期中的日
// 过滤已存在的日期,只返回“缺失日期”的 day
return
allDays
.
stream
()
return
allDays
.
stream
()
.
filter
(
day
->
!
existingDays
.
contains
(
day
))
.
filter
(
day
->
!
existingDays
.
contains
(
day
))
.
map
(
day
->
day
.
split
(
"-"
)[
2
]
)
.
map
(
day
->
LocalDate
.
parse
(
day
).
getDayOfMonth
()
)
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
}
}
...
...
rpc-dj-staff/src/main/resources/META-INF/orm/StaffSalaryAppealApplyRecordMapper.xml
View file @
86075df
...
@@ -49,6 +49,9 @@
...
@@ -49,6 +49,9 @@
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
FROM dj_car_life_staff_salary_appeal_apply_record
FROM dj_car_life_staff_salary_appeal_apply_record
WHERE deleted_flag = 'N'
WHERE deleted_flag = 'N'
<if
test=
"isSuper != null and !isSuper"
>
AND direct_leader_phone = #{loginPhone}
</if>
<if
test=
"staffName != null and staffName != ''"
>
<if
test=
"staffName != null and staffName != ''"
>
AND staff_name LIKE CONCAT('%', #{staffName}, '%')
AND staff_name LIKE CONCAT('%', #{staffName}, '%')
</if>
</if>
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment