Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
Overview
Overview
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
徐少华
midjourney-proxy
Commits
5ffb6ccf
Commit
5ffb6ccf
authored
Jul 08, 2019
by
阮思源
Browse files
Options
Browse Files
Download
Plain Diff
Merge branches 'master' and 'mymaster' of
http://192.168.89.173/rays/pcloud-book
into mymaster
parents
6d871d8e
2ac38974
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
141 additions
and
29 deletions
+141
-29
AdvertisingSpaceBizImpl.java
...ud/book/advertising/biz/impl/AdvertisingSpaceBizImpl.java
+35
-21
AdvertisingSpaceFacadeImpl.java
...k/advertising/facade/impl/AdvertisingSpaceFacadeImpl.java
+1
-1
BookAuthInfoBizImpl.java
...m/pcloud/book/copyright/biz/impl/BookAuthInfoBizImpl.java
+4
-0
CopyrightTools.java
.../java/com/pcloud/book/copyright/tools/CopyrightTools.java
+100
-3
AdvertisingClickRecordMapper.xml
...urces/mapper/advertising/AdvertisingClickRecordMapper.xml
+1
-4
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/advertising/biz/impl/AdvertisingSpaceBizImpl.java
View file @
5ffb6ccf
...
@@ -432,7 +432,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -432,7 +432,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
String
adTitle
=
advertisingSpace
.
getAdTitle
();
String
adTitle
=
advertisingSpace
.
getAdTitle
();
List
<
String
>
linkList
=
getLinkList
(
adTitle
);
//提取文本链接
List
<
String
>
linkList
=
getLinkList
(
adTitle
);
//提取文本链接
if
(!
ListUtils
.
isEmpty
(
linkList
))
{
if
(!
ListUtils
.
isEmpty
(
linkList
))
{
adTitle
=
adTitle
.
replaceAll
(
"</link><link>"
,
"</link> <link>"
);
//连续两个链接之间要有分隔
adTitle
=
adTitle
.
replaceAll
(
"</link><link>"
,
"</link> <link>"
);
//连续两个链接之间要有分隔
for
(
String
link
:
linkList
)
{
for
(
String
link
:
linkList
)
{
String
adLink
=
""
;
String
adLink
=
""
;
String
adLinkOld
=
link
.
replaceAll
(
"<link>"
,
""
).
replace
(
"</link>"
,
""
);
String
adLinkOld
=
link
.
replaceAll
(
"<link>"
,
""
).
replace
(
"</link>"
,
""
);
...
@@ -633,9 +633,9 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -633,9 +633,9 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
if
(
pageBean
==
null
||
ListUtils
.
isEmpty
(
pageBean
.
getRecordList
()))
{
if
(
pageBean
==
null
||
ListUtils
.
isEmpty
(
pageBean
.
getRecordList
()))
{
return
new
PageBean
(
0
,
0
,
new
ArrayList
<>());
return
new
PageBean
(
0
,
0
,
new
ArrayList
<>());
}
}
List
<
Object
>
objs
=
pageBean
.
getRecordList
();
List
<
Object
>
objs
=
pageBean
.
getRecordList
();
Object
objectlist
=
(
Object
)
objs
;
Object
objectlist
=
(
Object
)
objs
;
List
<
GroupQrcodeVO
>
groupQrcodeVOList
=
(
List
<
GroupQrcodeVO
>)
objectlist
;
List
<
GroupQrcodeVO
>
groupQrcodeVOList
=
(
List
<
GroupQrcodeVO
>)
objectlist
;
List
<
Long
>
labelIds
=
new
ArrayList
<>();
List
<
Long
>
labelIds
=
new
ArrayList
<>();
List
<
Long
>
proLabels
=
groupQrcodeVOList
.
stream
().
filter
(
s
->
s
.
getProLabelId
()!=
null
).
map
(
GroupQrcodeVO:
:
getProLabelId
).
distinct
().
collect
(
Collectors
.
toList
());
List
<
Long
>
proLabels
=
groupQrcodeVOList
.
stream
().
filter
(
s
->
s
.
getProLabelId
()!=
null
).
map
(
GroupQrcodeVO:
:
getProLabelId
).
distinct
().
collect
(
Collectors
.
toList
());
List
<
Long
>
depLabels
=
groupQrcodeVOList
.
stream
().
filter
(
s
->
s
.
getDepLabelId
()!=
null
).
map
(
GroupQrcodeVO:
:
getDepLabelId
).
distinct
().
collect
(
Collectors
.
toList
());
List
<
Long
>
depLabels
=
groupQrcodeVOList
.
stream
().
filter
(
s
->
s
.
getDepLabelId
()!=
null
).
map
(
GroupQrcodeVO:
:
getDepLabelId
).
distinct
().
collect
(
Collectors
.
toList
());
...
@@ -643,16 +643,16 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -643,16 +643,16 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
if
(!
ListUtils
.
isEmpty
(
proLabels
)){
if
(!
ListUtils
.
isEmpty
(
proLabels
)){
labelIds
.
addAll
(
proLabels
);
labelIds
.
addAll
(
proLabels
);
}
}
if
(!
ListUtils
.
isEmpty
(
depLabels
)){
if
(!
ListUtils
.
isEmpty
(
depLabels
))
{
labelIds
.
addAll
(
depLabels
);
labelIds
.
addAll
(
depLabels
);
}
}
if
(!
ListUtils
.
isEmpty
(
purLabels
)){
if
(!
ListUtils
.
isEmpty
(
purLabels
))
{
labelIds
.
addAll
(
purLabels
);
labelIds
.
addAll
(
purLabels
);
}
}
if
(!
ListUtils
.
isEmpty
(
labelIds
))
{
if
(!
ListUtils
.
isEmpty
(
labelIds
))
{
Map
<
Long
,
String
>
labelMap
=
labelConsr
.
getLabelName
(
labelIds
);
Map
<
Long
,
String
>
labelMap
=
labelConsr
.
getLabelName
(
labelIds
);
if
(!
MapUtils
.
isEmpty
(
labelMap
))
{
if
(!
MapUtils
.
isEmpty
(
labelMap
))
{
for
(
Object
object
:
objs
)
{
for
(
Object
object
:
objs
)
{
GroupQrcodeVO
qrcodeVO
=
(
GroupQrcodeVO
)
object
;
GroupQrcodeVO
qrcodeVO
=
(
GroupQrcodeVO
)
object
;
if
(
null
!=
qrcodeVO
.
getProLabelId
()
&&
labelMap
.
containsKey
(
qrcodeVO
.
getProLabelId
()))
{
if
(
null
!=
qrcodeVO
.
getProLabelId
()
&&
labelMap
.
containsKey
(
qrcodeVO
.
getProLabelId
()))
{
qrcodeVO
.
setProLabelName
(
labelMap
.
get
(
qrcodeVO
.
getProLabelId
()));
qrcodeVO
.
setProLabelName
(
labelMap
.
get
(
qrcodeVO
.
getProLabelId
()));
...
@@ -905,15 +905,16 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -905,15 +905,16 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
}
}
/**
/**
* 获取书刊广告位点击读者量
* 获取书刊广告位点击读者量
(废弃,读者不走授权,读者信息全为空,没办法聚合,点击量就是读者量)
*/
*/
private
Long
getClickUserNumByGroupQrcodeId
(
Long
qrcodeId
,
Long
adId
,
String
statisMonth
)
{
private
Long
getClickUserNumByGroupQrcodeId
(
Long
qrcodeId
,
Long
adId
,
String
statisMonth
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
/*
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("qrcodeId", qrcodeId);
paramMap.put("qrcodeId", qrcodeId);
paramMap.put("adId", adId);
paramMap.put("adId", adId);
paramMap.put("statisMonth", statisMonth);
paramMap.put("statisMonth", statisMonth);
Long clickUserNum = (Long) advertisingClickRecordDao.getBy(paramMap, "getClickUserNumByGroupQrcodeId");
Long clickUserNum = (Long) advertisingClickRecordDao.getBy(paramMap, "getClickUserNumByGroupQrcodeId");
return
null
==
clickUserNum
?
0L
:
clickUserNum
;
return null == clickUserNum ? 0L : clickUserNum;*/
return
0L
;
}
}
/**
/**
...
@@ -1283,10 +1284,15 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -1283,10 +1284,15 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
return
new
PageBean
(
0
,
0
,
new
ArrayList
<>());
return
new
PageBean
(
0
,
0
,
new
ArrayList
<>());
}
}
List
<
Long
>
wechatUserIds
=
new
ArrayList
<>();
List
<
Long
>
wechatUserIds
=
new
ArrayList
<>();
pageBean
.
getRecordList
().
forEach
(
obj
->
{
for
(
Object
object
:
pageBean
.
getRecordList
())
{
wechatUserIds
.
add
(((
WechatGroupClickUserDTO
)
obj
).
getWechatUserId
());
Long
wechatUserId
=
((
WechatGroupClickUserDTO
)
object
).
getWechatUserId
();
});
wechatUserIds
.
add
(
wechatUserId
);
Map
<
Long
,
WechatUser
>
wechatUserMap
=
readerConsr
.
getUserList
(
wechatUserIds
);
}
Map
<
Long
,
WechatUser
>
wechatUserMap
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
wechatUserIds
))
{
wechatUserIds
=
new
ArrayList
<>(
new
HashSet
<>(
wechatUserIds
));
wechatUserMap
=
readerConsr
.
getUserList
(
wechatUserIds
);
}
for
(
Object
object
:
pageBean
.
getRecordList
())
{
for
(
Object
object
:
pageBean
.
getRecordList
())
{
WechatGroupClickUserDTO
dto
=
(
WechatGroupClickUserDTO
)
object
;
WechatGroupClickUserDTO
dto
=
(
WechatGroupClickUserDTO
)
object
;
if
(!
MapUtils
.
isEmpty
(
wechatUserMap
)
&&
wechatUserMap
.
containsKey
(
dto
.
getWechatUserId
()))
{
if
(!
MapUtils
.
isEmpty
(
wechatUserMap
)
&&
wechatUserMap
.
containsKey
(
dto
.
getWechatUserId
()))
{
...
@@ -1318,8 +1324,12 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -1318,8 +1324,12 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
if
(
ListUtils
.
isEmpty
(
list
))
{
if
(
ListUtils
.
isEmpty
(
list
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"暂无数据导出!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"暂无数据导出!"
);
}
}
List
<
Long
>
wechatUserIds
=
list
.
stream
().
map
(
WechatGroupClickUserDTO:
:
getWechatUserId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
wechatUserIds
=
list
.
stream
().
filter
(
dto
->
null
!=
dto
.
getWechatUserId
()).
map
(
WechatGroupClickUserDTO:
:
getWechatUserId
).
collect
(
Collectors
.
toList
());
Map
<
Long
,
WechatUser
>
wechatUserMap
=
readerConsr
.
getUserList
(
wechatUserIds
);
Map
<
Long
,
WechatUser
>
wechatUserMap
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
wechatUserIds
))
{
wechatUserIds
=
new
ArrayList
<>(
new
HashSet
<>(
wechatUserIds
));
wechatUserMap
=
readerConsr
.
getUserList
(
wechatUserIds
);
}
// 字段名
// 字段名
String
[]
rowsName
=
{
"序号"
,
"读者信息"
,
"读者标签"
,
"点击时间"
};
String
[]
rowsName
=
{
"序号"
,
"读者信息"
,
"读者标签"
,
"点击时间"
};
List
<
Object
[]>
dataList
=
new
ArrayList
<>();
List
<
Object
[]>
dataList
=
new
ArrayList
<>();
...
@@ -1330,9 +1340,13 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -1330,9 +1340,13 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
objs
[
0
]
=
i
+
1
;
objs
[
0
]
=
i
+
1
;
if
(!
MapUtils
.
isEmpty
(
wechatUserMap
)
&&
wechatUserMap
.
containsKey
(
dto
.
getWechatUserId
()))
{
if
(!
MapUtils
.
isEmpty
(
wechatUserMap
)
&&
wechatUserMap
.
containsKey
(
dto
.
getWechatUserId
()))
{
WechatUser
wechatUser
=
wechatUserMap
.
get
(
dto
.
getWechatUserId
());
WechatUser
wechatUser
=
wechatUserMap
.
get
(
dto
.
getWechatUserId
());
objs
[
1
]
=
wechatUser
.
getWechatUserNickname
();
objs
[
1
]
=
null
!=
wechatUser
.
getWechatUserNickname
()
?
wechatUser
.
getWechatUserNickname
()
:
"--"
;
String
sex
=
wechatUser
.
getWechatUserSex
().
equals
(
1
)
?
"男"
:
(
wechatUser
.
getWechatUserSex
().
equals
(
2
)
?
"女"
:
"未知"
);
if
(
null
==
wechatUser
.
getWechatUserSex
()
&&
StringUtil
.
isEmpty
(
wechatUser
.
getWechatUserCity
()))
{
objs
[
2
]
=
sex
+
","
+
wechatUser
.
getWechatUserCity
();
objs
[
2
]
=
"--"
;
}
else
{
String
sex
=
null
==
wechatUser
.
getWechatUserSex
()
?
"--"
:
(
wechatUser
.
getWechatUserSex
().
equals
(
1
)
?
"男"
:
(
wechatUser
.
getWechatUserSex
().
equals
(
2
)
?
"女"
:
"未知"
));
objs
[
2
]
=
sex
+
","
+
(
null
==
wechatUser
.
getWechatUserCity
()
?
"--"
:
wechatUser
.
getWechatUserCity
());
}
}
else
{
}
else
{
objs
[
1
]
=
""
;
objs
[
1
]
=
""
;
objs
[
2
]
=
""
;
objs
[
2
]
=
""
;
...
@@ -1343,10 +1357,10 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -1343,10 +1357,10 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
GroupQrcode
groupQrcode
=
groupQrcodeDao
.
getById
(
qrcodeId
);
GroupQrcode
groupQrcode
=
groupQrcodeDao
.
getById
(
qrcodeId
);
String
[]
dateStr
=
statisMonth
.
split
(
"-"
);
String
[]
dateStr
=
statisMonth
.
split
(
"-"
);
String
fileName
;
String
fileName
;
if
(
StringUtil
.
isEmpty
(
statisMonth
))
{
if
(
!
StringUtil
.
isEmpty
(
statisMonth
))
{
fileName
=
(
null
!=
groupQrcode
?
groupQrcode
.
getGroupName
()
:
""
)
+
dateStr
[
0
]
+
"年"
+
Integer
.
parseInt
(
dateStr
[
1
])
+
"月"
+
space
.
getAdName
()
+
"广告位点击
读者
明细"
;
fileName
=
(
null
!=
groupQrcode
?
groupQrcode
.
getGroupName
()
:
""
)
+
dateStr
[
0
]
+
"年"
+
Integer
.
parseInt
(
dateStr
[
1
])
+
"月"
+
space
.
getAdName
()
+
"广告位点击明细"
;
}
else
{
}
else
{
fileName
=
space
.
getAdName
()
+
"广告位"
+
(
null
!=
groupQrcode
?
groupQrcode
.
getGroupName
()
:
""
)
+
"点击
读者
明细"
;
fileName
=
space
.
getAdName
()
+
"广告位"
+
(
null
!=
groupQrcode
?
groupQrcode
.
getGroupName
()
:
""
)
+
"点击明细"
;
}
}
String
fileUrl
=
exportConsr
.
exportExcel
(
fileName
,
rowsName
,
dataList
);
String
fileUrl
=
exportConsr
.
exportExcel
(
fileName
,
rowsName
,
dataList
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
...
...
pcloud-service-book/src/main/java/com/pcloud/book/advertising/facade/impl/AdvertisingSpaceFacadeImpl.java
View file @
5ffb6ccf
...
@@ -371,7 +371,7 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
...
@@ -371,7 +371,7 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
bookGroupId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
BOOK_GROUP_ID
);
Long
bookGroupId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
BOOK_GROUP_ID
);
if
(
null
==
advertisingClickRecord
||
null
==
advertisingClickRecord
.
getAdId
()
||
null
==
wechatUserId
)
{
if
(
null
==
advertisingClickRecord
||
null
==
advertisingClickRecord
.
getAdId
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
}
if
((
null
==
advertisingClickRecord
.
getBookId
()
&&
!
"WECHAT_GROUP"
.
equals
(
advertisingClickRecord
.
getFromType
()))
if
((
null
==
advertisingClickRecord
.
getBookId
()
&&
!
"WECHAT_GROUP"
.
equals
(
advertisingClickRecord
.
getFromType
()))
...
...
pcloud-service-book/src/main/java/com/pcloud/book/copyright/biz/impl/BookAuthInfoBizImpl.java
View file @
5ffb6ccf
...
@@ -183,6 +183,10 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
...
@@ -183,6 +183,10 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
String
url
=
generateExcel
(
bookAuthCodes
,
bookDto
.
getBookName
());
String
url
=
generateExcel
(
bookAuthCodes
,
bookDto
.
getBookName
());
String
zipUrl
=
CopyrightTools
.
generateBar4Zip
(
bookAuthCodes
,
bookDto
.
getBookName
(),
url
);
String
zipUrl
=
CopyrightTools
.
generateBar4Zip
(
bookAuthCodes
,
bookDto
.
getBookName
(),
url
);
noticeUrl
=
zipUrl
;
noticeUrl
=
zipUrl
;
}
else
if
(
isHaveBarCode
.
equals
(
2
)){
String
url
=
generateExcel
(
bookAuthCodes
,
bookDto
.
getBookName
());
String
zipUrl
=
CopyrightTools
.
generateQrcode4Zip
(
bookAuthCodes
,
bookDto
.
getBookName
(),
url
);
noticeUrl
=
zipUrl
;
}
else
{
}
else
{
String
url
=
generateExcel
(
bookAuthCodes
,
bookDto
.
getBookName
());
String
url
=
generateExcel
(
bookAuthCodes
,
bookDto
.
getBookName
());
noticeUrl
=
url
;
noticeUrl
=
url
;
...
...
pcloud-service-book/src/main/java/com/pcloud/book/copyright/tools/CopyrightTools.java
View file @
5ffb6ccf
package
com
.
pcloud
.
book
.
copyright
.
tools
;
package
com
.
pcloud
.
book
.
copyright
.
tools
;
import
com.google.zxing.BarcodeFormat
;
import
com.google.zxing.EncodeHintType
;
import
com.google.zxing.MultiFormatWriter
;
import
com.google.zxing.common.BitMatrix
;
import
com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
;
import
com.pcloud.book.book.constant.BookConstant
;
import
com.pcloud.book.book.constant.BookConstant
;
import
com.pcloud.book.copyright.dto.DateDTO
;
import
com.pcloud.book.copyright.dto.DateDTO
;
import
com.pcloud.book.copyright.entity.BookAuthCode
;
import
com.pcloud.book.copyright.entity.BookAuthCode
;
...
@@ -14,6 +20,7 @@ import com.pcloud.common.utils.LocalDateUtils;
...
@@ -14,6 +20,7 @@ import com.pcloud.common.utils.LocalDateUtils;
import
com.pcloud.common.utils.UUIDUitl
;
import
com.pcloud.common.utils.UUIDUitl
;
import
com.pcloud.common.utils.aliyun.OssUtils
;
import
com.pcloud.common.utils.aliyun.OssUtils
;
import
com.pcloud.common.utils.zip.CompressUtils
;
import
com.pcloud.common.utils.zip.CompressUtils
;
import
org.jbarcode.JBarcode
;
import
org.jbarcode.JBarcode
;
import
org.jbarcode.encode.Code128Encoder
;
import
org.jbarcode.encode.Code128Encoder
;
import
org.jbarcode.paint.BaseLineTextPainter
;
import
org.jbarcode.paint.BaseLineTextPainter
;
...
@@ -23,7 +30,6 @@ import org.slf4j.Logger;
...
@@ -23,7 +30,6 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
javax.imageio.ImageIO
;
import
java.awt.*
;
import
java.awt.*
;
import
java.awt.image.BufferedImage
;
import
java.awt.image.BufferedImage
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
...
@@ -38,6 +44,8 @@ import java.util.Map;
...
@@ -38,6 +44,8 @@ import java.util.Map;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.UUID
;
import
java.util.UUID
;
import
javax.imageio.ImageIO
;
/**
/**
* @author lily
* @author lily
* @date 2018/12/4 16:37
* @date 2018/12/4 16:37
...
@@ -66,12 +74,13 @@ public class CopyrightTools {
...
@@ -66,12 +74,13 @@ public class CopyrightTools {
return
shortBuffer
.
toString
().
toLowerCase
();
return
shortBuffer
.
toString
().
toLowerCase
();
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
long
time
=
System
.
currentTimeMillis
();
long
time
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
createShortUuidByCount
(
100000
));
System
.
out
.
println
(
createShortUuidByCount
(
100000
));
long
time1
=
System
.
currentTimeMillis
();
long
time1
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
time1
-
time
);
System
.
out
.
println
(
time1
-
time
);
}
}
/**
/**
* 生成count位非重复的数
* 生成count位非重复的数
*
*
...
@@ -108,6 +117,13 @@ public class CopyrightTools {
...
@@ -108,6 +117,13 @@ public class CopyrightTools {
}
}
}
}
/**
* 生成条形码
* @param bookAuthCodes
* @param fileName
* @param excelUrl
* @return
*/
public
static
String
generateBar4Zip
(
List
<
BookAuthCode
>
bookAuthCodes
,
String
fileName
,
String
excelUrl
)
{
public
static
String
generateBar4Zip
(
List
<
BookAuthCode
>
bookAuthCodes
,
String
fileName
,
String
excelUrl
)
{
fileName
=
FileUtils
.
formatName
(
fileName
);
fileName
=
FileUtils
.
formatName
(
fileName
);
String
tempZipName
=
fileName
+
"_"
+
LocalDateUtils
.
getYmdhmss
();
String
tempZipName
=
fileName
+
"_"
+
LocalDateUtils
.
getYmdhmss
();
...
@@ -147,6 +163,66 @@ public class CopyrightTools {
...
@@ -147,6 +163,66 @@ public class CopyrightTools {
return
uploadResultInfo
==
null
?
null
:
uploadResultInfo
.
getUrl
();
return
uploadResultInfo
==
null
?
null
:
uploadResultInfo
.
getUrl
();
}
}
/**
* 生成二维码
* @param bookAuthCodes
* @param fileName
* @param excelUrl
* @return
*/
public
static
String
generateQrcode4Zip
(
List
<
BookAuthCode
>
bookAuthCodes
,
String
fileName
,
String
excelUrl
)
{
fileName
=
FileUtils
.
formatName
(
fileName
);
String
tempZipName
=
fileName
+
"_"
+
LocalDateUtils
.
getYmdhmss
();
String
zipFilePath
=
ZIP_FILE_PATH
+
tempZipName
+
".zip"
;
String
fileFolderPath
=
FILE_LOCAL_PATH
+
tempZipName
;
FileUtils
.
isDir
(
fileFolderPath
);
UploadResultInfo
uploadResultInfo
;
try
{
for
(
BookAuthCode
bookAuthCode
:
bookAuthCodes
)
{
LOGGER
.
info
(
"【二维码】generateQrcode4Zip,<START>.[url]="
+
bookAuthCode
);
Map
<
EncodeHintType
,
Object
>
hints
=
new
HashMap
<
EncodeHintType
,
Object
>();
hints
.
put
(
EncodeHintType
.
CHARACTER_SET
,
"UTF-8"
);
hints
.
put
(
EncodeHintType
.
ERROR_CORRECTION
,
ErrorCorrectionLevel
.
H
);
hints
.
put
(
EncodeHintType
.
MARGIN
,
0
);
// 设置白边
try
{
// 生成矩阵
BitMatrix
bitMatrix
=
new
MultiFormatWriter
().
encode
(
bookAuthCode
.
getFullCode
(),
BarcodeFormat
.
QR_CODE
,
55
,
55
,
hints
);
int
width
=
bitMatrix
.
getWidth
();
int
height
=
bitMatrix
.
getHeight
();
BufferedImage
bufferedImage
=
new
BufferedImage
(
width
,
height
,
BufferedImage
.
TYPE_INT_RGB
);
for
(
int
x
=
0
;
x
<
width
;
x
++){
for
(
int
y
=
0
;
y
<
height
;
y
++){
bufferedImage
.
setRGB
(
x
,
y
,
bitMatrix
.
get
(
x
,
y
)
?
0xFF000000
:
0xFFFFFFFF
);
}
}
// paintQrcodeText(bufferedImage, bookAuthCode.getFullCode());
File
file
=
new
File
(
fileFolderPath
+
"/"
+
bookAuthCode
.
getFullCode
()
+
".png"
);
ImageIO
.
write
(
bufferedImage
,
ImageTypeEnum
.
PNG
.
value
,
file
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"【二维码】创建二维码失败,<ERROR>:"
+
e
.
getMessage
(),
e
);
throw
new
FileException
(
FileException
.
FILE_UPLOAD_FAILURE
,
"创建二维码失败"
);
}
}
String
downloadLocalPath
=
fileFolderPath
+
"/"
+
fileName
+
".xls"
;
FileUtils
.
downloadFileFromUrl
(
excelUrl
,
downloadLocalPath
);
// 检查压缩包临时文件夹是否存在,不存在就创建
FileUtils
.
isDir
(
ZIP_FILE_PATH
);
CompressUtils
.
zip
(
fileFolderPath
,
zipFilePath
);
// 上传文件到服务器中
uploadResultInfo
=
OssUtils
.
uploadLocalFile4CustomName
(
zipFilePath
,
fileName
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"【压缩】压缩失败,<ERROR>:"
+
e
.
getMessage
(),
e
);
throw
new
FileException
(
FileException
.
ZIP_ERROR
,
"压缩失败!"
);
}
finally
{
// 删除产生的文件
FileUtils
.
deleteDirectory
(
fileFolderPath
);
FileUtils
.
deleteFile
(
zipFilePath
);
}
return
uploadResultInfo
==
null
?
null
:
uploadResultInfo
.
getUrl
();
}
public
static
String
uploadImage
(
BufferedImage
image
)
throws
BizException
{
public
static
String
uploadImage
(
BufferedImage
image
)
throws
BizException
{
UploadResultInfo
uploadResultInfo
=
null
;
UploadResultInfo
uploadResultInfo
=
null
;
...
@@ -207,6 +283,27 @@ public class CopyrightTools {
...
@@ -207,6 +283,27 @@ public class CopyrightTools {
// g2d.drawString(text, center, barCodeImage.getHeight() - (height / 10) - 2);
// g2d.drawString(text, center, barCodeImage.getHeight() - (height / 10) - 2);
// }
// }
public
static
void
paintQrcodeText
(
BufferedImage
barCodeImage
,
String
text
)
{
//绘图
Graphics
g2d
=
barCodeImage
.
getGraphics
();
//创建字体
Font
font
=
new
Font
(
"console"
,
Font
.
PLAIN
,
5
);
g2d
.
setFont
(
font
);
FontMetrics
fm
=
g2d
.
getFontMetrics
();
int
height
=
fm
.
getHeight
();
// int center = (barCodeImage.getWidth() - fm.stringWidth(text)) / 2;
g2d
.
setColor
(
Color
.
WHITE
);
g2d
.
fillRect
(
0
,
0
,
barCodeImage
.
getWidth
(),
barCodeImage
.
getHeight
()
/
20
);
g2d
.
fillRect
(
0
,
barCodeImage
.
getHeight
()
-
(
height
*
9
/
10
),
barCodeImage
.
getWidth
(),
(
height
*
9
/
10
));
g2d
.
setColor
(
Color
.
BLACK
);
//g2d.drawString(text, center, barCodeImage.getHeight() - (height / 10) - 2);
int
start
=
17
;
int
length
=
(
barCodeImage
.
getWidth
()
-
2
*
start
)
/
text
.
length
();
for
(
int
i
=
0
;
i
<
text
.
length
();
i
++)
{
g2d
.
drawString
(
text
.
substring
(
i
,
i
+
1
),
start
+
i
*
length
,
barCodeImage
.
getHeight
()
-
(
height
/
10
)
-
2
);
}
}
public
static
void
paintText
(
BufferedImage
barCodeImage
,
String
text
)
{
public
static
void
paintText
(
BufferedImage
barCodeImage
,
String
text
)
{
//绘图
//绘图
Graphics
g2d
=
barCodeImage
.
getGraphics
();
Graphics
g2d
=
barCodeImage
.
getGraphics
();
...
...
pcloud-service-book/src/main/resources/mapper/advertising/AdvertisingClickRecordMapper.xml
View file @
5ffb6ccf
...
@@ -122,7 +122,7 @@
...
@@ -122,7 +122,7 @@
from_type fromType,
from_type fromType,
from_id fromId,
from_id fromId,
wechat_user_id wechatUserId,
wechat_user_id wechatUserId,
max(create_time)
createTime
create_time
createTime
FROM
FROM
advertising_click_record
advertising_click_record
WHERE
WHERE
...
@@ -132,9 +132,6 @@
...
@@ -132,9 +132,6 @@
<if
test=
"statisMonth != null"
>
<if
test=
"statisMonth != null"
>
AND create_month = #{statisMonth}
AND create_month = #{statisMonth}
</if>
</if>
AND wechat_user_id IS NOT NULL
GROUP BY
wechat_user_id
ORDER BY
ORDER BY
createTime DESC
createTime DESC
</select>
</select>
...
...
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