|
@@ -1,5 +1,6 @@
|
|
|
package shop.alien.store.service.impl;
|
|
package shop.alien.store.service.impl;
|
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
@@ -3403,24 +3404,46 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
}
|
|
}
|
|
|
if (StringUtils.isNotEmpty(response.getBody())) {
|
|
if (StringUtils.isNotEmpty(response.getBody())) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(response.getBody());
|
|
JSONObject jsonObject = JSONObject.parseObject(response.getBody());
|
|
|
- if (jsonObject.getInteger("code") == 200) {
|
|
|
|
|
|
|
+ if (Integer.valueOf(200).equals(jsonObject.getInteger("code"))) {
|
|
|
JSONObject data = jsonObject.getJSONObject("data");
|
|
JSONObject data = jsonObject.getJSONObject("data");
|
|
|
|
|
+ if (data == null) {
|
|
|
|
|
+ log.info("AI门店审核接口返回 data 为空, userId={}", aiApproveStoreInfo.getUserId());
|
|
|
|
|
+ throw new RuntimeException("AI门店审核接口返回 data 为空");
|
|
|
|
|
+ }
|
|
|
List<StoreInfo> storeInfos = storeInfoMapper.selectList(new LambdaQueryWrapper<StoreInfo>()
|
|
List<StoreInfo> storeInfos = storeInfoMapper.selectList(new LambdaQueryWrapper<StoreInfo>()
|
|
|
.eq(StoreInfo::getCreatedUserId, aiApproveStoreInfo.getUserId()).eq(StoreInfo::getStoreApplicationStatus, 0).eq(StoreInfo::getDeleteFlag, 0));
|
|
.eq(StoreInfo::getCreatedUserId, aiApproveStoreInfo.getUserId()).eq(StoreInfo::getStoreApplicationStatus, 0).eq(StoreInfo::getDeleteFlag, 0));
|
|
|
|
|
+ String status = data.getString("status");
|
|
|
for (StoreInfo storeInfo : storeInfos) {
|
|
for (StoreInfo storeInfo : storeInfos) {
|
|
|
- if ("approved".equals(data.getString("status"))) {
|
|
|
|
|
|
|
+ if ("approved".equals(status)) {
|
|
|
|
|
+ log.info("AI门店审核通过, storeId={}", storeInfo.getId());
|
|
|
approveStoreInfo(storeInfo.getId().toString(), 1, "审核通过");
|
|
approveStoreInfo(storeInfo.getId().toString(), 1, "审核通过");
|
|
|
- } else if ("rejected".equals(data.getString("status"))) {
|
|
|
|
|
- approveStoreInfo(storeInfo.getId().toString(), 2, data.getString("audit_summary"));
|
|
|
|
|
|
|
+ } else if ("rejected".equals(status)) {
|
|
|
|
|
+ log.info("AI门店审核拒绝, storeId={}", storeInfo.getId());
|
|
|
|
|
+ String reason = data.getString("audit_summary");
|
|
|
|
|
+ if (StringUtils.isEmpty(reason) && data.containsKey("risk_tags")) {
|
|
|
|
|
+ log.info("AI门店审核拒绝, risk_tags 不为空, storeId={}", storeInfo.getId());
|
|
|
|
|
+ JSONArray riskTags = data.getJSONArray("risk_tags");
|
|
|
|
|
+ if (riskTags != null && !riskTags.isEmpty()) {
|
|
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
|
|
+ for (int i = 0; i < riskTags.size(); i++) {
|
|
|
|
|
+ if (i > 0) sb.append(";");
|
|
|
|
|
+ sb.append(riskTags.getString(i));
|
|
|
|
|
+ }
|
|
|
|
|
+ reason = sb.toString();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ approveStoreInfo(storeInfo.getId().toString(), 2, StringUtils.isNotEmpty(reason) ? reason : "审核未通过");
|
|
|
} else {
|
|
} else {
|
|
|
- System.out.println("未知状态");
|
|
|
|
|
|
|
+ log.warn("AI门店审核返回未知状态: status={}, storeId={}", status, storeInfo.getId());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ log.error("AI门店审核接口调用失败, userId={}, code={}", aiApproveStoreInfo.getUserId(), jsonObject.getInteger("code"));
|
|
|
throw new RuntimeException("AI门店审核接口调用失败 code:" + jsonObject.getInteger("code"));
|
|
throw new RuntimeException("AI门店审核接口调用失败 code:" + jsonObject.getInteger("code"));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
|
|
+ log.error("调用门店审核接口异常, userId={},{}", aiApproveStoreInfo.getUserId(), e);
|
|
|
throw new RuntimeException("调用门店审核接口异常", e);
|
|
throw new RuntimeException("调用门店审核接口异常", e);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|