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
9eef1739
Commit
9eef1739
authored
May 13, 2024
by
chenzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录问题修复
parent
d6709bce
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
2 deletions
+55
-2
ControllerAop.java
...a/com/yeejoin/amos/boot/biz/common/aop/ControllerAop.java
+1
-0
BeanDtoUtils.java
.../yeejoin/amos/boot/module/hygf/api/util/BeanDtoUtils.java
+52
-0
PeasantHouseholdWxController.java
...ule/hygf/biz/controller/PeasantHouseholdWxController.java
+2
-2
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/aop/ControllerAop.java
View file @
9eef1739
...
...
@@ -103,6 +103,7 @@ public class ControllerAop {
urls
.
add
(
"/hygf/unit-info/sendTelCode/.*"
);
urls
.
add
(
"/hygf/unit-info/verifyTelCode/.*/.*"
);
urls
.
add
(
"/hygf/peasant-household/mobile/login"
);
urls
.
add
(
"/hygf/peasant-household/mobile/getRegisterPhone"
);
urls
.
add
(
"/hygf/qiyuesuo/callback"
);
urls
.
add
(
"/hygf/unit-info/unitRegister"
);
urls
.
add
(
"/hygf/maintenance/getDealer"
);
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/util/BeanDtoUtils.java
View file @
9eef1739
...
...
@@ -69,4 +69,56 @@ public class BeanDtoUtils {
}
}
}
public
static
<
S
,
T
>
void
copyPropertiesAllNonNull
(
S
source
,
T
target
)
{
if
(
source
==
null
||
target
==
null
)
{
throw
new
IllegalArgumentException
(
"Source and target cannot be null"
);
}
Class
<?>
sourceClass
=
source
.
getClass
();
// 遍历源对象的所有类(包括父类)
while
(
sourceClass
!=
null
&&
!
sourceClass
.
equals
(
Object
.
class
))
{
Field
[]
sourceFields
=
sourceClass
.
getDeclaredFields
();
for
(
Field
sourceField
:
sourceFields
)
{
//静态常量字段忽略 因为是类级别不是实例
if
(
sourceField
.
getName
().
equals
(
"serialVersionUID"
))
{
continue
;
}
sourceField
.
setAccessible
(
true
);
try
{
// 尝试在目标对象的类层次结构中查找对应的字段
Field
targetField
=
findField
(
target
.
getClass
(),
sourceField
.
getName
());
if
(
targetField
!=
null
)
{
targetField
.
setAccessible
(
true
);
// 获取源对象的属性值
Object
sourceValue
=
sourceField
.
get
(
source
);
// 如果源对象的属性值不是 null,则复制到目标对象
if
(
sourceValue
!=
null
)
{
targetField
.
set
(
target
,
sourceValue
);
}
}
}
catch
(
IllegalAccessException
e
)
{
// 如果访问属性时发生异常,则抛出运行时异常
throw
new
RuntimeException
(
e
);
}
}
// 继续处理父类
sourceClass
=
sourceClass
.
getSuperclass
();
}
}
// 辅助方法,用于在目标对象的类层次结构中查找字段
private
static
Field
findField
(
Class
<?>
clazz
,
String
name
)
{
for
(
Class
<?>
c
=
clazz
;
c
!=
null
;
c
=
c
.
getSuperclass
())
{
try
{
return
c
.
getDeclaredField
(
name
);
}
catch
(
NoSuchFieldException
e
)
{
// 忽略并继续查找
}
}
return
null
;
// 如果没有找到字段,则返回null
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/PeasantHouseholdWxController.java
View file @
9eef1739
...
...
@@ -138,7 +138,7 @@ public class PeasantHouseholdWxController extends BaseController {
log
.
info
(
"微信农户注册, 入参 => {}"
,
mobileLoginParam
);
PeasantHouseholdDto
model
=
mobileLoginParam
.
getPeasantHouseholdDto
();
validatedPeasantHouseholdDto
(
model
);
BeanDtoUtils
.
copyPropertiesNonNull
(
peasantHousehold
,
model
);
BeanDtoUtils
.
copyProperties
All
NonNull
(
peasantHousehold
,
model
);
model
.
setPeasantHouseholdNo
(
peasantHouseholdServiceImpl
.
getPeasantHouseholdNo
(
model
.
getRegionalCompaniesSeq
()));
model
.
setIsCertified
(
1
);
// 这里就实名认证
model
.
setSurveyOrNot
(
0
);
...
...
@@ -173,7 +173,7 @@ public class PeasantHouseholdWxController extends BaseController {
}
}
}
BeanDtoUtils
.
copyPropertiesNonNull
(
model
,
peasantHousehold
);
BeanDtoUtils
.
copyProperties
All
NonNull
(
model
,
peasantHousehold
);
PeasantHouseholdDto
result
=
peasantHouseholdServiceImpl
.
savePeasantHousehold
(
model
,
null
);
peasantHouseholdWxDto
.
setPeasantHousehold
(
peasantHousehold
);
return
ResponseHelper
.
buildResponse
(
peasantHouseholdWxDto
);
...
...
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