Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
attendance-performance-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
attendance-performance-platform
Commits
2443e2b3
Commit
2443e2b3
authored
Mar 20, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加接口同步效能记录
parent
915841b6
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
178 additions
and
26 deletions
+178
-26
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/h5/req/EffectSaveReq.java
...main/java/com/mortals/xhx/busiz/h5/req/EffectSaveReq.java
+11
-0
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/h5/web/ApiWebPerformController.java
...com/mortals/xhx/busiz/h5/web/ApiWebPerformController.java
+3
-4
attendance-performance-manager/src/main/java/com/mortals/xhx/common/key/ParamKey.java
...er/src/main/java/com/mortals/xhx/common/key/ParamKey.java
+2
-0
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/service/impl/PerformEffectRecordServiceImpl.java
.../perform/service/impl/PerformEffectRecordServiceImpl.java
+161
-21
attendance-performance-manager/src/test/java/com/mortals/httpclient/system.http
...-manager/src/test/java/com/mortals/httpclient/system.http
+1
-1
No files found.
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/h5/req/EffectSaveReq.java
View file @
2443e2b3
...
...
@@ -37,4 +37,15 @@ public class EffectSaveReq extends BaseReq {
* 抓拍图片
*/
private
String
snapPath
;
/**
* 唯一标识
*/
private
String
ext
;
/**
* 名称
*/
private
String
staffName
;
}
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/h5/web/ApiWebPerformController.java
View file @
2443e2b3
...
...
@@ -405,7 +405,6 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
//效能保存
StaffEntity
staffEntity
=
getStaff
(
req
.
getPhone
());
PerformRulesEntity
rule
=
getRule
(
req
.
getRuleCode
());
checkStaffAutoConf
(
staffEntity
,
rule
);
PerformEffectRecordEntity
recordEntity
=
new
PerformEffectRecordEntity
();
recordEntity
.
initAttrValue
();
recordEntity
.
setSubMethod
(
SubMethodEnum
.
系统自动
.
getValue
());
...
...
@@ -426,6 +425,7 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
recordEntity
.
setDeductPerson
(
"系统管理员"
);
recordEntity
.
setDeductTime
(
new
Date
());
recordEntity
.
setWorkNum
(
staffEntity
.
getWorkNum
());
recordEntity
.
setRemark
(
req
.
getExt
());
recordEntity
.
setWindowNum
(
req
.
getWindowNum
());
...
...
@@ -506,13 +506,12 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
PerformRulesEntity
rule
=
rulesService
.
getCache
(
ruleCode
);
if
(
ObjectUtils
.
isEmpty
(
rule
))
throw
new
AppException
(
String
.
format
(
"当前手机号码未找到匹配的员工!rule:%s"
,
ruleCode
));
return
rule
;
}
private
StaffEntity
getStaff
(
String
phone
)
{
StaffEntity
staffEntity
=
staffService
.
selectOne
(
new
StaffQuery
().
phoneNumber
(
phone
));
if
(
ObjectUtils
.
isEmpty
(
staffEntity
)){
if
(
ObjectUtils
.
isEmpty
(
staffEntity
))
{
throw
new
AppException
(
String
.
format
(
"当前手机号码未找到匹配的员工!phone:%s"
,
phone
));
}
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/common/key/ParamKey.java
View file @
2443e2b3
...
...
@@ -29,4 +29,6 @@ public class ParamKey {
public
static
String
SYS_PARAM_BELONG
=
"belong"
;
public
static
String
SYS_PARAM_XNJC_URL
=
"xnjc_url"
;
}
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/service/impl/PerformEffectRecordServiceImpl.java
View file @
2443e2b3
package
com.mortals.xhx.module.perform.service.impl
;
import
cn.hutool.core.lang.Validator
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.TypeReference
;
import
com.mortals.framework.ap.GlobalSysInfo
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.xhx.busiz.h5.req.EffectSaveReq
;
import
com.mortals.xhx.busiz.h5.rsp.ApiResp
;
import
com.mortals.xhx.common.code.*
;
import
com.mortals.xhx.common.utils.BeanUtil
;
import
com.mortals.xhx.module.check.model.CheckEffectRecordEntity
;
import
com.mortals.xhx.module.check.service.CheckEffectRecordService
;
import
com.mortals.xhx.module.perform.model.PerformComplainRecordEntity
;
import
com.mortals.xhx.module.perform.model.PerformEffectRecordQuery
;
import
com.mortals.xhx.module.perform.model.PerformRulesEntity
;
import
com.mortals.xhx.module.perform.service.PerformRulesService
;
import
com.mortals.xhx.module.perform.service.PerformStaffConfService
;
import
com.mortals.xhx.module.perform.dao.PerformEffectRecordDao
;
import
com.mortals.xhx.module.perform.model.*
;
import
com.mortals.xhx.module.perform.service.*
;
import
com.mortals.xhx.module.staff.model.StaffEntity
;
import
com.mortals.xhx.module.staff.model.StaffQuery
;
import
com.mortals.xhx.module.staff.service.StaffService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.xhx.module.perform.dao.PerformEffectRecordDao
;
import
com.mortals.xhx.module.perform.model.PerformEffectRecordEntity
;
import
com.mortals.xhx.module.perform.service.PerformEffectRecordService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.util.ObjectUtils
;
import
java.util.Date
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
ParamKey
.
SYS_PARAM_XNJC_URL
;
/**
* PerformEffectRecordService
...
...
@@ -38,22 +47,27 @@ public class PerformEffectRecordServiceImpl extends AbstractCRUDServiceImpl<Perf
@Autowired
private
CheckEffectRecordService
checkEffectRecordService
;
@Autowired
private
PerformRulesCategoryService
categoryService
;
@Autowired
private
PerformRulesService
rulesService
;
@Autowired
private
StaffService
staffService
;
@Autowired
private
PerformStaffConfService
performStaffConfService
;
@Autowired
private
PerformStaffConfDetailService
performStaffConfDetailService
;
@Autowired
private
PerformErrorRecordService
errorRecordService
;
@Override
protected
void
saveBefore
(
PerformEffectRecordEntity
entity
,
Context
context
)
throws
AppException
{
updateStaffRuleNames
(
entity
,
context
);
updateStaffRuleNames
(
entity
,
context
);
}
@Override
protected
void
updateBefore
(
PerformEffectRecordEntity
entity
,
Context
context
)
throws
AppException
{
updateStaffRuleNames
(
entity
,
context
);
updateStaffRuleNames
(
entity
,
context
);
}
...
...
@@ -69,7 +83,7 @@ public class PerformEffectRecordServiceImpl extends AbstractCRUDServiceImpl<Perf
entity
.
setDeptName
(
staffCache
==
null
?
""
:
staffCache
.
getDeptName
());
}
entity
.
setDeductTime
(
new
Date
());
if
(
ObjectUtils
.
isEmpty
(
entity
.
getDeductPerson
()))
{
if
(
ObjectUtils
.
isEmpty
(
entity
.
getDeductPerson
()))
{
entity
.
setDeductPerson
(
context
==
null
?
""
:
context
.
getUser
()
==
null
?
""
:
context
.
getUser
().
getRealName
());
}
}
...
...
@@ -81,15 +95,15 @@ public class PerformEffectRecordServiceImpl extends AbstractCRUDServiceImpl<Perf
BeanUtils
.
copyProperties
(
entity
,
checkEffectRecordEntity
,
BeanUtil
.
getNullPropertyNames
(
entity
));
checkEffectRecordEntity
.
setId
(
null
);
checkEffectRecordEntity
.
setRecordId
(
entity
.
getId
());
if
(
performStaffConfService
.
checkRules
(
entity
.
getStaffId
(),
entity
.
getDeptId
(),
entity
.
getRuleId
()))
{
if
(
performStaffConfService
.
checkRules
(
entity
.
getStaffId
(),
entity
.
getDeptId
(),
entity
.
getRuleId
()))
{
checkEffectRecordEntity
.
setCheckStatus
(
CheckStatusEnum
.
已处理
.
getValue
());
if
(
checkEffectRecordEntity
.
getSubAddType
()==
SubAddTypeEnum
.
增加
.
getValue
())
{
if
(
checkEffectRecordEntity
.
getSubAddType
()
==
SubAddTypeEnum
.
增加
.
getValue
())
{
checkEffectRecordEntity
.
setCheckResult
(
CheckResultAddEnum
.
核查加分
.
getValue
());
}
else
{
}
else
{
checkEffectRecordEntity
.
setCheckResult
(
CheckResultSubEnum
.
核查扣分
.
getValue
());
}
checkEffectRecordEntity
.
setUpdateTime
(
new
Date
());
}
else
{
}
else
{
checkEffectRecordEntity
.
setCheckStatus
(
CheckStatusEnum
.
未处理
.
getValue
());
//非自动扣分相设置为未处理
}
checkEffectRecordService
.
save
(
checkEffectRecordEntity
,
context
);
...
...
@@ -116,7 +130,133 @@ public class PerformEffectRecordServiceImpl extends AbstractCRUDServiceImpl<Perf
@Override
public
void
syncEffectRecord
(
PerformEffectRecordQuery
query
,
Context
context
)
{
log
.
info
(
"同步效能绩效记录开始"
);
String
phpInUrl
=
GlobalSysInfo
.
getParamValue
(
SYS_PARAM_XNJC_URL
,
"http://127.0.0.1:11039/zwfw_api_xnjc"
);
String
xnjcUrl
=
phpInUrl
+
"/api/kq_alert/leaveList"
;
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"start"
,
query
.
getHappenTimeStart
());
params
.
put
(
"end"
,
query
.
getHappenTimeEnd
());
String
resp
=
null
;
try
{
resp
=
HttpUtil
.
createPost
(
xnjcUrl
).
form
(
params
).
timeout
(
60000
).
execute
().
body
();
if
(
ObjectUtils
.
isEmpty
(
resp
))
throw
new
AppException
(
"请求失败!"
);
ApiResp
<
List
<
EffectSaveReq
>>
rest
=
JSON
.
parseObject
(
resp
,
new
TypeReference
<
ApiResp
<
List
<
EffectSaveReq
>>>()
{
});
//记录保存
if
(
rest
.
getCode
()
==
0
)
{
List
<
EffectSaveReq
>
list
=
rest
.
getData
();
for
(
EffectSaveReq
effectSaveReq
:
list
)
{
boolean
isMobile
=
Validator
.
isMobile
(
effectSaveReq
.
getPhone
());
if
(!
isMobile
)
continue
;
if
(
ObjectUtils
.
isEmpty
(
effectSaveReq
.
getRuleCode
()))
continue
;
if
(
ObjectUtils
.
isEmpty
(
effectSaveReq
.
getPhone
()))
{
//通过名称查询员工,再看是否有匹配的
if
(!
ObjectUtils
.
isEmpty
(
effectSaveReq
.
getStaffName
()))
{
StaffQuery
staffQuery
=
new
StaffQuery
();
staffQuery
.
setName
(
effectSaveReq
.
getStaffName
());
StaffEntity
staffEntity
=
staffService
.
selectOne
(
staffQuery
);
if
(!
ObjectUtils
.
isEmpty
(
staffEntity
))
{
effectSaveReq
.
setPhone
(
staffEntity
.
getPhoneNumber
());
}
}
else
{
continue
;
}
}
Long
ruleId
=
null
;
PerformRulesEntity
rule
=
rulesService
.
getCache
(
effectSaveReq
.
getRuleCode
());
if
(
ObjectUtils
.
isEmpty
(
rule
))
{
ruleId
=
rule
.
getId
();
}
//查询是否存在 如果没有 则保存
PerformEffectRecordQuery
effectRecordQuery
=
new
PerformEffectRecordQuery
();
effectRecordQuery
.
setHappenTime
(
effectSaveReq
.
getHappenTime
());
effectRecordQuery
.
setWindowNum
(
effectSaveReq
.
getWindowNum
());
if
(!
ObjectUtils
.
isEmpty
(
ruleId
))
{
effectRecordQuery
.
setRuleId
(
ruleId
);
}
// effectRecordQuery.setRemark(effectSaveReq.getExt());
int
count
=
this
.
count
(
effectRecordQuery
,
context
);
if
(
count
>
0
)
continue
;
//保存
effect
(
effectSaveReq
);
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"异常:"
,
e
);
}
}
private
boolean
effect
(
EffectSaveReq
req
)
throws
AppException
{
//效能保存
StaffEntity
staffEntity
=
getStaff
(
req
.
getPhone
());
PerformRulesEntity
rule
=
getRule
(
req
.
getRuleCode
());
PerformEffectRecordEntity
recordEntity
=
new
PerformEffectRecordEntity
();
recordEntity
.
initAttrValue
();
recordEntity
.
setSubMethod
(
SubMethodEnum
.
系统自动
.
getValue
());
BeanUtils
.
copyProperties
(
req
,
recordEntity
);
recordEntity
.
setStaffId
(
staffEntity
.
getId
());
recordEntity
.
setStaffName
(
staffEntity
.
getName
());
recordEntity
.
setWorkNum
(
staffEntity
.
getWorkNum
());
recordEntity
.
setDeptId
(
staffEntity
.
getDeptId
());
recordEntity
.
setDeptName
(
staffEntity
.
getDeptName
());
recordEntity
.
setSalaId
(
staffEntity
.
getSalaId
());
recordEntity
.
setSalaName
(
staffEntity
.
getSalaName
());
recordEntity
.
setSubAddType
(
rule
.
getSubAddType
());
recordEntity
.
setScore
(
rule
.
getScore
());
recordEntity
.
setRuleId
(
rule
.
getId
());
recordEntity
.
setRuleName
(
rule
.
getName
());
recordEntity
.
setCategoryId
(
rule
.
getCategoryId
());
recordEntity
.
setCategoryName
(
rule
.
getCategoryName
());
recordEntity
.
setDeductPerson
(
"系统管理员"
);
recordEntity
.
setDeductTime
(
new
Date
());
recordEntity
.
setWorkNum
(
staffEntity
.
getWorkNum
());
recordEntity
.
setRemark
(
req
.
getExt
());
recordEntity
.
setWindowNum
(
req
.
getWindowNum
());
recordEntity
.
setCreateUserId
(
1L
);
recordEntity
.
setCreateTime
(
new
Date
());
PerformRulesCategoryEntity
categoryEntity
=
categoryService
.
get
(
rule
.
getCategoryId
());
recordEntity
.
setCategoryName
(
categoryEntity
==
null
?
""
:
categoryEntity
.
getName
());
PerformEffectRecordEntity
save
=
this
.
save
(
recordEntity
);
return
save
.
newEntity
();
}
private
void
checkStaffAutoConf
(
StaffEntity
staffEntity
,
PerformRulesEntity
rule
)
{
Boolean
rulePass
=
false
;
//校验当前员工是否存在自动规则中
List
<
PerformStaffConfEntity
>
performStaffConfEntities
=
performStaffConfService
.
find
(
new
PerformStaffConfQuery
());
for
(
PerformStaffConfEntity
performStaffConfEntity
:
performStaffConfEntities
)
{
String
staffIds
=
performStaffConfEntity
.
getStaffIds
();
Set
<
String
>
split
=
StrUtil
.
split
(
staffIds
,
","
).
stream
().
collect
(
Collectors
.
toSet
());
if
(
split
.
contains
(
staffEntity
.
getId
().
toString
()))
{
//查询当前规则
List
<
PerformStaffConfDetailEntity
>
staffConfDetailEntities
=
performStaffConfDetailService
.
find
(
new
PerformStaffConfDetailQuery
().
staffConfId
(
performStaffConfEntity
.
getId
()));
for
(
PerformStaffConfDetailEntity
staffConfDetailEntity
:
staffConfDetailEntities
)
{
if
(
staffConfDetailEntity
.
getRuleId
()
==
rule
.
getId
())
{
rulePass
=
true
;
break
;
}
}
}
if
(
rulePass
)
break
;
}
if
(
rulePass
)
throw
new
AppException
(
"当前用户与绩效规则未配置自动核查,请在后台配置后再新增!"
);
}
private
PerformRulesEntity
getRule
(
String
ruleCode
)
{
PerformRulesEntity
rule
=
rulesService
.
getCache
(
ruleCode
);
return
rule
;
}
private
StaffEntity
getStaff
(
String
phone
)
{
StaffEntity
staffEntity
=
staffService
.
selectOne
(
new
StaffQuery
().
phoneNumber
(
phone
));
return
staffEntity
;
}
}
\ No newline at end of file
attendance-performance-manager/src/test/java/com/mortals/httpclient/system.http
View file @
2443e2b3
...
...
@@ -86,7 +86,7 @@ Content-Type: application/json
POST {{baseUrl}}/staff/perform/summary/summary
Content-Type: application/json
{"checkTimeStart":"2024-02-01","checkTimeEnd":"2024-02-29"}
{"checkTimeStart":"2024-02-01","checkTimeEnd":"2024-02-29"
,"checkType":4
}
###考勤打卡记录异常信息列表
POST {{baseUrl}}/attendance/record/error/doReprocess
...
...
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