Commit baa8291d by fudahua

导购可编辑状态

parent c73af46d
......@@ -59,4 +59,12 @@ public interface MaterialApiService {
*/
void delMaterial(List<String> ids);
/**
* 自动刷新madiaid的 获取素材
*
* @param materialId
* @return
*/
MaterialDTO getHasChangeMadieMaterialById(String materialId);
}
......@@ -139,6 +139,10 @@ public class StoreRangeServiceImpl implements StoreRangeService {
return true;
}
private void dealStoreRelation(List<TabStoreRelation> storeRelations, String enterpriseId) {
//todo 动态删除
}
/**
* 批量插入
*
......
......@@ -12,6 +12,8 @@ import com.gic.haoban.manage.service.entity.TabMiniprogramSetting;
import com.gic.haoban.manage.service.service.MiniprogramSettingService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -131,7 +133,11 @@ public class MaterialApiServiceImpl implements MaterialApiService {
fileType = QywxMediaTypeEnum.FILE;
url = materialDTO.getLink();
}
if(type == 3){
if (type == 6) {
fileType = QywxMediaTypeEnum.IMAGE;
url = materialDTO.getImgUrl();
}
if(type == 3){
String imgUrl = materialDTO.getImgUrl();
logger.info("【上传图片】imgUrl={}",imgUrl);
JSONResponse response = qywxSuiteApiService.uploadImage(enterprise.getCorpid(), config.getWxSuiteid(), getFileByte(imgUrl));
......@@ -244,8 +250,11 @@ public class MaterialApiServiceImpl implements MaterialApiService {
if(type == 5){
fileType = QywxMediaTypeEnum.FILE;
url = old.getLink();
}
String[] arr = url.split("/");
} else if (type == 6) {
fileType = QywxMediaTypeEnum.IMAGE;
url = old.getImgUrl();
}
String[] arr = url.split("/");
int count = arr.length;
JSONResponse jp = qywxSuiteApiService.uploadMedia(enterprise.getCorpid(), config.getWxSuiteid(), getFileByte(url),arr[count - 1], fileType.getCode());
if(jp.getErrorCode() == 0){
......@@ -337,4 +346,22 @@ public class MaterialApiServiceImpl implements MaterialApiService {
public void delMaterial(List<String> ids) {
materialService.delmaterialByIds(ids);
}
@Override
public MaterialDTO getHasChangeMadieMaterialById(String materialId) {
MaterialDTO materialDTO = this.selectMaterialById(materialId);
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;
}
String madiaId = this.reUpdalodMetail(materialId);
materialDTO.setMediaId(madiaId);
materialDTO.setWxLastUploadTime(date);
return materialDTO;
}
}
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