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

转户逻辑调整 素材可跨项目进行推送

yumeng 2 éve
szülő
commit
6fdf42cc24

+ 1 - 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java

@@ -249,6 +249,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/manager/**", "anon");
         filterChainDefinitionMap.put("/manager/**", "anon");
         filterChainDefinitionMap.put("/liveData/**", "anon");
         filterChainDefinitionMap.put("/liveData/**", "anon");
         filterChainDefinitionMap.put("/product/material/**", "anon");
         filterChainDefinitionMap.put("/product/material/**", "anon");
+        filterChainDefinitionMap.put("/ctop/materialInfo/**", "anon");
 
 
         // 添加自己的过滤器并且取名为jwt
         // 添加自己的过滤器并且取名为jwt
         Map<String, Filter> filterMap = new HashMap<>(1);
         Map<String, Filter> filterMap = new HashMap<>(1);

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java

@@ -39,5 +39,7 @@ public interface MaterialInfoMapper extends BaseMapper<MaterialInfo> {
 
 
     List<MaterialInfo> getListByProduct(@Param("productId") Long productId);
     List<MaterialInfo> getListByProduct(@Param("productId") Long productId);
 
 
+    void materialSync(@Param("projectId") Long projectId, @Param("toProjectId") Long toProjectId, @Param("productId") Long productId);
+
     // List<MaterialInfo> getListByParams(String tagCode, String type, Integer status, String materialName, String code, String startDate, String endDate, List<Long> projectIds, String ascription, String clipId, String shotId, String planId, Integer offlineFlag);
     // List<MaterialInfo> getListByParams(String tagCode, String type, Integer status, String materialName, String code, String startDate, String endDate, List<Long> projectIds, String ascription, String clipId, String shotId, String planId, Integer offlineFlag);
 }
 }

+ 67 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml

@@ -1,6 +1,73 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.common.module.mapper.MaterialInfoMapper">
 <mapper namespace="cn.com.ctop.common.module.mapper.MaterialInfoMapper">
+    <insert id="materialSync">
+        INSERT INTO ctop_material_info (
+        id,
+        `code`,
+        url,
+        cover_url,
+        watermark_code,
+        material_name,
+        watermark_url,
+        watermark_material_name,
+        user_id,
+        auditor_id,
+        `status`,
+        material_describe,
+        product_id,
+        project_id,
+        refuse_reason,
+        creative_copywriter,
+        refuse_file,
+        excellent,
+        type,
+        confirm_time,
+        create_time,
+        update_time,
+        toutiao_effi_type,
+        kuaishou_effi_type,
+        supplier_code,
+        material_innovate,
+        sync_kuaishou,
+        sync_bytedance
+        )
+        SELECT UUID(),
+        t1.`code`,
+        t1.url,
+        t1.cover_url,
+        t1.watermark_code,
+        t1.material_name,
+        t1.watermark_url,
+        t1.watermark_material_name,
+        t1.user_id,
+        t1.auditor_id,
+        0,
+        t1.material_describe,
+        #{productId},
+        #{toProjectId},
+        t1.refuse_reason,
+        t1.creative_copywriter,
+        t1.refuse_file,
+        t1.excellent,
+        t1.type,
+        t1.confirm_time,
+        t1.create_time,
+        t1.update_time,
+        t1.toutiao_effi_type,
+        t1.kuaishou_effi_type,
+        t1.supplier_code,
+        t1.material_innovate,
+        t1.sync_kuaishou,
+        t1.sync_bytedance
+        FROM ctop_material_info t1
+        WHERE t1.project_id = #{projectId}
+        AND t1.`code` not in(
+        SELECT `code`
+        FROM ctop_material_info
+        WHERE project_id = #{toProjectId}
+        )
+    </insert>
 
 
 
 
     <select id="getProjectIdByAccountId" resultType="java.lang.Long">
     <select id="getProjectIdByAccountId" resultType="java.lang.Long">

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java

@@ -88,4 +88,6 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
     JSONArray checkArrayCode(JSONArray array);
     JSONArray checkArrayCode(JSONArray array);
 
 
     List<MaterialInfo> getListByProduct(Long productId);
     List<MaterialInfo> getListByProduct(Long productId);
+
+    void materialSync(Long projectId, JSONArray toProjectIds);
 }
 }

+ 21 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -651,6 +651,25 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     }
     }
 
 
     /**
     /**
+     * 项目同步
+     *
+     * @param projectId
+     * @param toProjectIds
+     * @return
+     */
+    @Override
+    public void materialSync(Long projectId, JSONArray toProjectIds) {
+        for (int i = 0; i < toProjectIds.size(); i++) {
+            Long toProjectId = toProjectIds.getLong(i);
+            Project project = projectService.getById(toProjectId);
+            if (Check.isNull(project)) {
+                continue;
+            }
+            materialInfoMapper.materialSync(projectId, toProjectId, project.getProductId());
+        }
+    }
+
+    /**
      * 素材库关联上传素材 1
      * 素材库关联上传素材 1
      *
      *
      * @param json
      * @param json
@@ -950,7 +969,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
 
 
 
 
     @Override
     @Override
-    public Map<String, Object> getListByParams(String tagCode, String type, Integer status, String materialName, List<Long> projectIds, String code, String startDate, String endDate, String userId, String clipId, String shotId, String planId, String leaderName, Integer offlineFlag, Integer pageNo, Integer pageSize, Integer syncKuaishou, Integer syncBytedance,Integer materialInnovate) {
+    public Map<String, Object> getListByParams(String tagCode, String type, Integer status, String materialName, List<Long> projectIds, String code, String startDate, String endDate, String userId, String clipId, String shotId, String planId, String leaderName, Integer offlineFlag, Integer pageNo, Integer pageSize, Integer syncKuaishou, Integer syncBytedance, Integer materialInnovate) {
         Map<String, Object> result = new HashMap<>();
         Map<String, Object> result = new HashMap<>();
         PageHelper.startPage(pageNo, pageSize);
         PageHelper.startPage(pageNo, pageSize);
         String ascription = null;
         String ascription = null;
@@ -964,7 +983,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         if (!Check.isNull(endDate)) {
         if (!Check.isNull(endDate)) {
             endDate = endDate + " 23:59:59";
             endDate = endDate + " 23:59:59";
         }
         }
-        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode, type, status, materialName, code, startDate, endDate, userId, projectIds, ascription, clipId, shotId, planId, leaderName, offlineFlag, syncKuaishou, syncBytedance,materialInnovate);
+        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode, type, status, materialName, code, startDate, endDate, userId, projectIds, ascription, clipId, shotId, planId, leaderName, offlineFlag, syncKuaishou, syncBytedance, materialInnovate);
         List<MaterialInfo> setList = new ArrayList<>();
         List<MaterialInfo> setList = new ArrayList<>();
         PageInfo<MaterialInfo> pageInfo = new PageInfo<>(dailyList);
         PageInfo<MaterialInfo> pageInfo = new PageInfo<>(dailyList);
         if (!dailyList.isEmpty()) {
         if (!dailyList.isEmpty()) {

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

@@ -84,6 +84,42 @@ public class MaterialInfoController {
     @Autowired
     @Autowired
     private IByteDanceCreativeWordPackageService byteDanceGeneralCopywriterService;
     private IByteDanceCreativeWordPackageService byteDanceGeneralCopywriterService;
 
 
+
+    /**
+     * 素材同步
+     *
+     * @param requestJson
+     * @return
+     */
+    @PostMapping(value = "/materialSync")
+    public Result<JSONObject> materialSync(@RequestBody JSONObject requestJson) {
+        Result<JSONObject> result = new Result<>();
+        try {
+            if (Check.isNull(requestJson)) {
+                throw new Exception("入参为空");
+            }
+            Long projectId = requestJson.getLong("projectId");
+            if (Check.isNull(projectId)) {
+                throw new Exception("请传入被同步的项目ID");
+            }
+            JSONArray toProjectIds = requestJson.getJSONArray("toProjectIds");
+            if (Check.isNull(toProjectIds)) {
+                throw new Exception("请传入需同步的项目ID");
+            }
+             materialInfoService.materialSync(projectId, toProjectIds);
+            result.setSuccess(true);
+
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+
+        return result;
+    }
+
+
     @GetMapping("/supplierWatermark")
     @GetMapping("/supplierWatermark")
     public Result<String> supplierWatermark(String id) {
     public Result<String> supplierWatermark(String id) {
         Result<String> result = new Result<>();
         Result<String> result = new Result<>();

+ 13 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TransferAccountController.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.ctop.controller;
 package org.jeecg.modules.ctop.controller;
 
 
+import android.accounts.Account;
 import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.MailLogMapper;
 import cn.com.ctop.common.module.mapper.MailLogMapper;
@@ -73,6 +74,18 @@ public class TransferAccountController {
                 return result;
                 return result;
             }
             }
 
 
+            if (transferAccount.getAssigneeDate().equals(transferAccount.getTransferorDate())) {
+                result.setSuccess(false);
+                result.setMessage("转户人绩效截止日期不能与受让人绩效开始日期相同");
+                return result;
+            }
+            //  转户日期 要 大于 受让日期
+            Integer count = transferAccountService.checkDate(transferAccount.getAccountId(), transferAccount.getTransferorDate());
+            if (count > 0) {
+                result.setSuccess(false);
+                result.setMessage("此账户转户日期不能早于历史转户日期");
+                return result;
+            }
             transferAccountService.save(transferAccount);
             transferAccountService.save(transferAccount);
             Long projectId = transferAccount.getProjectId();
             Long projectId = transferAccount.getProjectId();
             Project project = projectService.getById(projectId);
             Project project = projectService.getById(projectId);

+ 2 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/TransferAccountMapper.java

@@ -20,4 +20,6 @@ public interface TransferAccountMapper extends BaseMapper<TransferAccount> {
     List<TransferAccount> getAccountQuarterDetail(@Param(value = "accountId") Long accountId, @Param(value = "startDate") String startDate, @Param(value = "endDate") String endDate);
     List<TransferAccount> getAccountQuarterDetail(@Param(value = "accountId") Long accountId, @Param(value = "startDate") String startDate, @Param(value = "endDate") String endDate);
 
 
     List<JSONObject> getListByMap(@Param("ids") Map<Long, Long> projectIdMap);
     List<JSONObject> getListByMap(@Param("ids") Map<Long, Long> projectIdMap);
+
+    Integer checkDate(@Param("accountId") Long accountId, @Param("transferorDate") String transferorDate);
 }
 }

+ 7 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/TransferAccountMapper.xml

@@ -30,5 +30,12 @@
         group by project_id
         group by project_id
 
 
     </select>
     </select>
+    <select id="checkDate" resultType="java.lang.Integer">
+        select count(1)
+        from ctop_transfer_account
+        where account_id = #{accountId}
+        and assignee_date > #{transferorDate}
+
+    </select>
 
 
 </mapper>
 </mapper>

+ 2 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/ITransferAccountService.java

@@ -21,4 +21,6 @@ public interface ITransferAccountService extends IService<TransferAccount> {
     List<TransferAccount> getAccountQuarterDetail(Long accountId, String startDate, String endDate);
     List<TransferAccount> getAccountQuarterDetail(Long accountId, String startDate, String endDate);
 
 
     List<Project> getTransferInfoListByList(List<Project> records);
     List<Project> getTransferInfoListByList(List<Project> records);
+
+    Integer checkDate(Long accountId, String transferorDate);
 }
 }

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/TransferAccountServiceImpl.java

@@ -160,4 +160,9 @@ public class TransferAccountServiceImpl extends ServiceImpl<TransferAccountMappe
         return records;
         return records;
     }
     }
 
 
+    @Override
+    public Integer checkDate(Long accountId, String transferorDate) {
+        return transferAccountMapper.checkDate(accountId,transferorDate);
+    }
+
 }
 }