|
@@ -234,24 +234,48 @@ public class DuxiaomanMaterialInfoServiceImpl extends ServiceImpl<DuxiaomanMater
|
|
|
params.put("authorize", "1");
|
|
|
params.put("description", materialInfo.getMaterialName());
|
|
|
StringBuffer md5Str = new StringBuffer();
|
|
|
- md5Str.append("app_id=").append(duAppId)
|
|
|
- .append("&authorize=1")
|
|
|
- .append("&channel_id=").append("3715834215185534246")
|
|
|
- .append("&datetime=").append(datetime)
|
|
|
- .append("&description=").append(materialInfo.getMaterialName())
|
|
|
- .append("&file_ids=").append(materialInfo.getFileId())
|
|
|
- .append("&type=").append(type).append(duToken);
|
|
|
- String sign = DigestUtils.md5Hex(md5Str.toString());
|
|
|
- params.put("sign", sign);
|
|
|
- String resultStr = HttpUtils.httpPostRequest(duUrl + KuaishouDuXiaoManAPIConstant.MATERIAL_REPORT, params, null);
|
|
|
- JSONObject resultJson = JSONObject.parseObject(resultStr);
|
|
|
- log.info("----------素材报备:{}", resultJson);
|
|
|
- if ((!Check.isNull(resultJson) && resultJson.getInteger("retCode") == 0)
|
|
|
- || (!Check.isNull(resultJson) && resultJson.getInteger("retCode") == 1 && resultJson.getString("retMsg").contains("已送审"))) {
|
|
|
- //2:审批中
|
|
|
- materialInfo.setStatus(2);
|
|
|
- materialInfo.setAuditTaskId(resultJson.getString("result"));
|
|
|
- baseMapper.updateById(materialInfo);
|
|
|
+ if (Check.isNull(materialInfo.getAuditTaskId())) {
|
|
|
+ md5Str.append("app_id=").append(duAppId)
|
|
|
+ .append("&authorize=1")
|
|
|
+ .append("&channel_id=").append("3715834215185534246")
|
|
|
+ .append("&datetime=").append(datetime)
|
|
|
+ .append("&description=").append(materialInfo.getMaterialName())
|
|
|
+ .append("&file_ids=").append(materialInfo.getFileId())
|
|
|
+ .append("&type=").append(type).append(duToken);
|
|
|
+ String sign = DigestUtils.md5Hex(md5Str.toString());
|
|
|
+ params.put("sign", sign);
|
|
|
+ String resultStr = HttpUtils.httpPostRequest(duUrl + KuaishouDuXiaoManAPIConstant.MATERIAL_REPORT, params, null);
|
|
|
+ JSONObject resultJson = JSONObject.parseObject(resultStr);
|
|
|
+ log.info("----------素材报备:{}", resultJson);
|
|
|
+ if ((!Check.isNull(resultJson) && resultJson.getInteger("retCode") == 0)
|
|
|
+ || (!Check.isNull(resultJson) && resultJson.getInteger("retCode") == 1 && resultJson.getString("retMsg").contains("已送审"))) {
|
|
|
+ //2:审批中
|
|
|
+ materialInfo.setStatus(2);
|
|
|
+ materialInfo.setAuditTaskId(resultJson.getString("result"));
|
|
|
+ baseMapper.updateById(materialInfo);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ md5Str.append("app_id=").append(duAppId)
|
|
|
+ .append("&authorize=1")
|
|
|
+ .append("&channel_id=").append("3715834215185534246")
|
|
|
+ .append("&datetime=").append(datetime)
|
|
|
+ .append("&description=").append(materialInfo.getMaterialName())
|
|
|
+ .append("&file_ids=").append(materialInfo.getFileId())
|
|
|
+ .append("&id=").append(materialInfo.getAuditTaskId())
|
|
|
+ .append("&type=").append(type).append(duToken);
|
|
|
+ String sign = DigestUtils.md5Hex(md5Str.toString());
|
|
|
+ params.put("sign", sign);
|
|
|
+ params.put("id", materialInfo.getAuditTaskId());
|
|
|
+ String resultStr = HttpUtils.httpPostRequest(duUrl + KuaishouDuXiaoManAPIConstant.MATERIAL_UPDATE, params, null);
|
|
|
+ JSONObject resultJson = JSONObject.parseObject(resultStr);
|
|
|
+ log.info("----------更新任务:{}", resultJson);
|
|
|
+ if ((!Check.isNull(resultJson) && resultJson.getInteger("retCode") == 0)
|
|
|
+ || (!Check.isNull(resultJson) && resultJson.getInteger("retCode") == 1 && resultJson.getString("retMsg").contains("已送审"))) {
|
|
|
+ //2:审批中
|
|
|
+ materialInfo.setStatus(2);
|
|
|
+// materialInfo.setAuditTaskId(resultJson.getString("result"));
|
|
|
+ baseMapper.updateById(materialInfo);
|
|
|
+ }
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -284,7 +308,14 @@ public class DuxiaomanMaterialInfoServiceImpl extends ServiceImpl<DuxiaomanMater
|
|
|
JSONObject result = resultJson.getJSONObject("result");
|
|
|
Integer auditStatus = result.getInteger("audit_status");
|
|
|
auditStatus = auditStatus == 1 ? 101 : auditStatus;
|
|
|
-
|
|
|
+ QueryWrapper<DuxiaomanMaterialInfo> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("audit_task_id", materialInfo.getAuditTaskId());
|
|
|
+ queryWrapper.orderByDesc("create_time");
|
|
|
+ queryWrapper.last("limit 1");
|
|
|
+ DuxiaomanMaterialInfo info = baseMapper.selectOne(queryWrapper);
|
|
|
+ if (!Check.isNull(info) && auditStatus == info.getStatus()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
materialInfo.setStatus(auditStatus);
|
|
|
materialInfo.setConfirmTime(result.getString("audit_time"));
|
|
|
materialInfo.setRefuseReason(result.getString("audit_reason"));
|
|
@@ -449,8 +480,6 @@ public class DuxiaomanMaterialInfoServiceImpl extends ServiceImpl<DuxiaomanMater
|
|
|
}
|
|
|
return Result.ok("success");
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 添加标签
|
|
|
*/
|