Commit 406718b1 by 王祖波

内容模板、消息

parent 1595a409
......@@ -9,8 +9,16 @@ public class NotifyMessageBatchQDTO extends NoticeMessageQDTO{
private static final long serialVersionUID = 1L;
/**
* 门店id列表
*/
private List<String> storeIdList;
/**
* 优先使用导购id
*/
private List<String> clerkIdList;
public List<String> getStoreIdList() {
return storeIdList;
}
......@@ -18,5 +26,13 @@ public class NotifyMessageBatchQDTO extends NoticeMessageQDTO{
public void setStoreIdList(List<String> storeIdList) {
this.storeIdList = storeIdList;
}
public List<String> getClerkIdList() {
return clerkIdList;
}
public void setClerkIdList(List<String> clerkIdList) {
this.clerkIdList = clerkIdList;
}
}
......@@ -14,6 +14,7 @@ public enum NoticeMessageCategoryTypeEnum {
REFUND(5, "售后相关"),
MATERIAL(6, "素材相关"),
POTENTIAL_CUSTOMER(7, "销售线索"),
AUTHORIZED(8, "授权登陆"),
OTHER(3, "其它"),;
private int type;
private String name;
......
......@@ -86,7 +86,10 @@ public enum NoticeMessageTypeEnum {
CASH_APPLY_FAIL_NOTIFY(7002,"提现通知", NoticeMessageCategoryTypeEnum.OTHER.getType(),"cash_apply_fail_notify","/pages/route/index?pageType=","hbapp_withdraw_list","cashApplyFailNotify","haobanNotice"),
CASH_APPLY_OFFLINE_SUCCESS_NOTIFY(7003,"提现通知", NoticeMessageCategoryTypeEnum.OTHER.getType(),"cash_apply_offline_success_notify","/pages/route/index?pageType=","hbapp_withdraw_list","cashApplyOfflineSuccessNotify","haobanNotice");
CASH_APPLY_OFFLINE_SUCCESS_NOTIFY(7003,"提现通知", NoticeMessageCategoryTypeEnum.OTHER.getType(),"cash_apply_offline_success_notify","/pages/route/index?pageType=","hbapp_withdraw_list","cashApplyOfflineSuccessNotify","haobanNotice"),
AUTHORIZED_LOGIN_NOTIFY(8001,"账号授权通知", NoticeMessageCategoryTypeEnum.AUTHORIZED.getType(),"authorized_login_notify","/pages/route/index?pageType=","hbapp_video_auth","authorizedLoginNotify","haobanNotice");
/**
* 消息类型
*/
......
......@@ -294,20 +294,25 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
logger.info("消息中心测试通知消息:{}", JSONObject.toJSONString(notifyMessageBatchQDTO));
String enterpriseId = notifyMessageBatchQDTO.getEnterpriseId();
List<String> storeIdList = notifyMessageBatchQDTO.getStoreIdList();
if (CollectionUtils.isEmpty(storeIdList)) {
logger.info("门店列表为空");
return ServiceResponse.success();
}
List<String> clerkIdList = notifyMessageBatchQDTO.getClerkIdList();
int count = wxEnterpriseRelatedService.getRelationCount(enterpriseId);
if (count == 0) {
logger.info("商户未关联好办或都已停用enterpriseId={}", enterpriseId);
return ServiceResponse.success();
}
List<String> clerkIdList = clerkService.getclerkListByStoreIds(storeIdList);
if (CollectionUtils.isEmpty(clerkIdList)) {
if (CollectionUtils.isEmpty(storeIdList)) {
logger.info("门店列表为空");
return ServiceResponse.success();
}
clerkIdList = clerkService.getclerkListByStoreIds(storeIdList);
}
if (CollectionUtils.isEmpty(clerkIdList)) {
logger.info("门店导购列表为空");
return ServiceResponse.success();
}
List<StaffClerkRelationDTO> relationList = staffClerkRelationService.listByClerkIds(clerkIdList);
if (CollectionUtils.isEmpty(relationList)) {
logger.info("成员关联列表为空");
......
package com.gic.haoban.manage.web.controller.content;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.PageHelperUtils;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.content.api.dto.template.ContentTemplateDTO;
import com.gic.content.api.dto.template.ContentTemplateTypeDTO;
import com.gic.content.api.qdto.template.ContentTemplateQDTO;
import com.gic.content.api.service.ContentTemplateApiService;
import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.haoban.manage.web.qo.content.ai.CmeExportVideoQO;
import com.gic.haoban.manage.web.qo.content.ai.CmeImportMaterialQO;
import com.gic.haoban.manage.web.qo.content.ai.ContentTemplateQO;
import com.gic.haoban.manage.web.vo.content.template.ContentTemplateDetailVO;
import com.gic.haoban.manage.web.vo.content.template.ContentTemplateVO;
import com.gic.thirdparty.cloudfile.CmeUtil;
import com.gic.thirdparty.cloudfile.pojo.cme.CmeImportMaterial;
import com.gic.thirdparty.cloudfile.pojo.cme.CmeTaskProcess;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* 好办-AI创作
*
*/
@Controller
@RequestMapping("/ai")
public class ContentAIController {
private static final Logger log = LoggerFactory.getLogger(ContentAIController.class);
@Autowired
private ContentTemplateApiService templateApiService;
@Autowired
private EnterpriseService enterpriseService;
/**
* 查询模板类型列表
*
* @param type 类型 1类别2风格 null查全部
* @return RestResponse
*/
@RequestMapping("list-template-type")
public RestResponse<List<ContentTemplateTypeDTO>> listTemplateType(@RequestParam(required = false)Integer type) {
ServiceResponse<List<ContentTemplateTypeDTO>> response = templateApiService.listTemplateType(type, true);
if (response.isSuccess()) {
return RestResponse.successResult(response.getResult());
}
return RestResponse.failure(response.getCode(), response.getMessage());
}
/**
* 模板分页查询
*
* @param search search
* @return RestResponse
*/
@RequestMapping("page-template")
public RestResponse<Page<ContentTemplateVO>> queryByPage(@RequestBody ContentTemplateQO search) {
ContentTemplateQDTO templateQDTO = com.gic.commons.util.EntityUtil.changeEntityNew(ContentTemplateQDTO.class, search);
BasePageInfo basePageInfo = search.getBasePageInfo();
ServiceResponse<Page<ContentTemplateDTO>> response = templateApiService.pageTemplate(templateQDTO,basePageInfo);
if (!response.isSuccess()) {
return RestResponse.failure(response.getCode(), response.getMessage());
}
Page<ContentTemplateDTO> result = response.getResult();
Page<ContentTemplateVO> ret = PageHelperUtils.changePageToCurrentPage(result, ContentTemplateVO.class);
return RestResponse.successResult(ret);
}
/**
* 模板详情查询
*
* @param contentTemplateId 主键ID
* @return RestResponse
*/
@RequestMapping("detail-template")
public RestResponse<ContentTemplateDetailVO> detailTemplate(Long contentTemplateId) {
ServiceResponse<ContentTemplateDTO> response = templateApiService.getTemplate(contentTemplateId);
if (response.isSuccess()) {
ContentTemplateDetailVO detailVO = com.gic.commons.util.EntityUtil.changeEntityByJSON(ContentTemplateDetailVO.class, response.getResult());
return RestResponse.successResult(detailVO);
}
return RestResponse.failure(response.getCode(), response.getMessage());
}
/**
* 导入cme媒体
* @param materialQO
* @return materialId 素材id
*/
@RequestMapping("import-material")
@ResponseBody
public RestResponse<String> importMaterial(@RequestBody CmeImportMaterialQO materialQO){
CmeImportMaterial cmeImportMaterial = EntityUtil.changeEntityNew(CmeImportMaterial.class, materialQO);
try {
String materialId = CmeUtil.importMaterial(cmeImportMaterial);
return RestResponse.successResult(materialId);
} catch (Exception e) {
log.warn("导入cme媒体:", e);
return RestResponse.failure("-1", "导入媒体异常");
}
}
/**
* 剪辑视频导出
* @param cmeExportVideo
* @return taskId 任务id
*/
@RequestMapping("export-video")
@ResponseBody
public RestResponse<String> exportVideo(@RequestBody CmeExportVideoQO cmeExportVideo){
String enterpriseId = cmeExportVideo.getEnterpriseId();
EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseById(enterpriseId);
String factoryCode = enterpriseDTO.getFactoryCode();
cmeExportVideo.setFactoryCode(factoryCode);
try {
String taskId = CmeUtil.exportVideo(cmeExportVideo);
return RestResponse.successResult(taskId);
} catch (Exception e) {
log.warn("剪辑视频导出:", e);
return RestResponse.failure("-1", "剪辑视频导出异常");
}
}
/**
* 获取视频导出任务进度
* @param taskId 任务id
* @return
*/
@RequestMapping("get-export-task")
@ResponseBody
public RestResponse<CmeTaskProcess> getExportTask(String taskId){
CmeTaskProcess cmeTaskProcess = CmeUtil.describeTaskProcess(taskId);
return RestResponse.successResult(cmeTaskProcess);
}
}
......@@ -5,6 +5,7 @@ import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.service.AccountService;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.thirdparty.cloudfile.CloudFileUtil;
import com.gic.thirdparty.cloudfile.CmeUtil;
import com.gic.thirdparty.cloudfile.enums.CloudFileBusinessOptEnum;
import com.gic.thirdparty.cloudfile.enums.CloudFileTypeEnum;
import com.gic.thirdparty.cloudfile.pojo.CloudFileInfo;
......@@ -39,19 +40,26 @@ public class ContentImageController {
/**
* 获取桶名称
* @param fileType 文件后缀 mp4
* @param fileFlag 视频类型 3为cme临时资源
* @return
*/
@RequestMapping("get-bucket")
@ResponseBody
public RestResponse<CloudFileInfo> getBucket(String fileType,String enterpriseId) {
public RestResponse<CloudFileInfo> getBucket(String fileType,String enterpriseId,@RequestParam(required = false)Integer fileFlag) {
//存储空间余额校验
if (!accountService.storageFeeCheck(enterpriseId)){
return RestResponse.failure("-1", "存储余额不足,暂不支持图片/视频上传,请充值");
}
EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseById(enterpriseId);
CloudFileInfo cloudFileInfo = CloudFileUtil.getPreUploadFileInfo(fileType, CloudFileTypeEnum.VIDEO, enterpriseDTO.getFactoryCode(), CloudFileBusinessOptEnum.MATERIAL_CONTENT);
CloudFileTypeEnum cloudFileTypeEnum = CloudFileTypeEnum.getFileTypeByExtension(fileType);
CloudFileInfo cloudFileInfo = null;
//cme上传视频走 temp存储桶只存一天有效期
if (fileFlag != null && fileFlag == 1) {
cloudFileInfo = CloudFileUtil.getPreUploadTempFileInfo(fileType, cloudFileTypeEnum, CmeUtil.CME_TEMP_COS, CloudFileBusinessOptEnum.MATERIAL_CONTENT, 1L);
}else {
cloudFileInfo = CloudFileUtil.getPreUploadFileInfo(fileType, cloudFileTypeEnum, enterpriseDTO.getFactoryCode(), CloudFileBusinessOptEnum.MATERIAL_CONTENT);
}
if (cloudFileInfo == null){
return RestResponse.failure("-1", "获取桶名称失败");
}
......@@ -63,7 +71,7 @@ public class ContentImageController {
*
* @param request
* @param videoPicFileId 上传视频首针图片时使用
* @param fileFlag = 1-普通图片 2-视频截取首针图片(需要与视频建立关联关系)
* @param fileFlag = 1-普通图片 2-视频截取首针图片(需要与视频建立关联关系)3-cme临时资源
* @param bucketName 存储桶名称
* @return
*/
......@@ -119,6 +127,10 @@ public class ContentImageController {
}else if (fileFlag == 2){
// 若是前端截取的视频首针图片,则调用新接口
CloudFileUtil.uploadPreFileByFieldKey(file, bucketName, videoPicFileId);
}else if (fileFlag == 3) {
// cme临时图片只能上传到temp存储桶 只存一天有效期
CloudFileInfo cloudFileInfo = CloudFileUtil.uploadTempFile(file, fileType, CloudFileTypeEnum.IMAGE, CmeUtil.CME_TEMP_COS, CloudFileBusinessOptEnum.MATERIAL_CONTENT, 1L);
return RestResponse.successResult(cloudFileInfo);
}
return RestResponse.successResult();
} catch (Exception e) {
......
package com.gic.haoban.manage.web.qo.content.ai;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.gic.thirdparty.cloudfile.pojo.cme.CmeExportVideo;
import java.io.Serializable;
/**
* Created by wangzubo on 2023/10/19.
*/
public class CmeExportVideoQO extends CmeExportVideo implements Serializable {
@JsonSerialize(
using = ToStringSerializer.class
)
/**
* 模板id主键
*/
private Long contentTemplateId;
/**
* 企业id
*/
private String enterpriseId;
/**
* 门店id
*/
private String storeId;
/**
* 门店code
*/
private String storeCode;
/**
* 门店名称
*/
private String storeName;
/**
* 导购id
*/
private String clerkId;
/**
* 导购code
*/
private String clerkCode;
/**
* 导购名称
*/
private String clerkName;
public Long getContentTemplateId() {
return contentTemplateId;
}
public void setContentTemplateId(Long contentTemplateId) {
this.contentTemplateId = contentTemplateId;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId;
}
public String getStoreCode() {
return storeCode;
}
public void setStoreCode(String storeCode) {
this.storeCode = storeCode;
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public String getClerkCode() {
return clerkCode;
}
public void setClerkCode(String clerkCode) {
this.clerkCode = clerkCode;
}
public String getClerkName() {
return clerkName;
}
public void setClerkName(String clerkName) {
this.clerkName = clerkName;
}
}
package com.gic.haoban.manage.web.qo.content.ai;
/**
* Created by wangzubo on 2023/10/24.
*/
public class CmeImportMaterialQO {
/**
* 媒体名称
*/
private String name;
/**
* 目前仅支持绑定 COS 桶的媒体,请填写存储对象 Key 值,例如:`example-folder/example.mp4`。
*/
private String mediaKey;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMediaKey() {
return mediaKey;
}
public void setMediaKey(String mediaKey) {
this.mediaKey = mediaKey;
}
}
package com.gic.haoban.manage.web.qo.content.ai;
import com.gic.commons.web.qo.PageQo;
import java.io.Serializable;
import java.util.List;
public class ContentTemplateQO extends PageQo implements Serializable {
private static final long serialVersionUID = -88886472498225164L;
/**
* 搜索
*/
private String search;
/**
* 类型id
*/
private List<Long> typeId;
/**
* 排序字段
*/
private String sortBy = "createTime";
/**
* 排序 desc asc
*/
private String sort = "desc";
public String getSearch() {
return search;
}
public void setSearch(String search) {
this.search = search;
}
public List<Long> getTypeId() {
return typeId;
}
public void setTypeId(List<Long> typeId) {
this.typeId = typeId;
}
public String getSortBy() {
return sortBy;
}
public void setSortBy(String sortBy) {
this.sortBy = sortBy;
}
public String getSort() {
return sort;
}
public void setSort(String sort) {
this.sort = sort;
}
}
package com.gic.haoban.manage.web.vo.content.template;
import java.io.Serializable;
/**
* Created by wangzubo on 2023/10/24.
*/
public class ContentTemplateDetailVO extends ContentTemplateVO implements Serializable {
private static final long serialVersionUID = -4296234499204281253L;
/**
* 模板数据
*/
private String data;
/**
* 替换素材信息
*/
private String slotSet;
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public String getSlotSet() {
return slotSet;
}
public void setSlotSet(String slotSet) {
this.slotSet = slotSet;
}
}
package com.gic.haoban.manage.web.vo.content.template;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.gic.content.api.dto.template.ContentTemplateRelationDTO;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* Created by wangzubo on 2023/10/24.
*/
public class ContentTemplateVO implements Serializable {
private static final long serialVersionUID = -4296234499204281253L;
/**
* 主键
*/
@JsonSerialize(
using = ToStringSerializer.class
)
private Long contentTemplateId;
/**
* 模板id
*/
private String templateId;
/**
* 模板名称
*/
private String templateName;
/**
* url
*/
private String url;
/**
* 预览图
*/
private String preview;
/**
* 时长
*/
private Integer duration;
/**
* 比例
*/
private String scale;
/**
* 可替换素材数量
*/
private Integer slotCount;
/**
* 使用次数
*/
private Integer useCount;
private Date createTime;
private Date updateTime;
private String creatorId;
private String creatorName;
/**
* 关联的类型列表
*/
private List<ContentTemplateRelationDTO> templateTypeList;
public Long getContentTemplateId() {
return contentTemplateId;
}
public void setContentTemplateId(Long contentTemplateId) {
this.contentTemplateId = contentTemplateId;
}
public String getTemplateId() {
return templateId;
}
public void setTemplateId(String templateId) {
this.templateId = templateId;
}
public String getTemplateName() {
return templateName;
}
public void setTemplateName(String templateName) {
this.templateName = templateName;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getPreview() {
return preview;
}
public void setPreview(String preview) {
this.preview = preview;
}
public Integer getDuration() {
return duration;
}
public void setDuration(Integer duration) {
this.duration = duration;
}
public String getScale() {
return scale;
}
public void setScale(String scale) {
this.scale = scale;
}
public Integer getSlotCount() {
return slotCount;
}
public void setSlotCount(Integer slotCount) {
this.slotCount = slotCount;
}
public Integer getUseCount() {
return useCount;
}
public void setUseCount(Integer useCount) {
this.useCount = useCount;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getCreatorId() {
return creatorId;
}
public void setCreatorId(String creatorId) {
this.creatorId = creatorId;
}
public String getCreatorName() {
return creatorName;
}
public void setCreatorName(String creatorName) {
this.creatorName = creatorName;
}
public List<ContentTemplateRelationDTO> getTemplateTypeList() {
return templateTypeList;
}
public void setTemplateTypeList(List<ContentTemplateRelationDTO> templateTypeList) {
this.templateTypeList = templateTypeList;
}
}
......@@ -121,6 +121,8 @@
<dubbo:reference interface="com.gic.content.api.service.ContentColumnApiService" id="contentColumnApiService" timeout="10000" retries="0" check="false"/>
<dubbo:reference interface="com.gic.content.api.service.ContentMaterialApiService" id="contentMaterialApiService" timeout="10000" retries="0" check="false"/>
<dubbo:reference interface="com.gic.content.api.service.ContentMaterialShareApiService" id="contentMaterialShareApiService" timeout="10000" retries="0" check="false"/>
<dubbo:reference interface="com.gic.content.api.service.ContentTemplateApiService" id="contentTemplateApiService" timeout="10000" retries="0" check="false"/>
<dubbo:reference id="settingApiService" interface="com.gic.haoban.app.aggregation.api.service.SettingApiService" timeout="10000" retries="0" check="false"/>
<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" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment