Commit b148fa76 by 桂前礼

bug: [none] 旧数据处理

parent a4f46f4f
......@@ -15,6 +15,7 @@ import com.pcloud.book.applet.enums.DataRecordTypeEnum;
import com.pcloud.book.applet.enums.DataTypeEnum;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.group.biz.BizMaterialBiz;
import com.pcloud.book.group.enums.UseTypeEnum;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.ListUtils;
......@@ -192,7 +193,9 @@ public class AppletThirdResourcesBizImpl implements AppletThirdResourcesBiz {
// 链接发生变化,更新素材
if (Objects.nonNull(thirdResourcesDTO.getRouteCode()) && thirdResourcesDTO.getRouteCode() == 1){
AppletThirdResources byId = thirdResourcesDao.getById(thirdResourcesDTO.getId());
if (!(StrUtil.equals(byId.getUrl(), thirdResourcesDTO.getUrl()) && StrUtil.equals(byId.getName(), thirdResourcesDTO.getName()))){
boolean exists = bizMaterialBiz.materialExists(byId.getId(), UseTypeEnum.THIRD_GROUP.value);
exists = !(exists && StrUtil.equals(byId.getUrl(), thirdResourcesDTO.getUrl()) && StrUtil.equals(byId.getName(), thirdResourcesDTO.getName()));
if (exists){
bizMaterialBiz.createMaterial4ThirdResource(thirdResourcesDTO.getName(), thirdResourcesDTO.getUrl(), Math.toIntExact(thirdResourcesDTO.getId()));
}
}
......
......@@ -12,4 +12,11 @@ public interface BizMaterialBiz {
*/
void createMaterial4ThirdResource(String name, String link, Integer resourceId);
/**
* 判读素材是否存在
* @param id
* @param value
* @return
*/
boolean materialExists(Long id, Integer type);
}
......@@ -68,4 +68,10 @@ public class BizMaterialBizImpl implements BizMaterialBiz {
bizMaterial.setMediaId(mediaId);
bizMaterialMapper.insertOrUpdate(bizMaterial);
}
@Override
public boolean materialExists(Long id, Integer type) {
BizMaterial byBizId = bizMaterialMapper.getByBizId(Math.toIntExact(id), type);
return Objects.nonNull(byBizId) && Objects.nonNull(byBizId.getId());
}
}
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