Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
haoban3.0
haoban-manage3.0
Commits
cc03b90b
Commit
cc03b90b
authored
Mar 16, 2023
by
songyinghui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 素材分享 短链和二维码生成
parent
fc8d5933
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
148 additions
and
85 deletions
+148
-85
pom.xml
haoban-manage3-wx/pom.xml
+6
-0
ContentMaterialController.java
...age/web/controller/content/ContentMaterialController.java
+48
-66
GoodsInfoAdaptor.java
.../haoban/manage/web/controller/goods/GoodsInfoAdaptor.java
+72
-0
ContentMaterialQO.java
...m/gic/haoban/manage/web/qo/content/ContentMaterialQO.java
+8
-6
ContentMaterialShareQO.java
.../haoban/manage/web/qo/content/ContentMaterialShareQO.java
+13
-13
dubbo-haoban-manage-wx.xml
...ge3-wx/src/main/webapp/WEB-INF/dubbo-haoban-manage-wx.xml
+1
-0
No files found.
haoban-manage3-wx/pom.xml
View file @
cc03b90b
...
...
@@ -215,6 +215,12 @@
<artifactId>
haoban-app-aggregation-api
</artifactId>
<version>
${haoban-app-aggregation-api}
</version>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-store-goods-api
</artifactId>
<version>
${gic-store-goods-api}
</version>
</dependency>
</dependencies>
<build>
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/content/ContentMaterialController.java
View file @
cc03b90b
...
...
@@ -15,12 +15,11 @@ import com.gic.content.api.qdto.material.ContentMaterialShareQDTO;
import
com.gic.content.api.service.ContentColumnApiService
;
import
com.gic.content.api.service.ContentMaterialApiService
;
import
com.gic.content.api.service.ContentMaterialShareApiService
;
import
com.gic.haoban.app.aggregation.api.dto.GoodsSettingDTO
;
import
com.gic.haoban.app.aggregation.api.service.SettingApiService
;
import
com.gic.haoban.common.utils.EntityUtil
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.web.
qo.content.ContentMaterialBaseQO
;
import
com.gic.haoban.manage.web.
controller.goods.GoodsInfoAdaptor
;
import
com.gic.haoban.manage.web.qo.content.ContentColumnClerkViewQO
;
import
com.gic.haoban.manage.web.qo.content.ContentMaterialBaseQO
;
import
com.gic.haoban.manage.web.qo.content.ContentMaterialQO
;
import
com.gic.haoban.manage.web.qo.content.ContentMaterialShareQO
;
import
com.gic.haoban.manage.web.qo.goods.GoodsSimpleSearchQO
;
...
...
@@ -35,6 +34,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -62,7 +62,7 @@ public class ContentMaterialController {
@Autowired
private
StaffApiService
staffApiService
;
@Autowired
private
SettingApiService
settingApiService
;
private
GoodsInfoAdaptor
goodsInfoAdaptor
;
/**
...
...
@@ -102,7 +102,7 @@ public class ContentMaterialController {
log
.
info
(
"企业id未传 {}"
,
JSON
.
toJSONString
(
contentMaterialQO
));
return
RestResponse
.
failure
(
"-777"
,
"参数异常"
);
}
List
<
Integer
>
goodsShowStatus
=
this
.
getGoodsShowStatus
(
contentMaterialQO
);
List
<
Integer
>
goodsShowStatus
=
goodsInfoAdaptor
.
getGoodsShowStatus
(
contentMaterialQO
.
getEnterpriseId
()
);
ContentMaterialPageFrontQDTO
contentMaterialPageFrontQDTO
=
new
ContentMaterialPageFrontQDTO
();
contentMaterialPageFrontQDTO
.
setEnterpriseId
(
contentMaterialQO
.
getEnterpriseId
());
contentMaterialPageFrontQDTO
.
setKeyWord
(
contentMaterialQO
.
getSearch
());
...
...
@@ -121,6 +121,12 @@ public class ContentMaterialController {
}
else
{
contentMaterialPageFrontQDTO
.
setStoreIdList
(
Collections
.
singletonList
(
contentMaterialQO
.
getStoreId
()));
}
if
(
contentMaterialQO
.
getSearchType
()
!=
null
&&
contentMaterialQO
.
getSearchType
().
equals
(
1
))
{
if
(
StringUtils
.
isNotBlank
(
contentMaterialQO
.
getSearch
()))
{
List
<
String
>
goodsIds
=
goodsInfoAdaptor
.
queryGoodsIdWithSearch
(
contentMaterialQO
.
getEnterpriseId
(),
contentMaterialQO
.
getSearch
());
contentMaterialPageFrontQDTO
.
setGoodsIdList
(
goodsIds
);
}
}
BasePageInfo
pageInfo
=
new
BasePageInfo
();
pageInfo
.
setPageNum
(
contentMaterialQO
.
getPageNum
());
pageInfo
.
setPageSize
(
contentMaterialQO
.
getPageSize
());
...
...
@@ -132,68 +138,49 @@ public class ContentMaterialController {
Page
<
ContentMaterialInfoVO
>
result
=
new
Page
<>();
result
.
setTotalCount
(
responseResult
.
getTotalCount
());
List
<
ContentMaterialInfoVO
>
contentMaterialInfos
=
responseResult
.
getResult
().
stream
()
.
map
(
item
->
{
ContentMaterialInfoVO
contentMaterialInfoVO
=
new
ContentMaterialInfoVO
();
BeanUtils
.
copyProperties
(
item
,
contentMaterialInfoVO
);
if
(
CollectionUtils
.
isNotEmpty
(
item
.
getContentGoodsList
()))
{
List
<
SimpleGoodsInfoVO
>
goodsInfoVOS
=
item
.
getContentGoodsList
()
.
stream
()
.
filter
(
temp
->
goodsShowStatus
.
contains
(
temp
.
getStatus
()))
.
map
(
temp
->
{
SimpleGoodsInfoVO
simpleGoodsInfoVO
=
new
SimpleGoodsInfoVO
();
BeanUtils
.
copyProperties
(
temp
,
simpleGoodsInfoVO
);
simpleGoodsInfoVO
.
setGoodsImg
(
temp
.
getGoodsImageUrl
());
return
simpleGoodsInfoVO
;
}).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
goodsInfoVOS
))
{
contentMaterialInfoVO
.
setContentGoodsList
(
goodsInfoVOS
);
}
}
contentMaterialInfoVO
.
setPublishTime
(
item
.
getPublishBeginTime
());
if
(
StringUtils
.
isNotBlank
(
item
.
getMaterialImageUrls
()))
{
String
[]
split
=
StringUtils
.
split
(
item
.
getMaterialImageUrls
(),
","
);
List
<
String
>
imageUrls
=
Arrays
.
stream
(
split
).
collect
(
Collectors
.
toList
());
contentMaterialInfoVO
.
setMaterialImageUrls
(
imageUrls
);
}
if
(
StringUtils
.
isNotBlank
(
item
.
getMaterialThumbnailImageUrls
()))
{
String
[]
split
=
StringUtils
.
split
(
item
.
getMaterialThumbnailImageUrls
(),
","
);
List
<
String
>
imageUrls
=
Arrays
.
stream
(
split
).
collect
(
Collectors
.
toList
());
contentMaterialInfoVO
.
setMaterialThumbnailImageUrls
(
imageUrls
);
}
return
contentMaterialInfoVO
;
}).
collect
(
Collectors
.
toList
());
.
map
(
item
->
getContentMaterialInfoVO
(
goodsShowStatus
,
item
))
.
collect
(
Collectors
.
toList
());
result
.
setResult
(
contentMaterialInfos
);
result
.
setCurrentPage
(
contentMaterialQO
.
getPageNum
());
result
.
setPageSize
(
contentMaterialQO
.
getPageSize
());
return
RestResponse
.
successResult
(
result
);
}
private
List
<
Integer
>
getGoodsShowStatus
(
ContentMaterialQO
contentMaterialQO
)
{
GoodsSettingDTO
goodsSettingDTO
=
settingApiService
.
getSetting
(
contentMaterialQO
.
getEnterpriseId
());
List
<
Integer
>
showStatus
=
new
ArrayList
<>();
if
(
goodsSettingDTO
!=
null
)
{
int
salesGoodsFlag
=
goodsSettingDTO
.
getSalesGoodsFlag
();
int
notSalesGoodsFlag
=
goodsSettingDTO
.
getNotSalesGoodsFlag
();
if
(
salesGoodsFlag
==
1
&&
notSalesGoodsFlag
==
1
)
{
//已上架和未上架
showStatus
.
add
(
1
);
showStatus
.
add
(
2
);
}
else
if
(
salesGoodsFlag
==
1
)
{
//已上架
showStatus
.
add
(
1
);
}
else
if
(
notSalesGoodsFlag
==
1
)
{
//未上架
showStatus
.
add
(
2
);
}
else
{
//啥都未打开
showStatus
.
add
(-
99
);
/**
* 对象转换
* @param goodsShowStatus
* @param item
* @return
*/
private
ContentMaterialInfoVO
getContentMaterialInfoVO
(
List
<
Integer
>
goodsShowStatus
,
ContentMaterialFrontDTO
item
)
{
ContentMaterialInfoVO
contentMaterialInfoVO
=
new
ContentMaterialInfoVO
();
BeanUtils
.
copyProperties
(
item
,
contentMaterialInfoVO
);
if
(
CollectionUtils
.
isNotEmpty
(
item
.
getContentGoodsList
()))
{
List
<
SimpleGoodsInfoVO
>
goodsInfoVOS
=
item
.
getContentGoodsList
()
.
stream
()
.
filter
(
temp
->
goodsShowStatus
.
contains
(
temp
.
getStatus
()))
.
map
(
temp
->
{
SimpleGoodsInfoVO
simpleGoodsInfoVO
=
new
SimpleGoodsInfoVO
();
BeanUtils
.
copyProperties
(
temp
,
simpleGoodsInfoVO
);
simpleGoodsInfoVO
.
setGoodsImg
(
temp
.
getGoodsImageUrl
());
return
simpleGoodsInfoVO
;
}).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
goodsInfoVOS
))
{
contentMaterialInfoVO
.
setContentGoodsList
(
goodsInfoVOS
);
}
}
else
{
// 默认展示已上架和未上架的数据
showStatus
.
add
(
1
);
showStatus
.
add
(
2
);
}
return
showStatus
;
contentMaterialInfoVO
.
setPublishTime
(
item
.
getPublishBeginTime
());
if
(
StringUtils
.
isNotBlank
(
item
.
getMaterialImageUrls
()))
{
String
[]
split
=
StringUtils
.
split
(
item
.
getMaterialImageUrls
(),
","
);
List
<
String
>
imageUrls
=
Arrays
.
stream
(
split
).
collect
(
Collectors
.
toList
());
contentMaterialInfoVO
.
setMaterialImageUrls
(
imageUrls
);
}
if
(
StringUtils
.
isNotBlank
(
item
.
getMaterialThumbnailImageUrls
()))
{
String
[]
split
=
StringUtils
.
split
(
item
.
getMaterialThumbnailImageUrls
(),
","
);
List
<
String
>
imageUrls
=
Arrays
.
stream
(
split
).
collect
(
Collectors
.
toList
());
contentMaterialInfoVO
.
setMaterialThumbnailImageUrls
(
imageUrls
);
}
return
contentMaterialInfoVO
;
}
/**
...
...
@@ -205,20 +192,15 @@ public class ContentMaterialController {
@RequestMapping
(
path
=
"/share-content-material"
)
public
RestResponse
<
ContentMaterialShareInfoVO
>
shareContentMaterial
(
ContentMaterialShareQO
contentMaterialShareQO
)
{
if
(
StringUtils
.
isBlank
(
contentMaterialShareQO
.
getEnterpriseId
()))
{
return
RestResponse
.
failure
(
"-777"
,
"企业参数异常"
);
}
if
(
StringUtils
.
isBlank
(
contentMaterialShareQO
.
getGoodsId
())
)
{
if
(
contentMaterialShareQO
.
getContentMaterialId
()
==
null
)
{
// 无商品id 不生成参数
return
RestResponse
.
successResult
();
}
ContentMaterialShareQDTO
contentMaterialShareQDTO
=
new
ContentMaterialShareQDTO
();
contentMaterialShareQDTO
.
setEnterpriseId
(
contentMaterialShareQO
.
getEnterpriseId
());
contentMaterialShareQDTO
.
setGoodsId
(
contentMaterialShareQO
.
getGoodsId
());
contentMaterialShareQDTO
.
setContentMaterialId
(
contentMaterialShareQO
.
getContentMaterialId
());
contentMaterialShareQDTO
.
setClerkId
(
contentMaterialShareQO
.
getClerkId
());
contentMaterialShareQDTO
.
setStoreId
(
contentMaterialShareQO
.
getStoreId
());
BeanUtils
.
copyProperties
(
contentMaterialShareQO
,
contentMaterialShareQDTO
);
ServiceResponse
<
ContentMaterialShareInfoDTO
>
serviceResponse
=
contentMaterialShareApiService
.
shareContentMaterial
(
contentMaterialShareQDTO
);
if
(!
serviceResponse
.
isSuccess
())
{
return
RestResponse
.
failure
(
serviceResponse
.
getCode
(),
serviceResponse
.
getMessage
());
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/goods/GoodsInfoAdaptor.java
0 → 100644
View file @
cc03b90b
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
.
goods
;
import
com.gic.haoban.app.aggregation.api.dto.GoodsSettingDTO
;
import
com.gic.haoban.app.aggregation.api.service.SettingApiService
;
import
com.gic.haoban.manage.web.qo.content.ContentMaterialQO
;
import
com.gic.store.goods.service.GoodsInfoOutApiService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
/**
* @Author MUSI
* @Date 2023/3/16 10:19 PM
* @Description
* @Version
**/
@Component
public
class
GoodsInfoAdaptor
{
@Autowired
private
SettingApiService
settingApiService
;
@Autowired
private
GoodsInfoOutApiService
goodsInfoOutApiService
;
public
List
<
String
>
queryGoodsIdWithSearch
(
String
enterpriseId
,
String
search
)
{
// 根据关键字查询1000个商品
return
Collections
.
emptyList
();
}
/**
* 查询好办商品展示的商品状态
*
* @param enterpriseId
* @return
*/
public
List
<
Integer
>
getGoodsShowStatus
(
String
enterpriseId
)
{
if
(
StringUtils
.
isBlank
(
enterpriseId
))
{
return
Collections
.
emptyList
();
}
GoodsSettingDTO
goodsSettingDTO
=
settingApiService
.
getSetting
(
enterpriseId
);
List
<
Integer
>
showStatus
=
new
ArrayList
<>();
if
(
goodsSettingDTO
!=
null
)
{
int
salesGoodsFlag
=
goodsSettingDTO
.
getSalesGoodsFlag
();
int
notSalesGoodsFlag
=
goodsSettingDTO
.
getNotSalesGoodsFlag
();
if
(
salesGoodsFlag
==
1
&&
notSalesGoodsFlag
==
1
)
{
//已上架和未上架
showStatus
.
add
(
1
);
showStatus
.
add
(
2
);
}
else
if
(
salesGoodsFlag
==
1
)
{
//已上架
showStatus
.
add
(
1
);
}
else
if
(
notSalesGoodsFlag
==
1
)
{
//未上架
showStatus
.
add
(
2
);
}
else
{
//啥都未打开
showStatus
.
add
(-
99
);
}
}
else
{
// 默认展示已上架和未上架的数据
showStatus
.
add
(
1
);
showStatus
.
add
(
2
);
}
return
showStatus
;
}
}
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/qo/content/ContentMaterialQO.java
View file @
cc03b90b
...
...
@@ -52,9 +52,11 @@ public class ContentMaterialQO extends PageQo {
private
Long
contentColumnId
;
/**
* 商品id
* 搜索类型
* 0 搜索素材内容
* 1 搜索商品
*/
private
String
goodsId
;
private
Integer
searchType
;
public
Integer
getSortType
()
{
...
...
@@ -121,11 +123,11 @@ public class ContentMaterialQO extends PageQo {
this
.
materialType
=
materialType
;
}
public
String
getGoodsId
()
{
return
goodsId
;
public
Integer
getSearchType
()
{
return
searchType
;
}
public
void
set
GoodsId
(
String
goodsId
)
{
this
.
goodsId
=
goodsId
;
public
void
set
SearchType
(
Integer
searchType
)
{
this
.
searchType
=
searchType
;
}
}
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/qo/content/ContentMaterialShareQO.java
View file @
cc03b90b
...
...
@@ -18,11 +18,6 @@ public class ContentMaterialShareQO implements Serializable {
private
String
enterpriseId
;
/**
* 商品id
*/
private
String
goodsId
;
/**
* 商品货号
*/
private
String
goodsCode
;
...
...
@@ -47,6 +42,11 @@ public class ContentMaterialShareQO implements Serializable {
*/
private
String
storeCode
;
/**
* 1朋友圈; 2客户群; 3 对话框; 0其他
*/
private
String
channelSource
;
public
String
getEnterpriseId
()
{
return
enterpriseId
;
}
...
...
@@ -55,14 +55,6 @@ public class ContentMaterialShareQO implements Serializable {
this
.
enterpriseId
=
enterpriseId
;
}
public
String
getGoodsId
()
{
return
goodsId
;
}
public
void
setGoodsId
(
String
goodsId
)
{
this
.
goodsId
=
goodsId
;
}
public
Long
getContentMaterialId
()
{
return
contentMaterialId
;
}
...
...
@@ -102,4 +94,12 @@ public class ContentMaterialShareQO implements Serializable {
public
void
setGoodsCode
(
String
goodsCode
)
{
this
.
goodsCode
=
goodsCode
;
}
public
String
getChannelSource
()
{
return
channelSource
;
}
public
void
setChannelSource
(
String
channelSource
)
{
this
.
channelSource
=
channelSource
;
}
}
haoban-manage3-wx/src/main/webapp/WEB-INF/dubbo-haoban-manage-wx.xml
View file @
cc03b90b
...
...
@@ -125,5 +125,6 @@
<dubbo:reference
id=
"newDataTargetConfigApiService"
interface=
"com.gic.enterprise.api.service.target.NewDataTargetConfigApiService"
timeout=
"100000"
retries=
"0"
check=
"false"
/>
<dubbo:reference
interface=
"com.gic.store.goods.service.GoodsInfoOutApiService"
id=
"goodsInfoOutApiService"
timeout=
"100000"
retries=
"0"
check=
"false"
/>
</beans>
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