yumeng vor 3 Monaten
Ursprung
Commit
9975cc4da7

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

@@ -17,4 +17,6 @@ public interface MaterialAscriptionMapper extends BaseMapper<MaterialAscription>
     JSONObject selectByMaterialId(@Param("materialId") String materialId);
 
     void updateBySignature(@Param("signature")String signature,@Param("md5") String md5);
+
+    String getUserIdByCode(@Param("materialId") String materialId);
 }

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

@@ -39,6 +39,11 @@
         order by create_time desc limit 1
 
     </select>
+    <select id="getUserIdByCode" resultType="java.lang.String" parameterType="java.lang.String">
+        SELECT user_id
+        FROM ctop_material_info
+        WHERE code = #{materialId} limit  1
+    </select>
 
     <update id="updateBySignature">
         UPDATE ctop_material_ascription

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

@@ -16,4 +16,5 @@ public interface IMaterialAscriptionService extends IService<MaterialAscription>
 
     MaterialAscription getInfoByCode(String code);
 
+    String getUserIdByCode(String materialId);
 }

+ 5 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/MaterialAscriptionServiceImpl.java

@@ -38,4 +38,9 @@ public class MaterialAscriptionServiceImpl extends ServiceImpl<MaterialAscriptio
         return this.getOne(queryWrapper);
 
     }
+
+    @Override
+    public String getUserIdByCode(String materialId) {
+        return ascriptionMapper.getUserIdByCode(materialId);
+    }
 }

+ 34 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialAscriptionController.java

@@ -15,9 +15,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.entity.SysUser;
 import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.system.vo.LoginUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -124,7 +126,33 @@ public class MaterialAscriptionController {
 
     @PutMapping(value = "/update")
     public Result<MaterialAscription> update(@RequestBody MaterialAscription materialAscription) {
+
+
         Result<MaterialAscription> result = new Result<>();
+        String materialId = materialAscription.getMaterialId();
+        if (!Check.isNull(materialId)) {
+            LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            String id = user.getId();
+            log.info("当前登陆人ID:{}",id);
+
+            String createId = materialAscriptionService.getUserIdByCode(materialId);
+            log.info("素材上传人人ID:{}",createId);
+
+            if (!id.equals(createId)) {
+                result.error500("非上传人不可修改");
+                return result;
+            }
+
+        /*    if (!id.equals("e9ca23d68d884d4ebb19d07889727dae")) {
+                if (!id.equals(createId)) {
+                    result.error500("非上传人不可修改");
+                    return result;
+                }
+            }*/
+
+        }
+
+
         String shotName = "";
         String shotId = materialAscription.getShotId();
         if (!Check.isNull(shotId)) {
@@ -132,10 +160,10 @@ public class MaterialAscriptionController {
             String shotCode = sysUserService.getRoleCodeByUserId(shotId);
             shotName = shot.getRealname();
             materialAscription.setShotName(shotName);
-            if("designTeamLeader".equals(shotCode)){
+            if ("designTeamLeader".equals(shotCode)) {
                 materialAscription.setShotLeaderId(shotId);
                 materialAscription.setShotLeaderName(shot.getRealname());
-            }else {
+            } else {
                 materialAscription.setShotLeaderId(shot.getLeaderId());
                 materialAscription.setShotLeaderName(shot.getLeaderName());
             }
@@ -157,17 +185,17 @@ public class MaterialAscriptionController {
                 clipName = clip.getRealname();
                 materialAscription.setClipName(clipName);
                 String roleCode = sysUserService.getRoleCodeByUserId(clipId);
-                log.info("剪辑人员名称:"+clip.getRealname()+";ID:"+clipId);
+                log.info("剪辑人员名称:" + clip.getRealname() + ";ID:" + clipId);
                 String leaderName = "";
                 String leaderId = "";
-                if("designTeamLeader".equals(roleCode)){
+                if ("designTeamLeader".equals(roleCode)) {
                     leaderId = clipId;
                     leaderName = clip.getRealname();
-                }else{
+                } else {
                     leaderId = clip.getLeaderId();
                     leaderName = clip.getLeaderName();
                 }
-                log.info("负责人名称:"+leaderName+";ID:"+leaderId);
+                log.info("负责人名称:" + leaderName + ";ID:" + leaderId);
                 materialAscription.setLeaderName(leaderName);
                 materialAscription.setLeaderId(leaderId);
             }