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
c0e95b29
Commit
c0e95b29
authored
Jan 30, 2019
by
李莉
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dw/C1360' into 'master'
版权保护添加【正版专享】 See merge request rays/pcloud-book!1
parents
9e24a4d6
bb661b08
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
147 additions
and
13 deletions
+147
-13
BookAuthServerDTO.java
...java/com/pcloud/book/copyright/dto/BookAuthServerDTO.java
+76
-0
BookAuthServeService.java
...m/pcloud/book/copyright/service/BookAuthServeService.java
+7
-0
BookAuthServeBiz.java
.../java/com/pcloud/book/copyright/biz/BookAuthServeBiz.java
+5
-0
BookAuthServeBizImpl.java
.../pcloud/book/copyright/biz/impl/BookAuthServeBizImpl.java
+13
-0
BookAuthServeServiceImpl.java
...book/copyright/service/impl/BookAuthServeServiceImpl.java
+15
-4
CopyrightTools.java
.../java/com/pcloud/book/copyright/tools/CopyrightTools.java
+31
-9
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/copyright/dto/BookAuthServerDTO.java
0 → 100644
View file @
c0e95b29
package
com
.
pcloud
.
book
.
copyright
.
dto
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
org.springframework.util.CollectionUtils
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @author lily
* @date 2018/12/26 15:35
*/
@ApiModel
public
class
BookAuthServerDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
9178152999605620185L
;
@ApiModelProperty
(
"图书id"
)
private
Long
bookId
;
@ApiModelProperty
(
"运营标识"
)
private
Long
channelId
;
@ApiModelProperty
(
"编辑标识"
)
private
Long
adviserId
;
@ApiModelProperty
(
"服务标识"
)
private
List
<
Long
>
serveIds
;
public
Boolean
check
(){
return
null
==
bookId
||
null
==
channelId
||
null
==
adviserId
||
CollectionUtils
.
isEmpty
(
serveIds
);
}
public
Long
getBookId
()
{
return
bookId
;
}
public
void
setBookId
(
Long
bookId
)
{
this
.
bookId
=
bookId
;
}
public
Long
getChannelId
()
{
return
channelId
;
}
public
void
setChannelId
(
Long
channelId
)
{
this
.
channelId
=
channelId
;
}
public
Long
getAdviserId
()
{
return
adviserId
;
}
public
void
setAdviserId
(
Long
adviserId
)
{
this
.
adviserId
=
adviserId
;
}
public
List
<
Long
>
getServeIds
()
{
return
serveIds
;
}
public
void
setServeIds
(
List
<
Long
>
serveIds
)
{
this
.
serveIds
=
serveIds
;
}
@Override
public
String
toString
()
{
return
"BookAuthServerDTO{"
+
"bookId="
+
bookId
+
", channelId="
+
channelId
+
", adviserId="
+
adviserId
+
", serveIds="
+
serveIds
+
'}'
;
}
}
pcloud-facade-book/src/main/java/com/pcloud/book/copyright/service/BookAuthServeService.java
View file @
c0e95b29
package
com
.
pcloud
.
book
.
copyright
.
service
;
package
com
.
pcloud
.
book
.
copyright
.
service
;
import
com.pcloud.book.book.dto.BookAuthServeStatusParam
;
import
com.pcloud.book.book.dto.BookAuthServeStatusParam
;
import
com.pcloud.book.copyright.dto.BookAuthServerDTO
;
import
com.pcloud.book.copyright.dto.QrcodeAuthServeDTO
;
import
com.pcloud.book.copyright.dto.QrcodeAuthServeDTO
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
...
@@ -8,6 +9,7 @@ import io.swagger.annotations.Api;
...
@@ -8,6 +9,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestMethod
;
...
@@ -33,4 +35,9 @@ public interface BookAuthServeService {
...
@@ -33,4 +35,9 @@ public interface BookAuthServeService {
ResponseEntity
<
ResponseDto
<
Map
<
String
,
Boolean
>>>
listIsOpen4ServeIdsAndQrcode
(
@RequestBody
QrcodeAuthServeDTO
qrcodeAuthServeDTO
)
ResponseEntity
<
ResponseDto
<
Map
<
String
,
Boolean
>>>
listIsOpen4ServeIdsAndQrcode
(
@RequestBody
QrcodeAuthServeDTO
qrcodeAuthServeDTO
)
throws
BizException
;
throws
BizException
;
@ApiOperation
(
value
=
"获取应用是否开启版权保护"
,
httpMethod
=
"POST"
)
@PostMapping
(
"listIsOpen4ServeIdsAndBookId"
)
ResponseEntity
<
ResponseDto
<
Map
<
String
,
Boolean
>>>
listIsOpen4ServeIdsAndBookId
(
@RequestBody
BookAuthServerDTO
bookAuthServerDTO
)
throws
BizException
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/copyright/biz/BookAuthServeBiz.java
View file @
c0e95b29
...
@@ -39,4 +39,9 @@ public interface BookAuthServeBiz {
...
@@ -39,4 +39,9 @@ public interface BookAuthServeBiz {
* @return
* @return
*/
*/
Map
<
String
,
Boolean
>
listIsOpen4ServeIdsAndQrcode
(
Long
sceneId
,
List
<
Long
>
serveIds
);
Map
<
String
,
Boolean
>
listIsOpen4ServeIdsAndQrcode
(
Long
sceneId
,
List
<
Long
>
serveIds
);
/**
* 获取图书是否开启版权保护
*/
Map
<
String
,
Boolean
>
listIsOpen4ServeIdsAndBookId
(
Long
bookId
,
Long
adviserId
,
Long
channelId
,
List
<
Long
>
serveIds
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/copyright/biz/impl/BookAuthServeBizImpl.java
View file @
c0e95b29
...
@@ -55,6 +55,7 @@ public class BookAuthServeBizImpl implements BookAuthServeBiz {
...
@@ -55,6 +55,7 @@ public class BookAuthServeBizImpl implements BookAuthServeBiz {
/**
/**
* 是否设置应用授权 return key : typeCode_serveId
* 是否设置应用授权 return key : typeCode_serveId
*/
*/
@Override
@ParamLog
(
"是否设置应用授权"
)
@ParamLog
(
"是否设置应用授权"
)
public
Map
<
String
,
Boolean
>
isSetServeAuth
(
Long
bookId
,
Long
channelId
,
Long
adviserId
,
List
<
Long
>
serveIds
)
{
public
Map
<
String
,
Boolean
>
isSetServeAuth
(
Long
bookId
,
Long
channelId
,
Long
adviserId
,
List
<
Long
>
serveIds
)
{
if
(
bookId
==
null
||
channelId
==
null
||
adviserId
==
null
||
ListUtils
.
isEmpty
(
serveIds
))
{
if
(
bookId
==
null
||
channelId
==
null
||
adviserId
==
null
||
ListUtils
.
isEmpty
(
serveIds
))
{
...
@@ -98,6 +99,18 @@ public class BookAuthServeBizImpl implements BookAuthServeBiz {
...
@@ -98,6 +99,18 @@ public class BookAuthServeBizImpl implements BookAuthServeBiz {
return
null
;
return
null
;
}
}
@Override
@ParamLog
(
"listIsOpen4ServeIdsAndBookId"
)
public
Map
<
String
,
Boolean
>
listIsOpen4ServeIdsAndBookId
(
Long
bookId
,
Long
adviserId
,
Long
channelId
,
List
<
Long
>
serveIds
)
{
BookInfoAndAuthStatusDTO
baseAndAuthStatus
=
bookBiz
.
getBaseAndAuthStatus
(
bookId
,
channelId
,
adviserId
);
final
boolean
boo
=
baseAndAuthStatus
!=
null
&&
BookStatusEnum
.
PROTECT
.
value
.
equals
(
baseAndAuthStatus
.
getBookStatus
())
&&
BookStatusEnum
.
BookDeleteStatus
.
NOT_DELETE
.
value
.
equals
(
baseAndAuthStatus
.
getIsDelete
());
if
(
boo
)
{
return
isSetServeAuth
(
bookId
,
channelId
,
adviserId
,
serveIds
);
}
return
null
;
}
private
List
<
BookAuthServe
>
changeToBookAuthServe
(
List
<
ServeVO
>
serves
,
Long
bookId
,
Long
channelId
,
Long
adviserId
)
{
private
List
<
BookAuthServe
>
changeToBookAuthServe
(
List
<
ServeVO
>
serves
,
Long
bookId
,
Long
channelId
,
Long
adviserId
)
{
List
<
BookAuthServe
>
bookAuthServes
=
new
ArrayList
<>();
List
<
BookAuthServe
>
bookAuthServes
=
new
ArrayList
<>();
...
...
pcloud-service-book/src/main/java/com/pcloud/book/copyright/service/impl/BookAuthServeServiceImpl.java
View file @
c0e95b29
...
@@ -2,8 +2,8 @@ package com.pcloud.book.copyright.service.impl;
...
@@ -2,8 +2,8 @@ package com.pcloud.book.copyright.service.impl;
import
com.pcloud.book.book.dto.BookAuthServeStatusParam
;
import
com.pcloud.book.book.dto.BookAuthServeStatusParam
;
import
com.pcloud.book.copyright.biz.BookAuthServeBiz
;
import
com.pcloud.book.copyright.biz.BookAuthServeBiz
;
import
com.pcloud.book.copyright.dto.BookAuthServerDTO
;
import
com.pcloud.book.copyright.dto.QrcodeAuthServeDTO
;
import
com.pcloud.book.copyright.dto.QrcodeAuthServeDTO
;
import
com.pcloud.book.copyright.entity.BookAuthServe
;
import
com.pcloud.book.copyright.service.BookAuthServeService
;
import
com.pcloud.book.copyright.service.BookAuthServeService
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
...
@@ -32,7 +32,7 @@ public class BookAuthServeServiceImpl implements BookAuthServeService {
...
@@ -32,7 +32,7 @@ public class BookAuthServeServiceImpl implements BookAuthServeService {
@PostMapping
(
"listIsOpen4ServeIds"
)
@PostMapping
(
"listIsOpen4ServeIds"
)
public
ResponseEntity
<
ResponseDto
<
Map
<
String
,
Boolean
>>>
listIsOpen4ServeIds
(
@RequestBody
BookAuthServeStatusParam
bookAuthServeStatusParam
)
throws
BizException
{
public
ResponseEntity
<
ResponseDto
<
Map
<
String
,
Boolean
>>>
listIsOpen4ServeIds
(
@RequestBody
BookAuthServeStatusParam
bookAuthServeStatusParam
)
throws
BizException
{
Map
<
String
,
Boolean
>
isOpen4ServeIds
=
null
;
Map
<
String
,
Boolean
>
isOpen4ServeIds
=
null
;
if
(
bookAuthServeStatusParam
!=
null
)
{
if
(
bookAuthServeStatusParam
!=
null
)
{
isOpen4ServeIds
=
bookAuthServeBiz
.
isSetServeAuth
(
bookAuthServeStatusParam
.
getBookId
(),
bookAuthServeStatusParam
.
getChannelId
(),
bookAuthServeStatusParam
.
getAdviserId
(),
bookAuthServeStatusParam
.
getServeIds
());
isOpen4ServeIds
=
bookAuthServeBiz
.
isSetServeAuth
(
bookAuthServeStatusParam
.
getBookId
(),
bookAuthServeStatusParam
.
getChannelId
(),
bookAuthServeStatusParam
.
getAdviserId
(),
bookAuthServeStatusParam
.
getServeIds
());
}
}
return
ResponseHandleUtil
.
toResponse
(
isOpen4ServeIds
);
return
ResponseHandleUtil
.
toResponse
(
isOpen4ServeIds
);
...
@@ -42,8 +42,19 @@ public class BookAuthServeServiceImpl implements BookAuthServeService {
...
@@ -42,8 +42,19 @@ public class BookAuthServeServiceImpl implements BookAuthServeService {
@PostMapping
(
"listIsOpen4ServeIdsAndQrcode"
)
@PostMapping
(
"listIsOpen4ServeIdsAndQrcode"
)
public
ResponseEntity
<
ResponseDto
<
Map
<
String
,
Boolean
>>>
listIsOpen4ServeIdsAndQrcode
(
@RequestBody
QrcodeAuthServeDTO
qrcodeAuthServeDTO
)
throws
BizException
{
public
ResponseEntity
<
ResponseDto
<
Map
<
String
,
Boolean
>>>
listIsOpen4ServeIdsAndQrcode
(
@RequestBody
QrcodeAuthServeDTO
qrcodeAuthServeDTO
)
throws
BizException
{
Map
<
String
,
Boolean
>
isOpen4ServeIds
=
null
;
Map
<
String
,
Boolean
>
isOpen4ServeIds
=
null
;
if
(
qrcodeAuthServeDTO
!=
null
)
{
if
(
qrcodeAuthServeDTO
!=
null
)
{
isOpen4ServeIds
=
bookAuthServeBiz
.
listIsOpen4ServeIdsAndQrcode
(
qrcodeAuthServeDTO
.
getSceneId
(),
qrcodeAuthServeDTO
.
getServeIds
());
isOpen4ServeIds
=
bookAuthServeBiz
.
listIsOpen4ServeIdsAndQrcode
(
qrcodeAuthServeDTO
.
getSceneId
(),
qrcodeAuthServeDTO
.
getServeIds
());
}
return
ResponseHandleUtil
.
toResponse
(
isOpen4ServeIds
);
}
@Override
@PostMapping
(
"listIsOpen4ServeIdsAndBookId"
)
public
ResponseEntity
<
ResponseDto
<
Map
<
String
,
Boolean
>>>
listIsOpen4ServeIdsAndBookId
(
@RequestBody
BookAuthServerDTO
bookAuthServerDTO
)
throws
BizException
{
Map
<
String
,
Boolean
>
isOpen4ServeIds
=
null
;
if
(
bookAuthServerDTO
!=
null
&&
!
bookAuthServerDTO
.
check
())
{
isOpen4ServeIds
=
bookAuthServeBiz
.
listIsOpen4ServeIdsAndBookId
(
bookAuthServerDTO
.
getBookId
(),
bookAuthServerDTO
.
getAdviserId
(),
bookAuthServerDTO
.
getChannelId
(),
bookAuthServerDTO
.
getServeIds
());
}
}
return
ResponseHandleUtil
.
toResponse
(
isOpen4ServeIds
);
return
ResponseHandleUtil
.
toResponse
(
isOpen4ServeIds
);
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/copyright/tools/CopyrightTools.java
View file @
c0e95b29
...
@@ -114,14 +114,14 @@ public class CopyrightTools {
...
@@ -114,14 +114,14 @@ public class CopyrightTools {
String
zipFilePath
=
ZIP_FILE_PATH
+
tempZipName
+
".zip"
;
String
zipFilePath
=
ZIP_FILE_PATH
+
tempZipName
+
".zip"
;
String
fileFolderPath
=
FILE_LOCAL_PATH
+
tempZipName
;
String
fileFolderPath
=
FILE_LOCAL_PATH
+
tempZipName
;
FileUtils
.
isDir
(
fileFolderPath
);
FileUtils
.
isDir
(
fileFolderPath
);
UploadResultInfo
uploadResultInfo
=
null
;
UploadResultInfo
uploadResultInfo
;
try
{
try
{
for
(
BookAuthCode
bookAuthCode
:
bookAuthCodes
)
{
for
(
BookAuthCode
bookAuthCode
:
bookAuthCodes
)
{
BufferedImage
bi
=
null
;
BufferedImage
bi
;
JBarcode
productBarcode
=
new
JBarcode
(
Code128Encoder
.
getInstance
(),
WidthCodedPainter
.
getInstance
(),
EAN13TextPainter
.
getInstance
());
JBarcode
productBarcode
=
new
JBarcode
(
Code128Encoder
.
getInstance
(),
WidthCodedPainter
.
getInstance
(),
EAN13TextPainter
.
getInstance
());
productBarcode
.
setXDimension
(
Double
.
valueOf
(
0.5
)
);
productBarcode
.
setXDimension
(
0.5
);
productBarcode
.
setBarHeight
(
Double
.
valueOf
(
30
)
);
productBarcode
.
setBarHeight
(
30
d
);
productBarcode
.
setWideRatio
(
Double
.
valueOf
(
30.0
D
)
);
productBarcode
.
setWideRatio
(
30.0
D
);
productBarcode
.
setShowText
(
true
);
productBarcode
.
setShowText
(
true
);
productBarcode
.
setTextPainter
(
BaseLineTextPainter
.
getInstance
());
productBarcode
.
setTextPainter
(
BaseLineTextPainter
.
getInstance
());
bi
=
productBarcode
.
createBarcode
(
bookAuthCode
.
getFullCode
());
bi
=
productBarcode
.
createBarcode
(
bookAuthCode
.
getFullCode
());
...
@@ -190,20 +190,42 @@ public class CopyrightTools {
...
@@ -190,20 +190,42 @@ public class CopyrightTools {
}
}
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);
// }
public
static
void
paintText
(
BufferedImage
barCodeImage
,
String
text
)
{
public
static
void
paintText
(
BufferedImage
barCodeImage
,
String
text
)
{
//绘图
//绘图
Graphics
g2d
=
barCodeImage
.
getGraphics
();
Graphics
g2d
=
barCodeImage
.
getGraphics
();
//创建字体
//创建字体
Font
font
=
new
Font
(
"console"
,
Font
.
PLAIN
,
15
);
Font
font
=
new
Font
(
"console"
,
Font
.
PLAIN
,
25
);
g2d
.
setFont
(
font
);
g2d
.
setFont
(
font
);
FontMetrics
fm
=
g2d
.
getFontMetrics
();
FontMetrics
fm
=
g2d
.
getFontMetrics
();
int
height
=
fm
.
getHeight
();
int
height
=
fm
.
getHeight
();
int
center
=
(
barCodeImage
.
getWidth
()
-
fm
.
stringWidth
(
text
))
/
2
;
//
int center = (barCodeImage.getWidth() - fm.stringWidth(text)) / 2;
g2d
.
setColor
(
Color
.
WHITE
);
g2d
.
setColor
(
Color
.
WHITE
);
g2d
.
fillRect
(
0
,
0
,
barCodeImage
.
getWidth
(),
barCodeImage
.
getHeight
()
*
1
/
20
);
g2d
.
fillRect
(
0
,
0
,
barCodeImage
.
getWidth
(),
barCodeImage
.
getHeight
()
/
20
);
g2d
.
fillRect
(
0
,
barCodeImage
.
getHeight
()
-
(
height
*
9
/
10
),
barCodeImage
.
getWidth
(),
(
height
*
9
/
10
));
g2d
.
fillRect
(
0
,
barCodeImage
.
getHeight
()
-
(
height
*
9
/
10
),
barCodeImage
.
getWidth
(),
(
height
*
9
/
10
));
g2d
.
setColor
(
Color
.
BLACK
);
g2d
.
setColor
(
Color
.
BLACK
);
g2d
.
drawString
(
text
,
center
,
barCodeImage
.
getHeight
()
-
(
height
/
10
)
-
2
);
//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
);
}
}
}
}
}
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