|
@@ -4,6 +4,7 @@ package org.jeecg.modules.ctop.controller;
|
|
|
import cn.com.ctop.common.module.entity.MaterialInfo;
|
|
|
import cn.com.ctop.common.module.service.IMaterialInfoService;
|
|
|
import cn.com.ctop.common.module.utils.Check;
|
|
|
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -20,6 +21,7 @@ import org.jeecg.common.system.query.QueryGenerator;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
|
+import org.jeecg.modules.ctop.service.IProjectMemberService;
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
@@ -65,7 +67,6 @@ public class MaterialInfoController {
|
|
|
|
|
|
@GetMapping(value = "/getDetail")
|
|
|
public JSONObject getDetail(String materialId) {
|
|
|
-
|
|
|
return materialInfoService.getDetail(materialId);
|
|
|
|
|
|
}
|
|
@@ -90,6 +91,9 @@ public class MaterialInfoController {
|
|
|
* @param req
|
|
|
* @return
|
|
|
*/
|
|
|
+ @Autowired
|
|
|
+ private IProjectMemberService memberService;
|
|
|
+
|
|
|
@AutoLog(value = "素材信息-分页列表查询")
|
|
|
@ApiOperation(value = "素材信息-分页列表查询", notes = "素材信息-分页列表查询")
|
|
|
@GetMapping(value = "/list")
|
|
@@ -99,24 +103,43 @@ public class MaterialInfoController {
|
|
|
HttpServletRequest req) {
|
|
|
|
|
|
Result<IPage<MaterialInfo>> result = new Result<>();
|
|
|
+ QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
|
|
|
Object createTime = materialInfo.getCreateTime();
|
|
|
materialInfo.setCreateTime(null);
|
|
|
if (!Check.isNull(materialInfo.getUserId())) {
|
|
|
String roleCode = materialInfoService.getRoleCodeByUserId(materialInfo.getUserId());
|
|
|
- if ("admin".equals(roleCode) || "operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode)) {
|
|
|
+ if ("admin".equals(roleCode) || "operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode)) {
|
|
|
+ materialInfo.setUserId(null);
|
|
|
+ queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
|
|
|
+ } else if ("designTeamLeader".equals(roleCode) || "planeLeader".equals(roleCode) || "plane".equals(roleCode) || "plan".equals(roleCode) || "shot".equals(roleCode)) {
|
|
|
+ String userId = materialInfo.getUserId();
|
|
|
materialInfo.setUserId(null);
|
|
|
+ queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
|
|
|
+ if (Check.isNull(materialInfo.getProjectId())) {
|
|
|
+ List<Long> projects = memberService.selectProjectsByUserId(userId);
|
|
|
+ if (!Check.isNull(projects)) {
|
|
|
+ queryWrapper.in("project_id", projects);
|
|
|
+ } else {
|
|
|
+ result.setSuccess(true);
|
|
|
+ result.setResult(null);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
|
|
|
}
|
|
|
- }
|
|
|
- QueryWrapper<MaterialInfo> queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
|
|
|
- if (!Check.isNull(createTime)) {
|
|
|
- try {
|
|
|
- Map<String, Object> map = DateUtils.getStartEndTime(createTime.toString());
|
|
|
- queryWrapper.ge("create_time", map.get("start"));
|
|
|
- queryWrapper.lt("create_time", map.get("end"));
|
|
|
- } catch (ParseException e) {
|
|
|
- e.printStackTrace();
|
|
|
+ if (!Check.isNull(createTime)) {
|
|
|
+ try {
|
|
|
+ Map<String, Object> map = DateUtils.getStartEndTime(createTime.toString());
|
|
|
+ queryWrapper.ge("create_time", map.get("start"));
|
|
|
+ queryWrapper.lt("create_time", map.get("end"));
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
Page<MaterialInfo> page = new Page<>(pageNo, pageSize);
|
|
|
IPage<MaterialInfo> pageList = materialInfoService.page(page, queryWrapper);
|
|
|
result.setSuccess(true);
|
|
@@ -193,6 +216,14 @@ public class MaterialInfoController {
|
|
|
if (materialInfoEntity == null) {
|
|
|
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);
|
|
|
+ }
|
|
|
+
|
|
|
boolean ok = materialInfoService.updateById(materialInfo);
|
|
|
if (ok) {
|
|
|
result.success("修改成功!");
|