|  | @@ -25,8 +25,10 @@ import org.jeecg.common.aspect.annotation.AutoLog;
 | 
	
		
			
				|  |  |  import org.jeecg.common.system.query.QueryGenerator;
 | 
	
		
			
				|  |  |  import org.jeecg.common.system.vo.LoginUser;
 | 
	
		
			
				|  |  |  import org.jeecg.common.util.DateUtils;
 | 
	
		
			
				|  |  | +import org.jeecg.modules.ctop.entity.Project;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.ctop.service.IKuaiShouUploadService;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.ctop.service.IProjectMemberService;
 | 
	
		
			
				|  |  | +import org.jeecg.modules.ctop.service.IProjectService;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -90,7 +92,7 @@ public class MaterialInfoController {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @PostMapping("watermark")
 | 
	
		
			
				|  |  | -    public Result<Object> watermarkVideo(@RequestParam(name = "id") String id, @RequestParam(name = "watermarkTemplateId") Integer watermarkTemplateId) {
 | 
	
		
			
				|  |  | +    public Result<Object> watermarkVideo(@RequestParam(name = "id") String id, @RequestParam(name = "watermarkTemplateId") Long watermarkTemplateId) {
 | 
	
		
			
				|  |  |          Result<Object> result = new Result<>();
 | 
	
		
			
				|  |  |          LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
 | 
	
		
			
				|  |  |          materialInfoService.watermarkVideo(id, watermarkTemplateId, sysUser.getId());
 | 
	
	
		
			
				|  | @@ -163,8 +165,6 @@ public class MaterialInfoController {
 | 
	
		
			
				|  |  |                                                       HttpServletRequest req) {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          Result<IPage<MaterialInfo>> result = new Result<>();
 | 
	
		
			
				|  |  | -        String materialName = materialInfo.getMaterialName();
 | 
	
		
			
				|  |  | -        materialInfo.setMaterialName(null);
 | 
	
		
			
				|  |  |          QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
 | 
	
		
			
				|  |  |          Object createTime = materialInfo.getCreateTime();
 | 
	
		
			
				|  |  |          materialInfo.setCreateTime(null);
 | 
	
	
		
			
				|  | @@ -201,10 +201,6 @@ public class MaterialInfoController {
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        if (!Check.isNull(materialName)) {
 | 
	
		
			
				|  |  | -            queryWrapper.like("material_name", materialName);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  |          Page<MaterialInfo> page = new Page<>(pageNo, pageSize);
 | 
	
		
			
				|  |  |          IPage<MaterialInfo> pageList = materialInfoService.page(page, queryWrapper);
 | 
	
		
			
				|  |  |          List<MaterialInfo> materialInfoList = pageList.getRecords();
 | 
	
	
		
			
				|  | @@ -340,75 +336,74 @@ public class MaterialInfoController {
 | 
	
		
			
				|  |  |          Result<MaterialInfo> result = new Result<>();
 | 
	
		
			
				|  |  |          MaterialInfo materialInfoEntity = materialInfoService.getById(materialInfo.getId());
 | 
	
		
			
				|  |  |          if (materialInfoEntity == null) {
 | 
	
		
			
				|  |  | -            return result.error500("未找到对应实体");
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        String url = materialInfo.getUrl();
 | 
	
		
			
				|  |  | -        if (!Check.isNull(url)) {
 | 
	
		
			
				|  |  | -            if (!url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
 | 
	
		
			
				|  |  | -                url = KuaishouInterfaceConstant.HTTPS_PREFIX + url;
 | 
	
		
			
				|  |  | +            result.error500("未找到对应实体");
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            String url = materialInfo.getUrl();
 | 
	
		
			
				|  |  | +            if (!Check.isNull(url)) {
 | 
	
		
			
				|  |  | +                if (!url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
 | 
	
		
			
				|  |  | +                    url = KuaishouInterfaceConstant.HTTPS_PREFIX + url;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                materialInfo.setUrl(url);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            materialInfo.setUrl(url);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        //  修改素材库 相关联code
 | 
	
		
			
				|  |  | -        if (!Check.isNull(materialInfo.getCode())) {
 | 
	
		
			
				|  |  | -            String code = materialInfoEntity.getCode();
 | 
	
		
			
				|  |  | -            if (!Check.isNull(code)) {
 | 
	
		
			
				|  |  | -                MaterialTag updateMaterialTag = new MaterialTag();
 | 
	
		
			
				|  |  | -                updateMaterialTag.setMaterialId(materialInfo.getCode());
 | 
	
		
			
				|  |  | -                QueryWrapper<MaterialTag> tagQueryWrapper = new QueryWrapper<>();
 | 
	
		
			
				|  |  | -                tagQueryWrapper.eq("material_id", code);
 | 
	
		
			
				|  |  | -                materialTagService.update(updateMaterialTag, tagQueryWrapper);
 | 
	
		
			
				|  |  | -                MaterialParameter updateParameter = new MaterialParameter();
 | 
	
		
			
				|  |  | -                updateParameter.setMaterialId(materialInfo.getCode());
 | 
	
		
			
				|  |  | -                QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
 | 
	
		
			
				|  |  | -                parameterQueryWrapper.eq("material_id", code);
 | 
	
		
			
				|  |  | -                materialParameterService.update(updateParameter, parameterQueryWrapper);
 | 
	
		
			
				|  |  | -                MaterialAscription updateMaterialAscription = new MaterialAscription();
 | 
	
		
			
				|  |  | -                updateMaterialAscription.setMaterialId(materialInfo.getCode());
 | 
	
		
			
				|  |  | -                QueryWrapper<MaterialAscription> ascriptionQueryWrapper = new QueryWrapper<>();
 | 
	
		
			
				|  |  | -                ascriptionQueryWrapper.eq("material_id", code);
 | 
	
		
			
				|  |  | -                materialAscriptionService.update(updateMaterialAscription, ascriptionQueryWrapper);
 | 
	
		
			
				|  |  | +            //  修改素材库 相关联code
 | 
	
		
			
				|  |  | +            if (!Check.isNull(materialInfo.getCode())) {
 | 
	
		
			
				|  |  | +                String code = materialInfoEntity.getCode();
 | 
	
		
			
				|  |  | +                if (!Check.isNull(code)) {
 | 
	
		
			
				|  |  | +                    MaterialTag updateMaterialTag = new MaterialTag();
 | 
	
		
			
				|  |  | +                    updateMaterialTag.setMaterialId(materialInfo.getCode());
 | 
	
		
			
				|  |  | +                    QueryWrapper<MaterialTag> tagQueryWrapper = new QueryWrapper<>();
 | 
	
		
			
				|  |  | +                    tagQueryWrapper.eq("material_id", code);
 | 
	
		
			
				|  |  | +                    materialTagService.update(updateMaterialTag, tagQueryWrapper);
 | 
	
		
			
				|  |  | +                    MaterialParameter updateParameter = new MaterialParameter();
 | 
	
		
			
				|  |  | +                    updateParameter.setMaterialId(materialInfo.getCode());
 | 
	
		
			
				|  |  | +                    QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
 | 
	
		
			
				|  |  | +                    parameterQueryWrapper.eq("material_id", code);
 | 
	
		
			
				|  |  | +                    materialParameterService.update(updateParameter, parameterQueryWrapper);
 | 
	
		
			
				|  |  | +                    MaterialAscription updateMaterialAscription = new MaterialAscription();
 | 
	
		
			
				|  |  | +                    updateMaterialAscription.setMaterialId(materialInfo.getCode());
 | 
	
		
			
				|  |  | +                    QueryWrapper<MaterialAscription> ascriptionQueryWrapper = new QueryWrapper<>();
 | 
	
		
			
				|  |  | +                    ascriptionQueryWrapper.eq("material_id", code);
 | 
	
		
			
				|  |  | +                    materialAscriptionService.update(updateMaterialAscription, ascriptionQueryWrapper);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        //  审核通过自动同步到到媒体后台
 | 
	
		
			
				|  |  | -       /* Long projectId = materialInfoEntity.getProjectId();
 | 
	
		
			
				|  |  | -        Project project = projectService.getById(projectId);
 | 
	
		
			
				|  |  | -        if (!Check.isNull(projectId)) {
 | 
	
		
			
				|  |  | -            if ("2".equals(project.getMediaId())) {
 | 
	
		
			
				|  |  | -                if (!Check.isNull(materialInfo.getStatus())) {
 | 
	
		
			
				|  |  | -                    Integer status = materialInfo.getStatus();
 | 
	
		
			
				|  |  | -                    if (status == 1) {
 | 
	
		
			
				|  |  | -                        Thread thread = new Thread() {
 | 
	
		
			
				|  |  | -                            @Override
 | 
	
		
			
				|  |  | -                            public void run() {
 | 
	
		
			
				|  |  | -                                log.info("开始自动同步素材,code:{}", materialInfoEntity.getCode());
 | 
	
		
			
				|  |  | -                                uploadService.upload(materialInfoEntity);
 | 
	
		
			
				|  |  | -                            }
 | 
	
		
			
				|  |  | -                        };
 | 
	
		
			
				|  |  | -                        thread.start();
 | 
	
		
			
				|  |  | +            //  审核通过自动同步到到媒体后台
 | 
	
		
			
				|  |  | +           /* Long projectId = materialInfoEntity.getProjectId();
 | 
	
		
			
				|  |  | +            Project project = projectService.getById(projectId);
 | 
	
		
			
				|  |  | +            if (!Check.isNull(projectId)) {
 | 
	
		
			
				|  |  | +                if ("2".equals(project.getMediaId())) {
 | 
	
		
			
				|  |  | +                    if (!Check.isNull(materialInfo.getStatus())) {
 | 
	
		
			
				|  |  | +                        Integer status = materialInfo.getStatus();
 | 
	
		
			
				|  |  | +                        if (status == 1) {
 | 
	
		
			
				|  |  | +                            Thread thread = new Thread() {
 | 
	
		
			
				|  |  | +                                @Override
 | 
	
		
			
				|  |  | +                                public void run() {
 | 
	
		
			
				|  |  | +                                    log.info("开始自动同步素材,code:{}", materialInfoEntity.getCode());
 | 
	
		
			
				|  |  | +                                    uploadService.upload(materialInfoEntity);
 | 
	
		
			
				|  |  | +                                }
 | 
	
		
			
				|  |  | +                            };
 | 
	
		
			
				|  |  | +                            thread.start();
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        }*/
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        boolean ok = materialInfoService.updateById(materialInfo);
 | 
	
		
			
				|  |  | -        if (ok) {
 | 
	
		
			
				|  |  | -            result.success("修改成功!");
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +            }*/
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        Integer status = materialInfo.getStatus();
 | 
	
		
			
				|  |  | -        // 如果状态为2 审核拒绝 给上传人发送消息
 | 
	
		
			
				|  |  | -        if (status == 2) {
 | 
	
		
			
				|  |  | -            Project project = projectService.getById(materialInfoEntity.getProjectId());
 | 
	
		
			
				|  |  | -            String text = messageTemplate.getMaterialRejectTemplate(project.getProjectName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
 | 
	
		
			
				|  |  | -            sendMessageService.sendMessage(materialInfoEntity.getUserId(), text);
 | 
	
		
			
				|  |  | +            boolean ok = materialInfoService.updateById(materialInfo);
 | 
	
		
			
				|  |  | +            if (ok) {
 | 
	
		
			
				|  |  | +                result.success("修改成功!");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            String feishuText = messageTemplate.getFeishuMaterialRejectTemplate(project.getProjectName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
 | 
	
		
			
				|  |  | -            sendMessageService.sendFeishuMessage(materialInfoEntity.getUserId(), feishuText);
 | 
	
		
			
				|  |  | +            Integer status = materialInfo.getStatus();
 | 
	
		
			
				|  |  | +            // 如果状态为2 审核拒绝 给上传人发送消息
 | 
	
		
			
				|  |  | +            if (status == 2) {
 | 
	
		
			
				|  |  | +                Project project = projectService.getById(materialInfoEntity.getProjectId());
 | 
	
		
			
				|  |  | +                String text = messageTemplate.getMaterialRejectTemplate(project.getProjectName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
 | 
	
		
			
				|  |  | +                sendMessageService.sendMessage(materialInfoEntity.getUserId(), text);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          return result;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -498,10 +493,6 @@ public class MaterialInfoController {
 | 
	
		
			
				|  |  |          List<String> effiList = materialInfoService.getEffiCode();
 | 
	
		
			
				|  |  |          Object createTime = materialInfo.getCreateTime();
 | 
	
		
			
				|  |  |          materialInfo.setCreateTime(null);
 | 
	
		
			
				|  |  | -        Long projectId = materialInfo.getProjectId();
 | 
	
		
			
				|  |  | -        if (projectId != null) {
 | 
	
		
			
				|  |  | -            queryWrapper.eq("project_id", projectId);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  |          queryWrapper.in("code", effiList);
 | 
	
		
			
				|  |  |          queryWrapper.groupBy("code");
 | 
	
		
			
				|  |  |          //queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
 |