Kaynağa Gözat

素材库调整

yumeng 4 yıl önce
ebeveyn
işleme
73bc5bcac1

+ 38 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java

@@ -72,6 +72,8 @@ public class MaterialInfoController {
     private IBytedanceVideoSlogenInfoService slogenInfoService;
     @Autowired
     private IProductService productService;
+    @Autowired
+    private IProjectService projectService;
 
 
     @GetMapping("/supplierWatermark")
@@ -523,8 +525,24 @@ public class MaterialInfoController {
         // 如果状态为2 审核拒绝 给上传人发送消息
         if (status == 2) {
             Product product = productService.getById(materialInfoEntity.getProductId());
-            String text = messageTemplate.getMaterialRejectTemplate(product.getProductName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
-            sendMessageService.sendMessage(materialInfoEntity.getUserId(), text);
+            Project project = projectService.getById(materialInfoEntity.getProjectId());
+            String text = messageTemplate.getMaterialRejectTemplate(product.getProductName(), project.getProjectName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
+            MaterialAscription ascription = materialAscriptionService.getInfoByCode(materialInfoEntity.getCode());
+            List<String> userList = new ArrayList<>();
+            if (!Check.isNull(ascription)) {
+                if (!Check.isNull(ascription.getClipId())) {
+                    userList.add(ascription.getClipId());
+                }
+                if (!Check.isNull(ascription.getPlanId())) {
+                    userList.add(ascription.getPlanId());
+                }
+            } else {
+                userList.add(materialInfoEntity.getUserId());
+            }
+            for (int i = 0; i < userList.size(); i++) {
+                String userId = userList.get(i);
+                sendMessageService.sendMessage(userId, text);
+            }
         }
         return result;
 
@@ -745,8 +763,24 @@ public class MaterialInfoController {
         // 如果状态为2 审核拒绝 给上传人发送消息
         if (status == 2) {
             Product product = productService.getById(materialInfoEntity.getProductId());
-            String text = messageTemplate.getMaterialRejectTemplate(product.getProductName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
-            sendMessageService.sendMessage(materialInfoEntity.getUserId(), text);
+            Project project = projectService.getById(materialInfoEntity.getProjectId());
+            String text = messageTemplate.getMaterialRejectTemplate(product.getProductName(), project.getProjectName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
+            List<String> userList = new ArrayList<>();
+            MaterialAscription ascription = materialAscriptionService.getInfoByCode(materialInfoEntity.getCode());
+            if (!Check.isNull(ascription)) {
+                if (!Check.isNull(ascription.getClipId())) {
+                    userList.add(ascription.getClipId());
+                }
+                if (!Check.isNull(ascription.getPlanId())) {
+                    userList.add(ascription.getPlanId());
+                }
+            } else {
+                userList.add(materialInfoEntity.getUserId());
+            }
+            for (int i = 0; i < userList.size(); i++) {
+                String userId = userList.get(i);
+                sendMessageService.sendMessage(userId, text);
+            }
         }
         return result;
     }

+ 12 - 2
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -58,10 +58,20 @@ public class SampleTest {
 
     @Test
     public void loadKuaishouCookie() throws ParseException {
-        wechatUserInfoService.getUserList();
+
+        CtopOauthToken tokenByAccountId = tokenService.getTokenByAccountId(1700996735138951L);
+        advertiserDataService.getMaterialList(tokenByAccountId);
+
+
+
+        CtopOauthToken tokenByAccountId1 = tokenService.getTokenByAccountId(1700996735589383L);
+        advertiserDataService.getMaterialList(tokenByAccountId1);
+
+/*
+        wechatUserInfoService.getUserList();*/
 
         // appchatCreateService.createAppChat(null, null, null);
-        appchatCreateService.getChatInfo(null);
+   //     appchatCreateService.getChatInfo(null);
        /* redisUtil.set("11sdfhgjksdhfjksdhfjksdhfkjsjkfhkjsddhfjksdhfkjhsjkfhjkshfjksdhfjksdhfjkshdjkfhsjkdfhkjsd1","hahahaha",5);
         Object o = redisUtil.get("11sdfhgjksdhfjksdhfjksdhfkjsjkfhkjsddhfjksdhfkjhsjkfhjkshfjksdhfjksdhfjkshdjkfhsjkdfhkjsd1");
         System.err.println(o);*/

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialAscriptionService.java

@@ -14,4 +14,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
 public interface IMaterialAscriptionService extends IService<MaterialAscription> {
     JSONObject getDetailByCode(String code);
 
+    MaterialAscription getInfoByCode(String code);
+
 }

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/IMessageTemplate.java

@@ -19,7 +19,7 @@ public interface IMessageTemplate {
     String getMaterialSyncSucessTemplate(String projectName, String accountId, String accountName, String materialName, String reason);
 
 
-    String getMaterialRejectTemplate(String projectName, String materialName, String refuseReason);
+    String getMaterialRejectTemplate(String productName, String projectName, String materialName, String refuseReason);
 
     String getFeishuMaterialSyncTemplate(String projectName, Long accountId, String accountName, String materialName, String reason);
 

+ 11 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialAscriptionServiceImpl.java

@@ -4,6 +4,7 @@ import cn.com.ctop.common.module.entity.MaterialAscription;
 import cn.com.ctop.common.module.mapper.MaterialAscriptionMapper;
 import cn.com.ctop.common.module.service.IMaterialAscriptionService;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
@@ -27,4 +28,14 @@ public class MaterialAscriptionServiceImpl extends ServiceImpl<MaterialAscriptio
     public JSONObject getDetailByCode(String code) {
         return ascriptionMapper.selectByMaterialId(code);
     }
+
+    @Override
+    public MaterialAscription getInfoByCode(String code) {
+        QueryWrapper<MaterialAscription> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("material_id", code);
+        queryWrapper.orderByDesc("create_time");
+        queryWrapper.last("limit 1");
+        return this.getOne(queryWrapper);
+
+    }
 }

+ 3 - 2
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MessageTemplateImpl.java

@@ -68,10 +68,11 @@ public class MessageTemplateImpl implements IMessageTemplate {
      * @return
      */
     @Override
-    public String getMaterialRejectTemplate(String projectName, String materialName, String refuseReason) {
+    public String getMaterialRejectTemplate(String productName, String projectName, String materialName, String refuseReason) {
         StringBuilder text = new StringBuilder();
         text.append("素材驳回通知").append("<br/>")
-                .append("您的项目:").append(projectName + ",").append("<br/>")
+                .append("您的产品:").append(productName + ",").append("<br/>")
+                .append("下的项目:").append(projectName + ",").append("<br/>")
                 .append("素材名称为:").append(materialName).append("<br/>")
                 .append("已被驳回。").append("<br/>");
         if (!Check.isNull(refuseReason)) {