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
96b8a46f
Commit
96b8a46f
authored
Jul 12, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
c8fde557
dca6a8b2
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
385 additions
and
62 deletions
+385
-62
attendance-performance-manager/pom.xml
attendance-performance-manager/pom.xml
+8
-1
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/dingtalk/api/TalkApiController.java
...com/mortals/xhx/busiz/dingtalk/api/TalkApiController.java
+190
-20
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/dingtalk/config/TalkConfiguration.java
.../mortals/xhx/busiz/dingtalk/config/TalkConfiguration.java
+32
-4
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/dingtalk/req/UserPageReq.java
.../java/com/mortals/xhx/busiz/dingtalk/req/UserPageReq.java
+39
-0
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/req/MobileReq.java
...er/src/main/java/com/mortals/xhx/busiz/req/MobileReq.java
+18
-0
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/model/vo/PerformDeptConfDetailVo.java
.../xhx/module/perform/model/vo/PerformDeptConfDetailVo.java
+2
-1
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/model/vo/PerformStaffConfDetailVo.java
...xhx/module/perform/model/vo/PerformStaffConfDetailVo.java
+2
-1
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/service/impl/PerformDeptConfServiceImpl.java
...dule/perform/service/impl/PerformDeptConfServiceImpl.java
+8
-0
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/service/impl/PerformStaffConfServiceImpl.java
...ule/perform/service/impl/PerformStaffConfServiceImpl.java
+86
-35
No files found.
attendance-performance-manager/pom.xml
View file @
96b8a46f
...
@@ -145,7 +145,14 @@
...
@@ -145,7 +145,14 @@
<dependency>
<dependency>
<groupId>
com.aliyun
</groupId>
<groupId>
com.aliyun
</groupId>
<artifactId>
dingtalk
</artifactId>
<artifactId>
dingtalk
</artifactId>
<version>
2.0.19
</version>
<version>
2.0.22
</version>
</dependency>
<!--dingdingtalk service sdk-->
<dependency>
<groupId>
com.aliyun
</groupId>
<artifactId>
alibaba-dingtalk-service-sdk
</artifactId>
<version>
2.0.0
</version>
</dependency>
</dependency>
<dependency>
<dependency>
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/dingtalk/api/TalkApiController.java
View file @
96b8a46f
...
@@ -2,20 +2,29 @@ package com.mortals.xhx.busiz.dingtalk.api;
...
@@ -2,20 +2,29 @@ package com.mortals.xhx.busiz.dingtalk.api;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.dingtalk.api.DefaultDingTalkClient
;
import
com.dingtalk.api.DingTalkClient
;
import
com.dingtalk.api.request.*
;
import
com.dingtalk.api.response.*
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.
service.ICacheService
;
import
com.mortals.framework.
exception.AppException
;
import
com.mortals.xhx.busiz.dingtalk.config.TalkConfiguration
;
import
com.mortals.xhx.busiz.dingtalk.config.TalkConfiguration
;
import
com.mortals.xhx.busiz.dingtalk.req.DingTalkBaseReq
;
import
com.mortals.xhx.busiz.dingtalk.req.DingTalkBaseReq
;
import
com.mortals.xhx.busiz.dingtalk.req.UserPageReq
;
import
com.mortals.xhx.busiz.req.MobileReq
;
import
com.mortals.xhx.busiz.req.ReviewSaveReq
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.pdu.ApiRespPdu
;
import
com.mortals.xhx.common.pdu.ApiRespPdu
;
import
lombok.extern.apachecommons.CommonsLog
;
import
lombok.extern.apachecommons.CommonsLog
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.poi.ss.formula.functions.T
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.
PostMapping
;
import
org.springframework.web.bind.annotation.
*
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
sun.security.krb5.internal.APOptions
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
/**
* 钉钉相关外部接口
* 钉钉相关外部接口
...
@@ -29,7 +38,7 @@ public class TalkApiController {
...
@@ -29,7 +38,7 @@ public class TalkApiController {
@Autowired
@Autowired
private
TalkConfiguration
talkConfiguration
;
private
TalkConfiguration
talkConfiguration
;
private
String
dingToken
;
/**
/**
* 获取token
* 获取token
...
@@ -37,33 +46,194 @@ public class TalkApiController {
...
@@ -37,33 +46,194 @@ public class TalkApiController {
* @return
* @return
*/
*/
@PostMapping
(
"/dingtalk/gettoken"
)
@PostMapping
(
"/dingtalk/gettoken"
)
public
Rest
<
String
>
getToken
(
@RequestBody
DingTalkBaseReq
dingTalkBaseReq
)
{
@UnAuth
log
.
info
(
"收到【getToken】请求【请求体】--> {}"
,
JSON
.
toJSONString
(
dingTalkBaseReq
));
public
ApiRespPdu
<
String
>
getToken
()
{
ApiRespPdu
<
String
>
apiRespPdu
=
new
ApiRespPdu
<>();
try
{
try
{
DingTalkClient
client
=
new
DefaultDingTalkClient
(
talkConfiguration
.
getGetTokneUrl
());
// DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
// OapiGettokenRequest req = new OapiGettokenRequest();
// req.setHttpMethod("GET");
// OapiGettokenResponse rsp = client.execute(req);
/* DingTalkClient client = new DefaultDingTalkClient(talkConfiguration.getGetTokneUrl());
OapiGettokenRequest
req
=
new
OapiGettokenRequest
();
OapiGettokenRequest
req
=
new
OapiGettokenRequest
();
req.setAppkey(
apiKey
);
req
.
setAppkey
(
talkConfiguration
.
getAppKey
()
);
req.setAppsecret(
appsecret
);
req
.
setAppsecret
(
talkConfiguration
.
getAppSecret
()
);
req
.
setHttpMethod
(
"GET"
);
req
.
setHttpMethod
(
"GET"
);
OapiGettokenResponse
rsp
=
client
.
execute
(
req
);
OapiGettokenResponse
rsp
=
client
.
execute
(
req
);
log
.
info
(
"gettoken rsp:"
+
rsp
.
getBody
());
log
.
info
(
"gettoken rsp:"
+
rsp
.
getBody
());
if
(
rsp
.
getErrcode
()
==
0
)
{
if
(
rsp
.
getErrcode
()
==
0
)
{
dingToken
=
rsp
.
getAccessToken
();
apiRespPdu
.
setCode
(
0
);
apiRespPdu
.
setData
(
rsp
.
getAccessToken
());
apiRespPdu
.
setData
(
rsp
.
getAccessToken
());
apiRespPdu
.
setMsg
(
rsp
.
getMsg
());
}
else
{
}
else
{
throw new AppException(String.format("errorCode:%s,errorMsg:%s", rsp.getErrcode(), rsp.getErrmsg()));
apiRespPdu
.
setCode
(-
1
);
apiRespPdu
.
setData
(
""
);
apiRespPdu
.
setMsg
(
rsp
.
getMsg
());
}
}
*/
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"异常"
,
e
);
log
.
error
(
"异常"
,
e
);
return
Rest
.
fail
(
e
.
getMessage
());
apiRespPdu
.
setCode
(-
1
);
apiRespPdu
.
setData
(
""
);
apiRespPdu
.
setMsg
(
e
.
toString
());
}
return
apiRespPdu
;
}
/**
* 获取部门列表
* @return
*/
@PostMapping
(
"/dingtalk/getSubList"
)
@UnAuth
public
ApiRespPdu
<
List
<
OapiV2DepartmentListsubResponse
.
DeptBaseResponse
>>
getSubList
(){
ApiRespPdu
<
List
<
OapiV2DepartmentListsubResponse
.
DeptBaseResponse
>>
apiRespPdu
=
new
ApiRespPdu
<>();
try
{
DingTalkClient
client
=
new
DefaultDingTalkClient
(
talkConfiguration
.
getGetSubList
());
OapiV2DepartmentListsubRequest
req
=
new
OapiV2DepartmentListsubRequest
();
if
(
dingToken
==
null
){
dingToken
=
getToken
().
getData
();
}
OapiV2DepartmentListsubResponse
rsp
=
client
.
execute
(
req
,
dingToken
);
if
(
rsp
.
getErrcode
()
==
0
){
apiRespPdu
.
setCode
(
0
);
apiRespPdu
.
setData
(
rsp
.
getResult
());
apiRespPdu
.
setMsg
(
rsp
.
getMsg
());
}
else
{
if
(
getToken
().
getCode
()
==
0
){
getSubList
();
}
else
{
apiRespPdu
.
setCode
(-
1
);
apiRespPdu
.
setData
(
null
);
apiRespPdu
.
setMsg
(
"获取token失败"
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
apiRespPdu
.
setCode
(-
1
);
apiRespPdu
.
setData
(
null
);
apiRespPdu
.
setMsg
(
e
.
toString
());
}
return
apiRespPdu
;
}
/**
* 根据部门id查询该部门下所有用户完整信息
* @return
*/
@PostMapping
(
"/dingtalk/getUserList"
)
@UnAuth
public
ApiRespPdu
<
OapiV2UserListResponse
.
PageResult
>
getUserList
(
@RequestBody
UserPageReq
res
){
ApiRespPdu
<
OapiV2UserListResponse
.
PageResult
>
apiRespPdu
=
new
ApiRespPdu
<>();
try
{
DingTalkClient
client
=
new
DefaultDingTalkClient
(
talkConfiguration
.
getGetuserlist
());
OapiV2UserListRequest
req
=
new
OapiV2UserListRequest
();
if
(
dingToken
==
null
){
dingToken
=
getToken
().
getData
();
}
req
.
setDeptId
(
res
.
getDeptid
());
req
.
setCursor
(
res
.
getCursor
());
req
.
setSize
(
res
.
getSize
());
OapiV2UserListResponse
rsp
=
client
.
execute
(
req
,
dingToken
);
if
(
rsp
.
getErrcode
()
==
0
){
apiRespPdu
.
setCode
(
0
);
apiRespPdu
.
setData
(
rsp
.
getResult
());
apiRespPdu
.
setMsg
(
rsp
.
getMsg
());
}
else
{
if
(
getToken
().
getCode
()
==
0
){
getUserList
(
res
);
}
else
{
apiRespPdu
.
setCode
(-
1
);
apiRespPdu
.
setData
(
null
);
apiRespPdu
.
setMsg
(
"获取token失败"
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
apiRespPdu
.
setCode
(-
1
);
apiRespPdu
.
setData
(
null
);
apiRespPdu
.
setMsg
(
e
.
toString
());
}
}
return
Rest
.
ok
();
return
apiRespPdu
;
}
}
/**
* 根据手机号查询用户
* @return
*/
@GetMapping
(
"/dingtalk/getByMobile"
)
@UnAuth
public
ApiRespPdu
<
OapiV2UserGetResponse
.
UserGetResponse
>
getByMobile
(
@RequestBody
MobileReq
mobile
){
ApiRespPdu
<
OapiV2UserGetResponse
.
UserGetResponse
>
apiRespPdu
=
new
ApiRespPdu
<>();
try
{
DingTalkClient
client
=
new
DefaultDingTalkClient
(
talkConfiguration
.
getGetbymobile
());
OapiV2UserGetbymobileRequest
req
=
new
OapiV2UserGetbymobileRequest
();
if
(
dingToken
==
null
){
dingToken
=
getToken
().
getData
();
}
req
.
setMobile
(
mobile
.
getMobile
());
OapiV2UserGetbymobileResponse
rsp
=
client
.
execute
(
req
,
dingToken
);
if
(
rsp
.
getErrcode
()
==
0
){
//根据获取到的userid去获取用户详情
ApiRespPdu
<
OapiV2UserGetResponse
.
UserGetResponse
>
userRsp
=
getUserInfo
(
rsp
.
getResult
().
getUserid
());
if
(
userRsp
.
getCode
()
==
0
){
apiRespPdu
.
setCode
(
userRsp
.
getCode
());
apiRespPdu
.
setData
(
userRsp
.
getData
());
apiRespPdu
.
setMsg
(
userRsp
.
getMsg
());
}
else
{
apiRespPdu
.
setCode
(-
1
);
apiRespPdu
.
setData
(
null
);
apiRespPdu
.
setMsg
(
userRsp
.
getMsg
());
}
}
else
{
if
(
getToken
().
getCode
()
==
0
){
getByMobile
(
mobile
);
}
else
{
apiRespPdu
.
setCode
(-
1
);
apiRespPdu
.
setData
(
null
);
apiRespPdu
.
setMsg
(
"获取token失败"
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
apiRespPdu
.
setCode
(-
1
);
apiRespPdu
.
setData
(
null
);
apiRespPdu
.
setMsg
(
e
.
toString
());
}
return
apiRespPdu
;
}
/**
* 根据userid查询用户详情
* @return
*/
@GetMapping
(
"/dingtalk/getUserInfo"
)
@UnAuth
public
ApiRespPdu
<
OapiV2UserGetResponse
.
UserGetResponse
>
getUserInfo
(
@RequestBody
String
userid
){
ApiRespPdu
<
OapiV2UserGetResponse
.
UserGetResponse
>
apiRespPdu
=
new
ApiRespPdu
<>();
try
{
DingTalkClient
client
=
new
DefaultDingTalkClient
(
talkConfiguration
.
getGetuserinfo
());
OapiV2UserGetRequest
req
=
new
OapiV2UserGetRequest
();
if
(
dingToken
==
null
){
dingToken
=
getToken
().
getData
();
}
req
.
setUserid
(
userid
);
OapiV2UserGetResponse
rsp
=
client
.
execute
(
req
,
dingToken
);
apiRespPdu
.
setCode
(
0
);
apiRespPdu
.
setData
(
rsp
.
getResult
());
apiRespPdu
.
setMsg
(
rsp
.
getMsg
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
apiRespPdu
.
setCode
(-
1
);
apiRespPdu
.
setData
(
null
);
apiRespPdu
.
setMsg
(
e
.
toString
());
}
return
apiRespPdu
;
}
}
}
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/dingtalk/config/TalkConfiguration.java
View file @
96b8a46f
...
@@ -19,19 +19,47 @@ public class TalkConfiguration {
...
@@ -19,19 +19,47 @@ public class TalkConfiguration {
@Value
(
"${dingtalk.agentId:''}"
)
@Value
(
"${dingtalk.agentId:''}"
)
private
String
getAgentId
;
private
String
getAgentId
;
/**
* appKey
*/
@Value
(
"${dingtalk.AppKey:''}"
)
private
String
AppKey
;
/**
* AppSecret
*/
@Value
(
"${dingtalk.AppSecret:''}"
)
private
String
AppSecret
;
/**
/**
* getToken
* getToken
*/
*/
@Value
(
"${dingtalk.gettoken:
''
}"
)
@Value
(
"${dingtalk.gettoken:
https://oapi.dingtalk.com/gettoken
}"
)
private
String
getTokneUrl
;
private
String
getTokneUrl
;
/**
/**
*
getbymobile
*
获取部门列表
*/
*/
@Value
(
"${dingtalk.
getbymobile:''
}"
)
@Value
(
"${dingtalk.
listsub:https://oapi.dingtalk.com/topapi/v2/department/listsub
}"
)
private
String
get
bymobile
;
private
String
get
SubList
;
/**
* 根据部门id获取用户详情列表
*/
@Value
(
"${dingtalk.getUserList:https://oapi.dingtalk.com/topapi/v2/user/list}"
)
private
String
getuserlist
;
/**
* 根据电话查询用户信息
*/
@Value
(
"${dingtalk.getbymobile:https://oapi.dingtalk.com/topapi/v2/user/getbymobile}"
)
private
String
getbymobile
;
/**
* 根据userid查询用户信息
*/
@Value
(
"${dingtalk.getuserinfo:https://oapi.dingtalk.com/topapi/v2/user/get}"
)
private
String
getuserinfo
;
/**
/**
* getDeptbyUser
* getDeptbyUser
*/
*/
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/dingtalk/req/UserPageReq.java
0 → 100644
View file @
96b8a46f
package
com.mortals.xhx.busiz.dingtalk.req
;
/**
* @author ZYW
* @date 2023-07-12 11:38
*/
public
class
UserPageReq
{
//部门id
private
Long
deptid
;
//起始页码
private
Long
cursor
;
//每页条数
private
Long
size
;
public
Long
getDeptid
()
{
return
deptid
;
}
public
void
setDeptid
(
Long
deptid
)
{
this
.
deptid
=
deptid
;
}
public
Long
getCursor
()
{
return
cursor
;
}
public
void
setCursor
(
Long
cursor
)
{
this
.
cursor
=
cursor
;
}
public
Long
getSize
()
{
return
size
;
}
public
void
setSize
(
Long
size
)
{
this
.
size
=
size
;
}
}
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/req/MobileReq.java
0 → 100644
View file @
96b8a46f
package
com.mortals.xhx.busiz.req
;
/**
* @author ZYW
* @date 2023-07-12 13:47
*/
public
class
MobileReq
{
String
mobile
;
public
String
getMobile
()
{
return
mobile
;
}
public
void
setMobile
(
String
mobile
)
{
this
.
mobile
=
mobile
;
}
}
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/model/vo/PerformDeptConfDetailVo.java
View file @
96b8a46f
...
@@ -13,6 +13,7 @@ import lombok.Data;
...
@@ -13,6 +13,7 @@ import lombok.Data;
@Data
@Data
public
class
PerformDeptConfDetailVo
extends
BaseEntityLong
{
public
class
PerformDeptConfDetailVo
extends
BaseEntityLong
{
/** 分类Id */
private
Long
categoryId
;
}
}
\ No newline at end of file
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/model/vo/PerformStaffConfDetailVo.java
View file @
96b8a46f
...
@@ -13,6 +13,7 @@ import lombok.Data;
...
@@ -13,6 +13,7 @@ import lombok.Data;
@Data
@Data
public
class
PerformStaffConfDetailVo
extends
BaseEntityLong
{
public
class
PerformStaffConfDetailVo
extends
BaseEntityLong
{
/** 分类Id */
private
Long
categoryId
;
}
}
\ No newline at end of file
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/service/impl/PerformDeptConfServiceImpl.java
View file @
96b8a46f
...
@@ -5,7 +5,9 @@ import com.mortals.xhx.module.dept.model.DeptEntity;
...
@@ -5,7 +5,9 @@ import com.mortals.xhx.module.dept.model.DeptEntity;
import
com.mortals.xhx.module.dept.service.DeptService
;
import
com.mortals.xhx.module.dept.service.DeptService
;
import
com.mortals.xhx.module.perform.model.PerformDeptConfDetailEntity
;
import
com.mortals.xhx.module.perform.model.PerformDeptConfDetailEntity
;
import
com.mortals.xhx.module.perform.model.PerformDeptConfDetailQuery
;
import
com.mortals.xhx.module.perform.model.PerformDeptConfDetailQuery
;
import
com.mortals.xhx.module.perform.model.PerformRulesCategoryEntity
;
import
com.mortals.xhx.module.perform.service.PerformDeptConfDetailService
;
import
com.mortals.xhx.module.perform.service.PerformDeptConfDetailService
;
import
com.mortals.xhx.module.perform.service.PerformRulesCategoryService
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -36,6 +38,8 @@ public class PerformDeptConfServiceImpl extends AbstractCRUDServiceImpl<PerformD
...
@@ -36,6 +38,8 @@ public class PerformDeptConfServiceImpl extends AbstractCRUDServiceImpl<PerformD
private
PerformDeptConfDetailService
performDeptConfDetailService
;
private
PerformDeptConfDetailService
performDeptConfDetailService
;
@Autowired
@Autowired
private
DeptService
deptService
;
private
DeptService
deptService
;
@Autowired
private
PerformRulesCategoryService
performRulesCategoryService
;
@Override
@Override
protected
void
findAfter
(
PerformDeptConfEntity
params
,
PageInfo
pageInfo
,
Context
context
,
List
<
PerformDeptConfEntity
>
list
)
throws
AppException
{
protected
void
findAfter
(
PerformDeptConfEntity
params
,
PageInfo
pageInfo
,
Context
context
,
List
<
PerformDeptConfEntity
>
list
)
throws
AppException
{
...
@@ -93,6 +97,10 @@ public class PerformDeptConfServiceImpl extends AbstractCRUDServiceImpl<PerformD
...
@@ -93,6 +97,10 @@ public class PerformDeptConfServiceImpl extends AbstractCRUDServiceImpl<PerformD
item
.
setCreateUser
(
entity
.
getCreateUser
());
item
.
setCreateUser
(
entity
.
getCreateUser
());
item
.
setDeptId
(
entity
.
getDeptId
());
item
.
setDeptId
(
entity
.
getDeptId
());
item
.
setDeptName
(
entity
.
getDeptName
());
item
.
setDeptName
(
entity
.
getDeptName
());
PerformRulesCategoryEntity
categoryEntity
=
performRulesCategoryService
.
get
(
item
.
getCategoryId
());
if
(
categoryEntity
!=
null
){
item
.
setCategoryName
(
categoryEntity
.
getName
());
}
item
.
setId
(
null
);
item
.
setId
(
null
);
}
}
performDeptConfDetailService
.
save
(
entity
.
getDeptConfDetail
(),
context
);
performDeptConfDetailService
.
save
(
entity
.
getDeptConfDetail
(),
context
);
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/service/impl/PerformStaffConfServiceImpl.java
View file @
96b8a46f
package
com.mortals.xhx.module.perform.service.impl
;
package
com.mortals.xhx.module.perform.service.impl
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.xhx.common.code.CheckTypeEnum
;
import
com.mortals.xhx.common.code.CheckTypeEnum
;
import
com.mortals.xhx.module.perform.model.*
;
import
com.mortals.xhx.module.perform.model.*
;
import
com.mortals.xhx.module.perform.service.PerformRulesCategoryService
;
import
com.mortals.xhx.module.perform.service.PerformStaffConfDetailService
;
import
com.mortals.xhx.module.perform.service.PerformStaffConfDetailService
;
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
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -30,52 +35,77 @@ public class PerformStaffConfServiceImpl extends AbstractCRUDServiceImpl<Perform
...
@@ -30,52 +35,77 @@ public class PerformStaffConfServiceImpl extends AbstractCRUDServiceImpl<Perform
@Autowired
@Autowired
private
PerformStaffConfDetailService
performStaffConfDetailService
;
private
PerformStaffConfDetailService
performStaffConfDetailService
;
@Autowired
private
StaffService
staffService
;
@Autowired
private
PerformRulesCategoryService
performRulesCategoryService
;
@Override
@Override
protected
void
saveBefore
(
PerformStaffConfEntity
entity
,
Context
context
)
throws
AppException
{
protected
void
saveBefore
(
PerformStaffConfEntity
entity
,
Context
context
)
throws
AppException
{
super
.
saveBefore
(
entity
,
context
);
super
.
saveBefore
(
entity
,
context
);
if
(
StringUtils
.
isNotEmpty
(
entity
.
getStaffIds
())){
List
<
Long
>
staffIdList
=
StringUtils
.
converStr2Long
(
entity
.
getStaffIds
());
StaffQuery
staffQuery
=
new
StaffQuery
();
staffQuery
.
setIdList
(
staffIdList
);
List
<
StaffEntity
>
staffEntityList
=
staffService
.
find
(
staffQuery
);
if
(
CollectionUtils
.
isNotEmpty
(
staffEntityList
)){
String
names
=
""
;
for
(
StaffEntity
item:
staffEntityList
){
names
+=
item
.
getName
()+
","
;
}
entity
.
setStaffNames
(
names
.
substring
(
0
,
names
.
length
()-
1
));
entity
.
setStaffCount
(
staffEntityList
.
size
());
}
else
{
entity
.
setStaffCount
(
0
);
}
}
if
(
CollectionUtils
.
isNotEmpty
(
entity
.
getStaffConfDetail
())){
if
(
CollectionUtils
.
isNotEmpty
(
entity
.
getStaffConfDetail
())){
//
Map<Integer,List<PerformStaffConfDetailEntity>> groupMap = entity.getStaffConfDetail().stream().collect(Collectors.groupingBy(PerformStaffConfDetailEntity::getType));
Map
<
Integer
,
List
<
PerformStaffConfDetailEntity
>>
groupMap
=
entity
.
getStaffConfDetail
().
stream
().
collect
(
Collectors
.
groupingBy
(
PerformStaffConfDetailEntity:
:
getType
));
//
if(groupMap.containsKey(CheckTypeEnum.考勤绩效.getValue())) {
if
(
groupMap
.
containsKey
(
CheckTypeEnum
.
考勤绩效
.
getValue
()))
{
//
entity.setAttendCount(groupMap.get(CheckTypeEnum.考勤绩效.getValue()).size());
entity
.
setAttendCount
(
groupMap
.
get
(
CheckTypeEnum
.
考勤绩效
.
getValue
()).
size
());
//
}else {
}
else
{
//
entity.setAttendCount(0);
entity
.
setAttendCount
(
0
);
//
}
}
//
if(groupMap.containsKey(CheckTypeEnum.评价绩效.getValue())) {
if
(
groupMap
.
containsKey
(
CheckTypeEnum
.
评价绩效
.
getValue
()))
{
//
entity.setAssessCount(groupMap.get(CheckTypeEnum.评价绩效.getValue()).size());
entity
.
setAssessCount
(
groupMap
.
get
(
CheckTypeEnum
.
评价绩效
.
getValue
()).
size
());
//
}else {
}
else
{
//
entity.setAssessCount(0);
entity
.
setAssessCount
(
0
);
//
}
}
//
if(groupMap.containsKey(CheckTypeEnum.办件绩效.getValue())) {
if
(
groupMap
.
containsKey
(
CheckTypeEnum
.
办件绩效
.
getValue
()))
{
//
entity.setWorkCount(groupMap.get(CheckTypeEnum.办件绩效.getValue()).size());
entity
.
setWorkCount
(
groupMap
.
get
(
CheckTypeEnum
.
办件绩效
.
getValue
()).
size
());
//
}else {
}
else
{
//
entity.setWorkCount(0);
entity
.
setWorkCount
(
0
);
//
}
}
//
if(groupMap.containsKey(CheckTypeEnum.效能绩效.getValue())) {
if
(
groupMap
.
containsKey
(
CheckTypeEnum
.
效能绩效
.
getValue
()))
{
//
entity.setEffectCount(groupMap.get(CheckTypeEnum.效能绩效.getValue()).size());
entity
.
setEffectCount
(
groupMap
.
get
(
CheckTypeEnum
.
效能绩效
.
getValue
()).
size
());
//
}else {
}
else
{
//
entity.setEffectCount(0);
entity
.
setEffectCount
(
0
);
//
}
}
//
if(groupMap.containsKey(CheckTypeEnum.其它绩效.getValue())) {
if
(
groupMap
.
containsKey
(
CheckTypeEnum
.
其它绩效
.
getValue
()))
{
//
entity.setOtherCount(groupMap.get(CheckTypeEnum.其它绩效.getValue()).size());
entity
.
setOtherCount
(
groupMap
.
get
(
CheckTypeEnum
.
其它绩效
.
getValue
()).
size
());
//
}else {
}
else
{
//
entity.setOtherCount(0);
entity
.
setOtherCount
(
0
);
//
}
}
}
}
}
}
@Override
@Override
protected
void
saveAfter
(
PerformStaffConfEntity
entity
,
Context
context
)
throws
AppException
{
protected
void
saveAfter
(
PerformStaffConfEntity
entity
,
Context
context
)
throws
AppException
{
if
(
CollectionUtils
.
isNotEmpty
(
entity
.
getStaffConfDetail
())){
if
(
CollectionUtils
.
isNotEmpty
(
entity
.
getStaffConfDetail
())){
// for(PerformStaffConfDetailEntity item:entity.getStaffConfDetail()){
for
(
PerformStaffConfDetailEntity
item:
entity
.
getStaffConfDetail
()){
// item.setStaffConfId(entity.getId());
item
.
setStaffConfId
(
entity
.
getId
());
// item.setCreateTime(entity.getCreateTime());
item
.
setCreateTime
(
entity
.
getCreateTime
());
// item.setCreateUser(entity.getCreateUser());
item
.
setCreateUser
(
entity
.
getCreateUser
());
// item.setStaffId(entity.getStaffId());
item
.
setId
(
null
);
// item.setStaffName(entity.getStaffName());
PerformRulesCategoryEntity
categoryEntity
=
performRulesCategoryService
.
get
(
item
.
getCategoryId
());
// item.setId(null);
if
(
categoryEntity
!=
null
){
// }
item
.
setCategoryName
(
categoryEntity
.
getName
());
// performDeptConfDetailService.save(entity.getDeptConfDetail(),context);
}
}
performStaffConfDetailService
.
save
(
entity
.
getStaffConfDetail
(),
context
);
}
}
}
}
...
@@ -88,4 +118,25 @@ public class PerformStaffConfServiceImpl extends AbstractCRUDServiceImpl<Perform
...
@@ -88,4 +118,25 @@ public class PerformStaffConfServiceImpl extends AbstractCRUDServiceImpl<Perform
}
}
}
}
}
}
@Override
public
PerformStaffConfEntity
get
(
Long
key
,
Context
context
)
throws
AppException
{
PerformStaffConfEntity
entity
=
this
.
dao
.
get
(
key
);
if
(
entity
!=
null
)
{
List
<
PerformStaffConfDetailEntity
>
detailEntityList
=
performStaffConfDetailService
.
find
(
new
PerformStaffConfDetailQuery
().
staffConfId
(
entity
.
getId
()));
entity
.
setStaffConfDetail
(
detailEntityList
);
}
return
entity
;
}
@Override
protected
void
removeAfter
(
Long
[]
ids
,
Context
context
,
int
result
)
throws
AppException
{
if
(
ids
!=
null
&&
ids
.
length
!=
0
){
for
(
Long
id:
ids
){
PerformStaffConfDetailEntity
condition
=
new
PerformStaffConfDetailEntity
();
condition
.
setStaffConfId
(
id
);
performStaffConfDetailService
.
remove
(
condition
,
context
);
}
}
}
}
}
\ 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