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
Expand all
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;
import
java.util.List
;
public
interface
TabHaobanMaterialMapper
{
int
deleteByPrimaryKey
(
String
materialId
);
int
insert
(
TabHaobanMaterial
record
);
int
batchInsert
(
@Param
(
"records"
)
List
<
TabHaobanMaterial
>
records
);
int
insertSelective
(
TabHaobanMaterial
record
);
TabHaobanMaterial
selectByPrimaryKey
(
String
materialId
);
List
<
TabHaobanMaterial
>
listByids
(
@Param
(
"materialIds"
)
List
<
String
>
materialIds
);
int
updateByPrimaryKeySelective
(
TabHaobanMaterial
record
);
int
updateByPrimaryKey
(
TabHaobanMaterial
record
);
List
<
TabHaobanMaterial
>
listMaterialByCategoryId
(
String
categoryId
);
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 {
/**
* 删除
*
* @param ids
* @return
*/
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 {
* @param 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
;
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.StringUtil
;
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.TabMaterialContentMapper
;
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.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
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
@Service
public
class
MaterialServiceImpl
implements
MaterialService
{
private
static
final
Logger
logger
=
getLogger
(
MaterialService
.
class
);
@Autowired
private
TabHaobanMaterialMapper
mapper
;
@Autowired
private
TabMaterialContentMapper
materialContentMapper
;
@Autowired
private
WxEnterpriseService
wxEnterpriseService
;
@Autowired
private
QywxSuiteApiService
qywxSuiteApiService
;
@Autowired
private
Config
config
;
@Override
public
List
<
MaterialDTO
>
listMaterialByCategoryId
(
String
categoryId
)
{
...
...
@@ -82,4 +108,105 @@ public class MaterialServiceImpl implements MaterialService {
public
void
delmaterialByIds
(
List
<
String
>
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;
import
com.gic.haoban.manage.api.dto.BatchAddMaterialDTO
;
import
com.gic.haoban.manage.api.dto.MaterialCategoryDTO
;
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.service.MaterialApiService
;
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
This diff is collapsed.
Click to expand it.
haoban-manage3-service/src/main/resources/mapper/TabHaobanMaterialMapper.xml
View file @
95f510a5
...
...
@@ -44,10 +44,6 @@
</foreach>
</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 into tab_haoban_material (material_id, from_material_id, material_title, material_type,
category_id, material_content, wx_last_upload_time,
...
...
@@ -64,115 +60,7 @@
#{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</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 into tab_haoban_material
...
...
@@ -280,26 +168,6 @@
</set>
where material_id = #{materialId,jdbcType=VARCHAR}
</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
...
...
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