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
24cdb527
Commit
24cdb527
authored
Jul 10, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加规则编码实现
parent
61ab114c
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
340 additions
and
23 deletions
+340
-23
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/req/PerformSaveReq.java
...c/main/java/com/mortals/xhx/busiz/req/PerformSaveReq.java
+39
-0
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/web/ApiWebPerformController.java
...va/com/mortals/xhx/busiz/web/ApiWebPerformController.java
+124
-0
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/web/AppealApiController.java
...n/java/com/mortals/xhx/busiz/web/AppealApiController.java
+0
-13
attendance-performance-manager/src/main/java/com/mortals/xhx/common/code/CheckResultEnum.java
...ain/java/com/mortals/xhx/common/code/CheckResultEnum.java
+65
-0
attendance-performance-manager/src/main/java/com/mortals/xhx/common/code/PerformRulesTypeEnum.java
...ava/com/mortals/xhx/common/code/PerformRulesTypeEnum.java
+65
-0
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/service/PerformRulesService.java
...rtals/xhx/module/perform/service/PerformRulesService.java
+2
-1
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/service/impl/PerformRulesServiceImpl.java
.../module/perform/service/impl/PerformRulesServiceImpl.java
+45
-9
No files found.
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/req/PerformSaveReq.java
0 → 100644
View file @
24cdb527
package
com.mortals.xhx.busiz.req
;
import
com.mortals.xhx.busiz.BaseReq
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.Date
;
@Data
public
class
PerformSaveReq
extends
BaseReq
{
/**
* 工号
*/
private
String
workNum
;
/**
* 标题
*/
private
String
title
;
/**
* 扣分时间
*/
private
Date
happenTime
;
/**
* 规则编码
*/
private
String
ruleCode
;
/**
* 类型
*/
private
String
performType
;
}
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/web/ApiWebPerformController.java
0 → 100644
View file @
24cdb527
package
com.mortals.xhx.busiz.web
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.xhx.base.framework.annotation.ApiUserAuth
;
import
com.mortals.xhx.busiz.req.PerformReq
;
import
com.mortals.xhx.busiz.req.PerformSaveReq
;
import
com.mortals.xhx.busiz.rsp.ApiResp
;
import
com.mortals.xhx.common.code.ApiRespCodeEnum
;
import
com.mortals.xhx.common.code.PerformTypeEnum
;
import
com.mortals.xhx.module.perform.service.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
@RestController
@Slf4j
@RequestMapping
(
"/api/v1/web/perform"
)
public
class
ApiWebPerformController
extends
AbstractBaseController
<
PerformReq
>
{
@Autowired
private
PerformAttendRecordService
attendRecordService
;
@Autowired
private
PerformReviewRecordService
reviewRecordService
;
@Autowired
private
PerformComplainRecordService
complainRecordService
;
@Autowired
private
PerformGoworkRecordService
performGoworkRecordService
;
@Autowired
private
PerformEffectRecordService
effectRecordService
;
@Autowired
private
PerformOtherRecordService
otherRecordService
;
@Autowired
private
PerformRulesService
rulesService
;
/**
* 绩效外部新增
*
* @param req
* @return
*/
@PostMapping
(
"save"
)
@ApiUserAuth
public
String
receive
(
HttpServletRequest
request
,
@RequestBody
PerformSaveReq
req
)
{
ApiResp
<
String
>
rsp
=
new
ApiResp
<>();
rsp
.
setMsg
(
ApiRespCodeEnum
.
SUCCESS
.
getLabel
());
rsp
.
setCode
(
ApiRespCodeEnum
.
SUCCESS
.
getValue
());
StringBuilder
message
=
new
StringBuilder
();
message
.
append
(
String
.
format
(
"【外部请求】类型【%s】 内容:%s"
,
PerformTypeEnum
.
getByValue
(
req
.
getPerformType
()).
getDesc
(),
JSONObject
.
toJSONString
(
req
)));
recordSysLog
(
request
,
message
.
toString
());
try
{
switch
(
PerformTypeEnum
.
getByValue
(
req
.
getPerformType
()))
{
case
考勤绩效:
attend
(
req
);
break
;
case
评价差评绩效:
review
(
req
);
break
;
case
评价投诉绩效:
complain
(
req
);
break
;
case
办件绩效:
gowork
(
req
);
break
;
case
效能绩效:
effect
(
req
);
break
;
case
其它绩效:
other
(
req
);
break
;
}
}
catch
(
AppException
e
)
{
log
.
error
(
"接收数据失败"
,
e
);
rsp
.
setCode
(
e
.
getCode
());
rsp
.
setMsg
(
e
.
getMessage
());
return
JSON
.
toJSONString
(
rsp
);
}
catch
(
Exception
e
)
{
log
.
error
(
"接收数据失败"
,
e
);
rsp
.
setCode
(
ApiRespCodeEnum
.
FAILED
.
getValue
());
rsp
.
setMsg
(
e
.
getMessage
());
return
JSON
.
toJSONString
(
rsp
);
}
log
.
info
(
"响应【设备接收】【响应体】--> "
+
JSONObject
.
toJSONString
(
rsp
));
return
JSON
.
toJSONString
(
rsp
);
}
private
void
attend
(
PerformSaveReq
req
)
throws
AppException
{
//考勤保存
}
private
void
review
(
PerformSaveReq
req
)
throws
AppException
{
//评价保存
}
private
void
complain
(
PerformSaveReq
req
)
throws
AppException
{
//投诉保存
}
private
void
gowork
(
PerformSaveReq
req
)
throws
AppException
{
//办件保存
}
private
void
effect
(
PerformSaveReq
req
)
throws
AppException
{
//效能保存
}
private
void
other
(
PerformSaveReq
req
)
throws
AppException
{
//其它保存
}
public
static
void
main
(
String
[]
args
)
{
}
}
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/web/AppealApiController.java
View file @
24cdb527
...
...
@@ -55,19 +55,6 @@ import static com.mortals.xhx.common.key.ErrorCode.ERROR_TOKEN_EXPIRED_CONTENT;
@RequestMapping
(
"/api/v1/appeal"
)
public
class
AppealApiController
extends
AbstractBaseController
<
PerformReq
>
{
// @Autowired
// private CheckAttendRecordService checkAttendRecordService;
// @Autowired
// private CheckReviewRecordService checkReviewRecordService;
// @Autowired
// private CheckComplainRecordService checkComplainRecordService;
// @Autowired
// private CheckEffectRecordService checkEffectRecordService;
// @Autowired
// private CheckGoworkRecordService checkGoworkRecordService;
// @Autowired
// private CheckOtherRecordService checkOtherRecordService;
@Autowired
private
PerformAttendAppealService
attendAppealService
;
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/common/code/CheckResultEnum.java
0 → 100644
View file @
24cdb527
package
com.mortals.xhx.common.code
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
/**
* 核查结果(1.加分或扣分,2.不扣分)枚举类
*
* @author zxfei
*/
public
enum
CheckResultEnum
{
加分或扣分
(
"加分或扣分"
,
"加分或扣分"
),
不扣分
(
"不扣分"
,
"不扣分"
);
private
String
value
;
private
String
desc
;
CheckResultEnum
(
String
value
,
String
desc
)
{
this
.
value
=
value
;
this
.
desc
=
desc
;
}
public
String
getValue
()
{
return
this
.
value
;
}
public
String
getDesc
()
{
return
this
.
desc
;
}
public
static
CheckResultEnum
getByValue
(
String
value
)
{
for
(
CheckResultEnum
checkResultEnum
:
CheckResultEnum
.
values
())
{
if
(
checkResultEnum
.
getValue
()
==
value
)
{
return
checkResultEnum
;
}
}
return
null
;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public
static
Map
<
String
,
String
>
getEnumMap
(
String
...
eItem
)
{
Map
<
String
,
String
>
resultMap
=
new
LinkedHashMap
<>();
for
(
CheckResultEnum
item
:
CheckResultEnum
.
values
())
{
try
{
boolean
hasE
=
false
;
for
(
String
e
:
eItem
)
{
if
(
item
.
getValue
()
==
e
)
{
hasE
=
true
;
break
;
}
}
if
(!
hasE
)
{
resultMap
.
put
(
item
.
getValue
()
+
""
,
item
.
getDesc
());
}
}
catch
(
Exception
ex
)
{
}
}
return
resultMap
;
}
}
\ No newline at end of file
attendance-performance-manager/src/main/java/com/mortals/xhx/common/code/PerformRulesTypeEnum.java
0 → 100644
View file @
24cdb527
package
com.mortals.xhx.common.code
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
public
enum
PerformRulesTypeEnum
{
考勤绩效
(
1
,
"attend"
),
评价差评绩效
(
2
,
"review"
),
评价投诉绩效
(
3
,
"complain"
),
办件绩效
(
4
,
"gowork"
),
效能绩效
(
5
,
"effect"
),
其它绩效
(
1
,
"other"
);
private
Integer
value
;
private
String
desc
;
PerformRulesTypeEnum
(
Integer
value
,
String
desc
)
{
this
.
value
=
value
;
this
.
desc
=
desc
;
}
public
Integer
getValue
()
{
return
this
.
value
;
}
public
String
getDesc
()
{
return
this
.
desc
;
}
public
static
PerformRulesTypeEnum
getByValue
(
Integer
value
)
{
for
(
PerformRulesTypeEnum
partAttendanceEnum
:
PerformRulesTypeEnum
.
values
())
{
if
(
partAttendanceEnum
.
getValue
()
==
value
)
{
return
partAttendanceEnum
;
}
}
return
null
;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public
static
Map
<
String
,
String
>
getEnumMap
(
Integer
...
eItem
)
{
Map
<
String
,
String
>
resultMap
=
new
LinkedHashMap
<>();
for
(
PerformRulesTypeEnum
item
:
PerformRulesTypeEnum
.
values
())
{
try
{
boolean
hasE
=
false
;
for
(
Integer
e
:
eItem
)
{
if
(
item
.
getValue
()
==
e
)
{
hasE
=
true
;
break
;
}
}
if
(!
hasE
)
{
resultMap
.
put
(
item
.
getValue
()
+
""
,
item
.
getDesc
());
}
}
catch
(
Exception
ex
)
{
}
}
return
resultMap
;
}
}
\ No newline at end of file
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/service/PerformRulesService.java
View file @
24cdb527
package
com.mortals.xhx.module.perform.service
;
import
com.mortals.framework.service.ICRUDCacheService
;
import
com.mortals.framework.service.ICRUDService
;
import
com.mortals.xhx.module.perform.model.PerformRulesEntity
;
import
com.mortals.xhx.module.perform.dao.PerformRulesDao
;
...
...
@@ -10,7 +11,7 @@ import com.mortals.xhx.module.perform.dao.PerformRulesDao;
* @author zxfei
* @date 2023-05-16
*/
public
interface
PerformRulesService
extends
ICRUD
Service
<
PerformRulesEntity
,
Long
>
{
public
interface
PerformRulesService
extends
ICRUD
CacheService
<
PerformRulesEntity
,
Long
>
{
PerformRulesDao
getDao
();
}
\ No newline at end of file
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/service/impl/PerformRulesServiceImpl.java
View file @
24cdb527
package
com.mortals.xhx.module.perform.service.impl
;
import
cn.hutool.core.util.CharUtil
;
import
cn.hutool.core.util.ReUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.extra.pinyin.PinyinUtil
;
import
com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl
;
import
com.mortals.xhx.common.code.PerformRulesTypeEnum
;
import
com.mortals.xhx.common.code.PerformTypeEnum
;
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.PerformRulesDao
;
import
com.mortals.xhx.module.perform.model.PerformRulesEntity
;
import
com.mortals.xhx.module.perform.service.PerformRulesService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.util.ObjectUtils
;
/**
* PerformRulesService
* 绩效规则信息 service实现
*
* @author zxfei
* @date 2023-05-16
*/
* PerformRulesService
* 绩效规则信息 service实现
*
* @author zxfei
* @date 2023-05-16
*/
@Service
(
"performRulesService"
)
@Slf4j
public
class
PerformRulesServiceImpl
extends
AbstractCRUDServiceImpl
<
PerformRulesDao
,
PerformRulesEntity
,
Long
>
implements
PerformRulesService
{
public
class
PerformRulesServiceImpl
extends
AbstractCRUDCacheServiceImpl
<
PerformRulesDao
,
PerformRulesEntity
,
Long
>
implements
PerformRulesService
{
@Override
protected
String
getExtKey
(
PerformRulesEntity
data
)
{
return
data
.
getRuleCode
();
}
@Override
protected
void
saveBefore
(
PerformRulesEntity
entity
,
Context
context
)
throws
AppException
{
if
(
ObjectUtils
.
isEmpty
(
entity
.
getRuleCode
()))
{
//自定义默认规则code
String
ruleCode
=
PerformRulesTypeEnum
.
getByValue
(
entity
.
getType
()).
getDesc
()
+
"_"
+
PinyinUtil
.
getFirstLetter
(
ReUtil
.
replaceAll
(
entity
.
getName
(),
"[^\\u4E00-\\u9FA5]"
,
""
),
""
);
entity
.
setRuleCode
(
ruleCode
);
}
super
.
saveBefore
(
entity
,
context
);
}
public
static
void
main
(
String
[]
args
)
{
String
str
=
"评价器评议、短信、电话回访等结果经核实为“不满意”的/次"
;
str
=
ReUtil
.
replaceAll
(
str
,
"[^\\u4E00-\\u9FA5]"
,
""
);
System
.
out
.
println
(
PinyinUtil
.
getPinyin
(
str
));
System
.
out
.
println
(
PinyinUtil
.
getPinyin
(
str
,
""
));
System
.
out
.
println
(
PinyinUtil
.
getFirstLetter
(
str
,
""
));
}
}
\ 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