Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
head_group
xyqb-user2
Commits
e16246fa
Commit
e16246fa
authored
Oct 29, 2019
by
技术部-任文超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决严重问题
parent
f7d4f4ca
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
51 additions
and
31 deletions
+51
-31
IntegerToEnumConverterFactory.java
...group/xyqb/config/http/IntegerToEnumConverterFactory.java
+5
-2
InnerController.java
...tgroup/xyqb/controller/internal/user/InnerController.java
+1
-1
BasePageType.java
...va/cn/quantgroup/xyqb/service/page/bean/BasePageType.java
+2
-2
PageServiceImpl.java
...cn/quantgroup/xyqb/service/page/impl/PageServiceImpl.java
+13
-13
SessionServiceImpl.java
...ntgroup/xyqb/service/session/impl/SessionServiceImpl.java
+2
-2
ContactServiceImpl.java
...quantgroup/xyqb/service/user/impl/ContactServiceImpl.java
+26
-10
DynamicTest.java
src/test/java/demo/DynamicTest.java
+2
-1
No files found.
src/main/java/cn/quantgroup/xyqb/config/http/IntegerToEnumConverterFactory.java
View file @
e16246fa
...
@@ -10,13 +10,15 @@ final class IntegerToEnumConverterFactory implements ConverterFactory<String, En
...
@@ -10,13 +10,15 @@ final class IntegerToEnumConverterFactory implements ConverterFactory<String, En
IntegerToEnumConverterFactory
()
{
IntegerToEnumConverterFactory
()
{
}
}
@Override
public
<
T
extends
Enum
>
Converter
<
String
,
T
>
getConverter
(
Class
<
T
>
targetType
)
{
public
<
T
extends
Enum
>
Converter
<
String
,
T
>
getConverter
(
Class
<
T
>
targetType
)
{
Class
<?>
enumType
=
targetType
;
Class
<?>
enumType
=
targetType
;
while
(
enumType
!=
null
&&
!
enumType
.
isEnum
())
{
while
(
enumType
!=
null
&&
!
enumType
.
isEnum
())
{
enumType
=
enumType
.
getSuperclass
();
enumType
=
enumType
.
getSuperclass
();
}
}
if
(
targetType
==
null
)
{
if
(
enumType
==
null
)
{
throw
new
IllegalArgumentException
(
"The target type null does not refer to an enum"
);
}
else
if
(
enumType
==
null
)
{
throw
new
IllegalArgumentException
(
"The target type "
+
targetType
.
getName
()
+
" does not refer to an enum"
);
throw
new
IllegalArgumentException
(
"The target type "
+
targetType
.
getName
()
+
" does not refer to an enum"
);
}
else
{
}
else
{
return
new
IntegerToEnumConverterFactory
.
IntegerToEnum
(
enumType
);
return
new
IntegerToEnumConverterFactory
.
IntegerToEnum
(
enumType
);
...
@@ -30,6 +32,7 @@ final class IntegerToEnumConverterFactory implements ConverterFactory<String, En
...
@@ -30,6 +32,7 @@ final class IntegerToEnumConverterFactory implements ConverterFactory<String, En
this
.
enumType
=
enumType
;
this
.
enumType
=
enumType
;
}
}
@Override
public
T
convert
(
String
source
)
{
public
T
convert
(
String
source
)
{
T
[]
ts
=
enumType
.
getEnumConstants
();
T
[]
ts
=
enumType
.
getEnumConstants
();
int
ordinal
=
Integer
.
parseInt
(
source
);
int
ordinal
=
Integer
.
parseInt
(
source
);
...
...
src/main/java/cn/quantgroup/xyqb/controller/internal/user/InnerController.java
View file @
e16246fa
...
@@ -708,7 +708,7 @@ public class InnerController implements IBaseController {
...
@@ -708,7 +708,7 @@ public class InnerController implements IBaseController {
user
=
userService
.
findByUuidWithCache
(
uuid
);
user
=
userService
.
findByUuidWithCache
(
uuid
);
}
}
UserDetail
userDetail
=
null
;
UserDetail
userDetail
=
null
;
if
(
!
Objects
.
isNull
(
user
)
&&
!
Objects
.
is
Null
(
user
.
getId
())
&&
user
.
getId
()
>
0
)
{
if
(
Objects
.
nonNull
(
user
)
&&
Objects
.
non
Null
(
user
.
getId
())
&&
user
.
getId
()
>
0
)
{
userDetail
=
userDetailService
.
findByUserId
(
user
.
getId
());
userDetail
=
userDetailService
.
findByUserId
(
user
.
getId
());
}
}
if
(
Objects
.
isNull
(
user
))
{
if
(
Objects
.
isNull
(
user
))
{
...
...
src/main/java/cn/quantgroup/xyqb/service/page/bean/PageType.java
→
src/main/java/cn/quantgroup/xyqb/service/page/bean/
Base
PageType.java
View file @
e16246fa
...
@@ -5,11 +5,11 @@ import cn.quantgroup.xyqb.entity.User;
...
@@ -5,11 +5,11 @@ import cn.quantgroup.xyqb.entity.User;
/**
/**
* Created by Miraculous on 2017/1/3.
* Created by Miraculous on 2017/1/3.
*/
*/
public
abstract
class
PageType
{
public
abstract
class
Base
PageType
{
protected
String
name
;
protected
String
name
;
protected
Boolean
needShow
;
protected
Boolean
needShow
;
public
PageType
(
String
name
,
Boolean
needShow
)
{
public
Base
PageType
(
String
name
,
Boolean
needShow
)
{
this
.
name
=
name
;
this
.
name
=
name
;
this
.
needShow
=
needShow
;
this
.
needShow
=
needShow
;
}
}
...
...
src/main/java/cn/quantgroup/xyqb/service/page/impl/PageServiceImpl.java
View file @
e16246fa
...
@@ -3,7 +3,7 @@ package cn.quantgroup.xyqb.service.page.impl;
...
@@ -3,7 +3,7 @@ package cn.quantgroup.xyqb.service.page.impl;
import
cn.quantgroup.xyqb.entity.*
;
import
cn.quantgroup.xyqb.entity.*
;
import
cn.quantgroup.xyqb.model.Tuple
;
import
cn.quantgroup.xyqb.model.Tuple
;
import
cn.quantgroup.xyqb.service.page.IPageService
;
import
cn.quantgroup.xyqb.service.page.IPageService
;
import
cn.quantgroup.xyqb.service.page.bean.PageType
;
import
cn.quantgroup.xyqb.service.page.bean.
Base
PageType
;
import
cn.quantgroup.xyqb.service.user.IAddressService
;
import
cn.quantgroup.xyqb.service.user.IAddressService
;
import
cn.quantgroup.xyqb.service.user.IContactService
;
import
cn.quantgroup.xyqb.service.user.IContactService
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
...
@@ -22,10 +22,10 @@ import java.util.Map;
...
@@ -22,10 +22,10 @@ import java.util.Map;
@Service
@Service
public
class
PageServiceImpl
implements
IPageService
{
public
class
PageServiceImpl
implements
IPageService
{
private
Map
<
String
,
PageType
[]>
routerDefinetion
;
private
Map
<
String
,
Base
PageType
[]>
routerDefinetion
;
@Autowired
@Autowired
private
IUserDetailService
userDetailService
;
private
IUserDetailService
userDetailService
;
private
PageType
pageIdNo
=
new
PageType
(
"name"
,
false
)
{
private
BasePageType
pageIdNo
=
new
Base
PageType
(
"name"
,
false
)
{
@Override
@Override
public
boolean
canPass
(
User
user
)
{
public
boolean
canPass
(
User
user
)
{
UserDetail
userDetail
=
userDetailService
.
findByUserId
(
user
.
getId
());
UserDetail
userDetail
=
userDetailService
.
findByUserId
(
user
.
getId
());
...
@@ -34,7 +34,7 @@ public class PageServiceImpl implements IPageService {
...
@@ -34,7 +34,7 @@ public class PageServiceImpl implements IPageService {
};
};
@Autowired
@Autowired
private
IUserExtInfoService
userExtInfoService
;
private
IUserExtInfoService
userExtInfoService
;
private
PageType
pageUserFinance
=
new
PageType
(
"info"
,
false
)
{
private
BasePageType
pageUserFinance
=
new
Base
PageType
(
"info"
,
false
)
{
@Override
@Override
public
boolean
canPass
(
User
user
)
{
public
boolean
canPass
(
User
user
)
{
UserExtInfo
extInfo
=
userExtInfoService
.
findByUserId
(
user
.
getId
());
UserExtInfo
extInfo
=
userExtInfoService
.
findByUserId
(
user
.
getId
());
...
@@ -43,7 +43,7 @@ public class PageServiceImpl implements IPageService {
...
@@ -43,7 +43,7 @@ public class PageServiceImpl implements IPageService {
};
};
@Autowired
@Autowired
private
IAddressService
addressService
;
private
IAddressService
addressService
;
private
PageType
pageAddress
=
new
PageType
(
"address"
,
false
)
{
private
BasePageType
pageAddress
=
new
Base
PageType
(
"address"
,
false
)
{
@Override
@Override
public
boolean
canPass
(
User
user
)
{
public
boolean
canPass
(
User
user
)
{
Address
address
=
addressService
.
findByUserId
(
user
.
getId
());
Address
address
=
addressService
.
findByUserId
(
user
.
getId
());
...
@@ -52,7 +52,7 @@ public class PageServiceImpl implements IPageService {
...
@@ -52,7 +52,7 @@ public class PageServiceImpl implements IPageService {
};
};
@Autowired
@Autowired
private
IContactService
contactService
;
private
IContactService
contactService
;
private
PageType
pageContacts
=
new
PageType
(
"contacts"
,
false
)
{
private
BasePageType
pageContacts
=
new
Base
PageType
(
"contacts"
,
false
)
{
@Override
@Override
public
boolean
canPass
(
User
user
)
{
public
boolean
canPass
(
User
user
)
{
List
<
Contact
>
contacts
=
contactService
.
findByUserId
(
user
.
getId
(),
true
);
List
<
Contact
>
contacts
=
contactService
.
findByUserId
(
user
.
getId
(),
true
);
...
@@ -64,19 +64,19 @@ public class PageServiceImpl implements IPageService {
...
@@ -64,19 +64,19 @@ public class PageServiceImpl implements IPageService {
private
void
init
()
{
private
void
init
()
{
routerDefinetion
=
new
HashMap
<>();
routerDefinetion
=
new
HashMap
<>();
routerDefinetion
.
put
(
"cashTarget1"
,
new
PageType
[]{
routerDefinetion
.
put
(
"cashTarget1"
,
new
Base
PageType
[]{
pageIdNo
,
pageUserFinance
pageIdNo
,
pageUserFinance
});
});
routerDefinetion
.
put
(
"cashTarget2"
,
new
PageType
[]{
routerDefinetion
.
put
(
"cashTarget2"
,
new
Base
PageType
[]{
pageIdNo
,
pageAddress
pageIdNo
,
pageAddress
});
});
routerDefinetion
.
put
(
"cashTarget3"
,
new
PageType
[]{
routerDefinetion
.
put
(
"cashTarget3"
,
new
Base
PageType
[]{
pageIdNo
,
pageContacts
pageIdNo
,
pageContacts
});
});
routerDefinetion
.
put
(
"cashTarget4"
,
new
PageType
[]{
routerDefinetion
.
put
(
"cashTarget4"
,
new
Base
PageType
[]{
pageIdNo
pageIdNo
});
});
routerDefinetion
.
put
(
"cashTarget5"
,
new
PageType
[]{
routerDefinetion
.
put
(
"cashTarget5"
,
new
Base
PageType
[]{
});
});
}
}
...
@@ -85,7 +85,7 @@ public class PageServiceImpl implements IPageService {
...
@@ -85,7 +85,7 @@ public class PageServiceImpl implements IPageService {
if
(
user
==
null
)
{
if
(
user
==
null
)
{
return
new
Tuple
<>(
""
,
false
);
return
new
Tuple
<>(
""
,
false
);
}
}
PageType
[]
processLists
=
routerDefinetion
.
getOrDefault
(
target
,
null
);
Base
PageType
[]
processLists
=
routerDefinetion
.
getOrDefault
(
target
,
null
);
if
(
processLists
==
null
)
{
if
(
processLists
==
null
)
{
return
new
Tuple
<>(
""
,
false
);
return
new
Tuple
<>(
""
,
false
);
}
}
...
@@ -93,7 +93,7 @@ public class PageServiceImpl implements IPageService {
...
@@ -93,7 +93,7 @@ public class PageServiceImpl implements IPageService {
return
new
Tuple
<>(
""
,
true
);
return
new
Tuple
<>(
""
,
true
);
}
}
boolean
isBeforeCurrentPage
=
true
;
boolean
isBeforeCurrentPage
=
true
;
for
(
PageType
page
:
processLists
)
{
for
(
Base
PageType
page
:
processLists
)
{
if
(!
page
.
canPass
(
user
))
{
if
(!
page
.
canPass
(
user
))
{
return
new
Tuple
<>(
page
.
getName
(),
false
);
return
new
Tuple
<>(
page
.
getName
(),
false
);
}
}
...
...
src/main/java/cn/quantgroup/xyqb/service/session/impl/SessionServiceImpl.java
View file @
e16246fa
...
@@ -53,10 +53,10 @@ public class SessionServiceImpl implements ISessionService {
...
@@ -53,10 +53,10 @@ public class SessionServiceImpl implements ISessionService {
//找到用户
//找到用户
String
sessionId
=
findSessionIdByUserIdLoginProperties
(
user
.
getId
(),
properties
);
String
sessionId
=
findSessionIdByUserIdLoginProperties
(
user
.
getId
(),
properties
);
SessionStruct
sessionStruct
=
null
;
SessionStruct
sessionStruct
=
null
;
if
(
org
.
apache
.
commons
.
lang
.
StringUtils
.
isNotEmpty
(
sessionId
))
{
if
(
StringUtils
.
isNotEmpty
(
sessionId
))
{
sessionStruct
=
findSessionBySessionId
(
sessionId
);
sessionStruct
=
findSessionBySessionId
(
sessionId
);
}
}
if
(
Objects
.
nonNull
(
sessionStruct
))
{
if
(
Objects
.
nonNull
(
sessionStruct
)
&&
Objects
.
nonNull
(
properties
)
)
{
sessionStruct
.
setAttribute
(
"channelId"
,
String
.
valueOf
(
properties
.
getChannelId
()));
sessionStruct
.
setAttribute
(
"channelId"
,
String
.
valueOf
(
properties
.
getChannelId
()));
sessionStruct
.
setAttribute
(
"createdFrom"
,
String
.
valueOf
(
properties
.
getCreatedFrom
()));
sessionStruct
.
setAttribute
(
"createdFrom"
,
String
.
valueOf
(
properties
.
getCreatedFrom
()));
sessionStruct
.
setAttribute
(
"appChannel"
,
String
.
valueOf
(
properties
.
getAppChannel
()));
sessionStruct
.
setAttribute
(
"appChannel"
,
String
.
valueOf
(
properties
.
getAppChannel
()));
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/ContactServiceImpl.java
View file @
e16246fa
...
@@ -14,7 +14,10 @@ import org.springframework.stereotype.Service;
...
@@ -14,7 +14,10 @@ import org.springframework.stereotype.Service;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
/**
/**
* Created by Miraculous on 2017/1/3.
* Created by Miraculous on 2017/1/3.
...
@@ -32,6 +35,23 @@ public class ContactServiceImpl implements IContactService {
...
@@ -32,6 +35,23 @@ public class ContactServiceImpl implements IContactService {
if
(
trim
)
{
if
(
trim
)
{
trim
(
contacts
);
trim
(
contacts
);
}
}
// 按修改时间倒序排列
if
(!
CollectionUtils
.
isEmpty
(
contacts
)){
Collections
.
sort
(
contacts
,
(
o1
,
o2
)
->
{
Date
paidAt1
=
o1
.
getUpdateAt
();
Date
paidAt2
=
o2
.
getUpdateAt
();
if
(
paidAt1
==
null
&&
paidAt2
==
null
)
{
return
0
;
}
if
(
paidAt1
==
null
)
{
return
-
1
;
}
if
(
paidAt2
==
null
)
{
return
-
1
;
}
return
paidAt1
.
compareTo
(
paidAt2
);
});
}
return
contacts
;
return
contacts
;
}
}
...
@@ -98,21 +118,17 @@ public class ContactServiceImpl implements IContactService {
...
@@ -98,21 +118,17 @@ public class ContactServiceImpl implements IContactService {
* @param contacts - 新联系人列表
* @param contacts - 新联系人列表
*/
*/
private
void
mergeContacts
(
Long
userId
,
List
<
Contact
>
contacts
)
{
private
void
mergeContacts
(
Long
userId
,
List
<
Contact
>
contacts
)
{
// 当前联系人列表
List
<
Contact
>
userContact
=
contactRepository
.
findByUserId
(
userId
);
int
userContactCount
=
(
userContact
==
null
)
?
0
:
userContact
.
size
();
Timestamp
now
=
new
Timestamp
(
System
.
currentTimeMillis
());
Timestamp
now
=
new
Timestamp
(
System
.
currentTimeMillis
());
for
(
int
i
=
0
;
i
<
contacts
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
contacts
.
size
();
i
++)
{
Contact
c
=
contacts
.
get
(
i
);
Contact
c
=
contacts
.
get
(
i
);
c
.
setId
(
null
);
c
.
setUserId
(
userId
);
c
.
setUserId
(
userId
);
c
.
setRelation
(
c
.
getRelation
()
==
null
?
Relation
.
OTHER
:
c
.
getRelation
());
if
(
Objects
.
isNull
(
c
.
getRelation
())){
c
.
setCreatedAt
(
now
);
c
.
setRelation
(
Relation
.
OTHER
);
c
.
setUpdateAt
(
now
);
if
(
userContactCount
>
i
)
{
c
.
setId
(
userContact
.
get
(
i
).
getId
());
c
.
setCreatedAt
(
userContact
.
get
(
i
).
getCreatedAt
()
==
null
?
now
:
userContact
.
get
(
i
).
getCreatedAt
());
}
}
if
(
Objects
.
isNull
(
c
.
getId
())){
c
.
setCreatedAt
(
now
);
}
c
.
setUpdateAt
(
now
);
}
}
}
}
}
}
src/test/java/demo/DynamicTest.java
View file @
e16246fa
...
@@ -3,6 +3,7 @@ package demo;
...
@@ -3,6 +3,7 @@ package demo;
import
org.junit.jupiter.api.*
;
import
org.junit.jupiter.api.*
;
import
org.junit.jupiter.api.function.ThrowingConsumer
;
import
org.junit.jupiter.api.function.ThrowingConsumer
;
import
java.security.SecureRandom
;
import
java.util.*
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.stream.IntStream
;
import
java.util.stream.IntStream
;
...
@@ -72,7 +73,7 @@ public class DynamicTest {
...
@@ -72,7 +73,7 @@ public class DynamicTest {
// a number evenly divisible by 7 is encountered.
// a number evenly divisible by 7 is encountered.
Iterator
<
Integer
>
inputGenerator
=
new
Iterator
<
Integer
>()
{
Iterator
<
Integer
>
inputGenerator
=
new
Iterator
<
Integer
>()
{
Random
random
=
new
Random
();
SecureRandom
random
=
new
Secure
Random
();
int
current
;
int
current
;
@Override
@Override
...
...
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