|
@@ -20,7 +20,6 @@ import io.swagger.annotations.ApiOperation;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.shiro.SecurityUtils;
|
|
import org.apache.shiro.SecurityUtils;
|
|
import org.jeecg.common.api.vo.Result;
|
|
import org.jeecg.common.api.vo.Result;
|
|
-import org.jeecg.common.constant.CommonConstant;
|
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
import org.jeecg.common.util.DateUtils;
|
|
import org.jeecg.common.util.DateUtils;
|
|
import org.jeecg.modules.ctop.service.IProjectMemberService;
|
|
import org.jeecg.modules.ctop.service.IProjectMemberService;
|
|
@@ -79,6 +78,9 @@ public class MaterialInfoController {
|
|
@Autowired
|
|
@Autowired
|
|
private IProjectService projectService;
|
|
private IProjectService projectService;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ private IProjectMemberService projectMemberService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
private IByteDanceCreativeWordPackageService byteDanceGeneralCopywriterService;
|
|
private IByteDanceCreativeWordPackageService byteDanceGeneralCopywriterService;
|
|
|
|
|
|
@GetMapping("/supplierWatermark")
|
|
@GetMapping("/supplierWatermark")
|
|
@@ -298,36 +300,57 @@ public class MaterialInfoController {
|
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
|
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
- List<Long> productIds = null;
|
|
|
|
|
|
+ List<Long> projectIds = new ArrayList<>();
|
|
String userId = user.getId();
|
|
String userId = user.getId();
|
|
String roleCode = roleService.getRoleCodeByUserId(userId);
|
|
String roleCode = roleService.getRoleCodeByUserId(userId);
|
|
if (null == tagCode || "".equals(tagCode.trim())) {
|
|
if (null == tagCode || "".equals(tagCode.trim())) {
|
|
tagCode = null;
|
|
tagCode = null;
|
|
}
|
|
}
|
|
- if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || "operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || roleCode.contains("sale")) {
|
|
|
|
- //查询所有
|
|
|
|
- if (null != productId && productId != 0) {
|
|
|
|
- productIds = new ArrayList<>();
|
|
|
|
- productIds.add(productId);
|
|
|
|
|
|
+ //管理员、销售查询所有素材
|
|
|
|
+ if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || roleCode.contains("sale")) {
|
|
|
|
+ if (!Check.isNull(projectId)) {
|
|
|
|
+ projectIds.add(projectId);
|
|
|
|
+ } else if (!Check.isNull(productId)) {
|
|
|
|
+ List<Long> projectIdsByProductId = projectService.getProjectIdsByProductId(productId);
|
|
|
|
+ projectIds.addAll(projectIdsByProductId);
|
|
|
|
+ }
|
|
|
|
+ return materialInfoService.getListByParams(tagCode, type, status, materialName, projectIds, code, startDate, endDate, null, clipId, shotId, planId, offlineFlag, pageNo, pageSize);
|
|
|
|
+ //运营经理、运营、运营助理
|
|
|
|
+ } else if ("operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode)) {
|
|
|
|
+ if (!Check.isNull(projectId)) {
|
|
|
|
+ projectIds.add(projectId);
|
|
|
|
+ } else if (!Check.isNull(productId)) {
|
|
|
|
+ List<Long> partakeProjectIds = projectMemberService.getProjectIdsByProductId(productId, userId);
|
|
|
|
+ List<Long> productProjectIds = projectService.getProjectIdsByProductIdAndNotIn(productId, partakeProjectIds);
|
|
|
|
+ projectIds.addAll(partakeProjectIds);
|
|
|
|
+ projectIds.addAll(productProjectIds);
|
|
|
|
+ } else {
|
|
|
|
+ List<Long> partakeProjectIds = projectMemberService.getProjectIdsByProductId(null, userId);
|
|
|
|
+ List<Long> productProjectIds = projectService.getProjectIdsByProductIdAndNotIn(null, partakeProjectIds);
|
|
|
|
+ projectIds.addAll(partakeProjectIds);
|
|
|
|
+ projectIds.addAll(productProjectIds);
|
|
}
|
|
}
|
|
- return materialInfoService.getListByParams(tagCode, type, status, productIds, materialName, code, startDate, endDate, null, projectId, clipId, shotId, planId,offlineFlag, pageNo, pageSize);
|
|
|
|
|
|
+ return materialInfoService.getListByParams(tagCode, type, status, materialName, projectIds, code, startDate, endDate, null, clipId, shotId, planId, offlineFlag, pageNo, pageSize);
|
|
|
|
+
|
|
} else if ("designTeamLeader".equals(roleCode) || "planeLeader".equals(roleCode) || "plane".equals(roleCode) || "plan".equals(roleCode) || "shot".equals(roleCode)) {
|
|
} else if ("designTeamLeader".equals(roleCode) || "planeLeader".equals(roleCode) || "plane".equals(roleCode) || "plan".equals(roleCode) || "shot".equals(roleCode)) {
|
|
//查询自己所在项目下的数据
|
|
//查询自己所在项目下的数据
|
|
- if (null == productId || productId == 0) {
|
|
|
|
- productIds = memberService.selectProductsByUserId(userId);
|
|
|
|
|
|
+ if (!Check.isNull(projectId)) {
|
|
|
|
+ projectIds.add(projectId);
|
|
|
|
+ } else if (!Check.isNull(productId)) {
|
|
|
|
+ projectIds = projectMemberService.getProjectIdsByProductId(productId, userId);
|
|
|
|
|
|
} else {
|
|
} else {
|
|
- productIds = new ArrayList<>();
|
|
|
|
- productIds.add(productId);
|
|
|
|
|
|
+ projectIds = projectMemberService.getProjectIdsByProductId(null, userId);
|
|
}
|
|
}
|
|
- return materialInfoService.getListByParams(tagCode, type, status, productIds, materialName, code, startDate, endDate, null, projectId, clipId, shotId, planId,offlineFlag, pageNo, pageSize);
|
|
|
|
|
|
+ return materialInfoService.getListByParams(tagCode, type, status, materialName, projectIds, code, startDate, endDate, null, clipId, shotId, planId, offlineFlag, pageNo, pageSize);
|
|
} else {
|
|
} else {
|
|
//查询自己上传的视频
|
|
//查询自己上传的视频
|
|
- if (null != productId && productId != 0) {
|
|
|
|
- productIds = new ArrayList<>();
|
|
|
|
- productIds.add(productId);
|
|
|
|
|
|
+ if (!Check.isNull(projectId)) {
|
|
|
|
+ projectIds.add(projectId);
|
|
|
|
+ } else if (!Check.isNull(productId)) {
|
|
|
|
+ projectIds = projectMemberService.getProjectIdsByProductId(productId, userId);
|
|
}
|
|
}
|
|
- return materialInfoService.getListByParams(tagCode, type, status, productIds, materialName, code, startDate, endDate, userId, projectId, clipId, shotId, planId,offlineFlag, pageNo, pageSize);
|
|
|
|
|
|
+ return materialInfoService.getListByParams(tagCode, type, status, materialName, projectIds, code, startDate, endDate, userId, clipId, shotId, planId, offlineFlag, pageNo, pageSize);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -520,12 +543,12 @@ public class MaterialInfoController {
|
|
if (null != slogans && !slogans.isEmpty()) {
|
|
if (null != slogans && !slogans.isEmpty()) {
|
|
|
|
|
|
|
|
|
|
- for (int i = 0;i<slogans.size();i++) {
|
|
|
|
|
|
+ for (int i = 0; i < slogans.size(); i++) {
|
|
JSONObject slogenInfo = slogans.getJSONObject(i);
|
|
JSONObject slogenInfo = slogans.getJSONObject(i);
|
|
String title = slogenInfo.getString("title");
|
|
String title = slogenInfo.getString("title");
|
|
- title = title.trim().replaceAll("[\\{]{2,}","{");
|
|
|
|
- title = title.trim().replaceAll("[\\}]{2,}","}");
|
|
|
|
- slogenInfo.put("title",title);
|
|
|
|
|
|
+ title = title.trim().replaceAll("[\\{]{2,}", "{");
|
|
|
|
+ title = title.trim().replaceAll("[\\}]{2,}", "}");
|
|
|
|
+ slogenInfo.put("title", title);
|
|
String reg = "\\{[\\u4e00-\\u9fa5\\-]{2,6}\\}";
|
|
String reg = "\\{[\\u4e00-\\u9fa5\\-]{2,6}\\}";
|
|
Pattern pattern = Pattern.compile(reg);
|
|
Pattern pattern = Pattern.compile(reg);
|
|
Matcher matcher = pattern.matcher(title);
|
|
Matcher matcher = pattern.matcher(title);
|
|
@@ -534,44 +557,44 @@ public class MaterialInfoController {
|
|
int len = StringUtils.lengthAsSlogan(title);
|
|
int len = StringUtils.lengthAsSlogan(title);
|
|
int left = title.indexOf("{");
|
|
int left = title.indexOf("{");
|
|
int right = title.indexOf("}");
|
|
int right = title.indexOf("}");
|
|
- if(left >= 0 || right >= 0){
|
|
|
|
|
|
+ if (left >= 0 || right >= 0) {
|
|
int times = 0;
|
|
int times = 0;
|
|
while (matcher.find()) { //此处find()每次被调用后,会偏移到下一个匹配
|
|
while (matcher.find()) { //此处find()每次被调用后,会偏移到下一个匹配
|
|
times++;
|
|
times++;
|
|
- if(times>=3){
|
|
|
|
|
|
+ if (times >= 3) {
|
|
result.setCode(500);
|
|
result.setCode(500);
|
|
result.setMessage("动态词包不合法,词包数量超过2个");
|
|
result.setMessage("动态词包不合法,词包数量超过2个");
|
|
- return result;
|
|
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
String matchStr = matcher.group();//获取当前匹配的值
|
|
String matchStr = matcher.group();//获取当前匹配的值
|
|
- title = title.replace(matchStr,"");
|
|
|
|
- ByteDanceCreativeWordPackage creativeWordPackage = byteDanceGeneralCopywriterService.selectCreativeWordPackageByName(matchStr.substring(1,matchStr.length()-1));
|
|
|
|
- if(Check.isNull(creativeWordPackage)){
|
|
|
|
|
|
+ title = title.replace(matchStr, "");
|
|
|
|
+ ByteDanceCreativeWordPackage creativeWordPackage = byteDanceGeneralCopywriterService.selectCreativeWordPackageByName(matchStr.substring(1, matchStr.length() - 1));
|
|
|
|
+ if (Check.isNull(creativeWordPackage)) {
|
|
result.setCode(500);
|
|
result.setCode(500);
|
|
result.setMessage("动态词包不合法,词包不存在或者含有单独的非词包大括号");
|
|
result.setMessage("动态词包不合法,词包不存在或者含有单独的非词包大括号");
|
|
- return result;
|
|
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
creativeWordIdsArray.add(creativeWordPackage.getCreativeWordId());
|
|
creativeWordIdsArray.add(creativeWordPackage.getCreativeWordId());
|
|
len = len - (right - left) + creativeWordPackage.getMaxWordLen();
|
|
len = len - (right - left) + creativeWordPackage.getMaxWordLen();
|
|
left = title.indexOf("{");
|
|
left = title.indexOf("{");
|
|
right = title.indexOf("}");
|
|
right = title.indexOf("}");
|
|
}
|
|
}
|
|
- if(title.contains("{") || title.contains("}")){
|
|
|
|
|
|
+ if (title.contains("{") || title.contains("}")) {
|
|
return result.error500("大括号单独出现或大括号中内容不合法");
|
|
return result.error500("大括号单独出现或大括号中内容不合法");
|
|
}
|
|
}
|
|
- slogenInfo.put("creative_word_ids",creativeWordIdsArray.toJSONString());
|
|
|
|
|
|
+ slogenInfo.put("creative_word_ids", creativeWordIdsArray.toJSONString());
|
|
}
|
|
}
|
|
//校验标题长度,长度小于5和大于30的全部过滤
|
|
//校验标题长度,长度小于5和大于30的全部过滤
|
|
- if(len<5 || len>30){
|
|
|
|
|
|
+ if (len < 5 || len > 30) {
|
|
result.setCode(500);
|
|
result.setCode(500);
|
|
result.setMessage("文案长度不合法,小于5或大于30");
|
|
result.setMessage("文案长度不合法,小于5或大于30");
|
|
- return result;
|
|
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
- slogenInfoService.deleteAllSlogens(Check.isNull(materialInfo.getProjectId()) ? materialInfoEntity.getProjectId() : materialInfo.getProjectId(),materialInfoEntity.getCode(),user.getId());
|
|
|
|
- slogenInfoService.insertSlogans(Check.isNull(materialInfo.getProjectId()) ? materialInfoEntity.getProjectId() : materialInfo.getProjectId() , materialInfoEntity.getCode(), slogans, user.getId());
|
|
|
|
|
|
+ slogenInfoService.deleteAllSlogens(Check.isNull(materialInfo.getProjectId()) ? materialInfoEntity.getProjectId() : materialInfo.getProjectId(), materialInfoEntity.getCode(), user.getId());
|
|
|
|
+ slogenInfoService.insertSlogans(Check.isNull(materialInfo.getProjectId()) ? materialInfoEntity.getProjectId() : materialInfo.getProjectId(), materialInfoEntity.getCode(), slogans, user.getId());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
boolean ok = materialInfoService.updateById(materialInfo);
|
|
boolean ok = materialInfoService.updateById(materialInfo);
|