Commit 5eddb67e by 王志超

fix: 合规负责人接口异常时走兜底

parent 62a9f2b6
Pipeline #92864 passed with stages
in 2 minutes 15 seconds
......@@ -228,17 +228,24 @@ public class InteriorChangeConfigServiceImpl implements InteriorChangeConfigServ
}
} else if (ChangePrincipalEnum.COMPLIANCE.getName().equals(commander)) {
for (Long goods: goodsInfos) {
String detail = qcApiRpcService.getQaUserListByItemId(goods.intValue());
logger.info("[queryGoodsCommander] compliance:{}", detail);
JSONObject jsonObject = JSONObject.parseObject(detail);
List<JSONObject> qaUserList = JSONObject.parseArray(jsonObject.getString("data"), JSONObject.class);
if (CollectionUtils.isNotEmpty(qaUserList)) {
for (JSONObject qaUser: qaUserList) {
GoodsResponseRpc rpc = new GoodsResponseRpc();
rpc.setEmail(qaUser.getString("uid"));
rpc.setName(qaUser.getString("userName"));
emails.add(rpc);
try {
String detail = qcApiRpcService.getQaUserListByItemId(goods.intValue());
logger.info("[queryGoodsCommander] compliance:{}", detail);
JSONObject jsonObject = JSONObject.parseObject(detail);
if (jsonObject != null) {
List<JSONObject> qaUserList = JSONObject.parseArray(jsonObject.getString("data"),
JSONObject.class);
if (CollectionUtils.isNotEmpty(qaUserList)) {
for (JSONObject qaUser: qaUserList) {
GoodsResponseRpc rpc = new GoodsResponseRpc();
rpc.setEmail(qaUser.getString("uid"));
rpc.setName(qaUser.getString("userName"));
emails.add(rpc);
}
}
}
} catch (Exception e) {
logger.error("[queryGoodsCommander] compliance error, itemId:{}", goods, e);
}
}
}
......@@ -405,16 +412,22 @@ public class InteriorChangeConfigServiceImpl implements InteriorChangeConfigServ
}
//合规
for (Long itemId: itemIds) {
String compliance = qcApiRpcService.getQaUserListByItemId(itemId.intValue());
logger.info("[queryGoodsPrincipalInfo] compliance:{}", compliance);
JSONObject jsonObject1 = JSONObject.parseObject(compliance);
List<JSONObject> qaUserList = JSONObject.parseArray(jsonObject1.getString("data"), JSONObject.class);
if (CollectionUtils.isNotEmpty(qaUserList)) {
JSONObject qaUser = qaUserList.get(0);
map.get(itemId).setGoodsComplianceName(qaUser.getString("userName"));
map.get(itemId).setGoodsComplianceEmail(qaUser.getString("uid"));
goodsRpc(ChangePrincipalEnum.COMPLIANCE.getType(), qaUser.getString("uid"), map.get(itemId));
} else {
try {
String compliance = qcApiRpcService.getQaUserListByItemId(itemId.intValue());
logger.info("[queryGoodsPrincipalInfo] compliance:{}", compliance);
JSONObject jsonObject1 = JSONObject.parseObject(compliance);
List<JSONObject> qaUserList = jsonObject1 == null ? null
: JSONObject.parseArray(jsonObject1.getString("data"), JSONObject.class);
if (CollectionUtils.isNotEmpty(qaUserList)) {
JSONObject qaUser = qaUserList.get(0);
map.get(itemId).setGoodsComplianceName(qaUser.getString("userName"));
map.get(itemId).setGoodsComplianceEmail(qaUser.getString("uid"));
goodsRpc(ChangePrincipalEnum.COMPLIANCE.getType(), qaUser.getString("uid"), map.get(itemId));
} else {
goodsRpc(ChangePrincipalEnum.COMPLIANCE.getType(), null, map.get(itemId));
}
} catch (Exception e) {
logger.error("[queryGoodsPrincipalInfo] compliance error, itemId:{}", itemId, e);
goodsRpc(ChangePrincipalEnum.COMPLIANCE.getType(), null, map.get(itemId));
}
}
......
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