Переглянути джерело

修改素材负责人逻辑

yumeng 3 роки тому
батько
коміт
9d1fcf6914

+ 22 - 36
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialAscriptionMapper.xml

@@ -3,42 +3,28 @@
 <mapper namespace="cn.com.ctop.common.module.mapper.MaterialAscriptionMapper">
 
     <select id="selectByMaterialId" resultType="com.alibaba.fastjson.JSONObject">
-    select
-      (case
-        when clip_id != ""
-        then (select realname from sys_user where id = clip_id)
-        else ""
-        end
-        ) clipName, /*剪辑人姓名*/
-
-        clip_id clipId,
-        (case
-        when shot_id != ""
-        then (select realname from sys_user where id = shot_id)
-        else ""
-        end
-        ) shotName, /*拍摄人姓名*/
-        shot_id shotId,
-
-         (case
-        when plan_id != ""
-        then (select realname from sys_user where id = plan_id)
-        else ""
-        end
-        ) planName, /*策划人姓名*/
-        plan_id planId,
-
-         (case
-        when plane_id != ""
-        then (select realname from sys_user where id = plane_id)
-        else ""
-        end
-        ) planeName, /*平面姓名*/
-        plane_id planeId
-        from ctop_material_ascription
-        where material_id = #{materialId}
-        order by create_time desc
-        limit 1
+    SELECT
+	( CASE WHEN t1.clip_id != "" THEN ( SELECT realname FROM sys_user WHERE id = t1.clip_id ) ELSE "" END ) clipName,
+	/*剪辑人姓名*/
+	t1.clip_id clipId,
+	( CASE WHEN t1.shot_id != "" THEN ( SELECT realname FROM sys_user WHERE id = t1.shot_id ) ELSE "" END ) shotName,
+	/*拍摄人姓名*/
+	t1.shot_id shotId,
+	( CASE WHEN t1.plan_id != "" THEN ( SELECT realname FROM sys_user WHERE id = t1.plan_id ) ELSE "" END ) planName,
+	/*策划人姓名*/
+	t1.plan_id planId,
+	( CASE WHEN t1.plane_id != "" THEN ( SELECT realname FROM sys_user WHERE id = t1.plane_id ) ELSE "" END ) planeName,
+	/*平面姓名*/
+	t1.plane_id planeId,
+	t1.leader_id AS 'leaderId',
+	/*负责人姓名*/
+	( CASE WHEN t1.leader_id != "" THEN ( SELECT realname FROM sys_user WHERE id = t1.leader_id ) ELSE "" END ) AS 'leaderName'
+FROM
+	ctop_material_ascription t1
+WHERE
+	t1.material_id = material_id = #{materialId}
+    order by create_time desc
+    limit 1
 
     </select>
 

+ 26 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/material/service/impl/EtlKuaishouVideoInfoServiceImpl.java

@@ -95,11 +95,12 @@ public class EtlKuaishouVideoInfoServiceImpl extends ServiceImpl<EtlKuaishouVide
                             etlKuaishouVideoInfo.setChannelName("素造");
                         }
                         //查询相关设计人员信息
+
                         String clipId = null;
                         JSONObject ascription = ascriptionService.getDetailByCode(signature);
                         if (null != ascription) {
-                            clipId = ascription.getString("clipId");
-                            if (null != clipId && !"".equals(clipId.trim())) {
+
+                            /*if (null != clipId && !"".equals(clipId.trim())) {
                                 etlKuaishouVideoInfo.setClipId(clipId);
                                 //根据id查询剪辑所属的设计负责人
                                 SysUser user = sysUserService.getById(clipId);
@@ -113,6 +114,10 @@ public class EtlKuaishouVideoInfoServiceImpl extends ServiceImpl<EtlKuaishouVide
                                         etlKuaishouVideoInfo.setDesignTeamLeaderName(user.getLeaderName());
                                     }
                                 }
+                            }*/
+                            clipId = ascription.getString("clipId");
+                            if (!Check.isNull(clipId)) {
+                                etlKuaishouVideoInfo.setClipId(clipId);
                             }
                             String clipName = ascription.getString("clipName");
                             if (null != clipName && !"".equals(clipName.trim())) {
@@ -134,7 +139,26 @@ public class EtlKuaishouVideoInfoServiceImpl extends ServiceImpl<EtlKuaishouVide
                             if (null != shotName && !"".equals(shotName.trim())) {
                                 etlKuaishouVideoInfo.setShotName(shotName);
                             }
+                            String leaderId = ascription.getString("leaderId");
+                            String leaderName = ascription.getString("leaderName");
+                            if (!Check.isNull(leaderId) && !Check.isNull(leaderName)) {
+                                etlKuaishouVideoInfo.setDesignTeamLeaderId(leaderId);
+                                etlKuaishouVideoInfo.setDesignTeamLeaderName(leaderName);
+                            } else {
+                                SysUser user = sysUserService.getById(clipId);
+                                if (null != user) {
+                                    String roleCode = sysUserService.getRoleCodeByUserId(user.getId());
+                                    if (null != roleCode && "designTeamLeader".equals(roleCode.trim())) {
+                                        etlKuaishouVideoInfo.setDesignTeamLeaderId(user.getId());
+                                        etlKuaishouVideoInfo.setDesignTeamLeaderName(user.getRealname());
+                                    } else {
+                                        etlKuaishouVideoInfo.setDesignTeamLeaderId(user.getLeaderId());
+                                        etlKuaishouVideoInfo.setDesignTeamLeaderName(user.getLeaderName());
+                                    }
+                                }
+                            }
                         }
+
                         if (Check.isNull(clipId)) {
                             Long accountId = videoJson.getLong("accountId");
                             if (!Check.isNull(accountId)) {