记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
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
董敬伟
liquidnet-bus-v1
Commits
48db67a9
Commit
48db67a9
authored
Jan 18, 2022
by
jiangxiulong
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into jxl_118_reservation
parents
960fd4ec
34ea3819
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
108 additions
and
31 deletions
+108
-31
AdamRedisConst.java
...a/com/liquidnet/service/adam/constant/AdamRedisConst.java
+4
-0
IAdamEntersService.java
...om/liquidnet/service/adam/service/IAdamEntersService.java
+1
-1
Error.java
...ain/java/com/liquidnet/common/exception/entity/Error.java
+28
-6
RestControllerAdviceHandler.java
...quidnet/common/exception/RestControllerAdviceHandler.java
+9
-5
liquidnet-service-adam-dev.yml
...us-config/liquidnet-config/liquidnet-service-adam-dev.yml
+3
-1
liquidnet-service-adam-test.yml
...s-config/liquidnet-config/liquidnet-service-adam-test.yml
+3
-0
AdamEntersController.java
...quidnet/service/adam/controller/AdamEntersController.java
+36
-6
AdamRdmService.java
...va/com/liquidnet/service/adam/service/AdamRdmService.java
+17
-0
AdamEntersServiceImpl.java
...dnet/service/adam/service/impl/AdamEntersServiceImpl.java
+6
-12
errors.properties
...et-service-adam-impl/src/main/resources/errors.properties
+1
-0
No files found.
liquidnet-bus-api/liquidnet-service-adam-api/src/main/java/com/liquidnet/service/adam/constant/AdamRedisConst.java
View file @
48db67a9
...
...
@@ -54,6 +54,10 @@ public class AdamRedisConst {
public
static
final
String
INCR_MEMBER_NO
=
PREFIX
.
concat
(
"incr:member_no"
);
public
static
final
String
INCR_MEMBER_LIMITATION
=
PREFIX
.
concat
(
"incr:member_limitation"
);
/**
* 用户添加/编辑入场人计数(N次/天)
*/
public
static
final
String
INCR_USER_ENTERS
=
PREFIX
.
concat
(
"incr:limit_u_e:"
);
// public static final String SWITCH_BUY_MEMBER = PREFIX.concat("switch:buy:member");
...
...
liquidnet-bus-api/liquidnet-service-adam-api/src/main/java/com/liquidnet/service/adam/service/IAdamEntersService.java
View file @
48db67a9
...
...
@@ -14,7 +14,7 @@ import java.util.List;
* @since 2021-04-28
*/
public
interface
IAdamEntersService
{
String
add
(
AdamEntersParam
parameter
);
String
add
(
AdamEntersParam
parameter
,
String
uid
,
List
<
AdamEntersVo
>
vos
);
void
def
(
String
uid
,
String
entersId
);
...
...
liquidnet-bus-common/liquidnet-common-exception/liquidnet-common-exception-base/src/main/java/com/liquidnet/common/exception/entity/Error.java
View file @
48db67a9
...
...
@@ -2,18 +2,14 @@ package com.liquidnet.common.exception.entity;
import
lombok.Data
;
import
java.
util.List
;
import
java.
io.Serializable
;
/**
* Created by shangshengfang on 2017/2/16.
*/
@Data
public
class
Error
{
public
class
Error
implements
Serializable
,
Cloneable
{
String
message
;
String
code
;
Object
data
;
public
Error
()
{
}
...
...
@@ -21,4 +17,30 @@ public class Error {
this
.
code
=
code
;
this
.
message
=
message
;
}
public
Error
setMessage
(
String
message
)
{
this
.
message
=
message
;
return
this
;
}
public
Error
setCode
(
String
code
)
{
this
.
code
=
code
;
return
this
;
}
public
Error
setData
(
Object
data
)
{
this
.
data
=
data
;
return
this
;
}
private
static
final
Error
obj
=
new
Error
();
public
static
Error
getNew
()
{
try
{
return
(
Error
)
obj
.
clone
();
}
catch
(
CloneNotSupportedException
e
)
{
return
new
Error
();
}
}
}
liquidnet-bus-common/liquidnet-common-exception/liquidnet-common-exception-handler-service/src/main/java/com/liquidnet/common/exception/RestControllerAdviceHandler.java
View file @
48db67a9
...
...
@@ -11,6 +11,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.converter.HttpMessageNotReadableException
;
import
org.springframework.validation.FieldError
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
import
org.springframework.web.bind.MissingServletRequestParameterException
;
...
...
@@ -42,10 +43,13 @@ public class RestControllerAdviceHandler {
logger
.
error
(
"Ex.Handler.RestController:uri:{},param:{},ex:{},msg:{},"
,
req
.
getRequestURI
(),
JSON
.
toJSONString
(
req
.
getParameterMap
()),
rex
.
getClass
().
getSimpleName
(),
rex
.
getLocalizedMessage
());
if
(
rex
instanceof
HttpMessageNotReadableException
)
{
return
new
ResponseEntity
<>(
Error
.
getNew
().
setCode
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
()).
setMessage
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getMessage
()),
HttpStatus
.
OK
);
}
if
(
rex
instanceof
MissingServletRequestParameterException
)
{
MissingServletRequestParameterException
ygex
=
(
MissingServletRequestParameterException
)
rex
;
String
message
=
ygex
.
getMessage
();
return
new
ResponseEntity
<
Error
>(
new
Error
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
message
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<
>(
Error
.
getNew
().
setCode
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
()).
setMessage
(
message
),
HttpStatus
.
OK
);
}
if
(
rex
instanceof
ConstraintViolationException
)
{
ConstraintViolationException
ygex
=
(
ConstraintViolationException
)
rex
;
...
...
@@ -53,27 +57,27 @@ public class RestControllerAdviceHandler {
String
violationNode
=
violation
.
getPropertyPath
().
toString
();
// String message = violationNode.substring(violationNode.indexOf(".") + 1) + violation.getMessage();
String
message
=
violation
.
getMessage
();
return
new
ResponseEntity
<
Error
>(
new
Error
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
message
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<
>(
Error
.
getNew
().
setCode
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
()).
setMessage
(
message
),
HttpStatus
.
OK
);
}
if
(
rex
instanceof
MethodArgumentNotValidException
)
{
MethodArgumentNotValidException
ygex
=
(
MethodArgumentNotValidException
)
rex
;
FieldError
fieldError
=
ygex
.
getBindingResult
().
getFieldErrors
().
get
(
0
);
// String message = fieldError.getField() + " " + fieldError.getDefaultMessage();
String
message
=
fieldError
.
getDefaultMessage
();
return
new
ResponseEntity
<
Error
>(
new
Error
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
message
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<
>(
Error
.
getNew
().
setCode
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
()).
setMessage
(
message
),
HttpStatus
.
OK
);
}
if
(
rex
instanceof
LiquidnetFeignException
)
{
LiquidnetFeignException
ygex
=
(
LiquidnetFeignException
)
rex
;
String
errorCode
=
ygex
.
errorCode
().
getCode
();
String
message
=
ygex
.
getMessage
();
message
=
message
==
null
?
ygex
.
errorCode
().
getMessage
()
:
message
;
return
new
ResponseEntity
<
Error
>(
new
Error
(
errorCode
,
message
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<
>(
Error
.
getNew
().
setCode
(
errorCode
).
setMessage
(
message
),
HttpStatus
.
OK
);
}
if
(
rex
instanceof
LiquidnetServiceException
)
{
LiquidnetServiceException
ygex
=
(
LiquidnetServiceException
)
rex
;
String
errorCode
=
ygex
.
getCode
();
String
message
=
ygex
.
getMessage
();
return
new
ResponseEntity
<
Error
>(
new
Error
(
errorCode
,
message
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<
>(
Error
.
getNew
().
setCode
(
errorCode
).
setMessage
(
message
),
HttpStatus
.
OK
);
}
else
{
logger
.
error
(
"Unprocessed exception"
,
rex
);
// return new ResponseEntity<Error>(new Error(ErrorCode.HTTP_SYSTEM_ERROR.getCode(), ErrorCode.HTTP_SYSTEM_ERROR.getMessage()), HttpStatus.OK);
...
...
liquidnet-bus-config/liquidnet-config/liquidnet-service-adam-dev.yml
View file @
48db67a9
...
...
@@ -25,6 +25,8 @@ liquidnet:
app-login
:
mobile
:
13724286255
user-info
:
false
limit
:
enters
:
10
enters_opr
:
20
#以下为spring各环境个性配置
liquidnet-bus-config/liquidnet-config/liquidnet-service-adam-test.yml
View file @
48db67a9
...
...
@@ -25,5 +25,8 @@ liquidnet:
app-login
:
mobile
:
13724286255
user-info
:
false
limit
:
enters
:
10
enters_opr
:
20
#以下为spring各环境个性配置
liquidnet-bus-service/liquidnet-service-adam/liquidnet-service-adam-impl/src/main/java/com/liquidnet/service/adam/controller/AdamEntersController.java
View file @
48db67a9
...
...
@@ -17,6 +17,7 @@ import io.swagger.annotations.ApiOperation;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -47,6 +48,12 @@ public class AdamEntersController {
@Autowired
IAdamEntersService
adamEntersService
;
@Value
(
"${liquidnet.reviewer.limit.enters:10}"
)
private
int
reviewLimitEnters
;
// @Value("${liquidnet.reviewer.limit.enters_opr:10}")
// private int reviewLimitEntersOpr;
@ApiOperationSupport
(
order
=
1
)
@ApiOperation
(
value
=
"添加入场人"
)
@PostMapping
(
"add"
)
...
...
@@ -84,8 +91,9 @@ public class AdamEntersController {
}
break
;
}
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
List
<
AdamEntersVo
>
vos
=
adamRdmService
.
getEntersVoByUid
(
CurrentUtil
.
getCurrentUid
()
);
List
<
AdamEntersVo
>
vos
=
adamRdmService
.
getEntersVoByUid
(
currentUid
);
if
(!
CollectionUtils
.
isEmpty
(
vos
))
{
Optional
<
AdamEntersVo
>
any
=
vos
.
stream
().
filter
(
r
->
(
r
.
getIdCard
().
equals
(
parameter
.
getIdCard
()))
&&
r
.
getType
().
equals
(
parameter
.
getType
())).
findAny
();
...
...
@@ -93,12 +101,23 @@ public class AdamEntersController {
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"10019"
));
}
if
(
vos
.
size
()
>=
10
)
{
if
(
reviewLimitEnters
>
0
&&
vos
.
size
()
>=
reviewLimitEnters
)
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"10025"
));
}
}
String
entersId
=
adamEntersService
.
add
(
parameter
);
// int userEntersOprNo = adamRdmService.getUserEntersOprNo(currentUid);
// if (reviewLimitEntersOpr > 0 && userEntersOprNo >= reviewLimitEntersOpr) {
// return ResponseDto.failure(ErrorMapping.get("10026"));
// }
String
entersId
=
adamEntersService
.
add
(
parameter
,
currentUid
,
vos
);
// if (userEntersOprNo == -1) {
// adamRdmService.setUserEntersOprNo(currentUid);
// } else {
// adamRdmService.incrUserEntersOprNo(currentUid);
// }
return
ResponseDto
.
success
(
entersId
);
}
...
...
@@ -147,12 +166,23 @@ public class AdamEntersController {
if
(
StringUtils
.
isBlank
(
parameter
.
getEntersId
()))
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"10015"
));
}
if
(
null
==
adamRdmService
.
getEntersVoByUidEntersId
(
CurrentUtil
.
getCurrentUid
(),
parameter
.
getEntersId
()))
{
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
if
(
null
==
adamRdmService
.
getEntersVoByUidEntersId
(
currentUid
,
parameter
.
getEntersId
()))
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"10105"
));
}
adamEntersService
.
edit
(
parameter
);
//// int userEntersOprNo = adamRdmService.getUserEntersOprNo(currentUid);
//// if (reviewLimitEntersOpr > 0 && userEntersOprNo >= reviewLimitEntersOpr) {
//// return ResponseDto.failure(ErrorMapping.get("10026"));
//// }
////
// adamEntersService.edit(parameter);
////
//// if (userEntersOprNo == -1) {
//// adamRdmService.setUserEntersOprNo(currentUid);
//// } else {
//// adamRdmService.incrUserEntersOprNo(currentUid);
//// }
return
ResponseDto
.
success
();
}
...
...
liquidnet-bus-service/liquidnet-service-adam/liquidnet-service-adam-impl/src/main/java/com/liquidnet/service/adam/service/AdamRdmService.java
View file @
48db67a9
...
...
@@ -915,6 +915,23 @@ public class AdamRdmService {
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | */
public
boolean
setUserEntersOprNo
(
String
uid
)
{
LocalDateTime
now
=
LocalDateTime
.
now
();
return
redisUtil
.
set
(
AdamRedisConst
.
INCR_USER_ENTERS
.
concat
(
uid
),
1
,
ChronoUnit
.
SECONDS
.
between
(
now
,
LocalDateTime
.
of
(
now
.
getYear
(),
now
.
getMonth
(),
now
.
getDayOfMonth
(),
23
,
59
,
59
)));
}
public
long
incrUserEntersOprNo
(
String
uid
)
{
return
redisUtil
.
incr
(
AdamRedisConst
.
INCR_USER_ENTERS
.
concat
(
uid
),
1
);
}
public
int
getUserEntersOprNo
(
String
uid
)
{
Object
o
=
redisUtil
.
get
(
AdamRedisConst
.
INCR_USER_ENTERS
.
concat
(
uid
));
return
null
==
o
?
-
1
:
(
int
)
o
;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | */
/* ========================================================== | Other micro-service data inquiry */
...
...
liquidnet-bus-service/liquidnet-service-adam/liquidnet-service-adam-impl/src/main/java/com/liquidnet/service/adam/service/impl/AdamEntersServiceImpl.java
View file @
48db67a9
...
...
@@ -43,8 +43,8 @@ public class AdamEntersServiceImpl implements IAdamEntersService {
@Override
// @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public
String
add
(
AdamEntersParam
parameter
)
{
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
public
String
add
(
AdamEntersParam
parameter
,
String
currentUid
,
List
<
AdamEntersVo
>
vos
)
{
//
String currentUid = CurrentUtil.getCurrentUid();
LocalDateTime
now
=
LocalDateTime
.
now
();
...
...
@@ -58,7 +58,7 @@ public class AdamEntersServiceImpl implements IAdamEntersService {
}
List
<
AdamEntersVo
>
vos
=
adamRdmService
.
getEntersVoByUid
(
currentUid
);
//
List<AdamEntersVo> vos = adamRdmService.getEntersVoByUid(currentUid);
AdamEntersVo
vo
=
AdamEntersVo
.
getNew
();
BeanUtils
.
copyProperties
(
parameter
,
vo
);
...
...
@@ -74,15 +74,9 @@ public class AdamEntersServiceImpl implements IAdamEntersService {
log
.
debug
(
"#RDS耗时:{}ms"
,
System
.
currentTimeMillis
()
-
s
);
s
=
System
.
currentTimeMillis
();
String
msg
=
SqlMapping
.
get
(
"adam_enters.add"
,
vo
.
getEntersId
(),
currentUid
,
vo
.
getType
(),
vo
.
getName
(),
vo
.
getMobile
(),
vo
.
getIdCard
(),
vo
.
getIsDefault
(),
vo
.
getState
(),
now
);
log
.
debug
(
"#SQL.GET耗时:{}ms"
,
System
.
currentTimeMillis
()
-
s
);
s
=
System
.
currentTimeMillis
();
queueUtils
.
sendMsgByRedis
(
MQConst
.
AdamQueue
.
SQL_UCENTER
.
getKey
(),
msg
queueUtils
.
sendMsgByRedis
(
MQConst
.
AdamQueue
.
SQL_UCENTER
.
getKey
(),
SqlMapping
.
get
(
"adam_enters.add"
,
vo
.
getEntersId
(),
currentUid
,
vo
.
getType
(),
vo
.
getName
(),
vo
.
getMobile
(),
vo
.
getIdCard
(),
vo
.
getIsDefault
(),
vo
.
getState
(),
now
)
);
log
.
debug
(
"#MQ耗时:{}ms"
,
System
.
currentTimeMillis
()
-
s
);
return
vo
.
getEntersId
();
...
...
liquidnet-bus-service/liquidnet-service-adam/liquidnet-service-adam-impl/src/main/resources/errors.properties
View file @
48db67a9
...
...
@@ -29,6 +29,7 @@
10023
=
背景图不合规
10024
=
该账号已被主动注销
10025
=
入场人已达上限
10026
=
入场人今日操作已达上限
10101
=
姓名或身份证件号无效
...
...
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