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
5c5ddd46
Commit
5c5ddd46
authored
Sep 07, 2020
by
吴博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:[none] getBookResource
parent
e40102b0
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
463 additions
and
0 deletions
+463
-0
AppletUserBookcaseBiz.java
...ava/com/pcloud/book/applet/biz/AppletUserBookcaseBiz.java
+3
-0
AppletUserBookcaseBizImpl.java
...cloud/book/applet/biz/impl/AppletUserBookcaseBizImpl.java
+141
-0
AppletHomeFacade.java
.../java/com/pcloud/book/applet/facade/AppletHomeFacade.java
+10
-0
BookAdviserBiz.java
...rc/main/java/com/pcloud/book/book/biz/BookAdviserBiz.java
+1
-0
BookAdviserBizImpl.java
...ava/com/pcloud/book/book/biz/impl/BookAdviserBizImpl.java
+5
-0
BookAdviserDao.java
...rc/main/java/com/pcloud/book/book/dao/BookAdviserDao.java
+1
-0
BookAdviserDaoImpl.java
...ava/com/pcloud/book/book/dao/impl/BookAdviserDaoImpl.java
+9
-0
ProductConsr.java
.../java/com/pcloud/book/consumer/resource/ProductConsr.java
+19
-0
ExcelUtil.java
.../main/java/com/pcloud/book/copyright/tools/ExcelUtil.java
+121
-0
BookGroupBiz.java
...src/main/java/com/pcloud/book/group/biz/BookGroupBiz.java
+2
-0
BookGroupBizImpl.java
...java/com/pcloud/book/group/biz/impl/BookGroupBizImpl.java
+133
-0
BookServeDTO.java
...src/main/java/com/pcloud/book/group/dto/BookServeDTO.java
+2
-0
BookAdviser.Mapper.xml
...ook/src/main/resources/mapper/book/BookAdviser.Mapper.xml
+16
-0
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/AppletUserBookcaseBiz.java
View file @
5c5ddd46
...
@@ -5,6 +5,7 @@ import com.pcloud.book.applet.dto.UserLastBookReDTO;
...
@@ -5,6 +5,7 @@ import com.pcloud.book.applet.dto.UserLastBookReDTO;
import
com.pcloud.book.applet.entity.AppletUserBookcase
;
import
com.pcloud.book.applet.entity.AppletUserBookcase
;
import
com.pcloud.book.applet.entity.AppletUserClickRecord
;
import
com.pcloud.book.applet.entity.AppletUserClickRecord
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageBeanNew
;
import
org.springframework.web.multipart.MultipartHttpServletRequest
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -95,4 +96,6 @@ public interface AppletUserBookcaseBiz {
...
@@ -95,4 +96,6 @@ public interface AppletUserBookcaseBiz {
Map
<
String
,
Integer
>
mapBookUserCountList
(
List
<
Long
>
bookIds
);
Map
<
String
,
Integer
>
mapBookUserCountList
(
List
<
Long
>
bookIds
);
AppletUserBookcaseDTO
getUserBookInfoByWechatUserId
(
Long
bookId
,
Long
channelId
,
Long
adviserId
,
Long
rightsSettingId
);
AppletUserBookcaseDTO
getUserBookInfoByWechatUserId
(
Long
bookId
,
Long
channelId
,
Long
adviserId
,
Long
rightsSettingId
);
String
getResources4Books
(
MultipartHttpServletRequest
request
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletUserBookcaseBizImpl.java
View file @
5c5ddd46
...
@@ -9,15 +9,19 @@ import com.pcloud.book.applet.dao.AppletUserBookcaseDao;
...
@@ -9,15 +9,19 @@ import com.pcloud.book.applet.dao.AppletUserBookcaseDao;
import
com.pcloud.book.applet.dto.AppletNewsDTO
;
import
com.pcloud.book.applet.dto.AppletNewsDTO
;
import
com.pcloud.book.applet.dto.AppletNewsServeDTO
;
import
com.pcloud.book.applet.dto.AppletNewsServeDTO
;
import
com.pcloud.book.applet.dto.AppletUserBookcaseDTO
;
import
com.pcloud.book.applet.dto.AppletUserBookcaseDTO
;
import
com.pcloud.book.applet.dto.BookResourceExcelDTO
;
import
com.pcloud.book.applet.dto.UserLastBookReDTO
;
import
com.pcloud.book.applet.dto.UserLastBookReDTO
;
import
com.pcloud.book.applet.entity.AppletUserBookcase
;
import
com.pcloud.book.applet.entity.AppletUserBookcase
;
import
com.pcloud.book.applet.entity.AppletUserClickRecord
;
import
com.pcloud.book.applet.entity.AppletUserClickRecord
;
import
com.pcloud.book.applet.enums.AppletNewsServeTypeEnum
;
import
com.pcloud.book.applet.enums.AppletNewsServeTypeEnum
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.biz.BookAdviserBiz
;
import
com.pcloud.book.book.constant.BookConstant
;
import
com.pcloud.book.book.constant.BookConstant
;
import
com.pcloud.book.book.dao.BookRaysClassifyDao
;
import
com.pcloud.book.book.dao.BookRaysClassifyDao
;
import
com.pcloud.book.book.entity.BookRaysClassify
;
import
com.pcloud.book.book.entity.BookRaysClassify
;
import
com.pcloud.book.consumer.app.AssistTempletConsr
;
import
com.pcloud.book.consumer.app.AssistTempletConsr
;
import
com.pcloud.book.consumer.common.ExportConsr
;
import
com.pcloud.book.copyright.tools.ExcelUtil
;
import
com.pcloud.book.es.biz.ESBookAndAdviserBiz
;
import
com.pcloud.book.es.biz.ESBookAndAdviserBiz
;
import
com.pcloud.book.group.biz.BookGroupBiz
;
import
com.pcloud.book.group.biz.BookGroupBiz
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
...
@@ -34,7 +38,9 @@ import com.pcloud.book.rightsSetting.entity.RightsReadType;
...
@@ -34,7 +38,9 @@ import com.pcloud.book.rightsSetting.entity.RightsReadType;
import
com.pcloud.book.rightsSetting.entity.RightsSetting
;
import
com.pcloud.book.rightsSetting.entity.RightsSetting
;
import
com.pcloud.book.rightsSetting.enums.RightsServeTypeEnum
;
import
com.pcloud.book.rightsSetting.enums.RightsServeTypeEnum
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.channelcenter.base.exceptions.ChannelBizException
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.BeanUtils
;
import
com.pcloud.common.utils.BeanUtils
;
...
@@ -43,10 +49,16 @@ import com.pcloud.common.utils.ListUtils;
...
@@ -43,10 +49,16 @@ import com.pcloud.common.utils.ListUtils;
import
com.pcloud.common.utils.cache.redis.JedisClusterUtils
;
import
com.pcloud.common.utils.cache.redis.JedisClusterUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartHttpServletRequest
;
import
java.io.File
;
import
java.io.IOException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Collections
;
...
@@ -64,6 +76,7 @@ import java.util.stream.Collectors;
...
@@ -64,6 +76,7 @@ import java.util.stream.Collectors;
* 小程序用户书架
* 小程序用户书架
*/
*/
@Component
@Component
@Slf4j
public
class
AppletUserBookcaseBizImpl
implements
AppletUserBookcaseBiz
{
public
class
AppletUserBookcaseBizImpl
implements
AppletUserBookcaseBiz
{
...
@@ -85,6 +98,10 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
...
@@ -85,6 +98,10 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
private
AppletNewsBiz
appletNewsBiz
;
private
AppletNewsBiz
appletNewsBiz
;
@Autowired
@Autowired
private
RightsSettingDAO
rightsSettingDAO
;
private
RightsSettingDAO
rightsSettingDAO
;
@Autowired
private
BookAdviserBiz
bookAdviserBiz
;
@Autowired
private
ExportConsr
exportConsr
;
@Override
@Override
public
void
addUserBook
(
AppletUserBookcase
appletUserBookcase
)
{
public
void
addUserBook
(
AppletUserBookcase
appletUserBookcase
)
{
...
@@ -431,6 +448,130 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
...
@@ -431,6 +448,130 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
return
appletUserBookcaseDTOS
.
get
(
0
);
return
appletUserBookcaseDTOS
.
get
(
0
);
}
}
@Override
public
String
getResources4Books
(
MultipartHttpServletRequest
request
)
{
String
excelUrl
=
null
;
List
<
BookResourceExcelDTO
>
bookResourceDTOList4BookExcel
=
getBookResourceList
(
request
);
if
(
ListUtils
.
isEmpty
(
bookResourceDTOList4BookExcel
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"bookResourceDTOList4Book"
);
}
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
List
<
BookResourceExcelDTO
>
bookResourceDTOList4ResourceExcel
=
new
ArrayList
<>(
1000
);
bookResourceDTOList4BookExcel
.
forEach
(
e
->
{
Long
bookId
=
e
.
getBookId
();
if
(
null
==
bookId
)
{
return
;
}
Integer
isRui
=
getIsRui
(
e
.
getAdviserId
(),
e
.
getBookId
(),
e
.
getChannelId
());
List
<
BookServeDTO
>
serveDTOList
=
bookGroupBiz
.
getBookAndBookGroupServeIds4Price
(
e
.
getAdviserId
(),
e
.
getBookId
(),
e
.
getChannelId
());
if
(
ListUtils
.
isEmpty
(
serveDTOList
))
{
return
;
}
serveDTOList
.
forEach
(
m
->
{
BookResourceExcelDTO
bookResourceExcelDTO
=
new
BookResourceExcelDTO
();
bookResourceExcelDTO
.
setBookId
(
e
.
getBookId
());
bookResourceExcelDTO
.
setAdviserId
(
e
.
getAdviserId
());
bookResourceExcelDTO
.
setChannelId
(
e
.
getChannelId
());
bookResourceExcelDTO
.
setBookName
(
e
.
getBookName
());
bookResourceExcelDTO
.
setUrl
(
e
.
getUrl
());
bookResourceExcelDTO
.
setResourceId
(
m
.
getServeId
());
bookResourceExcelDTO
.
setResourceName
(
m
.
getServeName
());
bookResourceExcelDTO
.
setResourceType
(
m
.
getServeType
());
bookResourceExcelDTO
.
setFromType
(
m
.
getFromType
());
bookResourceExcelDTO
.
setFromTypeName
(
m
.
getFromTypeName
());
bookResourceExcelDTO
.
setPrice
(
m
.
getPrice
());
bookResourceExcelDTO
.
setIsRui
(
isRui
);
bookResourceDTOList4ResourceExcel
.
add
(
bookResourceExcelDTO
);
});
});
String
fileName
=
"书籍相关资源-研发-"
+
simpleDateFormat
.
format
(
new
Date
());
excelUrl
=
getExcelUrl4Resource
(
bookResourceDTOList4ResourceExcel
,
fileName
);
return
excelUrl
;
}
private
String
getExcelUrl4Resource
(
List
<
BookResourceExcelDTO
>
bookResourceDTOList4ResourceExcel
,
String
fileName
)
{
// 字段名
String
[]
rowsName
=
{
"书籍id"
,
"编辑id"
,
"渠道id"
,
"书籍名称"
,
"书籍二维码"
,
"资源id"
,
"资源名称"
,
"资源类型"
,
"资源具体类型"
,
"资源类型名称"
,
"资源价格"
,
"是否小睿书"
};
List
<
Object
[]>
dataList
=
new
ArrayList
<>();
Object
[]
objs
;
for
(
int
i
=
0
;
i
<
bookResourceDTOList4ResourceExcel
.
size
();
i
++)
{
BookResourceExcelDTO
bookResourceExcelDTO
=
bookResourceDTOList4ResourceExcel
.
get
(
i
);
objs
=
new
Object
[
rowsName
.
length
];
objs
[
0
]
=
bookResourceExcelDTO
.
getBookId
();
objs
[
1
]
=
bookResourceExcelDTO
.
getAdviserId
();
objs
[
2
]
=
bookResourceExcelDTO
.
getChannelId
();
objs
[
3
]
=
bookResourceExcelDTO
.
getBookName
();
objs
[
4
]
=
bookResourceExcelDTO
.
getUrl
();
objs
[
5
]
=
bookResourceExcelDTO
.
getResourceId
();
objs
[
6
]
=
bookResourceExcelDTO
.
getResourceName
();
objs
[
7
]
=
bookResourceExcelDTO
.
getResourceType
();
objs
[
8
]
=
bookResourceExcelDTO
.
getFromType
();
objs
[
9
]
=
bookResourceExcelDTO
.
getFromTypeName
();
objs
[
10
]
=
bookResourceExcelDTO
.
getPrice
();
objs
[
11
]
=
bookResourceExcelDTO
.
getIsRui
();
dataList
.
add
(
objs
);
}
String
fileUrl
=
exportConsr
.
exportExcel
(
fileName
,
rowsName
,
dataList
);
return
fileUrl
;
}
private
Integer
getIsRui
(
Long
adviserId
,
Long
bookId
,
Long
channelId
)
{
return
bookAdviserBiz
.
getIsRui
(
adviserId
,
bookId
,
channelId
);
}
private
List
<
BookResourceExcelDTO
>
getBookResourceList
(
MultipartHttpServletRequest
request
)
{
List
<
BookResourceExcelDTO
>
bookResourceExcelDTOList
=
new
ArrayList
<>();
List
<
MultipartFile
>
files
=
request
.
getFiles
(
"file"
);
if
(
files
==
null
||
files
.
size
()
==
0
)
{
throw
new
ChannelBizException
(
ChannelBizException
.
BOOK_ID_IS_NULL
,
"未发现上传内容,请检查!"
);
}
MultipartFile
multipartFile
=
files
.
get
(
0
);
String
suffix
=
getfileSuffix
(
multipartFile
);
String
fileName
=
multipartFile
.
getOriginalFilename
();
File
temp
=
null
;
try
{
temp
=
File
.
createTempFile
(
"temp"
,
suffix
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
try
{
multipartFile
.
transferTo
(
temp
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
String
[][]
data
;
try
{
data
=
ExcelUtil
.
getData
(
temp
,
1
);
}
catch
(
BizException
e
)
{
log
.
warn
(
"导入出错"
+
e
,
e
.
getMessage
());
throw
new
ChannelBizException
(
e
.
getCode
(),
e
.
getMsg
());
}
catch
(
Exception
e
)
{
log
.
warn
(
"导入出错"
+
e
,
e
.
getMessage
());
throw
new
ChannelBizException
(
BookBizException
.
PARAM_IS_NULL
,
"错误的文件或者未按模板格式导入!"
);
}
int
num
=
0
;
for
(
int
i
=
0
;
i
<
data
.
length
;
i
++)
{
BookResourceExcelDTO
bookResourceExcelDTO
=
new
BookResourceExcelDTO
();
num
=
i
+
2
;
bookResourceExcelDTO
.
setRowNo
(
Long
.
valueOf
(
num
));
bookResourceExcelDTO
.
setBookId
(
Long
.
valueOf
(
data
[
i
][
1
]));
bookResourceExcelDTO
.
setBookName
(
data
[
i
][
2
]);
bookResourceExcelDTO
.
setAdviserId
(
Long
.
valueOf
(
data
[
i
][
3
]));
bookResourceExcelDTO
.
setChannelId
(
Long
.
valueOf
(
data
[
i
][
5
]));
bookResourceExcelDTO
.
setUrl
(
data
[
i
][
6
]);
bookResourceExcelDTOList
.
add
(
bookResourceExcelDTO
);
}
return
bookResourceExcelDTOList
;
}
private
String
getfileSuffix
(
MultipartFile
multipartFile
)
{
String
originalFilename
=
multipartFile
.
getOriginalFilename
();
return
originalFilename
.
substring
(
originalFilename
.
lastIndexOf
(
'.'
),
originalFilename
.
length
());
}
private
void
fillReadGuide
(
AppletUserBookcaseDTO
appletUserBookcaseDTO
,
Long
rightsSettingId
){
private
void
fillReadGuide
(
AppletUserBookcaseDTO
appletUserBookcaseDTO
,
Long
rightsSettingId
){
RightsSetting
rightsSetting
=
rightsSettingDAO
.
selectByPrimaryKey
(
rightsSettingId
);
RightsSetting
rightsSetting
=
rightsSettingDAO
.
selectByPrimaryKey
(
rightsSettingId
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/facade/AppletHomeFacade.java
View file @
5c5ddd46
...
@@ -42,6 +42,7 @@ import com.pcloud.common.utils.cookie.Cookie;
...
@@ -42,6 +42,7 @@ import com.pcloud.common.utils.cookie.Cookie;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
@@ -49,6 +50,7 @@ import org.springframework.web.bind.annotation.PostMapping;
...
@@ -49,6 +50,7 @@ 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.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestHeader
;
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.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -58,6 +60,7 @@ import java.util.Map;
...
@@ -58,6 +60,7 @@ import java.util.Map;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.web.multipart.MultipartHttpServletRequest
;
@Api
(
description
=
"小睿小程序首页"
)
@Api
(
description
=
"小睿小程序首页"
)
@RestController
(
"appletHomeFacade"
)
@RestController
(
"appletHomeFacade"
)
...
@@ -1130,6 +1133,13 @@ public class AppletHomeFacade {
...
@@ -1130,6 +1133,13 @@ public class AppletHomeFacade {
}
}
return
new
ResponseDto
<>();
return
new
ResponseDto
<>();
}
}
@RequestMapping
(
value
=
"getResources4Books"
,
method
=
RequestMethod
.
POST
,
consumes
=
{
MediaType
.
MULTIPART_FORM_DATA_VALUE
},
produces
=
{
MediaType
.
APPLICATION_JSON_UTF8_VALUE
})
public
ResponseDto
<
String
>
getResources4Books
(
MultipartHttpServletRequest
request
)
{
String
url
=
appletUserBookcaseBiz
.
getResources4Books
(
request
);
return
new
ResponseDto
<>(
url
);
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/BookAdviserBiz.java
View file @
5c5ddd46
...
@@ -260,4 +260,5 @@ public interface BookAdviserBiz {
...
@@ -260,4 +260,5 @@ public interface BookAdviserBiz {
*/
*/
Map
<
String
,
Object
>
getRayBookCountAndRate
(
Boolean
showRate
);
Map
<
String
,
Object
>
getRayBookCountAndRate
(
Boolean
showRate
);
Integer
getIsRui
(
Long
adviserId
,
Long
bookId
,
Long
channelId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/impl/BookAdviserBizImpl.java
View file @
5c5ddd46
...
@@ -1361,4 +1361,9 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
...
@@ -1361,4 +1361,9 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
return
map
;
return
map
;
}
}
@Override
public
Integer
getIsRui
(
Long
adviserId
,
Long
bookId
,
Long
channelId
)
{
return
bookAdviserDao
.
getIsRui
(
adviserId
,
bookId
,
channelId
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/book/dao/BookAdviserDao.java
View file @
5c5ddd46
...
@@ -284,4 +284,5 @@ public interface BookAdviserDao extends BaseDao<BookAdviser> {
...
@@ -284,4 +284,5 @@ public interface BookAdviserDao extends BaseDao<BookAdviser> {
*/
*/
Long
getRayBookCount
(
String
startTime
,
String
endTime
);
Long
getRayBookCount
(
String
startTime
,
String
endTime
);
Integer
getIsRui
(
Long
adviserId
,
Long
bookId
,
Long
channelId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/book/dao/impl/BookAdviserDaoImpl.java
View file @
5c5ddd46
...
@@ -291,4 +291,13 @@ public class BookAdviserDaoImpl extends BaseDaoImpl<BookAdviser> implements Book
...
@@ -291,4 +291,13 @@ public class BookAdviserDaoImpl extends BaseDaoImpl<BookAdviser> implements Book
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getRayBookCount"
),
map
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getRayBookCount"
),
map
);
}
}
@Override
public
Integer
getIsRui
(
Long
adviserId
,
Long
bookId
,
Long
channelId
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"bookId"
,
bookId
);
paramMap
.
put
(
"channelId"
,
channelId
);
paramMap
.
put
(
"adviserId"
,
adviserId
);
return
super
.
getSqlSession
().
selectOne
(
this
.
getStatement
(
"getIsRui"
),
paramMap
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/consumer/resource/ProductConsr.java
View file @
5c5ddd46
...
@@ -307,4 +307,23 @@ public class ProductConsr {
...
@@ -307,4 +307,23 @@ public class ProductConsr {
return
productMap
;
return
productMap
;
}
}
public
Map
<
Long
,
ProductDto
>
getProductInfoByIds
(
List
<
Long
>
proIds
)
{
LOGGER
.
info
(
"获取商品id集合对应商品信息,参数列表[proIds]:"
+
proIds
);
Map
<
Long
,
ProductDto
>
productDtoMap
=
new
HashMap
<>();
if
(
ListUtils
.
isEmpty
(
proIds
))
{
return
productDtoMap
;
}
try
{
productDtoMap
=
ResponseHandleUtil
.
parseMapResponse
(
productService
.
getProBasesByIds
(
proIds
),
Long
.
class
,
ProductDto
.
class
);
}
catch
(
BizException
e
)
{
throw
new
BizException
(
e
.
getCode
(),
e
.
getMessage
());
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"获取商品id集合对应商品信息失败[productService.getProBasesByIds]:"
+
e
.
getMessage
(),
e
);
throw
new
ChannelBizException
(
ChannelBizException
.
INVOKE_RES_ERROR
,
"获取商品信息失败~!"
);
}
LOGGER
.
info
(
"获取商品id集合对应商品信息【end】 [productService.getProBasesByIds]"
);
return
productDtoMap
==
null
?
new
HashMap
<>()
:
productDtoMap
;
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/copyright/tools/ExcelUtil.java
View file @
5c5ddd46
package
com
.
pcloud
.
book
.
copyright
.
tools
;
package
com
.
pcloud
.
book
.
copyright
.
tools
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.copyright.biz.impl.BookAuthInfoBizImpl
;
import
com.pcloud.book.copyright.biz.impl.BookAuthInfoBizImpl
;
import
com.pcloud.channelcenter.base.exceptions.ChannelBizException
;
import
com.pcloud.common.constant.OSConstant
;
import
com.pcloud.common.constant.OSConstant
;
import
com.pcloud.common.utils.FileUtils
;
import
com.pcloud.common.utils.FileUtils
;
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.string.StringUtil
;
import
org.apache.poi.hssf.usermodel.HSSFCell
;
import
org.apache.poi.hssf.usermodel.HSSFCell
;
import
org.apache.poi.hssf.usermodel.HSSFDateUtil
;
import
org.apache.poi.hssf.usermodel.HSSFDateUtil
;
import
org.apache.poi.hssf.usermodel.HSSFRow
;
import
org.apache.poi.hssf.usermodel.HSSFRow
;
...
@@ -15,7 +18,10 @@ import org.apache.poi.poifs.filesystem.POIFSFileSystem;
...
@@ -15,7 +18,10 @@ import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.io.BufferedInputStream
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormat
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
...
@@ -170,4 +176,119 @@ public class ExcelUtil {
...
@@ -170,4 +176,119 @@ public class ExcelUtil {
}
}
return
str
.
substring
(
0
,
length
);
return
str
.
substring
(
0
,
length
);
}
}
public
static
String
[][]
getData
(
File
file
,
int
ignoreRows
)
throws
FileNotFoundException
,
IOException
{
List
<
String
[]>
result
=
new
ArrayList
<
String
[]>();
int
rowSize
=
0
;
BufferedInputStream
in
=
new
BufferedInputStream
(
new
FileInputStream
(
file
));
// 打开HSSFWorkbook
POIFSFileSystem
fs
=
new
POIFSFileSystem
(
in
);
HSSFWorkbook
wb
=
new
HSSFWorkbook
(
fs
);
HSSFCell
cell
=
null
;
List
<
Integer
>
temp
=
new
ArrayList
<>();
for
(
int
sheetIndex
=
0
;
sheetIndex
<
wb
.
getNumberOfSheets
();
sheetIndex
++)
{
HSSFSheet
st
=
wb
.
getSheetAt
(
sheetIndex
);
// 第一行为标题,不取
for
(
int
rowIndex
=
ignoreRows
;
rowIndex
<=
st
.
getLastRowNum
();
rowIndex
++)
{
HSSFRow
row
=
st
.
getRow
(
rowIndex
);
if
(
row
==
null
)
{
continue
;
}
int
tempRowSize
=
row
.
getLastCellNum
()
+
1
;
if
(
tempRowSize
>
rowSize
)
{
rowSize
=
tempRowSize
;
}
String
[]
values
=
new
String
[
rowSize
];
Arrays
.
fill
(
values
,
""
);
boolean
hasValue
=
false
;
for
(
short
columnIndex
=
0
;
columnIndex
<=
row
.
getLastCellNum
();
columnIndex
++)
{
String
value
=
""
;
cell
=
row
.
getCell
(
columnIndex
);
if
(
cell
!=
null
)
{
// 注意:一定要设成这个,否则可能会出现乱码
//cell.set.setEncoding(HSSFCell.ENCODING_UTF_16);
switch
(
cell
.
getCellType
())
{
case
HSSFCell
.
CELL_TYPE_STRING
:
value
=
cell
.
getStringCellValue
();
break
;
case
HSSFCell
.
CELL_TYPE_NUMERIC
:
if
(
HSSFDateUtil
.
isCellDateFormatted
(
cell
))
{
Date
date
=
cell
.
getDateCellValue
();
if
(
date
!=
null
)
{
value
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
)
.
format
(
date
);
}
else
{
value
=
""
;
}
}
else
{
value
=
new
DecimalFormat
(
"0"
).
format
(
cell
.
getNumericCellValue
());
}
break
;
case
HSSFCell
.
CELL_TYPE_FORMULA
:
// 导入时如果为公式生成的数据则无值
if
(!
cell
.
getStringCellValue
().
equals
(
""
))
{
value
=
cell
.
getStringCellValue
();
}
else
{
value
=
cell
.
getNumericCellValue
()
+
""
;
}
break
;
case
HSSFCell
.
CELL_TYPE_BLANK
:
break
;
case
HSSFCell
.
CELL_TYPE_ERROR
:
value
=
""
;
break
;
case
HSSFCell
.
CELL_TYPE_BOOLEAN
:
value
=
(
cell
.
getBooleanCellValue
()
==
true
?
"Y"
:
"N"
);
break
;
default
:
value
=
""
;
}
if
(!
rightTrim
(
value
).
trim
().
equals
(
""
))
{
hasValue
=
true
;
}
values
[
columnIndex
]
=
rightTrim
(
value
);
}
else
{
values
[
columnIndex
]
=
null
;
}
}
if
(!
hasValue
)
{
temp
.
add
(
rowIndex
-
1
);
}
result
.
add
(
values
);
}
}
in
.
close
();
String
[][]
returnArray
=
new
String
[
result
.
size
()][
rowSize
+
1
];
for
(
int
i
=
0
;
i
<
returnArray
.
length
;
i
++)
{
returnArray
[
i
]
=
(
String
[])
result
.
get
(
i
);
}
String
[][]
resultStr
=
new
String
[
result
.
size
()
-
temp
.
size
()][
rowSize
+
1
];
int
j
=
0
;
HSSFSheet
st
=
wb
.
getSheetAt
(
0
);
for
(
int
i
=
0
;
i
<
returnArray
.
length
;
i
++)
{
if
(
temp
.
contains
(
i
))
{
continue
;
}
resultStr
[
j
]
=
returnArray
[
i
];
if
(
StringUtil
.
isEmpty
(
returnArray
[
i
][
0
]))
{
throw
new
ChannelBizException
(
BookBizException
.
PARAM_IS_NULL
,
"论文题名不能为空"
);
}
if
(
StringUtil
.
isEmpty
(
returnArray
[
i
][
1
]))
{
throw
new
ChannelBizException
(
BookBizException
.
PARAM_IS_NULL
,
"关键词不能为空"
);
}
if
(
StringUtil
.
isEmpty
(
returnArray
[
i
][
2
]))
{
throw
new
ChannelBizException
(
BookBizException
.
PARAM_IS_NULL
,
"全部作者不能为空"
);
}
if
(
StringUtil
.
isEmpty
(
returnArray
[
i
][
5
]))
{
throw
new
ChannelBizException
(
BookBizException
.
PARAM_IS_NULL
,
"论文语言不能为空"
);
}
j
++;
}
return
resultStr
;
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/BookGroupBiz.java
View file @
5c5ddd46
...
@@ -955,4 +955,6 @@ public interface BookGroupBiz {
...
@@ -955,4 +955,6 @@ public interface BookGroupBiz {
* * @param null
* * @param null
*/
*/
Integer
getBookGroupCountByAgent
(
Integer
joinGroupType
,
Long
agentId
);
Integer
getBookGroupCountByAgent
(
Integer
joinGroupType
,
Long
agentId
);
List
<
BookServeDTO
>
getBookAndBookGroupServeIds4Price
(
Long
adviserId
,
Long
bookId
,
Long
channelId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/impl/BookGroupBizImpl.java
View file @
5c5ddd46
...
@@ -183,6 +183,7 @@ import com.pcloud.book.util.common.ThreadPoolUtils;
...
@@ -183,6 +183,7 @@ import com.pcloud.book.util.common.ThreadPoolUtils;
import
com.pcloud.book.util.properties.BookProps
;
import
com.pcloud.book.util.properties.BookProps
;
import
com.pcloud.channelcenter.base.constants.ChannelConstants
;
import
com.pcloud.channelcenter.base.constants.ChannelConstants
;
import
com.pcloud.channelcenter.base.constants.ChannelEnum
;
import
com.pcloud.channelcenter.base.constants.ChannelEnum
;
import
com.pcloud.channelcenter.base.constants.MessageFromTypeEnum
;
import
com.pcloud.channelcenter.base.exceptions.ChannelBizException
;
import
com.pcloud.channelcenter.base.exceptions.ChannelBizException
;
import
com.pcloud.channelcenter.qrcode.dto.GroupQrcodeVO
;
import
com.pcloud.channelcenter.qrcode.dto.GroupQrcodeVO
;
import
com.pcloud.channelcenter.qrcode.dto.QrcodeSceneDto
;
import
com.pcloud.channelcenter.qrcode.dto.QrcodeSceneDto
;
...
@@ -5555,6 +5556,138 @@ public class BookGroupBizImpl implements BookGroupBiz {
...
@@ -5555,6 +5556,138 @@ public class BookGroupBizImpl implements BookGroupBiz {
return
bookGroupDao
.
getBookGroupCountByAgent
(
joinGroupType
,
agentId
);
return
bookGroupDao
.
getBookGroupCountByAgent
(
joinGroupType
,
agentId
);
}
}
@Override
public
List
<
BookServeDTO
>
getBookAndBookGroupServeIds4Price
(
Long
adviserId
,
Long
bookId
,
Long
channelId
)
{
List
<
BookServeDTO
>
serveDTOList
=
new
ArrayList
<>();
BookGroupDTO
bookGroupDTO
=
bookGroupDao
.
getDTOByBookId
(
bookId
,
channelId
,
adviserId
);
List
<
Long
>
appIds
=
new
ArrayList
<>();
List
<
Long
>
productIds
=
new
ArrayList
<>();
AccountSettingDto
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
channelId
);
if
(
null
==
accountSettingDto
){
return
new
ArrayList
<>();
}
if
(
null
!=
bookGroupDTO
)
{
//有社群书
//社群书配置资源
List
<
BookGroupServe
>
bookGroupServes
=
bookGroupServeDao
.
getListByBookGroupId
(
bookGroupDTO
.
getId
());
if
(!
ListUtils
.
isEmpty
(
bookGroupServes
))
{
for
(
BookGroupServe
bookGroupServe
:
bookGroupServes
)
{
BookServeDTO
bookServeDTO
=
new
BookServeDTO
();
BeanUtils
.
copyProperties
(
bookGroupServe
,
bookServeDTO
);
String
url
=
SendWeixinRequestTools
.
splitUrl
(
accountSettingDto
,
bookGroupServe
.
getServeUrl
());
bookServeDTO
.
setUrl
(
url
);
bookServeDTO
.
setTypeCode
(
bookServeDTO
.
getServeType
());
bookServeDTO
.
setFromType
(
bookGroupServe
.
getTypeCode
());
serveDTOList
.
add
(
bookServeDTO
);
if
(
AppAndProductTypeEnum
.
APP
.
value
.
equals
(
bookServeDTO
.
getServeType
()))
{
appIds
.
add
(
bookGroupServe
.
getServeId
());
}
else
{
productIds
.
add
(
bookGroupServe
.
getServeId
());
}
}
}
}
//设置应用名称与价格
setAppPrice
(
serveDTOList
);
//现代纸书二维码配置资源
BookServeParamVO
serveParamVO
=
new
BookServeParamVO
();
serveParamVO
.
setAdviserId
(
adviserId
);
serveParamVO
.
setBookId
(
bookId
);
serveParamVO
.
setChannelId
(
channelId
);
List
<
BookServeVO
>
bookServeVOS
=
qrcodeSceneConsr
.
listBookServe
(
serveParamVO
);
if
(!
ListUtils
.
isEmpty
(
bookServeVOS
))
{
for
(
BookServeVO
bookServeVO
:
bookServeVOS
)
{
Long
serveId
=
bookServeVO
.
getServeId
();
BookServeDTO
bookServeDTO
=
new
BookServeDTO
();
bookServeDTO
.
setServeName
(
bookServeVO
.
getServeName
());
bookServeDTO
.
setPrice
(
bookServeVO
.
getRetailPrice
());
bookServeDTO
.
setTypeCode
(
bookServeVO
.
getTypeCode
());
bookServeDTO
.
setFromType
(
bookServeVO
.
getFromType
());
String
url
=
SendWeixinRequestTools
.
splitUrl
(
accountSettingDto
,
bookServeVO
.
getUrl
());
if
(
AppAndProductTypeEnum
.
APP
.
value
.
equals
(
bookServeVO
.
getTypeCode
())
&&
!
appIds
.
contains
(
serveId
))
{
bookServeDTO
.
setServeId
(
serveId
);
bookServeDTO
.
setServeType
(
bookServeVO
.
getTypeCode
());
bookServeDTO
.
setUrl
(
url
);
serveDTOList
.
add
(
bookServeDTO
);
appIds
.
add
(
serveId
);
}
else
if
(
AppAndProductTypeEnum
.
PRODUCT
.
value
.
equals
(
bookServeVO
.
getTypeCode
())
&&
!
productIds
.
contains
(
serveId
))
{
bookServeDTO
.
setServeId
(
serveId
);
bookServeDTO
.
setServeType
(
bookServeVO
.
getTypeCode
());
bookServeDTO
.
setUrl
(
url
);
serveDTOList
.
add
(
bookServeDTO
);
productIds
.
add
(
serveId
);
}
}
}
return
serveDTOList
;
}
private
void
setAppPrice
(
List
<
BookServeDTO
>
serveDTOList
)
{
if
(
ListUtils
.
isEmpty
(
serveDTOList
))
{
return
;
}
List
<
Long
>
productIds
=
serveDTOList
.
stream
().
filter
(
s
->
s
.
getServeId
()
!=
null
&&
MessageFromTypeEnum
.
PRODUCT
.
value
.
equalsIgnoreCase
(
s
.
getTypeCode
())).
map
(
BookServeDTO:
:
getServeId
).
distinct
().
collect
(
Collectors
.
toList
());
List
<
Long
>
appIds
=
serveDTOList
.
stream
().
filter
(
s
->
s
.
getServeId
()
!=
null
&&
MessageFromTypeEnum
.
APP
.
value
.
equalsIgnoreCase
(
s
.
getTypeCode
())).
map
(
BookServeDTO:
:
getServeId
).
distinct
().
collect
(
Collectors
.
toList
());
//获取详情
Map
<
Long
,
AppDto
>
appDtoMap
=
new
HashMap
<>();
Map
<
Long
,
ProductDto
>
productDtoMap
=
new
HashMap
<>();
Map
<
Long
,
BigDecimal
>
appPriceMap
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
appIds
))
{
appDtoMap
=
appConsr
.
mapByIds
(
appIds
);
List
<
AppPriceCacheDTO
>
appPriceCacheDTOS
=
new
ArrayList
<>();
for
(
Long
appId
:
appIds
)
{
if
(
appDtoMap
.
get
(
appId
)
!=
null
)
{
AppPriceCacheDTO
appPriceCacheDTO
=
new
AppPriceCacheDTO
();
appPriceCacheDTO
.
setAppTypeEnum
(
AppTypeEnum
.
APP_TYPE_MAP
.
get
(
appDtoMap
.
get
(
appId
).
getTypeCode
()));
appPriceCacheDTO
.
setAppId
(
appId
);
appPriceCacheDTOS
.
add
(
appPriceCacheDTO
);
}
}
appPriceMap
=
appConsr
.
getAppPrice
(
appPriceCacheDTOS
);
}
if
(!
ListUtils
.
isEmpty
(
productIds
))
{
productDtoMap
=
productConsr
.
getProductInfoByIds
(
productIds
);
}
for
(
BookServeDTO
item
:
serveDTOList
)
{
String
originType
=
item
.
getTypeCode
();
Long
id
=
item
.
getServeId
();
if
(
MessageFromTypeEnum
.
PRODUCT
.
value
.
equalsIgnoreCase
(
originType
))
{
if
(
productDtoMap
!=
null
&&
productDtoMap
.
get
(
id
)
!=
null
)
{
ProductDto
productDto
=
productDtoMap
.
get
(
id
);
item
.
setServeName
(
productDto
.
getProductName
());
item
.
setCoverImg
(
productDto
.
getCoverImg
());
ProductTypeDto
productTypeDto
=
productDto
.
getProductTypeDto
();
if
(
productTypeDto
!=
null
)
{
item
.
setFromTypeName
(
productTypeDto
.
getTypeName
());
}
List
<
SpecificationDto
>
specificationDtos
=
productDto
.
getSpecification
();
if
(!
ListUtils
.
isEmpty
(
specificationDtos
))
{
SpecificationDto
specificationDto
=
specificationDtos
.
get
(
0
);
if
(
specificationDto
!=
null
)
{
item
.
setPrice
(
specificationDto
.
getAdvisePrice
());
}
}
}
}
if
(
MessageFromTypeEnum
.
APP
.
value
.
equalsIgnoreCase
(
originType
))
{
if
(
appDtoMap
!=
null
&&
appDtoMap
.
get
(
id
)
!=
null
)
{
AppDto
appDto
=
appDtoMap
.
get
(
id
);
item
.
setFromTypeName
(
appDto
.
getTypeName
());
item
.
setServeName
(
appDto
.
getTitle
());
item
.
setCoverImg
(
appDto
.
getSquareImg
());
}
if
(
appPriceMap
!=
null
)
{
if
(
appPriceMap
.
get
(
id
)
!=
null
)
{
item
.
setPrice
(
appPriceMap
.
get
(
id
).
doubleValue
());
}
}
}
}
}
@Override
@Override
public
BookGroupDTO
getMaxScanCountBookGroup
(
Long
agentId
,
Integer
joinGroupType
)
{
public
BookGroupDTO
getMaxScanCountBookGroup
(
Long
agentId
,
Integer
joinGroupType
)
{
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/dto/BookServeDTO.java
View file @
5c5ddd46
...
@@ -38,4 +38,6 @@ public class BookServeDTO extends BaseDto {
...
@@ -38,4 +38,6 @@ public class BookServeDTO extends BaseDto {
@ApiModelProperty
(
"类型;APP应用,PRODUCT作品"
)
@ApiModelProperty
(
"类型;APP应用,PRODUCT作品"
)
private
String
typeCode
;
private
String
typeCode
;
private
Double
price
;
}
}
pcloud-service-book/src/main/resources/mapper/book/BookAdviser.Mapper.xml
View file @
5c5ddd46
...
@@ -789,5 +789,20 @@
...
@@ -789,5 +789,20 @@
) AS a
) AS a
</select>
</select>
<select
id=
"getIsRui"
parameterType=
"map"
resultType=
"integer"
>
SELECT
IF(is_open_robot_process = 1 OR join_group_type = 4,1,0) isRui
FROM
book_adviser a
LEFT JOIN book_group b ON a.BOOK_ID = b.book_id
AND a.CHANNEL_ID = b.channel_id
WHERE
a.BOOK_ID = #{bookId}
AND
a.CHANNEL_ID = #{channelId}
AND
a.ADVISER_ID = #{adviserId}
</select>
</mapper>
</mapper>
\ No newline at end of file
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