Forráskód Böngészése

Merge branch 'master' of http://git.tjyourong.com.cn/ctop/adsp-boot

zhaoxian 4 éve
szülő
commit
c7420f5186

+ 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);*/

+ 3 - 4
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java

@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -126,13 +125,13 @@ public class MaterialInfo implements Serializable {
      * createTime
      */
     @ApiModelProperty(value = "createTime")
-    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
-    private Object createTime;
+    // @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    private Date createTime;
     /**
      * updateTime
      */
     @ApiModelProperty(value = "updateTime")
-    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    // @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
     private Date updateTime;
 
     //判断是否为头条有效素材0否_1是

+ 2 - 3
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml

@@ -114,7 +114,6 @@
         <if test="projectId !=null and projectId != ''">
             and matInfo.project_id = #{projectId}
         </if>
-
         <if test="status!=null">
             and matInfo.status = #{status}
         </if>
@@ -133,10 +132,10 @@
                 #{item}
             </foreach>
         </if>
-        <if test="startDate!=null">
+        <if test="startDate!= null and startDate != '' ">
             and matInfo.create_time &gt;= #{startDate}
         </if>
-        <if test="endDate!=null">
+        <if test="endDate != null and endDate != '' ">
             and matInfo.create_time &lt;= #{endDate}
         </if>
         order by matInfo.create_time desc

+ 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);
+
+    }
 }

+ 9 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -782,6 +782,15 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             ascription = "true";
         }
 
+        if (!Check.isNull(startDate)) {
+            startDate = startDate + " 00:00:01";
+        }
+
+        if (!Check.isNull(endDate)) {
+            endDate = endDate + " 23:59:59";
+        }
+
+
         List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode, type, status, productId, materialName, code, startDate, endDate, userId, projectId, ascription, clipId, shotId, planId);
         List<MaterialInfo> setList = new ArrayList<>();
         PageInfo<MaterialInfo> pageInfo = new PageInfo<>(dailyList);

+ 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)) {

+ 1 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouTemplateServiceImpl.java

@@ -359,7 +359,6 @@ public class KuaishouTemplateServiceImpl extends ServiceImpl<KuaishouTemplateMap
             String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.TEMPLATE_CREATE;
 
             String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
-
             JSONObject resultJson = JSONObject.parseObject(result);
             if (!Check.isNull(resultJson)) {
                 Integer code = resultJson.getInteger("code");
@@ -371,7 +370,7 @@ public class KuaishouTemplateServiceImpl extends ServiceImpl<KuaishouTemplateMap
 
                 } else {
                     returnJson.put("code", -1);
-                    returnJson.put("message", returnJson.getString("message"));
+                    returnJson.put("message", resultJson.getString("message"));
                 }
             } else {
                 returnJson.put("code", -1);