Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
indicators
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhangkb
indicators
Commits
b1ffbd58
Commit
b1ffbd58
authored
Jul 28, 2020
by
zhangkb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加操作日志代码
parent
d68ba542
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
1 deletion
+63
-1
DriveIndCalResultCtrl.java
...obile/indicators/api/hytobacco/DriveIndCalResultCtrl.java
+8
-0
IndicatorsDefCtrl.java
...keymobile/indicators/api/hytobacco/IndicatorsDefCtrl.java
+7
-0
Constants.java
...ain/java/com/keymobile/indicators/constant/Constants.java
+4
-0
LogManager.java
src/main/java/com/keymobile/indicators/utils/LogManager.java
+7
-1
ModelPathEnum.java
...in/java/com/keymobile/indicators/utils/ModelPathEnum.java
+31
-0
logback-custom.xml
src/main/resources/logback-custom.xml
+6
-0
No files found.
src/main/java/com/keymobile/indicators/api/hytobacco/DriveIndCalResultCtrl.java
View file @
b1ffbd58
...
...
@@ -10,10 +10,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.keymobile.indicators.constant.Constants
;
import
com.keymobile.indicators.model.entity.indicators.CompareUnitDef
;
import
com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef
;
import
com.keymobile.indicators.service.hytobacco.CompareUnitCalLogService
;
import
com.keymobile.indicators.service.hytobacco.DriveIndCalResultService
;
import
com.keymobile.indicators.utils.LogManager
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -36,6 +38,12 @@ public class DriveIndCalResultCtrl {
@ApiOperation
(
value
=
"对标单元综合计算"
,
notes
=
"对标单元综合计算"
)
@PostMapping
(
value
=
"/compareUnitListCal"
)
public
void
compareUnitListCal
(
@RequestBody
List
<
CompareUnitDef
>
compareUnitList
)
{
StringBuilder
compUnitDefString
=
new
StringBuilder
(
""
);
for
(
CompareUnitDef
compUnitDef
:
compareUnitList
)
{
compUnitDefString
.
append
(
compUnitDef
.
getCompareId
()).
append
(
";"
);
}
LogManager
.
logInfo
(
Constants
.
LOG_INDICATOR_UNIT_CAL_API
,
"执行对标单元id:{},日期:{} 的计算"
,
compUnitDefString
.
toString
(),
compareUnitList
.
get
(
0
).
getDate
());
driveIndCalResultService
.
compareUnitListCal
(
compareUnitList
);
}
...
...
src/main/java/com/keymobile/indicators/api/hytobacco/IndicatorsDefCtrl.java
View file @
b1ffbd58
...
...
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.keymobile.indicators.constant.Constants
;
import
com.keymobile.indicators.model.entity.indicators.BaseIndDef
;
import
com.keymobile.indicators.model.entity.indicators.BaseIndDefVersionData
;
import
com.keymobile.indicators.model.entity.indicators.DriveIndDef
;
...
...
@@ -18,6 +19,7 @@ import com.keymobile.indicators.service.hytobacco.BaseIndDefService;
import
com.keymobile.indicators.service.hytobacco.BaseIndDefVersionService
;
import
com.keymobile.indicators.service.hytobacco.DriveIndDefService
;
import
com.keymobile.indicators.service.hytobacco.DriveIndDefVersionService
;
import
com.keymobile.indicators.utils.LogManager
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -58,6 +60,11 @@ public class IndicatorsDefCtrl {
@RequestParam
String
catalogIdPath
,
@RequestParam
String
user
,
@RequestParam
String
isUpdate
,
@RequestParam
String
code
)
throws
Exception
{
baseIndDefService
.
saveOrUpdate
(
baseIndDef
,
catalogId
,
catalogIdPath
,
user
,
isUpdate
,
code
);
if
(
"0"
.
equals
(
isUpdate
))
{
LogManager
.
logInfo
(
Constants
.
LOG_INDICATOR_BASE_INDI_API
,
"新增基础项:{}"
,
baseIndDef
.
getIndName
());
}
else
{
LogManager
.
logInfo
(
Constants
.
LOG_INDICATOR_BASE_INDI_API
,
"修改基础项:{}"
,
baseIndDef
.
getIndName
());
}
}
@ApiOperation
(
value
=
"删除基础指标"
,
notes
=
"删除基础指标"
)
...
...
src/main/java/com/keymobile/indicators/constant/Constants.java
View file @
b1ffbd58
...
...
@@ -10,6 +10,10 @@ public class Constants {
*/
public
static
final
String
LOG_CONTEXT_API
=
"indicator.operate"
;
public
static
final
String
LOG_INDICATOR_UNIT_CAL_API
=
"indicator.unit.cal"
;
public
static
final
String
LOG_INDICATOR_BASE_INDI_API
=
"indicator.base.indi"
;
/** collection Name */
/** collection Name */
...
...
src/main/java/com/keymobile/indicators/utils/LogManager.java
View file @
b1ffbd58
...
...
@@ -78,7 +78,7 @@ public class LogManager {
message
=
StringUtils
.
replace
(
message
,
"{}"
,
"%s"
);
message
=
String
.
format
(
message
,
objects
);
if
(
logger
.
isInfoEnabled
())
{
logger
.
info
(
message
,
getUser
(),
getSessionId
(),
ip
);
logger
.
info
(
message
,
getUser
(),
getSessionId
(),
ip
,
getMenuPath
(
context
));
}
}
...
...
@@ -162,4 +162,10 @@ public class LogManager {
return
SystemUserUtil
.
getCurrentUser
();
}
/**
* 获取模块路径
*/
public
static
String
getMenuPath
(
String
context
)
{
return
ModelPathEnum
.
getModelPath
(
context
);
}
}
src/main/java/com/keymobile/indicators/utils/ModelPathEnum.java
0 → 100644
View file @
b1ffbd58
package
com
.
keymobile
.
indicators
.
utils
;
public
enum
ModelPathEnum
{
LOG_CONTEXT_API
(
"indicator.operate"
,
"数据填报/数据填报"
),
LOG_INDICATOR_UNIT_CAL_API
(
"indicator.unit.cal"
,
"数据填报/数据运算"
),
LOG_INDICATOR_BASE_INDI_API
(
"indicator.base.indi"
,
"规则管理/数据项管理"
);
private
String
modelName
;
private
String
modelPath
;
private
ModelPathEnum
(
String
modelName
,
String
modelPath
)
{
this
.
modelName
=
modelName
;
this
.
modelPath
=
modelPath
;
}
public
static
String
getModelPath
(
String
modelName
)
{
for
(
ModelPathEnum
path
:
ModelPathEnum
.
values
())
{
if
(
modelName
.
equals
(
path
.
getModelName
()))
{
return
path
.
getModelPath
();
}
}
return
null
;
}
public
String
getModelName
()
{
return
modelName
;
}
public
String
getModelPath
()
{
return
modelPath
;
}
}
src/main/resources/logback-custom.xml
View file @
b1ffbd58
...
...
@@ -21,6 +21,12 @@
<logger
name=
"indicator.operate"
>
<appender-ref
ref=
"db"
/>
</logger>
<logger
name=
"indicator.unit.cal"
>
<appender-ref
ref=
"db"
/>
</logger>
<logger
name=
"indicator.base.indi"
>
<appender-ref
ref=
"db"
/>
</logger>
<root
level=
"INFO"
>
<appender-ref
ref=
"stdout"
/>
</root>
...
...
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