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
fdd6f655
Commit
fdd6f655
authored
Jul 10, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加规则编码实现
parent
24cdb527
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
109 additions
and
3 deletions
+109
-3
attendance-performance-manager/src/main/java/com/mortals/xhx/base/system/idgenerator/service/impl/IdgeneratorServiceImpl.java
...stem/idgenerator/service/impl/IdgeneratorServiceImpl.java
+44
-0
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/web/TestController.java
...c/main/java/com/mortals/xhx/busiz/web/TestController.java
+17
-1
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/service/impl/PerformRulesServiceImpl.java
.../module/perform/service/impl/PerformRulesServiceImpl.java
+42
-1
attendance-performance-manager/src/test/java/com/mortals/httpclient/system.http
...-manager/src/test/java/com/mortals/httpclient/system.http
+6
-1
No files found.
attendance-performance-manager/src/main/java/com/mortals/xhx/base/system/idgenerator/service/impl/IdgeneratorServiceImpl.java
View file @
fdd6f655
...
...
@@ -56,6 +56,14 @@ public class IdgeneratorServiceImpl implements IdgeneratorService {
*/
INFO_VERSION_KEY
(
50L
,
"getInfoVersion"
,
null
),
ATTEND_KEY
(
50L
,
"attend"
,
null
),
REVIEW_KEY
(
50L
,
"review"
,
null
),
COMPLAIN_KEY
(
50L
,
"complain"
,
null
),
GOWORK_KEY
(
50L
,
"gowork"
,
null
),
EFFECT_KEY
(
50L
,
"effect"
,
null
),
OTHER_KEY
(
50L
,
"other"
,
null
),
/** 空,测试用 */
DUMMY
(
DEFAULT_STEP
,
""
,
null
),
;
...
...
@@ -125,6 +133,42 @@ public class IdgeneratorServiceImpl implements IdgeneratorService {
}
}
private
Long
attend
()
{
synchronized
(
IdGeneratorKey
.
ATTEND_KEY
)
{
return
getNextSequenceId
(
IdGeneratorKey
.
ATTEND_KEY
,
null
);
}
}
private
Long
review
()
{
synchronized
(
IdGeneratorKey
.
REVIEW_KEY
)
{
return
getNextSequenceId
(
IdGeneratorKey
.
REVIEW_KEY
,
null
);
}
}
private
Long
complain
()
{
synchronized
(
IdGeneratorKey
.
COMPLAIN_KEY
)
{
return
getNextSequenceId
(
IdGeneratorKey
.
COMPLAIN_KEY
,
null
);
}
}
private
Long
gowork
()
{
synchronized
(
IdGeneratorKey
.
GOWORK_KEY
)
{
return
getNextSequenceId
(
IdGeneratorKey
.
GOWORK_KEY
,
null
);
}
}
private
Long
effect
()
{
synchronized
(
IdGeneratorKey
.
EFFECT_KEY
)
{
return
getNextSequenceId
(
IdGeneratorKey
.
EFFECT_KEY
,
null
);
}
}
private
Long
other
()
{
synchronized
(
IdGeneratorKey
.
OTHER_KEY
)
{
return
getNextSequenceId
(
IdGeneratorKey
.
OTHER_KEY
,
null
);
}
}
// *******************************************************************************
/**
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/web/TestController.java
View file @
fdd6f655
package
com.mortals.xhx.busiz.web
;
import
com.mortals.xhx.base.system.idgenerator.service.IdgeneratorService
;
import
com.mortals.xhx.base.system.idgenerator.service.impl.IdgeneratorServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -17,6 +20,9 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping
(
"/test"
)
public
class
TestController
{
@Autowired
private
IdgeneratorService
idgeneratorService
;
@GetMapping
(
"webservice"
)
public
String
webservice
()
{
log
.
info
(
"测试"
);
...
...
@@ -24,6 +30,16 @@ public class TestController {
return
"ok"
;
}
@GetMapping
(
"idGens"
)
public
String
idGens
()
{
log
.
info
(
"测试id生成"
);
String
stringId
=
idgeneratorService
.
getLongId
(
IdgeneratorServiceImpl
.
IdGeneratorKey
.
EFFECT
).
toString
();
return
stringId
;
}
public
static
void
main
(
String
[]
args
)
{
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/service/impl/PerformRulesServiceImpl.java
View file @
fdd6f655
...
...
@@ -5,8 +5,11 @@ 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.base.system.idgenerator.service.IdgeneratorService
;
import
com.mortals.xhx.common.code.CommentTypeEnum
;
import
com.mortals.xhx.common.code.PerformRulesTypeEnum
;
import
com.mortals.xhx.common.code.PerformTypeEnum
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
...
...
@@ -16,6 +19,8 @@ import com.mortals.xhx.module.perform.service.PerformRulesService;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.util.ObjectUtils
;
import
static
com
.
mortals
.
xhx
.
base
.
system
.
idgenerator
.
service
.
impl
.
IdgeneratorServiceImpl
.
IdGeneratorKey
.*;
/**
* PerformRulesService
* 绩效规则信息 service实现
...
...
@@ -26,6 +31,10 @@ import org.springframework.util.ObjectUtils;
@Service
(
"performRulesService"
)
@Slf4j
public
class
PerformRulesServiceImpl
extends
AbstractCRUDCacheServiceImpl
<
PerformRulesDao
,
PerformRulesEntity
,
Long
>
implements
PerformRulesService
{
@Autowired
private
IdgeneratorService
idgeneratorService
;
@Override
protected
String
getExtKey
(
PerformRulesEntity
data
)
{
return
data
.
getRuleCode
();
...
...
@@ -34,8 +43,40 @@ public class PerformRulesServiceImpl extends AbstractCRUDCacheServiceImpl<Perfor
@Override
protected
void
saveBefore
(
PerformRulesEntity
entity
,
Context
context
)
throws
AppException
{
if
(
ObjectUtils
.
isEmpty
(
entity
.
getRuleCode
()))
{
String
ruleCode
=
""
;
/*
if (PerformRulesTypeEnum.考勤绩效.getValue() == entity.getType()) {
ruleCode = PerformRulesTypeEnum.getByValue(entity.getType()).getDesc().toUpperCase() + "_" + idgeneratorService.getLongId(ATTEND_KEY);
}
*/
switch
(
PerformRulesTypeEnum
.
getByValue
(
entity
.
getType
()))
{
case
考勤绩效:
ruleCode
=
PerformRulesTypeEnum
.
getByValue
(
entity
.
getType
()).
getDesc
().
toUpperCase
()
+
"_"
+
idgeneratorService
.
getLongId
(
ATTEND_KEY
);
break
;
case
评价差评绩效:
ruleCode
=
PerformRulesTypeEnum
.
getByValue
(
entity
.
getType
()).
getDesc
().
toUpperCase
()
+
"_"
+
idgeneratorService
.
getLongId
(
REVIEW_KEY
);
break
;
case
评价投诉绩效:
ruleCode
=
PerformRulesTypeEnum
.
getByValue
(
entity
.
getType
()).
getDesc
().
toUpperCase
()
+
"_"
+
idgeneratorService
.
getLongId
(
COMPLAIN_KEY
);
break
;
case
办件绩效:
ruleCode
=
PerformRulesTypeEnum
.
getByValue
(
entity
.
getType
()).
getDesc
().
toUpperCase
()
+
"_"
+
idgeneratorService
.
getLongId
(
GOWORK_KEY
);
break
;
case
效能绩效:
ruleCode
=
PerformRulesTypeEnum
.
getByValue
(
entity
.
getType
()).
getDesc
().
toUpperCase
()
+
"_"
+
idgeneratorService
.
getLongId
(
EFFECT_KEY
);
break
;
case
其它绩效:
ruleCode
=
PerformRulesTypeEnum
.
getByValue
(
entity
.
getType
()).
getDesc
().
toUpperCase
()
+
"_"
+
idgeneratorService
.
getLongId
(
OTHER_KEY
);
break
;
default
:
throw
new
AppException
(
"绩效类型不支持!"
);
}
//自定义默认规则code
String
ruleCode
=
PerformRulesTypeEnum
.
getByValue
(
entity
.
getType
()).
getDesc
()
+
"_"
+
PinyinUtil
.
getFirstLetter
(
ReUtil
.
replaceAll
(
entity
.
getName
(),
"[^\\u4E00-\\u9FA5]"
,
""
),
""
);
//PerformTypeEnum
// String ruleCode = PerformRulesTypeEnum.getByValue(entity.getType()).getDesc() + "_" + PinyinUtil.getFirstLetter(ReUtil.replaceAll(entity.getName(), "[^\\u4E00-\\u9FA5]", ""), "");
//String ruleCode = PerformRulesTypeEnum.getByValue(entity.getType()).getDesc().toUpperCase() + "_" + idgeneratorService.getLongId();
entity
.
setRuleCode
(
ruleCode
);
}
...
...
attendance-performance-manager/src/test/java/com/mortals/httpclient/system.http
View file @
fdd6f655
...
...
@@ -32,8 +32,13 @@ GET {{baseUrl}}/sms/set/edit?id={{SmsSet_id}}
Accept: application/json
###id生成
GET {{baseUrl}}/test/idGens
Accept: application/json
###短信设置删除
GET {{baseUrl}}/
sms
/set/delete?id={{SmsSet_id}}
GET {{baseUrl}}/
att
/set/delete?id={{SmsSet_id}}
Accept: application/json
...
...
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