Commit 9e724003 by 徐高华

导购任务-消息

parent 31035919
......@@ -262,6 +262,11 @@
<artifactId>gic-webapp-common</artifactId>
<version>${gic-webapp-common}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-message-center-api</artifactId>
<version>${gic-message-center-api}</version>
</dependency>
</dependencies>
<build>
......
package com.gic.haoban.manage.web.controller.content;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Constant;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.commons.util.ToolUtil;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.content.api.dto.material.ContentMaterialDTO;
import com.gic.content.api.dto.setting.ContentSettingDTO;
import com.gic.content.api.enums.*;
import com.gic.content.api.qdto.material.ContentMaterialPageQDTO;
import com.gic.content.api.qdto.material.ContentMaterialQDTO;
import com.gic.content.api.qdto.producer.ContentProducerClerkRandomQDTO;
import com.gic.content.api.service.ContentMaterialApiService;
import com.gic.content.api.service.ContentSettingApiService;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.web.controller.content.adaptor.ClerkStoreAdaptor;
......@@ -25,6 +31,8 @@ import com.gic.haoban.manage.web.vo.content.creative.ContentMaterialDataVO;
import com.gic.haoban.manage.web.vo.content.creative.ContentMaterialVO;
import com.gic.marketing.pro.api.dto.clerktask.ClerkTaskContentLogDTO;
import com.gic.marketing.pro.api.service.clerktask.ClerkTaskApiService;
import com.gic.message.center.api.subscribe.model.NoticeMessageForm;
import com.gic.mq.sdk.GicMQClient;
import com.google.common.collect.Lists;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -37,6 +45,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -60,6 +70,8 @@ public class ContentCreativeController {
private MaterialDataAdaptor materialDataAdaptor;
@Autowired
private ClerkTaskApiService clerkTaskApiService ;
@Autowired
private ContentSettingApiService contentSettingApiService ;
/**
* 创建素材
......@@ -114,10 +126,43 @@ public class ContentCreativeController {
dto.setStatusFlag(0);
dto.setClerkId(clerkId);
this.clerkTaskApiService.saveContent(dto) ;
}else {
// 发送审批消息
// 不是私域,且未开启自动审核
ServiceResponse<ContentSettingDTO> resp = this.contentSettingApiService.queryContentSettingInfo(saveQO.getEnterpriseId()) ;
if(resp.getResult().getCommunityUserSetting().getClerkMaterialAudit()==null || resp.getResult().getCommunityUserSetting().getClerkMaterialAudit()==0) {
this.sendAudit(saveQO.getEnterpriseId(),saveQO.getClerkId()) ;
}
}
return RestResponse.successResult(response.getResult());
}
private void sendAudit(String enterpriseId, String clerkName) {
Map<String, String> map = new HashMap<>();
map.put("clerkName", clerkName);
this.send(enterpriseId,map,"clerkCreateContent");
}
private void send(String enterpriseId ,Map<String, String> map , String msgCode) {
log.info("发送消息={}",msgCode);
String mqName = "haobanNotice";
NoticeMessageForm noticeMessageForm = new NoticeMessageForm();
noticeMessageForm.setMessageCode(msgCode);
noticeMessageForm.setMqRouterCode(mqName);
noticeMessageForm.setEnterpriseId(enterpriseId);
noticeMessageForm.setBusinessId(ToolUtil.randomUUID());
noticeMessageForm.setUniqueKey(UniqueIdUtils.uniqueLongHex());
noticeMessageForm.setUserIdList(null);
noticeMessageForm.setCreateTime(new Date());
noticeMessageForm.setVariableMap(map);
try {
GicMQClient client = GICMQClientUtil.getClientInstance();
client.sendMessage(mqName, JSON.toJSONString(noticeMessageForm));
} catch (Exception e) {
log.info("异常",e);
}
}
/**
* 删除素材
* @param enterpriseId 企业id
......
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