|
@@ -16,25 +16,27 @@
|
|
|
*/
|
|
|
package org.springblade.business.controller;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import io.swagger.annotations.*;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.Valid;
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
-import org.springblade.business.entity.ConstructionLedger;
|
|
|
-import org.springblade.business.entity.ContractTreeDrawings;
|
|
|
-import org.springblade.business.entity.TreeContractFirst;
|
|
|
+import org.jetbrains.annotations.NotNull;
|
|
|
+import org.springblade.business.entity.*;
|
|
|
+import org.springblade.business.feign.OperationLogClient;
|
|
|
+import org.springblade.business.feign.TaskClient;
|
|
|
import org.springblade.business.feignClient.ClientTreePublicCodeClientImpl;
|
|
|
import org.springblade.business.service.IConstructionLedgerService;
|
|
|
import org.springblade.business.service.IContractTreeDrawingsService;
|
|
|
import org.springblade.business.service.ITreeContractFirstService;
|
|
|
-import org.springblade.business.vo.CopyContractTreeNodeVO;
|
|
|
-import org.springblade.business.vo.FileUserVO;
|
|
|
-import org.springblade.business.vo.InformationQueryVO;
|
|
|
-import org.springblade.business.vo.AddContractTreeNodeVO;
|
|
|
+import org.springblade.business.vo.*;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
@@ -53,11 +55,11 @@ import org.springblade.system.feign.IDictBizClient;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springblade.business.entity.InformationQuery;
|
|
|
import org.springblade.business.service.IInformationQueryService;
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
|
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 资料填报及查询控制器
|
|
@@ -89,6 +91,144 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
|
|
|
private final IConstructionLedgerService constructionLedgerService;
|
|
|
|
|
|
+ private final TaskClient taskClient;
|
|
|
+
|
|
|
+ private final OperationLogClient operationLogClient;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 本地验签
|
|
|
+ */
|
|
|
+ @PostMapping("/localVerify")
|
|
|
+ @ApiOperationSupport(order = 21)
|
|
|
+ @ApiOperation(value = "本地验签")
|
|
|
+ public R<Boolean> localVerify(@RequestParam String ids){
|
|
|
+ return R.data(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 在线验签
|
|
|
+ */
|
|
|
+ @PostMapping("/onlineVerify")
|
|
|
+ @ApiOperationSupport(order = 21)
|
|
|
+ @ApiOperation(value = "在线验签")
|
|
|
+ public R<Boolean> onlineVerify(@RequestParam String ids){
|
|
|
+ return R.data(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量打印
|
|
|
+ */
|
|
|
+ @PostMapping("/batchPrint")
|
|
|
+ @ApiOperationSupport(order = 20)
|
|
|
+ @ApiOperation(value = "批量打印")
|
|
|
+ public R<String> batchPrint(@RequestParam String ids){
|
|
|
+ return R.data(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量下载
|
|
|
+ */
|
|
|
+ @PostMapping("/batchDownloadFileToZip")
|
|
|
+ @ApiOperationSupport(order = 19)
|
|
|
+ @ApiOperation(value = "批量下载")
|
|
|
+ public void batchDownloadFileToZip(String ids, HttpServletResponse response){
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量废除
|
|
|
+ */
|
|
|
+ @PostMapping("/batchAbolish")
|
|
|
+ @ApiOperationSupport(order = 18)
|
|
|
+ @ApiOperation(value = "批量废除")
|
|
|
+ public R<Boolean> batchAbolish(@RequestParam String ids){
|
|
|
+ //获取所有相关任务记录
|
|
|
+ List<Task> taskList = this.taskClient.queryTaskListByFormDataId(ids);
|
|
|
+ if(taskList != null && taskList.size() > 0){
|
|
|
+ //执行废除
|
|
|
+ for(Task task : taskList){
|
|
|
+ if(new Integer("1").equals(task.getStatus())){
|
|
|
+ //正在审批,调用废除
|
|
|
+ this.taskClient.abolishTask(task);
|
|
|
+ } else if(new Integer("2").equals(task.getStatus())) {
|
|
|
+ //已审批的任务,修改业务数据的审批状态为未上报并撤签即可
|
|
|
+ this.informationQueryService.update(Wrappers.<InformationQuery>lambdaUpdate().set(InformationQuery::getStatus, 3).in(InformationQuery::getId, Arrays.asList(task.getFormDataId().split(","))));
|
|
|
+ // todo ================== 调用撤签
|
|
|
+ // todo ================== 调用撤签
|
|
|
+ }
|
|
|
+ //保存操作记录
|
|
|
+ this.operationLogClient.saveUserOperationLog(6, "资料管理", "工序资料", task.getFormDataId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.data(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量上报
|
|
|
+ */
|
|
|
+ @PostMapping("/batchTask")
|
|
|
+ @ApiOperationSupport(order = 17)
|
|
|
+ @ApiOperation(value = "批量上报")
|
|
|
+ public R<Boolean> batchTask(@RequestBody WriteBatchTaskVO batchTaskVO){
|
|
|
+ if(StringUtils.isNotEmpty(batchTaskVO.getIds())){
|
|
|
+ //获取数据源id
|
|
|
+ String[] ids = batchTaskVO.getIds().split(",");
|
|
|
+ if(ids.length > 0){
|
|
|
+ for(String id : ids){
|
|
|
+ //生成任务实体
|
|
|
+ TaskVO taskVO = new TaskVO();
|
|
|
+ BeanUtils.copyProperties(batchTaskVO, taskVO);
|
|
|
+ //设置数据源指向
|
|
|
+ taskVO.setFormDataId(id);
|
|
|
+ //设置上报类型
|
|
|
+ taskVO.setApprovalType(1);
|
|
|
+ //上报
|
|
|
+ if(this.taskClient.startTask(taskVO).getData()){
|
|
|
+ //查询审批人
|
|
|
+ List<TaskParallel> taskUsers = this.taskClient.queryApprovalUser(id);
|
|
|
+ if(taskUsers.size() > 0){
|
|
|
+ //生成审批人信息
|
|
|
+ StringBuilder stringBuilder = new StringBuilder();
|
|
|
+ taskUsers.forEach(users -> stringBuilder.append(",").append(users.getTaskUser()).append("-").append(users.getTaskUserName()));
|
|
|
+ //修改记录
|
|
|
+ this.informationQueryService.update(Wrappers.<InformationQuery>lambdaUpdate().set(InformationQuery::getStatus, 1).set(InformationQuery::getAuditUserIdAndName, stringBuilder.substring(1)).eq(InformationQuery::getId, id));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //保存操作记录
|
|
|
+ this.operationLogClient.saveUserOperationLog(5, "资料管理", "工序资料", batchTaskVO.getIds());
|
|
|
+ return R.data(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.data(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 自定义排序
|
|
|
+ */
|
|
|
+ @PostMapping("/diySort")
|
|
|
+ @ApiOperationSupport(order = 16)
|
|
|
+ @ApiOperation(value = "自定义排序")
|
|
|
+ public R<Boolean> diySort(@RequestBody DiySortVO vo){
|
|
|
+ //获取排序集合
|
|
|
+ List<String> sortList = vo.getSortList();
|
|
|
+ if(sortList.size() > 0){
|
|
|
+ for(int i = 0, l = sortList.size(); i < l; i ++){
|
|
|
+ try{
|
|
|
+ WbsTreeContract newData = new WbsTreeContract();
|
|
|
+ newData.setPKeyId(Long.parseLong(sortList.get(i)));
|
|
|
+ newData.setSort(i);
|
|
|
+ //修改排序
|
|
|
+ this.wbsTreeContractClient.updateContractNodeParameter(newData);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return R.data(false);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 复制节点
|
|
|
*/
|
|
@@ -200,17 +340,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
- if(saveList.size() > 0){
|
|
|
- //保存施工日志
|
|
|
- if(saveLedger.size() > 0){
|
|
|
- this.constructionLedgerService.saveBatch(saveLedger);
|
|
|
- }
|
|
|
-
|
|
|
- //保存节点
|
|
|
- return R.data(this.wbsTreeContractClient.saveBatch(saveList));
|
|
|
- }
|
|
|
-
|
|
|
- return R.data(false);
|
|
|
+ return this.saveOrCopyNodeTree(saveList, saveLedger);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -346,6 +476,8 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
if(StringUtils.isEmpty(node.getDeptName()) || "null".equals(String.valueOf(node.getPKeyId())) || StringUtils.isEmpty(String.valueOf(node.getPKeyId()))){
|
|
|
return R.data(-1, false , "缺少参数");
|
|
|
}
|
|
|
+ //保存操作记录
|
|
|
+ this.operationLogClient.saveUserOperationLog(3, "资料管理", "工序资料", pKeyId);
|
|
|
return R.data(this.wbsTreeContractClient.updateContractNodeParameter(node));
|
|
|
}
|
|
|
|
|
@@ -373,6 +505,8 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
@ApiOperation(value = "删除节点")
|
|
|
@ApiImplicitParam(name = "ids", value = "节点的primaryKeyId")
|
|
|
public R<Boolean> removeContractTreeNode(@RequestParam String ids){
|
|
|
+ //保存操作记录
|
|
|
+ this.operationLogClient.saveUserOperationLog(4, "资料管理", "工序资料", ids);
|
|
|
return R.data(this.wbsTreeContractClient.removeContractTreeNode(ids));
|
|
|
}
|
|
|
|
|
@@ -388,9 +522,14 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
WbsTreeContract treeContract = this.wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(Long.parseLong(vo.getCurrentNodePrimaryKeyId()));
|
|
|
|
|
|
//半选
|
|
|
- List<String> halfSelectedList = vo.getHalfSelectedList();
|
|
|
+ List<AddContractTreeNodeVO.Node> halfSelectedNodeList = vo.getHalfSelectedList();
|
|
|
//全选
|
|
|
- List<String> allSelectedList = vo.getAllSelectedList();
|
|
|
+ List<AddContractTreeNodeVO.Node> allSelectedNodeList = vo.getAllSelectedList();
|
|
|
+ //勾选的数据
|
|
|
+ List<AddContractTreeNodeVO.Node> selectList = new ArrayList<>();
|
|
|
+ selectList.addAll(halfSelectedNodeList);
|
|
|
+ selectList.addAll(allSelectedNodeList);
|
|
|
+
|
|
|
//所有相关节点集合
|
|
|
List<WbsTreePrivate> selectedNodeList = new ArrayList<>();
|
|
|
|
|
@@ -398,10 +537,13 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
if("1".equals(vo.getSaveType())){
|
|
|
//todo 当前节点及其子节点
|
|
|
//当前节点及其子节点时,半选说明其下的子节点并不是全部选中的,所以这时候只需要根据全选的查询其全部子节点即可
|
|
|
- if(allSelectedList != null && allSelectedList.size() > 0){
|
|
|
+ if(allSelectedNodeList.size() > 0){
|
|
|
+ //获取主键
|
|
|
+ List<String> allSelectedList = allSelectedNodeList.stream().map(AddContractTreeNodeVO.Node::getPrimaryKeyId).distinct().collect(Collectors.toList());
|
|
|
+ //查询对应数据
|
|
|
selectedNodeList = this.wbsTreePrivateClient.queryByPKeyIds(allSelectedList);
|
|
|
//剔除与当前操作节点相同的ID
|
|
|
- selectedNodeList.removeIf(wbsTreePrivate -> vo.getCurrentNodePrimaryKeyId().equals(wbsTreePrivate.getId().toString()));
|
|
|
+ selectedNodeList.removeIf(wbsTreePrivate -> treeContract.getId().equals(wbsTreePrivate.getId()));
|
|
|
|
|
|
//全选的集合则进一步向下查询
|
|
|
List<WbsTreePrivate> childList = new ArrayList<>();
|
|
@@ -424,29 +566,20 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
selectedNodeList.addAll(childList);
|
|
|
}
|
|
|
//处理半选
|
|
|
- if(halfSelectedList != null && halfSelectedList.size() > 0){
|
|
|
- List<WbsTreePrivate> halfSelectedNodeList = this.wbsTreePrivateClient.queryByPKeyIds(halfSelectedList);
|
|
|
- //剔除与当前操作节点相同的ID
|
|
|
- halfSelectedNodeList.removeIf(wbsTreePrivate -> vo.getCurrentNodePrimaryKeyId().equals(wbsTreePrivate.getId().toString()));
|
|
|
- //设置到集合中
|
|
|
- selectedNodeList.addAll(halfSelectedNodeList);
|
|
|
- }
|
|
|
+ this.disposeHalfSelectList(vo, halfSelectedNodeList, selectedNodeList);
|
|
|
|
|
|
} else {
|
|
|
//todo 仅当前节点操作
|
|
|
- if(halfSelectedList != null && halfSelectedList.size() > 0){
|
|
|
+ if(halfSelectedNodeList.size() > 0){
|
|
|
+ //获取主键
|
|
|
+ List<String> halfSelectedList = halfSelectedNodeList.stream().map(AddContractTreeNodeVO.Node::getPrimaryKeyId).distinct().collect(Collectors.toList());
|
|
|
+ //查询数据
|
|
|
selectedNodeList = this.wbsTreePrivateClient.queryByPKeyIds(halfSelectedList);
|
|
|
//剔除与当前操作节点相同的ID
|
|
|
- selectedNodeList.removeIf(wbsTreePrivate -> vo.getCurrentNodePrimaryKeyId().equals(wbsTreePrivate.getId().toString()));
|
|
|
- }
|
|
|
-
|
|
|
- if(allSelectedList != null && allSelectedList.size() > 0){
|
|
|
- List<WbsTreePrivate> allSelectedNodeList = this.wbsTreePrivateClient.queryByPKeyIds(allSelectedList);
|
|
|
- //剔除与当前操作节点相同的ID
|
|
|
- allSelectedNodeList.removeIf(wbsTreePrivate -> vo.getCurrentNodePrimaryKeyId().equals(wbsTreePrivate.getId().toString()));
|
|
|
- //设置到集合中
|
|
|
- selectedNodeList.addAll(allSelectedNodeList);
|
|
|
+ selectedNodeList.removeIf(wbsTreePrivate -> treeContract.getId().equals(wbsTreePrivate.getId()));
|
|
|
}
|
|
|
+ //处理半选
|
|
|
+ this.disposeHalfSelectList(vo, allSelectedNodeList, selectedNodeList);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -476,6 +609,18 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
newData.setContractIdRelation(treeContract.getContractIdRelation());
|
|
|
newData.setContractType(treeContract.getContractType());
|
|
|
newData.setCreateTime(new Date());
|
|
|
+
|
|
|
+ //设置名称
|
|
|
+ Iterator<AddContractTreeNodeVO.Node> iterator = selectList.iterator();
|
|
|
+ while (iterator.hasNext()){
|
|
|
+ AddContractTreeNodeVO.Node next = iterator.next();
|
|
|
+ if(next.getPrimaryKeyId().equals(half.getPKeyId().toString())){
|
|
|
+ newData.setFullName(next.getNodeName());
|
|
|
+ iterator.remove();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//设置到保存集合中
|
|
|
saveList.add(newData);
|
|
|
|
|
@@ -487,11 +632,22 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ return this.saveOrCopyNodeTree(saveList, saveLedger);
|
|
|
+ }
|
|
|
+
|
|
|
+ @NotNull
|
|
|
+ private R<Boolean> saveOrCopyNodeTree(List<WbsTreeContract> saveList, List<ConstructionLedger> saveLedger) {
|
|
|
if(saveList.size() > 0){
|
|
|
//保存施工日志
|
|
|
if(saveLedger.size() > 0){
|
|
|
this.constructionLedgerService.saveBatch(saveLedger);
|
|
|
}
|
|
|
+ try{
|
|
|
+ //保存操作记录
|
|
|
+ this.operationLogClient.saveUserOperationLog(2, "资料管理", "工序资料", String.join(",", JSONArray.parseArray(JSONObject.toJSONString(saveList.stream().map(WbsTreeContract::getPKeyId).distinct().collect(Collectors.toList())), String.class)));
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
//保存节点
|
|
|
return R.data(this.wbsTreeContractClient.saveBatch(saveList));
|
|
|
}
|
|
@@ -499,6 +655,22 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
return R.data(false);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 处理半选集合
|
|
|
+ */
|
|
|
+ private void disposeHalfSelectList(@RequestBody AddContractTreeNodeVO vo, List<AddContractTreeNodeVO.Node> allSelectedNodeList, List<WbsTreePrivate> selectedNodeList) {
|
|
|
+ if(allSelectedNodeList != null && allSelectedNodeList.size() > 0){
|
|
|
+ //获取主键
|
|
|
+ List<String> allSelectedList = allSelectedNodeList.stream().map(AddContractTreeNodeVO.Node::getPrimaryKeyId).distinct().collect(Collectors.toList());
|
|
|
+ //查询对应数据
|
|
|
+ List<WbsTreePrivate> allSelectedNodeLists = this.wbsTreePrivateClient.queryByPKeyIds(allSelectedList);
|
|
|
+ //剔除与当前操作节点相同的ID
|
|
|
+ allSelectedNodeLists.removeIf(wbsTreePrivate -> vo.getCurrentNodePrimaryKeyId().equals(wbsTreePrivate.getId().toString()));
|
|
|
+ //设置到集合中
|
|
|
+ selectedNodeList.addAll(allSelectedNodeLists);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 循环查询子节点
|
|
|
* @param parentList 父节点集合
|