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
f07e3fdb
Commit
f07e3fdb
authored
Dec 17, 2018
by
lili
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
版权保护优化
parent
7caddf92
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
183 additions
and
52 deletions
+183
-52
BookDto.java
...-book/src/main/java/com/pcloud/book/book/dto/BookDto.java
+90
-22
BookFacade.java
...src/main/java/com/pcloud/book/book/facade/BookFacade.java
+4
-2
BookFacadeImpl.java
...java/com/pcloud/book/book/facade/impl/BookFacadeImpl.java
+3
-1
BookAuthInfoBizImpl.java
...m/pcloud/book/copyright/biz/impl/BookAuthInfoBizImpl.java
+6
-6
CopyrightTools.java
.../java/com/pcloud/book/copyright/tools/CopyrightTools.java
+70
-8
Book.Mapper.xml
...rvice-book/src/main/resources/mapper/book/Book.Mapper.xml
+10
-13
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/book/dto/BookDto.java
View file @
f07e3fdb
...
@@ -5,6 +5,7 @@ package com.pcloud.book.book.dto;
...
@@ -5,6 +5,7 @@ package com.pcloud.book.book.dto;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.common.dto.BaseDto
;
import
com.pcloud.common.dto.BaseDto
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -397,6 +398,8 @@ public class BookDto extends BaseDto {
...
@@ -397,6 +398,8 @@ public class BookDto extends BaseDto {
*/
*/
private
String
qrRemark
;
private
String
qrRemark
;
@ApiModelProperty
(
"图书状态"
)
private
Integer
bookStatus
;
public
String
getQrRemark
()
{
public
String
getQrRemark
()
{
return
qrRemark
;
return
qrRemark
;
...
@@ -1006,29 +1009,94 @@ public class BookDto extends BaseDto {
...
@@ -1006,29 +1009,94 @@ public class BookDto extends BaseDto {
this
.
typeCodeNames
=
typeCodeNames
;
this
.
typeCodeNames
=
typeCodeNames
;
}
}
public
Integer
getBookStatus
()
{
return
bookStatus
;
}
public
void
setBookStatus
(
Integer
bookStatus
)
{
this
.
bookStatus
=
bookStatus
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"BookDto [bookId="
+
bookId
+
", typeCode="
+
typeCode
+
", typeName="
+
typeName
+
", isbn="
+
isbn
return
"BookDto{"
+
+
", bookName="
+
bookName
+
", bookPrice="
+
bookPrice
+
", originName="
+
originName
+
", remark="
"bookId="
+
bookId
+
+
remark
+
", author="
+
author
+
", publish="
+
publish
+
", publishDate="
+
publishDate
", typeCode='"
+
typeCode
+
'\''
+
+
", coverImg="
+
coverImg
+
", detail="
+
detail
+
", sponsor="
+
sponsor
+
", organizer="
+
organizer
", typeName='"
+
typeName
+
'\''
+
+
", cn="
+
cn
+
", releaseCycle="
+
releaseCycle
+
", bookNum="
+
bookNum
+
", programa="
+
programa
", isbn='"
+
isbn
+
'\''
+
+
", mailCode="
+
mailCode
+
", address="
+
address
+
", telephone="
+
telephone
+
", mail="
+
mail
", bookName='"
+
bookName
+
'\''
+
+
", purpose="
+
purpose
+
", adviserId="
+
adviserId
+
", adviserName="
+
adviserName
+
", channelId="
", bookPrice='"
+
bookPrice
+
'\''
+
+
channelId
+
", channelName="
+
channelName
+
", qrcodeCount="
+
qrcodeCount
+
", appCount="
+
appCount
", originName='"
+
originName
+
'\''
+
+
", productCount="
+
productCount
+
", latestQrcode="
+
latestQrcode
+
", apps="
+
apps
+
", products="
", remark='"
+
remark
+
'\''
+
+
products
+
", resourceFiles="
+
resourceFiles
+
", firstScanDate="
+
firstScanDate
", author='"
+
author
+
'\''
+
+
", firstSceneName="
+
firstSceneName
+
", issn="
+
issn
+
", appId="
+
appId
+
", serialNumber="
", publish='"
+
publish
+
'\''
+
+
serialNumber
+
", isSelect="
+
isSelect
+
", adImg="
+
adImg
+
", isMainEditor="
+
isMainEditor
", publishDate="
+
publishDate
+
+
", mainEditorName="
+
mainEditorName
+
", mainEditorPic="
+
mainEditorPic
+
", isHaveAdviser="
", coverImg='"
+
coverImg
+
'\''
+
+
isHaveAdviser
+
", isFundSupport="
+
isFundSupport
+
", isHaveFund="
+
isHaveFund
+
", bookScanCount="
", detail='"
+
detail
+
'\''
+
+
bookScanCount
+
", bookQrCount="
+
bookQrCount
+
", readerCount="
+
readerCount
+
", bookIncome="
", sponsor='"
+
sponsor
+
'\''
+
+
bookIncome
+
", fundMoney="
+
fundMoney
+
", bookFunds="
+
bookFunds
+
", agentType="
+
agentType
", organizer='"
+
organizer
+
'\''
+
+
", startTime="
+
startTime
+
", endTime="
+
endTime
+
", sceneId="
+
sceneId
+
", templeParentId="
", cn='"
+
cn
+
'\''
+
+
templeParentId
+
", templetId="
+
templetId
+
", templetName="
+
templetName
+
", browseCounts="
", releaseCycle='"
+
releaseCycle
+
'\''
+
+
browseCounts
+
", browserCounts="
+
browserCounts
+
", scanCount="
+
scanCount
+
", FreezeStatus="
", bookNum='"
+
bookNum
+
'\''
+
+
FreezeStatus
+
", income="
+
income
+
", bookAdviserId="
+
bookAdviserId
+
", relationQrcode="
", programa='"
+
programa
+
'\''
+
+
relationQrcode
+
"]"
;
", mailCode='"
+
mailCode
+
'\''
+
", address='"
+
address
+
'\''
+
", telephone='"
+
telephone
+
'\''
+
", mail='"
+
mail
+
'\''
+
", purpose='"
+
purpose
+
'\''
+
", adviserId="
+
adviserId
+
", adviserName='"
+
adviserName
+
'\''
+
", channelId="
+
channelId
+
", channelName='"
+
channelName
+
'\''
+
", qrcodeCount="
+
qrcodeCount
+
", appCount="
+
appCount
+
", productCount="
+
productCount
+
", latestQrcode='"
+
latestQrcode
+
'\''
+
", apps="
+
apps
+
", products="
+
products
+
", resourceFiles="
+
resourceFiles
+
", firstScanDate="
+
firstScanDate
+
", firstSceneName='"
+
firstSceneName
+
'\''
+
", issn='"
+
issn
+
'\''
+
", appId="
+
appId
+
", serialNumber='"
+
serialNumber
+
'\''
+
", isSelect="
+
isSelect
+
", adImg='"
+
adImg
+
'\''
+
", isMainEditor="
+
isMainEditor
+
", mainEditorName='"
+
mainEditorName
+
'\''
+
", mainEditorPic='"
+
mainEditorPic
+
'\''
+
", isHaveAdviser="
+
isHaveAdviser
+
", isFundSupport="
+
isFundSupport
+
", isHaveFund="
+
isHaveFund
+
", bookScanCount="
+
bookScanCount
+
", bookQrCount="
+
bookQrCount
+
", readerCount="
+
readerCount
+
", bookIncome="
+
bookIncome
+
", fundMoney="
+
fundMoney
+
", bookFunds="
+
bookFunds
+
", agentType="
+
agentType
+
", startTime="
+
startTime
+
", endTime="
+
endTime
+
", sceneId="
+
sceneId
+
", templeParentId="
+
templeParentId
+
", templetId="
+
templetId
+
", templetName='"
+
templetName
+
'\''
+
", browseCounts="
+
browseCounts
+
", browserCounts="
+
browserCounts
+
", scanCount="
+
scanCount
+
", FreezeStatus="
+
FreezeStatus
+
", income="
+
income
+
", bookAdviserId="
+
bookAdviserId
+
", relationQrcode="
+
relationQrcode
+
", noAuditNum="
+
noAuditNum
+
", transferor='"
+
transferor
+
'\''
+
", qrcodeUrl='"
+
qrcodeUrl
+
'\''
+
", messageCount="
+
messageCount
+
", typeCodeNames="
+
typeCodeNames
+
", location='"
+
location
+
'\''
+
", sceneName='"
+
sceneName
+
'\''
+
", qrRemark='"
+
qrRemark
+
'\''
+
", bookStatus="
+
bookStatus
+
'}'
;
}
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/book/facade/BookFacade.java
View file @
f07e3fdb
...
@@ -136,7 +136,8 @@ public interface BookFacade {
...
@@ -136,7 +136,8 @@ public interface BookFacade {
@ApiImplicitParam
(
name
=
"isMainEditor"
,
value
=
"只看我是主编辑"
,
dataType
=
"int"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"isMainEditor"
,
value
=
"只看我是主编辑"
,
dataType
=
"int"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"isFundSupport"
,
value
=
"只看基金支持"
,
dataType
=
"int"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"isFundSupport"
,
value
=
"只看基金支持"
,
dataType
=
"int"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"bookId"
,
value
=
"书籍标识"
,
dataType
=
"int"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"bookId"
,
value
=
"书籍标识"
,
dataType
=
"int"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"templetId"
,
value
=
"图书类型标识"
,
dataType
=
"long"
,
paramType
=
"query"
)})
@ApiImplicitParam
(
name
=
"templetId"
,
value
=
"图书类型标识"
,
dataType
=
"long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"bookStatus"
,
value
=
"图书版权保护状态"
,
dataType
=
"Integer"
,
paramType
=
"query"
)})
@RequestMapping
(
value
=
"listPage4Adviser"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"listPage4Adviser"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<
PageBean
>
getListPage4Adviser
(
@RequestHeader
(
"token"
)
String
token
,
ResponseDto
<
PageBean
>
getListPage4Adviser
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
...
@@ -149,7 +150,8 @@ public interface BookFacade {
...
@@ -149,7 +150,8 @@ public interface BookFacade {
@RequestParam
(
value
=
"isMainEditor"
,
required
=
false
)
Integer
isMainEditor
,
@RequestParam
(
value
=
"isMainEditor"
,
required
=
false
)
Integer
isMainEditor
,
@RequestParam
(
value
=
"isFundSupport"
,
required
=
false
)
Integer
isFundSupport
,
@RequestParam
(
value
=
"isFundSupport"
,
required
=
false
)
Integer
isFundSupport
,
@RequestParam
(
value
=
"bookId"
,
required
=
false
)
Integer
bookId
,
@RequestParam
(
value
=
"bookId"
,
required
=
false
)
Integer
bookId
,
@RequestParam
(
value
=
"templetId"
,
required
=
false
)
Long
templetId
)
@RequestParam
(
value
=
"templetId"
,
required
=
false
)
Long
templetId
,
@RequestParam
(
value
=
"bookStatus"
,
required
=
false
)
Integer
bookStatus
)
throws
BizException
,
PermissionException
;
throws
BizException
,
PermissionException
;
@ApiOperation
(
value
=
"首页获取正在做的图书"
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"首页获取正在做的图书"
,
httpMethod
=
"GET"
)
...
...
pcloud-service-book/src/main/java/com/pcloud/book/book/facade/impl/BookFacadeImpl.java
View file @
f07e3fdb
...
@@ -252,7 +252,8 @@ public class BookFacadeImpl implements BookFacade {
...
@@ -252,7 +252,8 @@ public class BookFacadeImpl implements BookFacade {
@RequestParam
(
value
=
"isMainEditor"
,
required
=
false
)
Integer
isMainEditor
,
@RequestParam
(
value
=
"isMainEditor"
,
required
=
false
)
Integer
isMainEditor
,
@RequestParam
(
value
=
"isFundSupport"
,
required
=
false
)
Integer
isFundSupport
,
@RequestParam
(
value
=
"isFundSupport"
,
required
=
false
)
Integer
isFundSupport
,
@RequestParam
(
value
=
"bookId"
,
required
=
false
)
Integer
bookId
,
@RequestParam
(
value
=
"bookId"
,
required
=
false
)
Integer
bookId
,
@RequestParam
(
value
=
"templetId"
,
required
=
false
)
Long
templetId
)
@RequestParam
(
value
=
"templetId"
,
required
=
false
)
Long
templetId
,
@RequestParam
(
value
=
"bookStatus"
,
required
=
false
)
Integer
bookStatus
)
throws
BizException
,
PermissionException
{
throws
BizException
,
PermissionException
{
Long
adviserId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
Long
adviserId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
...
@@ -269,6 +270,7 @@ public class BookFacadeImpl implements BookFacade {
...
@@ -269,6 +270,7 @@ public class BookFacadeImpl implements BookFacade {
paramMap
.
put
(
"typeCode"
,
typeCode
!=
null
&&
""
.
equals
(
typeCode
.
trim
())
?
null
:
typeCode
);
paramMap
.
put
(
"typeCode"
,
typeCode
!=
null
&&
""
.
equals
(
typeCode
.
trim
())
?
null
:
typeCode
);
paramMap
.
put
(
"bookId"
,
bookId
);
paramMap
.
put
(
"bookId"
,
bookId
);
paramMap
.
put
(
"templetId"
,
templetId
);
paramMap
.
put
(
"templetId"
,
templetId
);
paramMap
.
put
(
"bookStatus"
,
bookStatus
);
PageBean
pageBean
=
bookBiz
.
getListPage4Adviser
(
paramMap
,
new
PageParam
(
currentPage
,
numPerPage
),
adviserId
);
PageBean
pageBean
=
bookBiz
.
getListPage4Adviser
(
paramMap
,
new
PageParam
(
currentPage
,
numPerPage
),
adviserId
);
return
new
ResponseDto
<>(
pageBean
);
return
new
ResponseDto
<>(
pageBean
);
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/copyright/biz/impl/BookAuthInfoBizImpl.java
View file @
f07e3fdb
...
@@ -92,8 +92,7 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
...
@@ -92,8 +92,7 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
@Autowired
@Autowired
private
ExportConsr
exportConsr
;
private
ExportConsr
exportConsr
;
private
static
final
ExecutorService
EXECUTOR_SINGLE_SERVICE
=
Executors
.
newSingleThreadExecutor
();
private
static
final
ExecutorService
EXECUTOR_SERVICE
=
Executors
.
newFixedThreadPool
(
2
);
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
setBookAuthOpen
(
SetAuthOpenParam
setAuthOpenParam
,
Long
adviserId
)
{
public
void
setBookAuthOpen
(
SetAuthOpenParam
setAuthOpenParam
,
Long
adviserId
)
{
...
@@ -124,7 +123,7 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
...
@@ -124,7 +123,7 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
@ParamLog
(
"异步导出"
)
@ParamLog
(
"异步导出"
)
private
void
asynExport
(
Long
bookId
,
Long
channelId
,
Long
adviserId
,
Integer
codeCount
)
{
private
void
asynExport
(
Long
bookId
,
Long
channelId
,
Long
adviserId
,
Integer
codeCount
)
{
EXECUTOR_S
INGLE_S
ERVICE
.
execute
(()
->
{
EXECUTOR_SERVICE
.
execute
(()
->
{
String
commitTime
=
DateUtils
.
formatDate
(
new
Date
());
String
commitTime
=
DateUtils
.
formatDate
(
new
Date
());
try
{
try
{
if
(
codeCount
==
null
||
codeCount
==
0
)
{
if
(
codeCount
==
null
||
codeCount
==
0
)
{
...
@@ -152,11 +151,12 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
...
@@ -152,11 +151,12 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
}
}
bookAuthCodeBiz
.
insert
(
bookAuthCodes
);
bookAuthCodeBiz
.
insert
(
bookAuthCodes
);
String
url
=
generateExcel
(
bookAuthCodes
,
bookDto
.
getBookName
());
String
url
=
generateExcel
(
bookAuthCodes
,
bookDto
.
getBookName
());
String
zipUrl
=
CopyrightTools
.
generateBar4Zip
(
bookAuthCodes
,
bookDto
.
getBookName
(),
url
);
//发送站内信
//发送站内信
sendLetter
(
adviserId
,
bookDto
.
getBookName
(),
u
rl
,
commitTime
);
sendLetter
(
adviserId
,
bookDto
.
getBookName
(),
zipU
rl
,
commitTime
);
//新增导出记录
//新增导出记录
insertExportRecord
(
bookId
,
channelId
,
adviserId
,
num
,
u
rl
);
insertExportRecord
(
bookId
,
channelId
,
adviserId
,
num
,
zipU
rl
);
LOGGER
.
info
(
"url"
+
u
rl
);
LOGGER
.
info
(
"url"
+
zipU
rl
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"导出条形码失败"
+
e
.
getMessage
(),
e
);
LOGGER
.
error
(
"导出条形码失败"
+
e
.
getMessage
(),
e
);
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/copyright/tools/CopyrightTools.java
View file @
f07e3fdb
package
com
.
pcloud
.
book
.
copyright
.
tools
;
package
com
.
pcloud
.
book
.
copyright
.
tools
;
import
com.pcloud.book.BookApplication
;
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.channelcenter.base.constants.ChannelConstants
;
import
com.pcloud.book.copyright.entity.BookAuthCode
;
import
com.pcloud.common.constant.OSConstant
;
import
com.pcloud.common.entity.UploadResultInfo
;
import
com.pcloud.common.entity.UploadResultInfo
;
import
com.pcloud.common.enums.ImageTypeEnum
;
import
com.pcloud.common.enums.ImageTypeEnum
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.FileException
;
import
com.pcloud.common.exceptions.FileException
;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.FileUtils
;
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
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
;
import
org.jbarcode.paint.EAN13TextPainter
;
import
org.jbarcode.paint.EAN13TextPainter
;
import
org.jbarcode.paint.WidthCodedPainter
;
import
org.jbarcode.paint.WidthCodedPainter
;
import
org.springframework.boot.SpringApplication
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
javax.imageio.ImageIO
;
import
javax.imageio.ImageIO
;
import
java.awt.*
;
import
java.awt.image.BufferedImage
;
import
java.awt.image.BufferedImage
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormat
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Calendar
;
...
@@ -38,8 +44,10 @@ import java.util.UUID;
...
@@ -38,8 +44,10 @@ import java.util.UUID;
*/
*/
@Component
(
"copyrightTools"
)
@Component
(
"copyrightTools"
)
public
class
CopyrightTools
{
public
class
CopyrightTools
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
CopyrightTools
.
class
);
private
static
String
[]
chars
=
new
String
[]{
"a"
,
"b"
,
"c"
,
"d"
,
"e"
,
"f"
,
private
static
String
ZIP_FILE_PATH
=
OSConstant
.
USERDIR
+
"/zip/"
;
private
static
String
FILE_LOCAL_PATH
=
OSConstant
.
USERDIR
+
"/download/"
;
private
static
String
[]
chars
=
new
String
[]{
"a"
,
"b"
,
"c"
,
"d"
,
"e"
,
"f"
,
"g"
,
"h"
,
"i"
,
"j"
,
"k"
,
"m"
,
"n"
,
"o"
,
"p"
,
"q"
,
"r"
,
"s"
,
"g"
,
"h"
,
"i"
,
"j"
,
"k"
,
"m"
,
"n"
,
"o"
,
"p"
,
"q"
,
"r"
,
"s"
,
"t"
,
"u"
,
"v"
,
"w"
,
"x"
,
"y"
,
"z"
,
"0"
,
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"t"
,
"u"
,
"v"
,
"w"
,
"x"
,
"y"
,
"z"
,
"0"
,
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
,
"7"
,
"8"
,
"9"
,
"A"
,
"B"
,
"C"
,
"D"
,
"E"
,
"F"
,
"G"
,
"H"
,
"6"
,
"7"
,
"8"
,
"9"
,
"A"
,
"B"
,
"C"
,
"D"
,
"E"
,
"F"
,
"G"
,
"H"
,
...
@@ -100,13 +108,52 @@ public class CopyrightTools {
...
@@ -100,13 +108,52 @@ public class CopyrightTools {
}
}
}
}
public
static
String
generateBar4Zip
(
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
=
null
;
try
{
for
(
BookAuthCode
bookAuthCode
:
bookAuthCodes
)
{
BufferedImage
bi
=
null
;
JBarcode
productBarcode
=
new
JBarcode
(
Code128Encoder
.
getInstance
(),
WidthCodedPainter
.
getInstance
(),
EAN13TextPainter
.
getInstance
());
productBarcode
.
setXDimension
(
Double
.
valueOf
(
0.5
));
productBarcode
.
setBarHeight
(
Double
.
valueOf
(
30
));
productBarcode
.
setWideRatio
(
Double
.
valueOf
(
30.0
D
));
productBarcode
.
setShowText
(
true
);
productBarcode
.
setTextPainter
(
BaseLineTextPainter
.
getInstance
());
bi
=
productBarcode
.
createBarcode
(
bookAuthCode
.
getFullCode
());
paintText
(
bi
,
bookAuthCode
.
getFullCode
());
File
file
=
new
File
(
fileFolderPath
+
"/"
+
bookAuthCode
.
getFullCode
()
+
".png"
);
ImageIO
.
write
(
bi
,
ImageTypeEnum
.
PNG
.
value
,
file
);
}
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
;
try
{
try
{
ByteArrayOutputStream
os
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
os
=
new
ByteArrayOutputStream
();
ImageIO
.
write
(
image
,
ImageTypeEnum
.
JP
G
.
value
,
os
);
ImageIO
.
write
(
image
,
ImageTypeEnum
.
PN
G
.
value
,
os
);
uploadResultInfo
=
OssUtils
.
uploadFileByte
(
os
.
toByteArray
(),
UUIDUitl
.
taskName
(),
ImageTypeEnum
.
JP
G
.
value
);
uploadResultInfo
=
OssUtils
.
uploadFileByte
(
os
.
toByteArray
(),
UUIDUitl
.
taskName
(),
ImageTypeEnum
.
PN
G
.
value
);
os
.
close
();
os
.
close
();
return
uploadResultInfo
==
null
?
null
:
uploadResultInfo
.
getUrl
();
return
uploadResultInfo
==
null
?
null
:
uploadResultInfo
.
getUrl
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -137,11 +184,26 @@ public class CopyrightTools {
...
@@ -137,11 +184,26 @@ public class CopyrightTools {
List
<
String
>
last6Months
=
new
ArrayList
<>(
6
);
List
<
String
>
last6Months
=
new
ArrayList
<>(
6
);
Calendar
cal
=
Calendar
.
getInstance
();
Calendar
cal
=
Calendar
.
getInstance
();
for
(
int
i
=
1
;
i
<
7
;
i
++)
{
for
(
int
i
=
1
;
i
<
7
;
i
++)
{
last6Months
.
add
(
cal
.
get
(
Calendar
.
YEAR
)
+
"-"
+
df
.
format
(
cal
.
get
(
Calendar
.
MONTH
)
+
1
))
;
last6Months
.
add
(
cal
.
get
(
Calendar
.
YEAR
)
+
"-"
+
df
.
format
(
cal
.
get
(
Calendar
.
MONTH
)
+
1
))
;
// 逐次往前推1个月
// 逐次往前推1个月
cal
.
set
(
Calendar
.
MONTH
,
cal
.
get
(
Calendar
.
MONTH
)
-
1
);
cal
.
set
(
Calendar
.
MONTH
,
cal
.
get
(
Calendar
.
MONTH
)
-
1
);
}
}
return
last6Months
;
return
last6Months
;
}
}
public
static
void
paintText
(
BufferedImage
barCodeImage
,
String
text
)
{
//绘图
Graphics
g2d
=
barCodeImage
.
getGraphics
();
//创建字体
Font
font
=
new
Font
(
"console"
,
Font
.
PLAIN
,
15
);
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
()
*
1
/
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
);
}
}
}
pcloud-service-book/src/main/resources/mapper/book/Book.Mapper.xml
View file @
f07e3fdb
...
@@ -47,6 +47,7 @@
...
@@ -47,6 +47,7 @@
<result
column=
"END_TIME"
property=
"endTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"END_TIME"
property=
"endTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"TEMPLET_ID"
property=
"templetId"
jdbcType=
"BIGINT"
/>
<result
column=
"TEMPLET_ID"
property=
"templetId"
jdbcType=
"BIGINT"
/>
<result
column=
"IS_DELETE"
property=
"isDelete"
jdbcType=
"BIT"
/>
<result
column=
"IS_DELETE"
property=
"isDelete"
jdbcType=
"BIT"
/>
<result
column=
"BOOK_STATUS"
property=
"bookStatus"
jdbcType=
"BIT"
/>
<result
column=
"LAST_MODIFIED_DATE"
property=
"lastModifiedDate"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"LAST_MODIFIED_DATE"
property=
"lastModifiedDate"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"BOOK_ADVISER_ID"
property=
"bookAdviserId"
jdbcType=
"BIGINT"
/>
<result
column=
"BOOK_ADVISER_ID"
property=
"bookAdviserId"
jdbcType=
"BIGINT"
/>
</resultMap>
</resultMap>
...
@@ -445,21 +446,13 @@
...
@@ -445,21 +446,13 @@
SELECT
SELECT
A.BOOK_ID, A.CHANNEL_ID, A.ADVISER_ID, A.IS_MAIN_EDITOR, T.TYPE_CODE, T.TYPE_NAME, B.ISBN, B.BOOK_NAME, B.REMARK,
A.BOOK_ID, A.CHANNEL_ID, A.ADVISER_ID, A.IS_MAIN_EDITOR, T.TYPE_CODE, T.TYPE_NAME, B.ISBN, B.BOOK_NAME, B.REMARK,
B.AUTHOR, B.PUBLISH, B.PUBLISH_DATE, B.COVER_IMG, B.ORIGIN_NAME, B.BOOK_PRICE, B.ISSN, B.BOOK_NUM, B.SERIAL_NUMBER,
B.AUTHOR, B.PUBLISH, B.PUBLISH_DATE, B.COVER_IMG, B.ORIGIN_NAME, B.BOOK_PRICE, B.ISSN, B.BOOK_NUM, B.SERIAL_NUMBER,
IF(ISNULL(BF.BOOK_FUND_ID),0,1) IS_FUND_SUPPORT,A.TEMPLET_ID, A.LAST_MODIFIED_DATE, A.BOOK_ADVISER_ID
IF(ISNULL(BF.BOOK_FUND_ID),0,1) IS_FUND_SUPPORT,A.TEMPLET_ID, A.LAST_MODIFIED_DATE, A.BOOK_ADVISER_ID
,I.BOOK_STATUS
FROM
FROM
BOOK_ADVISER A
BOOK_ADVISER A
INNER JOIN
INNER JOIN BOOK B ON A.BOOK_ID = B.BOOK_ID AND A.ADVISER_ID = #{adviserId} AND A.IS_DELETE = 0 AND B.IS_DELETE = 0
BOOK B
LEFT JOIN BOOK_TYPE T ON B.TYPE_CODE = T.TYPE_CODE
ON
LEFT JOIN BOOK_FUND BF ON BF.BOOK_ID = A.BOOK_ID AND BF.END_TIME
<![CDATA[ > ]]>
NOW() AND BF.START_TIME
<![CDATA[ < ]]>
NOW()
A.BOOK_ID = B.BOOK_ID AND A.ADVISER_ID = #{adviserId} AND A.IS_DELETE = 0 AND B.IS_DELETE = 0
LEFT JOIN book_auth_info I ON I.BOOK_ID = A.BOOK_ID AND I.ADVISER_ID = #{adviserId}
LEFT JOIN
BOOK_TYPE T
ON
B.TYPE_CODE = T.TYPE_CODE
LEFT JOIN
BOOK_FUND BF
ON
BF.BOOK_ID = A.BOOK_ID AND BF.END_TIME
<![CDATA[ > ]]>
NOW() AND BF.START_TIME
<![CDATA[ < ]]>
NOW()
WHERE
WHERE
1=1
1=1
<if
test=
"bookId!=null"
>
<if
test=
"bookId!=null"
>
...
@@ -505,6 +498,10 @@
...
@@ -505,6 +498,10 @@
AND
AND
B.ISBN
<![CDATA[ <> ]]>
${isbns}
B.ISBN
<![CDATA[ <> ]]>
${isbns}
</if>
</if>
<if
test=
"bookStatus != null"
>
AND
I.book_status = #{bookStatus}
</if>
GROUP BY A.BOOK_ID, A.CHANNEL_ID
GROUP BY A.BOOK_ID, A.CHANNEL_ID
ORDER BY
ORDER BY
A.LAST_MODIFIED_DATE DESC
A.LAST_MODIFIED_DATE DESC
...
...
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