Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
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
项目统一框架
amos-boot-biz
Commits
77d5b908
Commit
77d5b908
authored
Dec 14, 2021
by
tianbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
metahandler修改
parent
1b48627c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
36 deletions
+40
-36
PermissionInterceptor.java
...s/boot/biz/common/interceptors/PermissionInterceptor.java
+3
-0
MetaHandler.java
...in/java/com/yeejoin/amos/boot/biz/config/MetaHandler.java
+23
-30
MultipartSupportConfig.java
...eejoin/amos/supervision/feign/MultipartSupportConfig.java
+9
-3
PushFeign.java
...in/java/com/yeejoin/amos/supervision/feign/PushFeign.java
+5
-3
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/interceptors/PermissionInterceptor.java
View file @
77d5b908
...
...
@@ -70,12 +70,14 @@ public class PermissionInterceptor implements Interceptor {
}
// 接口地址为空返回空数据
if
(
ValidationUtil
.
isEmpty
(
dataAuth
.
interfacePath
()))
{
// method.getReturnType().isPrimitive() = true 是count语句
return
method
.
getReturnType
().
isPrimitive
()
?
invocation
.
proceed
()
:
null
;
}
ReginParams
reginParam
=
JSON
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
()
,
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
if
(
ValidationUtil
.
isEmpty
(
reginParam
)
||
ValidationUtil
.
isEmpty
(
reginParam
.
getUserModel
()))
{
// method.getReturnType().isPrimitive() = true 是count语句
return
method
.
getReturnType
().
isPrimitive
()
?
invocation
.
proceed
()
:
null
;
}
// 用户数据权限配置信息
...
...
@@ -88,6 +90,7 @@ public class PermissionInterceptor implements Interceptor {
BoundSql
boundSql
=
(
BoundSql
)
metaObject
.
getValue
(
"delegate.boundSql"
);
String
sql
=
boundSql
.
getSql
();
// 将权限规则拼接到原始sql
sql
=
processSelectSql
(
sql
,
dataAuthorization
,
reginParam
,
boundSql
);
metaObject
.
setValue
(
"delegate.boundSql.sql"
,
sql
);
return
invocation
.
proceed
();
...
...
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/config/MetaHandler.java
View file @
77d5b908
...
...
@@ -15,7 +15,6 @@ import org.springframework.util.ObjectUtils;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
java.util.Date
;
import
java.util.Map
;
/**
* @author Dell
...
...
@@ -41,7 +40,6 @@ public class MetaHandler implements MetaObjectHandler {
*/
@Override
public
void
insertFill
(
MetaObject
metaObject
)
{
// autoFillUser(metaObject, metaObject.getOriginalObject());
Date
currentDate
=
new
Date
();
Class
clazz
=
metaObject
.
getOriginalObject
().
getClass
();
FillCommonUserField
annotation
=
(
FillCommonUserField
)
clazz
.
getAnnotation
(
FillCommonUserField
.
class
);
...
...
@@ -50,11 +48,10 @@ public class MetaHandler implements MetaObjectHandler {
}
//如果有上传创建时间,不需要修改
// if(metaObject.getValue("createDate")==null){
// this.setFieldValByName("createDate", currentDate, metaObject);
// }
this
.
setFieldValByName
(
"createDate"
,
currentDate
,
metaObject
);
}
private
void
autoFillUser
(
MetaObject
metaObject
,
Object
entity
)
{
//获取用户信息 以及当前用户登录公司部门,角色
String
userId
=
RequestContext
.
getExeUserId
();
...
...
@@ -69,16 +66,10 @@ public class MetaHandler implements MetaObjectHandler {
if
(
ObjectUtils
.
isEmpty
(
reginParams
)
||
ObjectUtils
.
isEmpty
(
agencyUserModel
))
{
return
;
}
if
(
isExistField
(
"recUserId"
,
entity
))
{
this
.
setFieldValByName
(
"recUserId"
,
agencyUserModel
.
getUserId
(),
metaObject
);
}
if
(
isExistField
(
"recUserName"
,
entity
))
{
this
.
setFieldValByName
(
"recUserName"
,
agencyUserModel
.
getRealName
(),
metaObject
);
}
if
(
isExistField
(
"recDate"
,
entity
))
{
Date
currentDate
=
new
Date
();
this
.
setFieldValByName
(
"recDate"
,
currentDate
,
metaObject
);
}
// 更新rec字段
recInfoUpdate
(
metaObject
,
agencyUserModel
);
if
(
isExistField
(
"allotmentTime"
,
entity
))
{
Date
currentDate
=
new
Date
();
this
.
setFieldValByName
(
"recDate"
,
currentDate
,
metaObject
);
...
...
@@ -105,13 +96,14 @@ public class MetaHandler implements MetaObjectHandler {
if
(
isExistField
(
"departmentOrgcode"
,
entity
))
{
this
.
setFieldValByName
(
"departmentOrgcode"
,
ObjectUtils
.
isEmpty
(
reginParams
.
getDepartment
())
?
""
:
reginParams
.
getDepartment
().
getOrgCode
(),
metaObject
);
}
// if (isExistField("updateTime", entity)) {
// Date currentDate = new Date();
// this.setFieldValByName("updateTime", currentDate, metaObject);
// }
// if (isExistField("companyName", entity)) {
// this.setFieldValByName("companyName", reginParams.getDepartment().getDepartmentName(), metaObject);
// }
}
private
void
recInfoUpdate
(
MetaObject
metaObject
,
AgencyUserModel
agencyUserModel
)
{
this
.
setFieldValByName
(
"recUserId"
,
agencyUserModel
.
getUserId
(),
metaObject
);
this
.
setFieldValByName
(
"recUserName"
,
agencyUserModel
.
getRealName
(),
metaObject
);
Date
currentDate
=
new
Date
();
this
.
setFieldValByName
(
"recDate"
,
currentDate
,
metaObject
);
this
.
setFieldValByName
(
"updateTime"
,
currentDate
,
metaObject
);
}
private
Boolean
isExistField
(
String
field
,
Object
obj
)
{
...
...
@@ -133,15 +125,15 @@ public class MetaHandler implements MetaObjectHandler {
*/
@Override
public
void
updateFill
(
MetaObject
metaObject
)
{
//todo tianbo 逻辑
Class
clazz
=
metaObject
.
getOriginalObject
().
getClass
();
FillCommonUserField
annotation
=
(
FillCommonUserField
)
clazz
.
getAnnotation
(
FillCommonUserField
.
class
);
if
(
annotation
==
null
||
annotation
.
isAutoFill
())
{
Object
updateEntity
=
((
Map
)
metaObject
.
getOriginalObject
()).
get
(
"et"
);
autoFillUser
(
metaObject
,
updateEntity
)
;
String
userId
=
RequestContext
.
getExeUserId
();
ReginParams
reginParams
=
JSONObject
.
parseObject
(
null
!=
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
userId
,
getToken
()))
?
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
userId
,
getToken
())).
toString
()
:
null
,
ReginParams
.
class
);
if
(
ObjectUtils
.
isEmpty
(
reginParams
))
{
return
;
}
// 正常只需要更新如下
Date
currentDate
=
new
Date
();
this
.
setFieldValByName
(
"updateTime"
,
currentDate
,
metaObject
);
AgencyUserModel
agencyUserModel
=
reginParams
.
getUserModel
();
recInfoUpdate
(
metaObject
,
agencyUserModel
);
}
}
\ No newline at end of file
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/feign/MultipartSupportConfig.java
View file @
77d5b908
/*
package com.yeejoin.amos.supervision.feign;
import feign.codec.Encoder;
...
...
@@ -10,11 +11,13 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.RequestContextListener;
*/
/**
* @Author: xinglei
* @Description:
* @Date: 2020/3/30 16:26
*/
*//*
@Configuration
public class MultipartSupportConfig {
...
...
@@ -26,12 +29,15 @@ public class MultipartSupportConfig {
return new SpringFormEncoder(new SpringEncoder(messageConverters));
}
/**
*/
/**
* 创建Feign请求拦截器,在发送请求前设置认证的token,各个微服务将token设置到环境变量中来达到通用
* @return
*/
*//*
@Bean
public RequestContextListener requestInterceptor() {
return new RequestContextListener();
}
}
*/
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/feign/PushFeign.java
View file @
77d5b908
package
com
.
yeejoin
.
amos
.
supervision
.
feign
;
import
com.yeejoin.amos.boot.biz.common.feign.MultipartSupportConfig
;
import
com.yeejoin.amos.supervision.business.param.PushMsgParam
;
import
com.yeejoin.amos.supervision.business.util.CommonResponse
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
com.yeejoin.amos.supervision.business.param.PushMsgParam
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.cloud.openfeign.FeignClient
;
...
...
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