Commit b3855195 by 徐高华

Merge branch 'xgh_内容中台' into 'developer'

上传

See merge request !570
parents 71e329a8 f694f3b6
......@@ -10,6 +10,17 @@ public class ContentMaterialDTO implements Serializable {
private int materialType;
private String imgUrl;
// 1群发 2朋友圈
private int mediaType ;
public int getMediaType() {
return mediaType;
}
public void setMediaType(int mediaType) {
this.mediaType = mediaType;
}
public String getImgUrl() {
return imgUrl;
......
......@@ -170,6 +170,8 @@ public class MaterialServiceImpl implements MaterialService {
if(null != entity) {
old = EntityUtil.changeEntityByJSON(MaterialDTO.class, entity) ;
}
// 1群发 2朋友圈
from = entity.getMediaType() ;
}
Integer type = old.getMaterialType();
if (type == null) {
......@@ -207,12 +209,14 @@ public class MaterialServiceImpl implements MaterialService {
}
String[] arr = url.split("/");
int count = arr.length;
if(from==2 && entity.getMediaType()==2) {
if(from==2) {
// 朋友圈上传接口
if (type == 2) {
url+= "?imageView2/2/w/1440/h/1080" ;
}
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) {
......
......@@ -453,7 +453,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
public com.gic.api.base.commons.ServiceResponse<String> getMaterialId(String wxEnterpriseId, ContentMaterialDTO dto) {
List<ContentMaterialDTO> imageList = Arrays.asList(dto) ;
List<String> materialIdList = this.materialService.getImageMediaId(wxEnterpriseId, imageList, dto.getMaterialType());
List<String> materialIdList = this.materialService.getImageMediaId(wxEnterpriseId, imageList, dto.getMediaType());
if (CollectionUtils.isEmpty(materialIdList)) {
com.gic.api.base.commons.ServiceResponse.failure("9999", "素材记录不存") ;
}
......@@ -469,6 +469,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
if (lastUploadTime != null && lastUploadTime.after(compareDate) && StringUtils.isNotBlank(madiaId)) {
return com.gic.api.base.commons.ServiceResponse.success(madiaId) ;
}
JSONResponse json = this.materialService.reUpdalodMetailJson(materialId,2) ;
if (json.getErrorCode() == 0) {
madiaId= json.getResult().toString() ;
......
......@@ -9,6 +9,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
......@@ -155,10 +156,12 @@ public class QwMessageController extends WebBaseController {
return RestResponse.successResult();
}
// 1群发 2朋友圈
@RequestMapping("get-qw-materialid")
public RestResponse<Object> getMaterialId(String wxEnterpriseId,String imgUrl , int materialType) {
public RestResponse<Object> getMaterialId(String wxEnterpriseId,String imgUrl , int materialType , @RequestParam(defaultValue="2")int mediaType) {
ContentMaterialDTO dto = new ContentMaterialDTO();
dto.setImgUrl(imgUrl);
dto.setMediaType(mediaType);
dto.setMaterialType(materialType);
ServiceResponse<String> resp = this.materialApiService.getMaterialId(wxEnterpriseId, dto) ;
if(resp.isSuccess()) {
......
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