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
355de78b
Commit
355de78b
authored
Jul 14, 2023
by
廖旭伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
绩效规则分数统计
parent
789e712a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
88 additions
and
3 deletions
+88
-3
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/model/vo/PerformRulesVo.java
...m/mortals/xhx/module/perform/model/vo/PerformRulesVo.java
+2
-2
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/service/PerformRulesService.java
...rtals/xhx/module/perform/service/PerformRulesService.java
+12
-0
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/service/impl/PerformRulesServiceImpl.java
.../module/perform/service/impl/PerformRulesServiceImpl.java
+35
-0
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/web/PerformRulesController.java
...ortals/xhx/module/perform/web/PerformRulesController.java
+39
-1
No files found.
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/model/vo/PerformRulesVo.java
View file @
355de78b
...
...
@@ -12,7 +12,7 @@ import lombok.Data;
*/
@Data
public
class
PerformRulesVo
extends
BaseEntityLong
{
/** 类型名称 **/
private
String
typeName
;
}
\ No newline at end of file
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/service/PerformRulesService.java
View file @
355de78b
package
com.mortals.xhx.module.perform.service
;
import
com.mortals.framework.exception.AppException
;
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
;
import
java.util.List
;
import
java.util.Map
;
/**
* PerformRulesService
*
...
...
@@ -14,4 +19,11 @@ import com.mortals.xhx.module.perform.dao.PerformRulesDao;
public
interface
PerformRulesService
extends
ICRUDCacheService
<
PerformRulesEntity
,
Long
>
{
PerformRulesDao
getDao
();
/**
* 规则分数统计
* @return
* @throws AppException
*/
Map
<
String
,
Object
>
summaryRules
()
throws
AppException
;
}
\ No newline at end of file
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/service/impl/PerformRulesServiceImpl.java
View file @
355de78b
...
...
@@ -6,6 +6,7 @@ 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.CheckTypeEnum
;
import
com.mortals.xhx.common.code.CommentTypeEnum
;
import
com.mortals.xhx.common.code.PerformRulesTypeEnum
;
import
com.mortals.xhx.common.code.PerformTypeEnum
;
...
...
@@ -19,6 +20,13 @@ import com.mortals.xhx.module.perform.service.PerformRulesService;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.util.ObjectUtils
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
static
com
.
mortals
.
xhx
.
base
.
system
.
idgenerator
.
service
.
impl
.
IdgeneratorServiceImpl
.
IdGeneratorKey
.*;
/**
...
...
@@ -93,4 +101,31 @@ public class PerformRulesServiceImpl extends AbstractCRUDCacheServiceImpl<Perfor
System
.
out
.
println
(
PinyinUtil
.
getFirstLetter
(
str
,
""
));
}
@Override
public
Map
<
String
,
Object
>
summaryRules
()
throws
AppException
{
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
List
<
PerformRulesEntity
>
all
=
this
.
getAllList
();
List
<
PerformRulesEntity
>
resultList
=
new
ArrayList
<>();
BigDecimal
totalScore
=
new
BigDecimal
(
0
);
Map
<
Integer
,
List
<
PerformRulesEntity
>>
groupMap
=
all
.
stream
().
collect
(
Collectors
.
groupingBy
(
PerformRulesEntity:
:
getType
));
for
(
Map
.
Entry
<
Integer
,
List
<
PerformRulesEntity
>>
entry:
groupMap
.
entrySet
()){
BigDecimal
sum
=
new
BigDecimal
(
0
);
for
(
PerformRulesEntity
item:
entry
.
getValue
()){
sum
=
sum
.
add
(
item
.
getScore
());
}
PerformRulesEntity
entity
=
new
PerformRulesEntity
();
entity
.
setType
(
entry
.
getKey
());
CheckTypeEnum
type
=
CheckTypeEnum
.
getByValue
(
entry
.
getKey
());
if
(
type
!=
null
){
entity
.
setTypeName
(
type
.
getDesc
());
}
entity
.
setScore
(
sum
);
totalScore
=
totalScore
.
add
(
sum
);
resultList
.
add
(
entity
);
}
resultMap
.
put
(
"totalScore"
,
totalScore
);
resultMap
.
put
(
"list"
,
resultList
);
return
resultMap
;
}
}
\ No newline at end of file
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/web/PerformRulesController.java
View file @
355de78b
package
com.mortals.xhx.module.perform.web
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.OrderCol
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.Result
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.base.system.user.model.UserQuery
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
com.mortals.xhx.common.code.CheckTypeEnum
;
import
com.mortals.xhx.module.perform.model.PerformRulesCategoryQuery
;
import
com.mortals.xhx.module.perform.model.PerformRulesEntity
;
import
com.mortals.xhx.module.perform.service.PerformRulesCategoryService
;
import
com.mortals.xhx.module.perform.service.PerformRulesService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.ObjectUtils
;
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
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
java
.
util
.
stream
.
Collectors
.
toMap
;
...
...
@@ -47,7 +56,7 @@ public class PerformRulesController extends BaseCRUDJsonBodyMappingController<Pe
protected
void
init
(
Map
<
String
,
Object
>
model
,
Context
context
)
{
this
.
addDict
(
model
,
"subAddType"
,
paramService
.
getParamBySecondOrganize
(
"PerformRules"
,
"subAddType"
));
this
.
addDict
(
model
,
"assoOwner"
,
paramService
.
getParamBySecondOrganize
(
"PerformRules"
,
"assoOwner"
));
this
.
addDict
(
model
,
"type"
,
paramService
.
getParamBySecondOrganize
(
"PerformRules"
,
"type"
));
this
.
addDict
(
model
,
"type"
,
CheckTypeEnum
.
getEnumMap
(
));
this
.
addDict
(
model
,
"categoryId"
,
categoryService
.
find
(
new
PerformRulesCategoryQuery
()).
stream
().
collect
(
toMap
(
x
->
x
.
getId
().
toString
(),
y
->
y
.
getName
(),
(
o
,
n
)
->
n
)));
this
.
addDict
(
model
,
"createUserId"
,
userService
.
find
(
new
UserQuery
()).
stream
().
collect
(
toMap
(
x
->
x
.
getId
().
toString
(),
y
->
y
.
getRealName
(),
(
o
,
n
)
->
n
)));
super
.
init
(
model
,
context
);
...
...
@@ -58,4 +67,33 @@ public class PerformRulesController extends BaseCRUDJsonBodyMappingController<Pe
super
.
doListBefore
(
query
,
model
,
context
);
query
.
setOrderColList
(
Arrays
.
asList
(
new
OrderCol
(
"createTime"
,
OrderCol
.
DESCENDING
)));
}
@PostMapping
({
"summary"
})
@UnAuth
public
Rest
<
Object
>
summary
()
{
Rest
<
Object
>
ret
=
new
Rest
();
Map
<
String
,
Object
>
model
=
new
HashMap
();
Context
context
=
this
.
getContext
();
String
busiDesc
=
"查询规则分数统计"
;
int
code
=
1
;
try
{
Map
<
String
,
Object
>
result
=
this
.
getService
().
summaryRules
();
model
.
put
(
"data"
,
result
);
model
.
put
(
"message_info"
,
busiDesc
+
"成功"
);
if
(!
ObjectUtils
.
isEmpty
(
context
)
&&
!
ObjectUtils
.
isEmpty
(
context
.
getUser
()))
{
this
.
recordSysLog
(
this
.
request
,
busiDesc
+
" 【成功】"
);
}
}
catch
(
Exception
var9
)
{
code
=
-
1
;
this
.
doException
(
this
.
request
,
busiDesc
,
model
,
var9
);
}
this
.
init
(
model
,
context
);
ret
.
setCode
(
code
);
ret
.
setData
(
model
.
get
(
"data"
));
ret
.
setDict
(
model
.
get
(
"dict"
));
ret
.
setMsg
(
model
.
get
(
"message_info"
)
==
null
?
""
:
model
.
remove
(
"message_info"
).
toString
());
return
ret
;
}
}
\ 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