Commit 6f8985c7 by Administrator

Merge branch 'fixbug/exception' into 'master'

bug: [none] 解决未捕获到超过限制异常的bug

See merge request rays/pcloud-book!843
parents a0c815d9 289dc4d1
...@@ -7,7 +7,6 @@ import com.pcloud.book.group.biz.GroupMaterialAccountBiz; ...@@ -7,7 +7,6 @@ import com.pcloud.book.group.biz.GroupMaterialAccountBiz;
import com.pcloud.book.group.entity.GroupMaterialAccount; import com.pcloud.book.group.entity.GroupMaterialAccount;
import com.pcloud.book.group.mapper.GroupMaterialAccountMapper; import com.pcloud.book.group.mapper.GroupMaterialAccountMapper;
import com.pcloud.common.utils.ResponseHandleUtil; import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.facade.wechat.exceptions.WechatSeviceException;
import com.pcloud.facade.wechat.material.service.MaterialService; import com.pcloud.facade.wechat.material.service.MaterialService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -71,15 +70,12 @@ public class GroupMaterialAccountBizImpl implements GroupMaterialAccountBiz { ...@@ -71,15 +70,12 @@ public class GroupMaterialAccountBizImpl implements GroupMaterialAccountBiz {
String mediaId = ResponseHandleUtil.parseResponse(materialService.addImgMaterial(account.getAccountId(), COVER_IMAGE), String.class); String mediaId = ResponseHandleUtil.parseResponse(materialService.addImgMaterial(account.getAccountId(), COVER_IMAGE), String.class);
account.setCoverMediaId(mediaId); account.setCoverMediaId(mediaId);
} }
} catch (WechatSeviceException e) { } catch (Exception e) {
// 接口调用超过限制,继续循环,获取下一个公众号 // 接口调用超过限制,更新状态为达到限制,继续循环,获取下一个公众号
if (45009 == e.getCode()) { if (account.getStatus() == 1) {
// 更新状态为达到限制 account.setStatus(0);
if (account.getStatus() == 1) { account.setUpdateTime(new Date());
account.setStatus(0); groupMaterialAccountMapper.update(account);
account.setUpdateTime(new Date());
groupMaterialAccountMapper.update(account);
}
} }
continue; continue;
} }
......
...@@ -236,17 +236,12 @@ public class WeixinQrcodeBizImpl implements WeixinQrcodeBiz { ...@@ -236,17 +236,12 @@ public class WeixinQrcodeBizImpl implements WeixinQrcodeBiz {
mediaId = ResponseHandleUtil.parseResponse(materialService.getGroupNewsMaterial(groupNewsMaterialAddDTO), String.class); mediaId = ResponseHandleUtil.parseResponse(materialService.getGroupNewsMaterial(groupNewsMaterialAddDTO), String.class);
// 增加素材更新时间字段,方便查询更新失败的群信息 // 增加素材更新时间字段,方便查询更新失败的群信息
groupQrcodeDao.updateMediaId(baseById.getId(), mediaId, new Date()); groupQrcodeDao.updateMediaId(baseById.getId(), mediaId, new Date());
} catch (WechatSeviceException e) { } catch (Exception e) {
// 接口调用超过限制,继续循环,获取下一个公众号 if (activeAccount.getStatus() == 1) {
if (45009 == e.getCode()) { activeAccount.setStatus(0);
// 更新状态为达到限制 activeAccount.setUpdateTime(new Date());
if (activeAccount.getStatus() == 1) { groupMaterialAccountMapper.update(activeAccount);
activeAccount.setStatus(0);
activeAccount.setUpdateTime(new Date());
groupMaterialAccountMapper.update(activeAccount);
}
} }
throw new BizException(WechatSeviceException.MATERIAL_ADD_ERROR, "更新二维码永久图文素材失败!");
} }
} }
} }
......
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