记得上下班打卡 | 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
9176068d
Commit
9176068d
authored
Jun 05, 2025
by
wangyifan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
douduo-中签上传文件接口; 修改db-sql文件
parent
4a96745c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
121 additions
and
4 deletions
+121
-4
ISweetDoudouService.java
.../liquidnet/service/sweet/service/ISweetDoudouService.java
+3
-0
db_20250604_doudou.sql
...rvice/liquidnet-service-sweet/docu/db_20250604_doudou.sql
+1
-1
SweetDoudouController.java
...idnet/service/sweet/controller/SweetDoudouController.java
+9
-2
SweetDoudouServiceImpl.java
...et/service/sweet/service/impl/SweetDoudouServiceImpl.java
+108
-1
No files found.
liquidnet-bus-api/liquidnet-service-sweet-api/src/main/java/com/liquidnet/service/sweet/service/ISweetDoudouService.java
View file @
9176068d
...
@@ -6,6 +6,7 @@ import com.liquidnet.service.sweet.entity.SweetDoudou;
...
@@ -6,6 +6,7 @@ import com.liquidnet.service.sweet.entity.SweetDoudou;
import
com.liquidnet.service.sweet.param.SweetDouDouCheckParam
;
import
com.liquidnet.service.sweet.param.SweetDouDouCheckParam
;
import
com.liquidnet.service.sweet.param.SweetDouDouParam
;
import
com.liquidnet.service.sweet.param.SweetDouDouParam
;
import
com.liquidnet.service.sweet.vo.SweetDouDouVo
;
import
com.liquidnet.service.sweet.vo.SweetDouDouVo
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
...
@@ -26,4 +27,6 @@ public interface ISweetDoudouService extends IService<SweetDoudou> {
...
@@ -26,4 +27,6 @@ public interface ISweetDoudouService extends IService<SweetDoudou> {
ResponseDto
check
(
SweetDouDouCheckParam
param
);
ResponseDto
check
(
SweetDouDouCheckParam
param
);
ResponseDto
<
SweetDouDouVo
>
detail
(
SweetDouDouCheckParam
param
);
ResponseDto
<
SweetDouDouVo
>
detail
(
SweetDouDouCheckParam
param
);
boolean
winningUpload
(
MultipartFile
file
);
}
}
liquidnet-bus-service/liquidnet-service-sweet/docu/db_20250604_doudou.sql
View file @
9176068d
...
@@ -9,7 +9,7 @@ CREATE TABLE `sweet_doudou`
...
@@ -9,7 +9,7 @@ CREATE TABLE `sweet_doudou`
`phone`
varchar
(
11
)
NOT
NULL
DEFAULT
''
COMMENT
'观演人手机号'
,
`phone`
varchar
(
11
)
NOT
NULL
DEFAULT
''
COMMENT
'观演人手机号'
,
`platform`
varchar
(
100
)
NOT
NULL
DEFAULT
''
COMMENT
'购买平台'
,
`platform`
varchar
(
100
)
NOT
NULL
DEFAULT
''
COMMENT
'购买平台'
,
`order_code`
varchar
(
100
)
NOT
NULL
DEFAULT
''
COMMENT
'购买订单号'
,
`order_code`
varchar
(
100
)
NOT
NULL
DEFAULT
''
COMMENT
'购买订单号'
,
`mark`
varchar
(
512
)
NOT
NULL
DEFAULT
''
COMMENT
'想给doudou说的话'
,
`mark`
varchar
(
512
)
DEFAULT
''
COMMENT
'想给doudou说的话'
,
`status`
tinyint
NOT
NULL
DEFAULT
1
COMMENT
'状态 1已登记 2未中签 3已中签 4已核销'
,
`status`
tinyint
NOT
NULL
DEFAULT
1
COMMENT
'状态 1已登记 2未中签 3已中签 4已核销'
,
`created_at`
datetime
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`created_at`
datetime
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`updated_at`
datetime
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'更新时间'
,
`updated_at`
datetime
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'更新时间'
,
...
...
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/controller/SweetDoudouController.java
View file @
9176068d
...
@@ -10,6 +10,7 @@ import io.swagger.annotations.Api;
...
@@ -10,6 +10,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
...
@@ -42,13 +43,19 @@ public class SweetDoudouController {
...
@@ -42,13 +43,19 @@ public class SweetDoudouController {
@PostMapping
(
"/detail"
)
@PostMapping
(
"/detail"
)
@ApiOperation
(
"核验-码详情"
)
@ApiOperation
(
"核验-码详情"
)
public
ResponseDto
<
SweetDouDouVo
>
detail
(
@Valid
@RequestBody
SweetDouDouCheckParam
param
){
public
ResponseDto
<
SweetDouDouVo
>
detail
(
@Valid
@RequestBody
SweetDouDouCheckParam
param
)
{
return
iSweetDoudouService
.
detail
(
param
);
return
iSweetDoudouService
.
detail
(
param
);
}
}
@PostMapping
(
"/check"
)
@PostMapping
(
"/check"
)
@ApiOperation
(
"核销"
)
@ApiOperation
(
"核销"
)
public
ResponseDto
check
(
@Valid
@RequestBody
SweetDouDouCheckParam
param
){
public
ResponseDto
check
(
@Valid
@RequestBody
SweetDouDouCheckParam
param
)
{
return
iSweetDoudouService
.
check
(
param
);
return
iSweetDoudouService
.
check
(
param
);
}
}
@PostMapping
(
"/winning/upload"
)
@ApiOperation
(
"中签上传"
)
public
ResponseDto
<
Boolean
>
winningUpload
(
@RequestPart
(
value
=
"file"
)
MultipartFile
file
)
{
return
ResponseDto
.
success
(
iSweetDoudouService
.
winningUpload
(
file
));
}
}
}
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/service/impl/SweetDoudouServiceImpl.java
View file @
9176068d
...
@@ -18,11 +18,14 @@ import com.liquidnet.service.sweet.utils.RedisDataUtils;
...
@@ -18,11 +18,14 @@ import com.liquidnet.service.sweet.utils.RedisDataUtils;
import
com.liquidnet.service.sweet.vo.SweetDouDouScopeVo
;
import
com.liquidnet.service.sweet.vo.SweetDouDouScopeVo
;
import
com.liquidnet.service.sweet.vo.SweetDouDouVo
;
import
com.liquidnet.service.sweet.vo.SweetDouDouVo
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.poi.ss.usermodel.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.InputStream
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.
LinkedList
;
import
java.util.
*
;
/**
/**
* <p>
* <p>
...
@@ -133,6 +136,110 @@ public class SweetDoudouServiceImpl extends ServiceImpl<SweetDoudouMapper, Sweet
...
@@ -133,6 +136,110 @@ public class SweetDoudouServiceImpl extends ServiceImpl<SweetDoudouMapper, Sweet
return
ResponseDto
.
success
(
vo
);
return
ResponseDto
.
success
(
vo
);
}
}
@Override
public
boolean
winningUpload
(
MultipartFile
file
)
{
List
<
SweetDouDouVo
>
fileSweetDouDouVos
=
getSweetDouDouVoListByFile
(
file
);
if
(
fileSweetDouDouVos
.
isEmpty
())
{
log
.
error
(
"文件是空的"
);
return
false
;
}
for
(
SweetDouDouVo
fileDouDouVo
:
fileSweetDouDouVos
)
{
SweetDouDouVo
vo
=
redisDataUtils
.
getSweetDouDou
(
fileDouDouVo
.
getUserId
());
if
(
vo
!=
null
)
{
vo
.
setStatus
(
fileDouDouVo
.
getStatus
());
redisDataUtils
.
setSweetDouDou
(
vo
);
log
.
info
(
"更新Redis成功"
);
LinkedList
<
String
>
sqls
=
CollectionUtil
.
linkedListString
();
LinkedList
<
Object
[]>
sqlsDataA
=
CollectionUtil
.
linkedListObjectArr
();
sqls
.
add
(
SqlMapping
.
get
(
"sweet_doudou.update"
));
sqlsDataA
.
add
(
new
Object
[]{
fileDouDouVo
.
getStatus
(),
LocalDateTime
.
now
(),
vo
.
getDoudouId
()
});
queueUtils
.
sendMsgByRedis
(
MQConst
.
SweetQueue
.
SWEET_ANSWER_INSERT
.
getKey
(),
SqlMapping
.
gets
(
sqls
,
sqlsDataA
));
log
.
info
(
"更新MySQL消息发送成功"
);
}
}
return
true
;
}
private
List
<
SweetDouDouVo
>
getSweetDouDouVoListByFile
(
MultipartFile
file
)
{
// 1. 验证文件类型
if
(!
isExcelFile
(
file
))
{
log
.
error
(
"请上传excel文件"
);
return
Collections
.
emptyList
();
}
ArrayList
<
SweetDouDouVo
>
sweetDouDouVos
=
new
ArrayList
<>();
try
(
InputStream
inputStream
=
file
.
getInputStream
();
Workbook
workbook
=
WorkbookFactory
.
create
(
inputStream
))
{
Sheet
sheet
=
workbook
.
getSheetAt
(
0
);
// 获取第一个工作表
Iterator
<
Row
>
rowIterator
=
sheet
.
iterator
();
// 跳过列名行
if
(
rowIterator
.
hasNext
())
rowIterator
.
next
();
// 2. 处理数据行
while
(
rowIterator
.
hasNext
())
{
Row
row
=
rowIterator
.
next
();
if
(
isRowEmpty
(
row
))
continue
;
// 跳过空行
SweetDouDouVo
vo
=
SweetDouDouVo
.
getNew
();
vo
.
setDoudouId
(
getStringValue
(
row
.
getCell
(
0
)));
vo
.
setUserId
(
getStringValue
(
row
.
getCell
(
1
)));
vo
.
setUsername
(
getStringValue
(
row
.
getCell
(
2
)));
vo
.
setPhone
(
getStringValue
(
row
.
getCell
(
3
)));
vo
.
setPlatform
(
getStringValue
(
row
.
getCell
(
4
)));
vo
.
setOrderCode
(
getStringValue
(
row
.
getCell
(
5
)));
vo
.
setMark
(
getStringValue
(
row
.
getCell
(
6
)));
String
cell7
=
getStringValue
(
row
.
getCell
(
7
));
vo
.
setStatus
(
cell7
.
equals
(
"1"
)
?
3
:
2
);
sweetDouDouVos
.
add
(
vo
);
}
return
sweetDouDouVos
;
}
catch
(
Exception
e
)
{
log
.
error
(
"error"
,
e
);
return
Collections
.
emptyList
();
}
}
// 辅助方法实现
private
boolean
isExcelFile
(
MultipartFile
file
)
{
String
fileName
=
file
.
getOriginalFilename
();
return
fileName
!=
null
&&
(
fileName
.
endsWith
(
".xls"
)
||
fileName
.
endsWith
(
".xlsx"
));
}
private
boolean
isRowEmpty
(
Row
row
)
{
for
(
int
i
=
0
;
i
<
7
;
i
++)
{
Cell
cell
=
row
.
getCell
(
i
,
Row
.
MissingCellPolicy
.
CREATE_NULL_AS_BLANK
);
if
(
cell
!=
null
&&
cell
.
getCellType
()
!=
CellType
.
BLANK
)
{
return
false
;
}
}
return
true
;
}
private
String
getStringValue
(
Cell
cell
)
{
if
(
cell
==
null
)
return
""
;
switch
(
cell
.
getCellType
())
{
case
STRING:
return
cell
.
getStringCellValue
().
trim
();
case
NUMERIC:
return
String
.
valueOf
((
int
)
cell
.
getNumericCellValue
());
case
BOOLEAN:
return
String
.
valueOf
(
cell
.
getBooleanCellValue
());
default
:
return
""
;
}
}
private
boolean
checkScope
(
String
authMobile
)
{
private
boolean
checkScope
(
String
authMobile
)
{
SweetDouDouScopeVo
sweetDouDouScopeVo
=
redisDataUtils
.
getSweetDouDouScopeVo
(
authMobile
);
SweetDouDouScopeVo
sweetDouDouScopeVo
=
redisDataUtils
.
getSweetDouDouScopeVo
(
authMobile
);
return
sweetDouDouScopeVo
!=
null
;
return
sweetDouDouScopeVo
!=
null
;
...
...
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