|
@@ -1,5 +1,6 @@
|
|
package org.springblade.business.controller;
|
|
package org.springblade.business.controller;
|
|
|
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.nacos.common.utils.StringUtils;
|
|
import com.alibaba.nacos.common.utils.StringUtils;
|
|
@@ -7,8 +8,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import io.swagger.annotations.*;
|
|
import io.swagger.annotations.*;
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
-
|
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
import org.springblade.business.entity.ImageClassificationShow;
|
|
import org.springblade.business.entity.ImageClassificationShow;
|
|
import org.springblade.business.service.ImageClassificationShowService;
|
|
import org.springblade.business.service.ImageClassificationShowService;
|
|
@@ -25,6 +24,8 @@ import org.springblade.manager.feign.ImageClassificationConfigClient;
|
|
import org.springblade.manager.feign.WbsTreeContractClient;
|
|
import org.springblade.manager.feign.WbsTreeContractClient;
|
|
import org.springblade.manager.vo.ImageClassificationConfigVO;
|
|
import org.springblade.manager.vo.ImageClassificationConfigVO;
|
|
import org.springblade.manager.vo.WbsTreeContractTreeVOS;
|
|
import org.springblade.manager.vo.WbsTreeContractTreeVOS;
|
|
|
|
+import org.springblade.system.entity.Dict;
|
|
|
|
+import org.springblade.system.feign.IDictClient;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
@@ -32,7 +33,6 @@ import org.springblade.business.entity.ImageClassificationFile;
|
|
import org.springblade.business.vo.ImageClassificationFileVO;
|
|
import org.springblade.business.vo.ImageClassificationFileVO;
|
|
import org.springblade.business.service.IImageClassificationFileService;
|
|
import org.springblade.business.service.IImageClassificationFileService;
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
-import java.io.IOException;
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -59,6 +59,8 @@ public class ImageClassificationFileController extends BladeController {
|
|
|
|
|
|
private final WbsTreeContractClient wbsTreeContractClient;
|
|
private final WbsTreeContractClient wbsTreeContractClient;
|
|
|
|
|
|
|
|
+ private final IDictClient dictClient;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 获取当前合同段的工程划分
|
|
* 获取当前合同段的工程划分
|
|
* @param parentId 父节点,为空则查询第一级节点
|
|
* @param parentId 父节点,为空则查询第一级节点
|
|
@@ -76,19 +78,18 @@ public class ImageClassificationFileController extends BladeController {
|
|
//为空,说明初始化
|
|
//为空,说明初始化
|
|
//获取根节点
|
|
//获取根节点
|
|
rootTreeNode = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, "0");
|
|
rootTreeNode = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, "0");
|
|
- if(rootTreeNode != null && rootTreeNode.size() != 0){
|
|
|
|
- rootTreeNode.forEach(vo -> {
|
|
|
|
- //获取一级子节点
|
|
|
|
- List<WbsTreeContractTreeVOS> treeNodes = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, vo.getId());
|
|
|
|
- if(treeNodes != null && treeNodes.size() != 0){
|
|
|
|
- vo.setChildren(treeNodes);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+// if(rootTreeNode != null && rootTreeNode.size() != 0){
|
|
|
|
+// rootTreeNode.forEach(vo -> {
|
|
|
|
+// //获取一级子节点
|
|
|
|
+// List<WbsTreeContractTreeVOS> treeNodes = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, vo.getId());
|
|
|
|
+// if(treeNodes != null && treeNodes.size() != 0){
|
|
|
|
+// vo.setChildren(treeNodes);
|
|
|
|
+// }
|
|
|
|
+// });
|
|
|
|
+// }
|
|
} else {
|
|
} else {
|
|
- // todo 先写死项目ID
|
|
|
|
//不为空,获取其下子节点
|
|
//不为空,获取其下子节点
|
|
- rootTreeNode = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType("1", 1, parentId);
|
|
|
|
|
|
+ rootTreeNode = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, parentId);
|
|
}
|
|
}
|
|
return R.data(rootTreeNode);
|
|
return R.data(rootTreeNode);
|
|
}
|
|
}
|
|
@@ -110,10 +111,11 @@ public class ImageClassificationFileController extends BladeController {
|
|
//判断提交的数据哪些是新增哪些是修改
|
|
//判断提交的数据哪些是新增哪些是修改
|
|
List<ImageClassificationShow> saveShow = new ArrayList<>(), updateShow = new ArrayList<>();
|
|
List<ImageClassificationShow> saveShow = new ArrayList<>(), updateShow = new ArrayList<>();
|
|
shows.forEach(show -> {
|
|
shows.forEach(show -> {
|
|
- if(show.getId() == null){
|
|
|
|
|
|
+ if(show.getId() == null || show.getId() == -1){
|
|
setUserData(show, true);
|
|
setUserData(show, true);
|
|
ImageClassificationShow newShow = new ImageClassificationShow();
|
|
ImageClassificationShow newShow = new ImageClassificationShow();
|
|
BeanUtils.copyProperties(show, newShow);
|
|
BeanUtils.copyProperties(show, newShow);
|
|
|
|
+ newShow.setId(null);
|
|
saveShow.add(newShow);
|
|
saveShow.add(newShow);
|
|
} else {
|
|
} else {
|
|
setUserData(show, false);
|
|
setUserData(show, false);
|
|
@@ -155,7 +157,7 @@ public class ImageClassificationFileController extends BladeController {
|
|
showClassifyIdList.forEach(show -> {
|
|
showClassifyIdList.forEach(show -> {
|
|
for(ImageClassificationConfigVO vo : sysClassifyConfigVoList){
|
|
for(ImageClassificationConfigVO vo : sysClassifyConfigVoList){
|
|
if(show.getClassifyId().equals(vo.getId())){
|
|
if(show.getClassifyId().equals(vo.getId())){
|
|
- vo.setIsShow(show.getIsShow());
|
|
|
|
|
|
+ vo.setIsShow(new Integer("1").equals(show.getIsShow()));
|
|
vo.setShowId(show.getId());
|
|
vo.setShowId(show.getId());
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -165,12 +167,12 @@ public class ImageClassificationFileController extends BladeController {
|
|
sysClassifyConfigVoList.forEach(vo -> {
|
|
sysClassifyConfigVoList.forEach(vo -> {
|
|
if(StringUtils.isEmpty(String.valueOf(vo.getShowId()))){
|
|
if(StringUtils.isEmpty(String.valueOf(vo.getShowId()))){
|
|
//默认为不显示
|
|
//默认为不显示
|
|
- vo.setIsShow(0);
|
|
|
|
|
|
+ vo.setIsShow(false);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
//不存在显隐记录,全部默认为显示
|
|
//不存在显隐记录,全部默认为显示
|
|
- sysClassifyConfigVoList.forEach(vo -> vo.setIsShow(1));
|
|
|
|
|
|
+ sysClassifyConfigVoList.forEach(vo -> vo.setIsShow(true));
|
|
}
|
|
}
|
|
|
|
|
|
return R.data(sysClassifyConfigVoList);
|
|
return R.data(sysClassifyConfigVoList);
|
|
@@ -183,7 +185,7 @@ public class ImageClassificationFileController extends BladeController {
|
|
@GetMapping("/getClassIfyList")
|
|
@GetMapping("/getClassIfyList")
|
|
@ApiOperationSupport(order = 8)
|
|
@ApiOperationSupport(order = 8)
|
|
@ApiOperation(value = "获取类型列表(类型主页)")
|
|
@ApiOperation(value = "获取类型列表(类型主页)")
|
|
- public R<List<ImageClassificationConfig>> getClassIfyList(@RequestParam String projectId, @RequestParam String contractId){
|
|
|
|
|
|
+ public R<List<ImageClassificationConfigVO>> getClassIfyList(@RequestParam String projectId, @RequestParam String contractId){
|
|
//获取当前项目下的类型显隐情况
|
|
//获取当前项目下的类型显隐情况
|
|
List<ImageClassificationShow> showClassifyIdList = this.imageClassificationShowService.queryShowClassify(projectId, contractId, "valid");
|
|
List<ImageClassificationShow> showClassifyIdList = this.imageClassificationShowService.queryShowClassify(projectId, contractId, "valid");
|
|
|
|
|
|
@@ -196,19 +198,28 @@ public class ImageClassificationFileController extends BladeController {
|
|
} else {
|
|
} else {
|
|
configList = this.imageClassificationConfigClient.queryClassificationConfigList();
|
|
configList = this.imageClassificationConfigClient.queryClassificationConfigList();
|
|
}
|
|
}
|
|
|
|
+ //转换类型
|
|
|
|
+ List<ImageClassificationConfigVO> configVoList = JSONArray.parseArray(JSONObject.toJSONString(configList), ImageClassificationConfigVO.class);
|
|
|
|
|
|
- return R.data(configList);
|
|
|
|
- }
|
|
|
|
|
|
+ //获取项目阶段字典
|
|
|
|
+ List<Dict> dictBizList = this.dictClient.getList("project_stage").getData();
|
|
|
|
|
|
- /**
|
|
|
|
- * 下载
|
|
|
|
- * @param id 要下载的数据ID
|
|
|
|
- */
|
|
|
|
- @PostMapping("/downloadFileByUrl")
|
|
|
|
- @ApiOperationSupport(order = 7)
|
|
|
|
- @ApiOperation(value = "下载", notes = "传入id主键")
|
|
|
|
- public void downloadFileByUrl(@RequestParam String id, HttpServletResponse response) throws IOException {
|
|
|
|
|
|
+ configVoList.forEach(vo -> {
|
|
|
|
+ //转换项目阶段
|
|
|
|
+ for(Dict biz : dictBizList){
|
|
|
|
+ if(biz.getDictKey().equals(vo.getProjectStage())){
|
|
|
|
+ vo.setProjectStage(biz.getDictValue());
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //获取当前节点下的文件
|
|
|
|
+ Integer count = this.imageClassificationFileService.queryCurrentClassifyAllFileCount(projectId, contractId, vo.getId());
|
|
|
|
+ vo.setCount(count);
|
|
|
|
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ return R.data(configVoList);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -258,8 +269,15 @@ public class ImageClassificationFileController extends BladeController {
|
|
@PostMapping("/queryById")
|
|
@PostMapping("/queryById")
|
|
@ApiOperationSupport(order = 3)
|
|
@ApiOperationSupport(order = 3)
|
|
@ApiOperation(value = "详情", notes = "传入主键")
|
|
@ApiOperation(value = "详情", notes = "传入主键")
|
|
- public R<ImageClassificationFile> queryById(@RequestParam String id){
|
|
|
|
- return R.data(this.imageClassificationFileService.getById(id));
|
|
|
|
|
|
+ public R<ImageClassificationFileVO> queryById(@RequestParam String id){
|
|
|
|
+ ImageClassificationFile file = this.imageClassificationFileService.getById(id);
|
|
|
|
+ if(file != null){
|
|
|
|
+ ImageClassificationFileVO vo = new ImageClassificationFileVO();
|
|
|
|
+ BeanUtils.copyProperties(file, vo);
|
|
|
|
+ vo.setShootingTimeStr(DateUtil.format(file.getShootingTime(), "yyyy-MM-dd"));
|
|
|
|
+ return R.data(vo);
|
|
|
|
+ }
|
|
|
|
+ return R.data(null);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -300,9 +318,20 @@ public class ImageClassificationFileController extends BladeController {
|
|
ImageClassificationFile newFile = new ImageClassificationFile();
|
|
ImageClassificationFile newFile = new ImageClassificationFile();
|
|
//复制数据
|
|
//复制数据
|
|
BeanUtils.copyProperties(fileVO, newFile);
|
|
BeanUtils.copyProperties(fileVO, newFile);
|
|
|
|
+ try{
|
|
|
|
+ String shootingTime = fileVO.getShootingTimeStr();
|
|
|
|
+ String format = "yyyy-MM-dd";
|
|
|
|
+ if(shootingTime.contains(":")){
|
|
|
|
+ format = "yyyy-MM-dd HH:mm:ss";
|
|
|
|
+ }
|
|
|
|
+ newFile.setShootingTime(DateUtil.parseLocalDateTime(shootingTime, format));
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+
|
|
//设置用户信息
|
|
//设置用户信息
|
|
setUserData(newFile, isCreate);
|
|
setUserData(newFile, isCreate);
|
|
- return new ImageClassificationFile();
|
|
|
|
|
|
+ return newFile;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -322,7 +351,7 @@ public class ImageClassificationFileController extends BladeController {
|
|
//记录操作人信息
|
|
//记录操作人信息
|
|
if(isCreate){
|
|
if(isCreate){
|
|
imageClassificationShow.setCreateUser(user.getUserId());
|
|
imageClassificationShow.setCreateUser(user.getUserId());
|
|
- imageClassificationShow.setCreateDept(Long.parseLong(user.getDeptId()));
|
|
|
|
|
|
+ imageClassificationShow.setCreateDept(user.getDeptId().contains(",") ? Long.parseLong(user.getDeptId().split(",")[0]) : Long.parseLong(user.getDeptId()));
|
|
} else {
|
|
} else {
|
|
imageClassificationShow.setUpdateUser(user.getUserId());
|
|
imageClassificationShow.setUpdateUser(user.getUserId());
|
|
imageClassificationShow.setUpdateTime(new Date());
|
|
imageClassificationShow.setUpdateTime(new Date());
|
|
@@ -336,7 +365,7 @@ public class ImageClassificationFileController extends BladeController {
|
|
//记录操作人信息
|
|
//记录操作人信息
|
|
if(isCreate){
|
|
if(isCreate){
|
|
imageClassificationFile.setCreateUser(user.getUserId());
|
|
imageClassificationFile.setCreateUser(user.getUserId());
|
|
- imageClassificationFile.setCreateDept(Long.parseLong(user.getDeptId()));
|
|
|
|
|
|
+ imageClassificationFile.setCreateDept(user.getDeptId().contains(",") ? Long.parseLong(user.getDeptId().split(",")[0]) : Long.parseLong(user.getDeptId()));
|
|
} else {
|
|
} else {
|
|
imageClassificationFile.setUpdateUser(user.getUserId());
|
|
imageClassificationFile.setUpdateUser(user.getUserId());
|
|
imageClassificationFile.setUpdateTime(new Date());
|
|
imageClassificationFile.setUpdateTime(new Date());
|