|
@@ -0,0 +1,201 @@
|
|
|
+/*
|
|
|
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
|
|
+ *
|
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
|
+ * modification, are permitted provided that the following conditions are met:
|
|
|
+ *
|
|
|
+ * Redistributions of source code must retain the above copyright notice,
|
|
|
+ * this list of conditions and the following disclaimer.
|
|
|
+ * Redistributions in binary form must reproduce the above copyright
|
|
|
+ * notice, this list of conditions and the following disclaimer in the
|
|
|
+ * documentation and/or other materials provided with the distribution.
|
|
|
+ * Neither the name of the dreamlu.net developer nor the names of its
|
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
|
+ * this software without specific prior written permission.
|
|
|
+ * Author: Chill 庄骞 (smallchill@163.com)
|
|
|
+ */
|
|
|
+package org.springblade.business.controller;
|
|
|
+
|
|
|
+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.validation.Valid;
|
|
|
+
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
+import org.springblade.business.vo.FileUserVO;
|
|
|
+import org.springblade.business.vo.InformationQueryVO;
|
|
|
+import org.springblade.core.mp.support.Condition;
|
|
|
+import org.springblade.core.mp.support.Query;
|
|
|
+import org.springblade.core.tool.api.R;
|
|
|
+import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springblade.manager.entity.ContractInfo;
|
|
|
+import org.springblade.manager.feign.ContractClient;
|
|
|
+import org.springblade.manager.feign.WbsTreeContractClient;
|
|
|
+import org.springblade.manager.vo.WbsTreeContractTreeVOS;
|
|
|
+import org.springblade.system.entity.DictBiz;
|
|
|
+import org.springblade.system.feign.IDictBizClient;
|
|
|
+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.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 资料查询控制器
|
|
|
+ *
|
|
|
+ * @author BladeX
|
|
|
+ * @since 2022-06-08
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@AllArgsConstructor
|
|
|
+@RequestMapping("/informationQuery")
|
|
|
+@Api(tags = "资料查询接口")
|
|
|
+public class InformationQueryController extends BladeController {
|
|
|
+
|
|
|
+ private final ContractClient contractClient;
|
|
|
+
|
|
|
+ private final WbsTreeContractClient wbsTreeContractClient;
|
|
|
+
|
|
|
+ private final IInformationQueryService informationQueryService;
|
|
|
+
|
|
|
+ private final IDictBizClient dictBizClient;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取流程状态分类和文件类型分类
|
|
|
+ */
|
|
|
+ @GetMapping("/getDictBizClassifyByCode")
|
|
|
+ @ApiOperationSupport(order = 7)
|
|
|
+ @ApiOperation(value = "获取流程状态分类和文件类型分类")
|
|
|
+ @ApiImplicitParam(name = "code", value = "获取流程状态分类:flowTaskStatus;获取文件类型分类:fileType")
|
|
|
+ public R<List<DictBiz>> getDictBizClassifyByCode(@RequestParam String code){
|
|
|
+ return this.dictBizClient.getList(code, "notRoot");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取当前合同段下所有的上报批次
|
|
|
+ * @param contractId 合同段ID
|
|
|
+ * @return 结果
|
|
|
+ */
|
|
|
+ @GetMapping("/getReportNumberByContractId")
|
|
|
+ @ApiOperationSupport(order = 6)
|
|
|
+ @ApiOperation(value = "获取当前合同段下所有的上报批次")
|
|
|
+ @ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
|
|
|
+ public R<List<Integer>> getReportNumberByContractId(@RequestParam String contractId){
|
|
|
+ //获取合同段信息
|
|
|
+ ContractInfo contract = this.contractClient.getContractById(Long.valueOf(contractId));
|
|
|
+ return R.data(this.informationQueryService.getReportNumberByContractId(contract.getContractType() == null ? 1 : contract.getContractType(), contractId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据合同段ID获取所有填报人
|
|
|
+ * @param contractId 合同段ID
|
|
|
+ * @return 填报人集合
|
|
|
+ */
|
|
|
+ @GetMapping("/getFileUserByContractId")
|
|
|
+ @ApiOperationSupport(order = 5)
|
|
|
+ @ApiOperation(value = "根据合同段ID获取所有填报人")
|
|
|
+ @ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
|
|
|
+ public R<List<FileUserVO>> getFileUserByContractId(@RequestParam String contractId){
|
|
|
+ //获取合同段信息
|
|
|
+ ContractInfo contract = this.contractClient.getContractById(Long.valueOf(contractId));
|
|
|
+ return R.data(this.informationQueryService.queryFileUserByContractId(contract.getContractType() == null ? 1 : contract.getContractType(), contractId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页
|
|
|
+ * @param vo 查询条件
|
|
|
+ * @return 结果
|
|
|
+ */
|
|
|
+ @PostMapping("/page")
|
|
|
+ @ApiOperationSupport(order = 4)
|
|
|
+ @ApiOperation(value = "分页")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "size", value = "当前页条数", required = true),
|
|
|
+ @ApiImplicitParam(name = "current", value = "当前页", required = true),
|
|
|
+ @ApiImplicitParam(name = "wbsId", value = "节点ID", required = true),
|
|
|
+ @ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
|
|
|
+ })
|
|
|
+ public R<IPage<InformationQueryVO>> page(@RequestBody InformationQueryVO vo){
|
|
|
+ if("null".equals(String.valueOf(vo.getContractId())) || StringUtils.isEmpty(String.valueOf(vo.getContractId()))){
|
|
|
+ return R.data(-1, null, "数据查询失败");
|
|
|
+ }
|
|
|
+ //封装分页信息
|
|
|
+ Query query = new Query();
|
|
|
+ query.setSize(vo.getSize());
|
|
|
+ query.setCurrent(vo.getCurrent());
|
|
|
+ //获取合同段信息
|
|
|
+ ContractInfo contract = this.contractClient.getContractById(vo.getContractId());
|
|
|
+ vo.setClassify(contract.getContractType() == null ? 1 : contract.getContractType());
|
|
|
+
|
|
|
+ return R.data(this.informationQueryService.selectInformationQueryPage(Condition.getPage(query), vo));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取当前合同段的划分树
|
|
|
+ * @return 结果
|
|
|
+ */
|
|
|
+ @GetMapping("/queryContractWbsTreeByContractIdAndType")
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperation(value = "获取当前合同段的划分树")
|
|
|
+ @ApiImplicitParams(value = {
|
|
|
+ @ApiImplicitParam(name = "parentId", value = "父节点,为空则查询第一级节点"),
|
|
|
+ @ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
|
|
|
+ })
|
|
|
+ public R<List<WbsTreeContractTreeVOS>> queryContractWbsTreeByContractIdAndType(@RequestParam String parentId, @RequestParam String contractId){
|
|
|
+ List<WbsTreeContractTreeVOS> rootTreeNode;
|
|
|
+
|
|
|
+ if(com.alibaba.nacos.common.utils.StringUtils.isEmpty(parentId)){
|
|
|
+ //为空,说明初始化
|
|
|
+ //获取根节点
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //不为空,获取其下子节点
|
|
|
+ rootTreeNode = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, parentId);
|
|
|
+ }
|
|
|
+
|
|
|
+ return R.data(rootTreeNode);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改
|
|
|
+ */
|
|
|
+ @PostMapping("/update")
|
|
|
+ @ApiOperationSupport(order = 1)
|
|
|
+ @ApiOperation(value = "修改(只能修改编号和文件名)")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "name", value = "文件名称, 必须有值", required = true),
|
|
|
+ @ApiImplicitParam(name = "number", value = "文件编号,可以为空")
|
|
|
+ })
|
|
|
+ public R<Boolean> update(@Valid @RequestBody InformationQuery informationQuery) {
|
|
|
+ if("null".equals(String.valueOf(informationQuery.getId())) || StringUtils.isEmpty(String.valueOf(informationQuery.getId()))){
|
|
|
+ return R.data(-1, false, "数据操作失败");
|
|
|
+ }
|
|
|
+ return R.status(informationQueryService.update(Wrappers.<InformationQuery>lambdaUpdate().set(InformationQuery::getName, informationQuery.getName()).set(InformationQuery::getNumber, informationQuery.getNumber()).eq(InformationQuery::getId, informationQuery.getId())));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除
|
|
|
+ */
|
|
|
+ @PostMapping("/remove")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "逻辑删除", notes = "传入ids")
|
|
|
+ public R<Boolean> remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
|
|
|
+ return R.status(informationQueryService.deleteLogic(Func.toLongList(ids)));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|