|
@@ -1,18 +1,27 @@
|
|
package cn.com.ctop.kuaishou.modules.document.service.impl;
|
|
package cn.com.ctop.kuaishou.modules.document.service.impl;
|
|
|
|
|
|
|
|
+import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
|
|
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
|
|
+import cn.com.ctop.common.module.service.IMaterialCutFrameService;
|
|
|
|
+import cn.com.ctop.common.module.utils.Check;
|
|
import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
|
|
import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
|
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
|
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
|
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouMaterialUploadService;
|
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouUpdateService;
|
|
import cn.com.ctop.kuaishou.modules.document.mapper.AuditRejectedResubmitMapper;
|
|
import cn.com.ctop.kuaishou.modules.document.mapper.AuditRejectedResubmitMapper;
|
|
|
|
+import cn.com.ctop.kuaishou.modules.document.mapper.DocumentLibraryMapper;
|
|
import cn.com.ctop.kuaishou.modules.document.service.AuditRejectedResubmitService;
|
|
import cn.com.ctop.kuaishou.modules.document.service.AuditRejectedResubmitService;
|
|
|
|
+import cn.com.ctop.kuaishou.modules.document.service.DocumentLibraryService;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.jeecg.common.api.vo.Result;
|
|
import org.jeecg.common.api.vo.Result;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Arrays;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description: 拒审重提
|
|
* @Description: 拒审重提
|
|
@@ -27,6 +36,24 @@ public class AuditRejectedResubmitServiceImpl implements AuditRejectedResubmitSe
|
|
@Autowired
|
|
@Autowired
|
|
AuditRejectedResubmitMapper auditRejectedResubmitMapper;
|
|
AuditRejectedResubmitMapper auditRejectedResubmitMapper;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IMaterialCutFrameService cutFrameService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IKuaiShouImageGetService imageGetService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IKuaiShouMaterialUploadService uploadService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ICtopOauthTokenService tokenService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IKuaiShouUpdateService updateService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private DocumentLibraryMapper documentLibraryMapper;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 重新提交创意
|
|
* 重新提交创意
|
|
*
|
|
*
|
|
@@ -37,10 +64,13 @@ public class AuditRejectedResubmitServiceImpl implements AuditRejectedResubmitSe
|
|
public Result resubmit() {
|
|
public Result resubmit() {
|
|
Result result = new Result();
|
|
Result result = new Result();
|
|
List<KuaiShouCreative> creativeList = new ArrayList<>();
|
|
List<KuaiShouCreative> creativeList = new ArrayList<>();
|
|
- SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
|
+ calendar.setTime(new Date());
|
|
|
|
+ calendar.roll(Calendar.DAY_OF_YEAR, -1);
|
|
try {
|
|
try {
|
|
- //creativeList = auditRejectedResubmitMapper.getCreativeList(42,formatter.format(new Date()));
|
|
|
|
- creativeList = auditRejectedResubmitMapper.getCreativeList(42,null);
|
|
|
|
|
|
+ log.info(formatter.format(calendar.getTime()));
|
|
|
|
+ creativeList = auditRejectedResubmitMapper.getCreativeList(42,formatter.format(calendar.getTime()));
|
|
//可重提词组
|
|
//可重提词组
|
|
List<String> submit = auditRejectedResubmitMapper.getRejectThesaurusListByStatus(0);
|
|
List<String> submit = auditRejectedResubmitMapper.getRejectThesaurusListByStatus(0);
|
|
//不可重提词组
|
|
//不可重提词组
|
|
@@ -51,16 +81,48 @@ public class AuditRejectedResubmitServiceImpl implements AuditRejectedResubmitSe
|
|
Boolean flag = isSubmit(strings, resubmit);
|
|
Boolean flag = isSubmit(strings, resubmit);
|
|
if (!flag) {
|
|
if (!flag) {
|
|
//不可重提
|
|
//不可重提
|
|
- log.info("修改为不可重提:{}",reviewDetail);
|
|
|
|
- auditRejectedResubmitMapper.updateCreativeResubmit(String.valueOf(obj.getCreativeId()),1);
|
|
|
|
|
|
+ log.info("修改为不可重提:{}", reviewDetail);
|
|
|
|
+ auditRejectedResubmitMapper.updateCreativeResubmit(String.valueOf(obj.getCreativeId()), 1);
|
|
} else {
|
|
} else {
|
|
Boolean flag2 = isNotSubmit(strings, submit);
|
|
Boolean flag2 = isNotSubmit(strings, submit);
|
|
- if(flag2){
|
|
|
|
|
|
+ if (flag2) {
|
|
//重提
|
|
//重提
|
|
- log.info("进行重提:{}",reviewDetail);
|
|
|
|
- }else {
|
|
|
|
|
|
+ log.info("进行重提:{}", reviewDetail);
|
|
|
|
+ Integer submit_size = obj.getSubmitSize();
|
|
|
|
+ if(submit_size<2){
|
|
|
|
+ JSONObject updateJson = new JSONObject();
|
|
|
|
+ updateJson.put("creativeId", obj.getCreativeId());
|
|
|
|
+ //更换封面
|
|
|
|
+ CtopOauthToken oauthToken = tokenService.getTokenByAccountId(obj.getAccountId());
|
|
|
|
+ JSONObject cutJson = cutFrameService.getCutFrameByVideoMd5(obj.getPhotoId(), obj.getImageToken());
|
|
|
|
+ if (!Check.isNull(cutJson)) {
|
|
|
|
+ String signature = cutJson.getString("signature");
|
|
|
|
+ String url = cutJson.getString("url");
|
|
|
|
+ String imageToken = getImageToken(signature, obj.getAccountId(), oauthToken.getAccessToken(), url);
|
|
|
|
+ if (!Check.isNull(imageToken)) {
|
|
|
|
+ updateJson.put("imageToken", imageToken);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //更换文案
|
|
|
|
+ List<String> documentByAccountId = documentLibraryMapper.getDocumentByAccountId(String.valueOf(obj.getAccountId()),obj.getDescription());
|
|
|
|
+ if(!documentByAccountId.isEmpty()){
|
|
|
|
+ updateJson.put("description", documentByAccountId.get(0));
|
|
|
|
+ }
|
|
|
|
+ Map<String, Object> creativeMap = updateService.updateCreative(oauthToken.getAccessToken(), obj.getAccountId(), updateJson);
|
|
|
|
+ Integer code = (Integer) creativeMap.get("code");
|
|
|
|
+ if (code == 0) {
|
|
|
|
+ auditRejectedResubmitMapper.updateCreativeResubmitSize(obj.getCreativeId());
|
|
|
|
+ log.info("拒审重提成功,accountId:{},creativeId:{}", obj.getAccountId(), obj.getCreativeId());
|
|
|
|
+ } else {
|
|
|
|
+ log.info("拒审重提失败,accountId:{},creativeId:{}", obj.getAccountId(), obj.getCreativeId());
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ log.info("重提次数已达上限:accountId:{},creativeId:{}",obj.getAccountId(), obj.getCreativeId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else {
|
|
//手动重提
|
|
//手动重提
|
|
- log.info("手动重提:{}",reviewDetail);
|
|
|
|
|
|
+ log.info("手动重提:{}", reviewDetail);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -117,4 +179,21 @@ public class AuditRejectedResubmitServiceImpl implements AuditRejectedResubmitSe
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ private String getImageToken(String md5, Long accountId, String accessToken, String url) {
|
|
|
|
+ String imageToken = null;
|
|
|
|
+ QueryWrapper<KuaiShouImageGet> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.eq("account_id", accountId);
|
|
|
|
+ queryWrapper.eq("signature", md5);
|
|
|
|
+ queryWrapper.last("limit 1");
|
|
|
|
+ KuaiShouImageGet imageGet = imageGetService.getOne(queryWrapper);
|
|
|
|
+ if (!Check.isNull(imageGet)) {
|
|
|
|
+ imageToken = imageGet.getImageToken();
|
|
|
|
+ } else {
|
|
|
|
+ imageToken = uploadService.kuauiShouImageUpload(url, md5, accountId, accessToken);
|
|
|
|
+ }
|
|
|
|
+ return imageToken;
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|