Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
D
data-server
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
licc
data-server
Commits
30757295
Commit
30757295
authored
Mar 29, 2021
by
m1991
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
后台接口——用户与资讯后台接口
parent
12eb51c2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
57 deletions
+24
-57
UploadServiceImpl.java
...java/cn/wisenergy/service/app/impl/UploadServiceImpl.java
+24
-57
No files found.
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/UploadServiceImpl.java
View file @
30757295
...
@@ -181,6 +181,7 @@ public class UploadServiceImpl implements UploadService {
...
@@ -181,6 +181,7 @@ public class UploadServiceImpl implements UploadService {
//过滤传入的邀请码带有“”的符号
//过滤传入的邀请码带有“”的符号
inviteCode
=
inviteCode
.
replace
(
"\""
,
""
).
replace
(
"\""
,
""
);
inviteCode
=
inviteCode
.
replace
(
"\""
,
""
).
replace
(
"\""
,
""
);
//获取上传图片数量,打印在控制台
//获取上传图片数量,打印在控制台
if
(
null
!=
files
&&!
""
.
equals
(
files
)){
System
.
out
.
println
(
"上传图片数量"
+
files
.
length
);
System
.
out
.
println
(
"上传图片数量"
+
files
.
length
);
//创建集合
//创建集合
List
<
Map
<
String
,
Object
>>
root
=
new
ArrayList
<
Map
<
String
,
Object
>>();
List
<
Map
<
String
,
Object
>>
root
=
new
ArrayList
<
Map
<
String
,
Object
>>();
...
@@ -191,11 +192,11 @@ public class UploadServiceImpl implements UploadService {
...
@@ -191,11 +192,11 @@ public class UploadServiceImpl implements UploadService {
Map
<
String
,
Object
>
result
=
new
HashMap
<
String
,
Object
>();
//一个文件上传的结果
Map
<
String
,
Object
>
result
=
new
HashMap
<
String
,
Object
>();
//一个文件上传的结果
String
msg
=
""
;
//上传结果信息
String
msg
=
""
;
//上传结果信息
//上传图片不为空时
//上传图片不为空时
Integer
sa
=
0
;
// long
sa = 0;
for
(
MultipartFile
file
:
files
)
{
//
for (MultipartFile file : files) {
sa
=
Math
.
toIntExact
(
file
.
getSize
()
);
// sa = file.getSize(
);
}
//
}
if
(
sa
>
0
&&
sa
!=
null
&&!
""
.
equals
(
sa
))
{
if
(
null
!=
files
&&!
""
.
equals
(
files
))
{
//遍历图片数据
//遍历图片数据
for
(
MultipartFile
file
:
files
)
{
for
(
MultipartFile
file
:
files
)
{
...
@@ -252,7 +253,7 @@ public class UploadServiceImpl implements UploadService {
...
@@ -252,7 +253,7 @@ public class UploadServiceImpl implements UploadService {
shopZxMapper
.
zxadd
(
zxUrl
,
zxField
,
inviteCode
,
zxDate
);
shopZxMapper
.
zxadd
(
zxUrl
,
zxField
,
inviteCode
,
zxDate
);
return
result
;
return
result
;
//用户只上传文字时
//用户只上传文字时
}
}
else
if
(
null
!=
zxField
&&
files
==
null
)
{
}
else
if
(
null
!=
zxField
&&
files
==
null
)
{
...
@@ -263,19 +264,18 @@ public class UploadServiceImpl implements UploadService {
...
@@ -263,19 +264,18 @@ public class UploadServiceImpl implements UploadService {
// zxUrl="0";
// zxUrl="0";
shopZxMapper
.
zxadd
(
zxUrl
,
zxField
,
inviteCode
,
zxDate
);
shopZxMapper
.
zxadd
(
zxUrl
,
zxField
,
inviteCode
,
zxDate
);
//图片与文字都为null的时候,给前端返回提示!
//图片与文字都为null的时候,给前端返回提示!
}
else
{
}
else
if
(
null
==
files
&&
null
==
zxField
)
{
if
(
null
==
files
&&
null
==
zxField
)
{
map
.
put
(
"code"
,
1
);
map
.
put
(
"code"
,
1
);
map
.
put
(
"msg"
,
"上传资讯不能为空,请重新上传!"
);
map
.
put
(
"msg"
,
"上传资讯不能为空,请重新上传!"
);
return
map
;
return
map
;
}
}
}
map
.
put
(
"code"
,
0
);
map
.
put
(
"code"
,
0
);
map
.
put
(
"msg"
,
"资讯上传成功!"
);
map
.
put
(
"msg"
,
"资讯上传成功!"
);
return
map
;
return
map
;
}
}
/**
/**
* TODO 多文件上传
* TODO 多文件上传
*/
*/
...
@@ -338,17 +338,25 @@ public class UploadServiceImpl implements UploadService {
...
@@ -338,17 +338,25 @@ public class UploadServiceImpl implements UploadService {
public
Map
selectPage
(
int
pageNum
,
int
pageSize
,
String
inviteCode
)
{
public
Map
selectPage
(
int
pageNum
,
int
pageSize
,
String
inviteCode
)
{
Map
map
=
new
HashMap
();
Map
map
=
new
HashMap
();
pageNum
=
pageNum
-
1
;
pageNum
=
pageNum
-
1
;
List
<
ZxUserDto
>
shopZxList
=
shopZxMapper
.
selectPage
(
pageNum
,
pageSize
);
List
<
ZxUserDto
>
shopZxList
=
shopZxMapper
.
selectPage
(
pageNum
,
pageSize
);
for
(
ZxUserDto
shopZx
:
shopZxList
)
{
for
(
ZxUserDto
shopZx
:
shopZxList
)
{
String
[]
zxUrl
=
shopZx
.
getZxUrl
().
split
(
","
);
String
[]
zxUrl
=
shopZx
.
getZxUrl
().
split
(
","
);
ArrayList
list
=
new
ArrayList
();
ArrayList
list
=
new
ArrayList
();
if
(
null
!=
zxUrl
)
{
if
(
!
""
.
equals
(
zxUrl
)
)
{
for
(
String
split
:
zxUrl
)
{
for
(
String
split
:
zxUrl
)
{
if
(
""
.
equals
(
split
)){
shopZx
.
setAskImgList
(
null
);
}
else
{
boolean
arrayList
=
Collections
.
addAll
(
list
,
split
);
boolean
arrayList
=
Collections
.
addAll
(
list
,
split
);
shopZx
.
setAskImgList
(
list
);
shopZx
.
setAskImgList
(
list
);
}
}
}
}
}
int
likedId
=
shopZx
.
getZxid
();
int
likedId
=
shopZx
.
getZxid
();
if
(
shopZx
.
getUserId
()
==
null
&&
""
!=
shopZx
.
getUserId
())
{
if
(
shopZx
.
getUserId
()
==
null
&&
""
!=
shopZx
.
getUserId
())
{
...
@@ -375,53 +383,10 @@ public class UploadServiceImpl implements UploadService {
...
@@ -375,53 +383,10 @@ public class UploadServiceImpl implements UploadService {
}
}
}
}
}
}
map
.
put
(
"data"
,
shopZxList
);
map
.
put
(
"data"
,
shopZxList
);
return
map
;
return
map
;
}
}
// @Override
// public Map selectPage(int pageNum, int pageSize, String inviteCode) {
// Map map = new HashMap();
// pageNum = pageNum - 1;
// List<ZxUserDto> shopZxList = shopZxMapper.selectPage(pageNum,pageSize);
//
// for (ZxUserDto shopZx : shopZxList) {
// String[] zxUrl = shopZx.getZxUrl().split(",");
// ArrayList list = new ArrayList();
// if (null != zxUrl) {
// for (String split : zxUrl) {
// boolean arrayList = Collections.addAll(list, split);
// shopZx.setAskImgList(list);
// }
// }
//
// int likedId = shopZx.getZxid();
// if (shopZx.getUserId() == null && "" != shopZx.getUserId()) {
// map.put("code", 1);
// map.put("msg", "用户不存在!请重新开始!");
// return map;
// }
// shopZx.setUserId(shopZx.getUserId().replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"));
//
// if (null != inviteCode && "" != inviteCode) {
// //用户个人邀请码查询用户数据
// User user = usersMapper.InvitedCode2(inviteCode);
// String userLikeId = user.getUserId();
// if (null == userLikeId) {
// map.put("code", 1);
// map.put("msg", "用户不存在,请重新登陆!");
// return map;
// }
// userLikes d = LikesMapper.selectlikes(userLikeId, likedId);
// if (null == d) {
// shopZx.setLikedStatus(0);
// } else {
// shopZx.setLikedStatus(1);
// }
// }
// }
// map.put("data", shopZxList);
// return map;
// }
@Override
@Override
public
R
<
PageInfo
<
ShopZxUserVo
>>
getShopZxUserList
(
ShopZxUserDto
shopZxUserDto
)
{
public
R
<
PageInfo
<
ShopZxUserVo
>>
getShopZxUserList
(
ShopZxUserDto
shopZxUserDto
)
{
...
@@ -452,6 +417,8 @@ public class UploadServiceImpl implements UploadService {
...
@@ -452,6 +417,8 @@ public class UploadServiceImpl implements UploadService {
return
R
.
ok
(
info
);
return
R
.
ok
(
info
);
}
}
/**
/**
* 分页处理方法
* 分页处理方法
*
*
...
...
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