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
95f510a5
Commit
95f510a5
authored
Nov 09, 2022
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
群发+朋友圈
parent
9dfc1bd8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
151 additions
and
280 deletions
+151
-280
TabHaobanMaterialMapper.java
...an/manage/service/dao/mapper/TabHaobanMaterialMapper.java
+0
-9
MaterialService.java
...om/gic/haoban/manage/service/service/MaterialService.java
+2
-0
MaterialServiceImpl.java
...oban/manage/service/service/impl/MaterialServiceImpl.java
+132
-5
MaterialApiServiceImpl.java
...nage/service/service/out/impl/MaterialApiServiceImpl.java
+0
-1
MemberUnionidRelatedApiServiceImpl.java
.../service/out/impl/MemberUnionidRelatedApiServiceImpl.java
+16
-132
TabHaobanMaterialMapper.xml
...ice/src/main/resources/mapper/TabHaobanMaterialMapper.xml
+1
-133
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/TabHaobanMaterialMapper.java
View file @
95f510a5
...
@@ -7,22 +7,17 @@ import org.apache.ibatis.annotations.Param;
...
@@ -7,22 +7,17 @@ import org.apache.ibatis.annotations.Param;
import
java.util.List
;
import
java.util.List
;
public
interface
TabHaobanMaterialMapper
{
public
interface
TabHaobanMaterialMapper
{
int
deleteByPrimaryKey
(
String
materialId
);
int
insert
(
TabHaobanMaterial
record
);
int
insert
(
TabHaobanMaterial
record
);
int
batchInsert
(
@Param
(
"records"
)
List
<
TabHaobanMaterial
>
records
);
int
batchInsert
(
@Param
(
"records"
)
List
<
TabHaobanMaterial
>
records
);
int
insertSelective
(
TabHaobanMaterial
record
);
TabHaobanMaterial
selectByPrimaryKey
(
String
materialId
);
TabHaobanMaterial
selectByPrimaryKey
(
String
materialId
);
List
<
TabHaobanMaterial
>
listByids
(
@Param
(
"materialIds"
)
List
<
String
>
materialIds
);
List
<
TabHaobanMaterial
>
listByids
(
@Param
(
"materialIds"
)
List
<
String
>
materialIds
);
int
updateByPrimaryKeySelective
(
TabHaobanMaterial
record
);
int
updateByPrimaryKeySelective
(
TabHaobanMaterial
record
);
int
updateByPrimaryKey
(
TabHaobanMaterial
record
);
List
<
TabHaobanMaterial
>
listMaterialByCategoryId
(
String
categoryId
);
List
<
TabHaobanMaterial
>
listMaterialByCategoryId
(
String
categoryId
);
Page
<
TabHaobanMaterial
>
listMaterial
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"keyword"
)
String
keyword
,
@Param
(
"categoryId"
)
String
categoryId
,
@Param
(
"materialType"
)
Integer
materialType
);
Page
<
TabHaobanMaterial
>
listMaterial
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"keyword"
)
String
keyword
,
@Param
(
"categoryId"
)
String
categoryId
,
@Param
(
"materialType"
)
Integer
materialType
);
...
@@ -35,9 +30,6 @@ public interface TabHaobanMaterialMapper {
...
@@ -35,9 +30,6 @@ public interface TabHaobanMaterialMapper {
/**
/**
* 删除
* 删除
*
* @param ids
* @return
*/
*/
int
delMaterialByIds
(
@Param
(
"ids"
)
List
<
String
>
ids
);
int
delMaterialByIds
(
@Param
(
"ids"
)
List
<
String
>
ids
);
}
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/MaterialService.java
View file @
95f510a5
...
@@ -49,5 +49,7 @@ public interface MaterialService {
...
@@ -49,5 +49,7 @@ public interface MaterialService {
* @param ids
* @param ids
*/
*/
void
delmaterialByIds
(
List
<
String
>
ids
);
void
delmaterialByIds
(
List
<
String
>
ids
);
public
MaterialDTO
getHasChangeMadieMaterialById
(
String
materialId
,
int
from
)
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/MaterialServiceImpl.java
View file @
95f510a5
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
impl
;
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
impl
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.slf4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.gic.api.base.commons.JSONResponse
;
import
com.gic.haoban.common.utils.EntityUtil
;
import
com.gic.haoban.common.utils.EntityUtil
;
import
com.gic.haoban.common.utils.StringUtil
;
import
com.gic.haoban.common.utils.StringUtil
;
import
com.gic.haoban.manage.api.dto.MaterialDTO
;
import
com.gic.haoban.manage.api.dto.MaterialDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanMaterialMapper
;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanMaterialMapper
;
import
com.gic.haoban.manage.service.dao.mapper.TabMaterialContentMapper
;
import
com.gic.haoban.manage.service.entity.TabHaobanMaterial
;
import
com.gic.haoban.manage.service.entity.TabHaobanMaterial
;
import
com.gic.haoban.manage.service.entity.TabMaterialContent
;
import
com.gic.haoban.manage.service.service.MaterialService
;
import
com.gic.haoban.manage.service.service.MaterialService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.haoban.manage.service.util.CommonUtil
;
import
com.gic.wechat.api.enums.QywxMediaTypeEnum
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.Page
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
@Service
@Service
public
class
MaterialServiceImpl
implements
MaterialService
{
public
class
MaterialServiceImpl
implements
MaterialService
{
private
static
final
Logger
logger
=
getLogger
(
MaterialService
.
class
);
@Autowired
@Autowired
private
TabHaobanMaterialMapper
mapper
;
private
TabHaobanMaterialMapper
mapper
;
@Autowired
private
TabMaterialContentMapper
materialContentMapper
;
@Autowired
private
WxEnterpriseService
wxEnterpriseService
;
@Autowired
private
QywxSuiteApiService
qywxSuiteApiService
;
@Autowired
private
Config
config
;
@Override
@Override
public
List
<
MaterialDTO
>
listMaterialByCategoryId
(
String
categoryId
)
{
public
List
<
MaterialDTO
>
listMaterialByCategoryId
(
String
categoryId
)
{
...
@@ -82,4 +108,105 @@ public class MaterialServiceImpl implements MaterialService {
...
@@ -82,4 +108,105 @@ public class MaterialServiceImpl implements MaterialService {
public
void
delmaterialByIds
(
List
<
String
>
ids
)
{
public
void
delmaterialByIds
(
List
<
String
>
ids
)
{
mapper
.
delMaterialByIds
(
ids
);
mapper
.
delMaterialByIds
(
ids
);
}
}
@Override
public
MaterialDTO
getHasChangeMadieMaterialById
(
String
materialId
,
int
from
)
{
MaterialDTO
materialDTO
=
null
;
TabMaterialContent
entity
=
null
;
if
(
from
==
1
)
{
materialDTO
=
this
.
selectMaterialById
(
materialId
);
}
if
(
from
==
2
)
{
entity
=
this
.
materialContentMapper
.
selectById
(
materialId
)
;
if
(
null
!=
entity
)
{
materialDTO
=
EntityUtil
.
changeEntityByJSON
(
MaterialDTO
.
class
,
entity
)
;
}
}
if
(
null
==
materialDTO
)
{
return
null
;
}
Date
lastUploadTime
=
materialDTO
.
getWxLastUploadTime
();
Date
date
=
new
Date
();
Date
compareDate
=
DateUtils
.
addDays
(
date
,
-
3
);
if
(
lastUploadTime
!=
null
&&
lastUploadTime
.
after
(
compareDate
)
&&
StringUtils
.
isNotBlank
(
materialDTO
.
getMediaId
()))
{
return
materialDTO
;
}
Integer
materialType
=
materialDTO
.
getMaterialType
();
String
madiaId
=
materialDTO
.
getMediaId
();
//需要上传的类型
List
<
Integer
>
typeList
=
Arrays
.
asList
(
2
,
4
,
5
,
6
);
if
(
typeList
.
contains
(
materialType
))
{
madiaId
=
this
.
reUpdalodMetail
(
materialId
,
from
);
}
materialDTO
.
setMediaId
(
madiaId
);
materialDTO
.
setWxLastUploadTime
(
date
);
return
materialDTO
;
}
private
String
reUpdalodMetail
(
String
materialId
,
int
from
)
{
MaterialDTO
old
=
null
;
TabMaterialContent
entity
=
null
;
if
(
from
==
1
)
{
old
=
this
.
selectMaterialById
(
materialId
);
}
if
(
from
==
2
)
{
entity
=
this
.
materialContentMapper
.
selectById
(
materialId
)
;
if
(
null
!=
entity
)
{
old
=
EntityUtil
.
changeEntityByJSON
(
MaterialDTO
.
class
,
entity
)
;
}
}
Integer
type
=
old
.
getMaterialType
();
if
(
type
==
null
)
{
return
""
;
}
String
wxEnterpriseId
=
old
.
getWxEnterpriseId
();
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
qwDTO
==
null
)
{
logger
.
info
(
"qwDTO is null"
);
return
""
;
}
String
url
=
""
;
QywxMediaTypeEnum
fileType
=
null
;
if
(
type
==
2
)
{
fileType
=
QywxMediaTypeEnum
.
IMAGE
;
url
=
old
.
getImgUrl
();
}
if
(
type
==
4
)
{
fileType
=
QywxMediaTypeEnum
.
VIDEO
;
url
=
old
.
getLink
();
}
if
(
type
==
5
)
{
fileType
=
QywxMediaTypeEnum
.
FILE
;
url
=
old
.
getLink
();
}
else
if
(
type
==
6
)
{
fileType
=
QywxMediaTypeEnum
.
IMAGE
;
url
=
old
.
getImgUrl
();
}
if
(
fileType
==
null
)
{
logger
.
error
(
"materialId无类型,materialId:{}"
,
materialId
);
return
""
;
}
String
[]
arr
=
url
.
split
(
"/"
);
int
count
=
arr
.
length
;
JSONResponse
jp
=
null
;
if
(
from
==
2
&&
entity
.
getMediaType
()==
2
)
{
jp
=
qywxSuiteApiService
.
uploadAttachment
(
qwDTO
.
getThirdCorpid
(),
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
url
),
arr
[
count
-
1
],
fileType
.
getCode
());
}
else
{
jp
=
qywxSuiteApiService
.
uploadMedia
(
qwDTO
.
getThirdCorpid
(),
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
url
),
arr
[
count
-
1
],
fileType
.
getCode
());
}
if
(
jp
.
getErrorCode
()
==
0
)
{
if
(
from
==
1
)
{
old
.
setWxLastUploadTime
(
new
Date
());
old
.
setMediaId
(
jp
.
getResult
().
toString
());
this
.
edit
(
old
);
}
if
(
from
==
2
)
{
entity
.
setWxLastUploadTime
(
new
Date
());
entity
.
setMediaId
(
jp
.
getResult
().
toString
());
this
.
materialContentMapper
.
updateByPrimaryKey
(
entity
)
;
}
}
return
old
.
getMediaId
();
}
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MaterialApiServiceImpl.java
View file @
95f510a5
...
@@ -27,7 +27,6 @@ import com.gic.haoban.common.utils.StringUtil;
...
@@ -27,7 +27,6 @@ import com.gic.haoban.common.utils.StringUtil;
import
com.gic.haoban.manage.api.dto.BatchAddMaterialDTO
;
import
com.gic.haoban.manage.api.dto.BatchAddMaterialDTO
;
import
com.gic.haoban.manage.api.dto.MaterialCategoryDTO
;
import
com.gic.haoban.manage.api.dto.MaterialCategoryDTO
;
import
com.gic.haoban.manage.api.dto.MaterialDTO
;
import
com.gic.haoban.manage.api.dto.MaterialDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO
;
import
com.gic.haoban.manage.api.service.MaterialApiService
;
import
com.gic.haoban.manage.api.service.MaterialApiService
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.config.Config
;
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MemberUnionidRelatedApiServiceImpl.java
View file @
95f510a5
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -30,7 +30,6 @@ import com.gic.api.base.commons.JSONResponse;
...
@@ -30,7 +30,6 @@ import com.gic.api.base.commons.JSONResponse;
import
com.gic.api.base.dto.SubscribeMessageDTO
;
import
com.gic.api.base.dto.SubscribeMessageDTO
;
import
com.gic.clerk.api.dto.ClerkDTO
;
import
com.gic.clerk.api.dto.ClerkDTO
;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.commons.util.DateUtil
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.GICMQClientUtil
;
import
com.gic.commons.util.GICMQClientUtil
;
import
com.gic.dubbo.entity.ProviderLocalTag
;
import
com.gic.dubbo.entity.ProviderLocalTag
;
...
@@ -50,7 +49,6 @@ import com.gic.haoban.manage.api.constants.Manage3Constants;
...
@@ -50,7 +49,6 @@ import com.gic.haoban.manage.api.constants.Manage3Constants;
import
com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO
;
import
com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO
;
import
com.gic.haoban.manage.api.dto.ExternalUserDTO
;
import
com.gic.haoban.manage.api.dto.ExternalUserDTO
;
import
com.gic.haoban.manage.api.dto.FriendStoreInfoDTO
;
import
com.gic.haoban.manage.api.dto.FriendStoreInfoDTO
;
import
com.gic.haoban.manage.api.dto.MaterialDTO
;
import
com.gic.haoban.manage.api.dto.MemberStoreDTO
;
import
com.gic.haoban.manage.api.dto.MemberStoreDTO
;
import
com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO
;
import
com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO
;
import
com.gic.haoban.manage.api.dto.MemberUnionidWechatAccountQDTO
;
import
com.gic.haoban.manage.api.dto.MemberUnionidWechatAccountQDTO
;
...
@@ -67,7 +65,6 @@ import com.gic.haoban.manage.api.enums.WelcomeMediaTypeEnum;
...
@@ -67,7 +65,6 @@ import com.gic.haoban.manage.api.enums.WelcomeMediaTypeEnum;
import
com.gic.haoban.manage.api.enums.hm.HmWelcomeReferType
;
import
com.gic.haoban.manage.api.enums.hm.HmWelcomeReferType
;
import
com.gic.haoban.manage.api.service.CheckQywxSettingApiService
;
import
com.gic.haoban.manage.api.service.CheckQywxSettingApiService
;
import
com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService
;
import
com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService
;
import
com.gic.haoban.manage.api.service.MaterialApiService
;
import
com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService
;
import
com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService
;
import
com.gic.haoban.manage.api.service.hm.HmClerkRelationApiService
;
import
com.gic.haoban.manage.api.service.hm.HmClerkRelationApiService
;
import
com.gic.haoban.manage.api.service.hm.HmQrcodeApiService
;
import
com.gic.haoban.manage.api.service.hm.HmQrcodeApiService
;
...
@@ -96,6 +93,7 @@ import com.gic.haoban.manage.service.service.ExternalClerkRelatedService;
...
@@ -96,6 +93,7 @@ import com.gic.haoban.manage.service.service.ExternalClerkRelatedService;
import
com.gic.haoban.manage.service.service.KeyDataService
;
import
com.gic.haoban.manage.service.service.KeyDataService
;
import
com.gic.haoban.manage.service.service.MemberUnionRelatedService
;
import
com.gic.haoban.manage.service.service.MemberUnionRelatedService
;
import
com.gic.haoban.manage.service.service.MiniprogramSettingService
;
import
com.gic.haoban.manage.service.service.MiniprogramSettingService
;
import
com.gic.haoban.manage.service.service.QywxSendService
;
import
com.gic.haoban.manage.service.service.SecretSettingService
;
import
com.gic.haoban.manage.service.service.SecretSettingService
;
import
com.gic.haoban.manage.service.service.StaffClerkRelationService
;
import
com.gic.haoban.manage.service.service.StaffClerkRelationService
;
import
com.gic.haoban.manage.service.service.StaffService
;
import
com.gic.haoban.manage.service.service.StaffService
;
...
@@ -119,12 +117,6 @@ import com.gic.member.tag.api.dto.outapi.MemberTagSingleDTO;
...
@@ -119,12 +117,6 @@ import com.gic.member.tag.api.dto.outapi.MemberTagSingleDTO;
import
com.gic.member.tag.api.service.MemberTagOpenApiService
;
import
com.gic.member.tag.api.service.MemberTagOpenApiService
;
import
com.gic.mq.sdk.GicMQClient
;
import
com.gic.mq.sdk.GicMQClient
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.wechat.api.dto.qywx.QywxExternalMessageDTO
;
import
com.gic.wechat.api.dto.qywx.QywxImageMaterialDTO
;
import
com.gic.wechat.api.dto.qywx.QywxLinkMaterialDTO
;
import
com.gic.wechat.api.dto.qywx.QywxMessageMaterialDTO
;
import
com.gic.wechat.api.dto.qywx.QywxMiniprogramMaterialDTO
;
import
com.gic.wechat.api.dto.qywx.QywxVideoMaterialDTO
;
import
com.gic.wechat.api.dto.qywx.UnionidToExternalUseridDTO
;
import
com.gic.wechat.api.dto.qywx.UnionidToExternalUseridDTO
;
import
com.gic.wechat.api.dto.qywx.welcome.QywxExternalMessageBaseDTO
;
import
com.gic.wechat.api.dto.qywx.welcome.QywxExternalMessageBaseDTO
;
import
com.gic.wechat.api.dto.qywx.welcome.QywxFileExternalBaseDTO
;
import
com.gic.wechat.api.dto.qywx.welcome.QywxFileExternalBaseDTO
;
...
@@ -173,8 +165,6 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -173,8 +165,6 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
@Autowired
@Autowired
private
QywxSuiteApiService
qywxSuiteApiService
;
private
QywxSuiteApiService
qywxSuiteApiService
;
@Autowired
@Autowired
private
MaterialApiService
materialApiService
;
@Autowired
private
SecretSettingService
secretSettingService
;
private
SecretSettingService
secretSettingService
;
@Autowired
@Autowired
private
StaffClerkRelationService
staffClerkRelationService
;
private
StaffClerkRelationService
staffClerkRelationService
;
...
@@ -218,6 +208,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -218,6 +208,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
private
StaffMapper
staffMapper
;
private
StaffMapper
staffMapper
;
@Autowired
@Autowired
private
MemberEntranceApiService
memberEntranceApiService
;
private
MemberEntranceApiService
memberEntranceApiService
;
@Autowired
private
QywxSendService
qywxSendService
;
@Override
@Override
...
@@ -1228,32 +1220,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -1228,32 +1220,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
}
/**
/**
* 老的单个素材群发的api
*
* @param wxEnterpriseId : 微信企业id
* @param userId : 用户id
* @param extendUserList : 发送的用户id
* @param materialId : 素材id
* @return : 返回群发执行结果
*/
@Override
public
String
sendMessage
(
String
wxEnterpriseId
,
String
staffId
,
List
<
String
>
extendUserList
,
String
materialId
)
{
JSONResponse
jp
=
this
.
sendMessage
(
wxEnterpriseId
,
staffId
,
extendUserList
,
Collections
.
singletonList
(
materialId
));
//返回执行结果, msgId
log
.
info
(
"【发送消息】jp = {}"
,
JSON
.
toJSONString
(
jp
));
Map
<
String
,
Object
>
returnMap
=
jp
.
getReturnMap
();
return
returnMap
.
get
(
"msgid"
)
==
null
?
""
:
returnMap
.
get
(
"msgid"
).
toString
();
}
@Override
public
JSONResponse
sendMessage
(
String
wxEnterpriseId
,
String
staffId
,
List
<
String
>
extendUserList
,
List
<
String
>
materialIdList
,
String
ecmPlanId
)
{
return
this
.
sendMessage
(
wxEnterpriseId
,
staffId
,
extendUserList
,
materialIdList
);
}
/**
* 创建企业群发, 支出素材批量发送
* 创建企业群发, 支出素材批量发送
*
* @param wxEnterpriseId : 微信企业id
* @param wxEnterpriseId : 微信企业id
* @param userId : 用户id
* @param userId : 用户id
* @param extendUserList : 发送的用户id
* @param extendUserList : 发送的用户id
...
@@ -1261,102 +1228,19 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -1261,102 +1228,19 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
* @return : 返回群发执行结果
* @return : 返回群发执行结果
*/
*/
@Override
@Override
public
JSONResponse
sendMessage
(
String
wxEnterpriseId
,
String
staffId
,
List
<
String
>
extendUserList
,
List
<
String
>
materialIdList
)
{
public
JSONResponse
sendMessage
(
String
wxEnterpriseId
,
String
staffId
,
List
<
String
>
extendUserList
,
List
<
String
>
materialIdList
,
String
planId
)
{
//群发请求参数
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
<
String
>
resp
=
this
.
qywxSendService
.
sendMessage
(
wxEnterpriseId
,
staffId
,
extendUserList
,
materialIdList
)
;
QywxExternalMessageDTO
qywxExternalMessageDTO
=
new
QywxExternalMessageDTO
();
JSONResponse
json
=
new
JSONResponse
();
//素材列表
if
(
resp
.
isSuccess
())
{
List
<
QywxMessageMaterialDTO
>
messageMaterialList
=
new
ArrayList
<>();
json
.
setErrorCode
(-
1
);
materialIdList
.
forEach
(
materialId
->
{
json
.
setErrorMessage
(
resp
.
getMessage
());
MaterialDTO
material
=
materialApiService
.
getHasChangeMadieMaterialById
(
materialId
);
}
else
{
if
(
material
==
null
)
{
json
.
setSuccess
(
true
);
return
;
json
.
setErrorCode
(
1
);
}
Map
<
String
,
Object
>
returnMap
=
new
HashMap
<
String
,
Object
>();
if
(
material
.
getMaterialType
()
==
1
)
{
returnMap
.
put
(
"msgid"
,
resp
.
getResult
());
qywxExternalMessageDTO
.
setContent
(
material
.
getMaterialContent
());
}
else
{
messageMaterialList
.
add
(
this
.
getMessageMaterial
(
material
));
}
});
//素材列表不存在, 并且不存在文本内容, 不执行
if
(
messageMaterialList
.
isEmpty
()
&&
StringUtils
.
isBlank
(
qywxExternalMessageDTO
.
getContent
()))
{
JSONResponse
jp
=
new
JSONResponse
();
jp
.
setErrorCode
(-
1
);
jp
.
setErrorMessage
(
"群发素材不存在, 群发创建失败"
);
return
jp
;
}
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
);
//请求参数赋值
qywxExternalMessageDTO
.
setChatType
(
"single"
);
qywxExternalMessageDTO
.
setExternalUserid
(
extendUserList
);
TabHaobanStaff
tabHaobanStaff
=
staffService
.
selectById
(
staffId
);
if
(
null
==
tabHaobanStaff
)
{
log
.
info
(
"staff不存在,staffId={}"
,
staffId
);
JSONResponse
jp
=
new
JSONResponse
();
jp
.
setErrorCode
(-
1
);
jp
.
setErrorMessage
(
"群发失败,成员查不到,"
+
staffId
);
return
jp
;
}
if
(
qwDTO
.
needOpenUserId3th
())
{
qywxExternalMessageDTO
.
setSenderUserId
(
tabHaobanStaff
.
getWxOpenUseId
());
}
else
{
qywxExternalMessageDTO
.
setSenderUserId
(
tabHaobanStaff
.
getWxUserId
());
}
qywxExternalMessageDTO
.
setAttachments
(
messageMaterialList
);
//调接口执行创建群发
return
qywxSuiteApiService
.
sendExternalMessage
(
qwDTO
.
getThirdCorpid
(),
config
.
getWxSuiteid
(),
qywxExternalMessageDTO
);
}
/**
* 素材发送对象构造
*
* @param material : 素材对象
* @return : 返回素材发送对象
*/
private
QywxMessageMaterialDTO
getMessageMaterial
(
MaterialDTO
material
)
{
//素材类型
Integer
materialType
=
material
.
getMaterialType
();
//主键id
String
materialId
=
material
.
getMaterialId
();
//企微对应的id
String
maerialId
=
material
.
getMediaId
();
//判断素材企微id是否需要刷新
List
<
Integer
>
materialTypeList
=
Arrays
.
asList
(
2
,
4
,
6
);
if
(
materialTypeList
.
contains
(
materialType
))
{
Date
wxLastTime
=
material
.
getWxLastUploadTime
();
if
(
DateUtil
.
addDay
(
wxLastTime
,
3
).
getTime
()
<
System
.
currentTimeMillis
())
{
maerialId
=
materialApiService
.
reUpdalodMetail
(
materialId
);
}
}
//素材对象
QywxMessageMaterialDTO
dto
=
new
QywxMessageMaterialDTO
();
if
(
materialType
==
2
)
{
QywxImageMaterialDTO
imageMaterialDTO
=
new
QywxImageMaterialDTO
();
imageMaterialDTO
.
setMediaId
(
maerialId
);
dto
.
setMsgType
(
QywxMediaTypeEnum
.
IMAGE
.
getName
());
dto
.
setImage
(
imageMaterialDTO
);
}
else
if
(
materialType
==
3
)
{
QywxLinkMaterialDTO
linkMaterialDTO
=
new
QywxLinkMaterialDTO
();
linkMaterialDTO
.
setTitle
(
material
.
getMaterialTitle
());
linkMaterialDTO
.
setPicUrl
(
material
.
getWxImgUrl
());
linkMaterialDTO
.
setDesc
(
material
.
getMaterialDesc
());
linkMaterialDTO
.
setUrl
(
material
.
getLink
());
dto
.
setMsgType
(
QywxMediaTypeEnum
.
LINK
.
getName
());
dto
.
setLink
(
linkMaterialDTO
);
}
else
if
(
materialType
==
4
)
{
QywxVideoMaterialDTO
videoMaterialDTO
=
new
QywxVideoMaterialDTO
();
videoMaterialDTO
.
setMediaId
(
maerialId
);
dto
.
setMsgType
(
QywxMediaTypeEnum
.
VIDEO
.
getName
());
dto
.
setVideo
(
videoMaterialDTO
);
}
else
if
(
materialType
==
6
)
{
QywxMiniprogramMaterialDTO
miniprogramMaterialDTO
=
new
QywxMiniprogramMaterialDTO
();
miniprogramMaterialDTO
.
setTitle
(
material
.
getMaterialTitle
());
miniprogramMaterialDTO
.
setPicMediaId
(
maerialId
);
miniprogramMaterialDTO
.
setAppid
(
material
.
getAppId
());
miniprogramMaterialDTO
.
setPage
(
material
.
getLink
());
dto
.
setMsgType
(
QywxMediaTypeEnum
.
MINIPROGRAM
.
getName
());
dto
.
setMiniprogram
(
miniprogramMaterialDTO
);
}
}
return
dto
;
return
json
;
}
}
/**
/**
...
...
haoban-manage3-service/src/main/resources/mapper/TabHaobanMaterialMapper.xml
View file @
95f510a5
...
@@ -44,10 +44,6 @@
...
@@ -44,10 +44,6 @@
</foreach>
</foreach>
</select>
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.String"
>
delete from tab_haoban_material
where material_id = #{materialId,jdbcType=VARCHAR}
</delete>
<insert
id=
"insert"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanMaterial"
>
<insert
id=
"insert"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanMaterial"
>
insert into tab_haoban_material (material_id, from_material_id, material_title, material_type,
insert into tab_haoban_material (material_id, from_material_id, material_title, material_type,
category_id, material_content, wx_last_upload_time,
category_id, material_content, wx_last_upload_time,
...
@@ -64,115 +60,7 @@
...
@@ -64,115 +60,7 @@
#{createTime,jdbcType=TIMESTAMP},
#{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
#{updateTime,jdbcType=TIMESTAMP})
</insert>
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanMaterial"
>
insert into tab_haoban_material
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"materialId != null"
>
material_id,
</if>
<if
test=
"materialTitle != null"
>
material_title,
</if>
<if
test=
"materialType != null"
>
material_type,
</if>
<if
test=
"categoryId != null"
>
category_id,
</if>
<if
test=
"materialContent != null"
>
material_content,
</if>
<if
test=
"wxLastUploadTime != null"
>
wx_last_upload_time,
</if>
<if
test=
"mediaId != null"
>
media_id,
</if>
<if
test=
"wxEnterpriseId != null"
>
wx_enterprise_id,
</if>
<if
test=
"staffId != null"
>
staff_id,
</if>
<if
test=
"staffName != null"
>
staff_name,
</if>
<if
test=
"imgUrl != null"
>
img_url,
</if>
<if
test=
"wxImgUrl != null"
>
wx_img_url,
</if>
<if
test=
"materialDesc != null"
>
material_desc,
</if>
<if
test=
"statusFlag != null"
>
status_flag,
</if>
<if
test=
"link != null"
>
link,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"materialId != null"
>
#{materialId,jdbcType=VARCHAR},
</if>
<if
test=
"materialTitle != null"
>
#{materialTitle,jdbcType=VARCHAR},
</if>
<if
test=
"materialType != null"
>
#{materialType,jdbcType=INTEGER},
</if>
<if
test=
"categoryId != null"
>
#{categoryId,jdbcType=VARCHAR},
</if>
<if
test=
"materialContent != null"
>
#{materialContent,jdbcType=VARCHAR},
</if>
<if
test=
"wxLastUploadTime != null"
>
#{wxLastUploadTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"mediaId != null"
>
#{mediaId,jdbcType=VARCHAR},
</if>
<if
test=
"wxEnterpriseId != null"
>
#{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if
test=
"staffId != null"
>
#{staffId,jdbcType=VARCHAR},
</if>
<if
test=
"staffName != null"
>
#{staffName,jdbcType=VARCHAR},
</if>
<if
test=
"imgUrl != null"
>
#{imgUrl,jdbcType=VARCHAR},
</if>
<if
test=
"wxImgUrl != null"
>
#{wxImgUrl,jdbcType=VARCHAR},
</if>
<if
test=
"materialDesc != null"
>
#{materialDesc,jdbcType=VARCHAR},
</if>
<if
test=
"statusFlag != null"
>
#{statusFlag,jdbcType=INTEGER},
</if>
<if
test=
"link != null"
>
#{link,jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<insert
id=
"batchInsert"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanMaterial"
>
<insert
id=
"batchInsert"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanMaterial"
>
insert into tab_haoban_material
insert into tab_haoban_material
...
@@ -280,26 +168,6 @@
...
@@ -280,26 +168,6 @@
</set>
</set>
where material_id = #{materialId,jdbcType=VARCHAR}
where material_id = #{materialId,jdbcType=VARCHAR}
</update>
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanMaterial"
>
update tab_haoban_material
set material_title = #{materialTitle,jdbcType=VARCHAR},
material_type = #{materialType,jdbcType=INTEGER},
category_id = #{categoryId,jdbcType=VARCHAR},
material_content = #{materialContent,jdbcType=VARCHAR},
wx_last_upload_time = #{wxLastUploadTime,jdbcType=TIMESTAMP},
media_id = #{mediaId,jdbcType=VARCHAR},
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
staff_id = #{staffId,jdbcType=VARCHAR},
staff_name = #{staffName,jdbcType=VARCHAR},
img_url = #{imgUrl,jdbcType=VARCHAR},
wx_img_url = #{wxImgUrl,jdbcType=VARCHAR},
material_desc = #{materialDesc,jdbcType=VARCHAR},
status_flag = #{statusFlag,jdbcType=INTEGER},
link = #{link,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where material_id = #{materialId,jdbcType=VARCHAR}
</update>
<select
id=
"listMaterialByCategoryId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
<select
id=
"listMaterialByCategoryId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
select
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment