瀏覽代碼

台账管理-业内台账
1、导出接口开发

LHB 1 月之前
父節點
當前提交
ff744419d1

+ 22 - 1
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/NeiYeLedgerVO.java

@@ -1,45 +1,61 @@
 package org.springblade.business.vo;
 
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.ContentRowHeight;
+import com.alibaba.excel.annotation.write.style.HeadRowHeight;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 @Data
+@ColumnWidth(16)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
+//忽略为加excel注解的字段
+@ExcelIgnoreUnannotated
 public class NeiYeLedgerVO {
 
     /**
      * 单位工程
      */
     @ApiModelProperty(value = "单位工程")
+    @ExcelProperty(value = "单位工程",order = 1)
     private String unitProject;
 
     /**
      * 分部工程
      */
     @ApiModelProperty(value = "分部工程")
+    @ExcelProperty(value = "分部工程",order = 2)
     private String partProject;
 
     /**
      * 子分部工程
      */
     @ApiModelProperty(value = "子分部工程")
+    @ExcelProperty(value = "子分部工程",order = 3)
     private String partChildProject;
 
     /**
      * 分项工程
      */
     @ApiModelProperty(value = "分项工程")
+    @ExcelProperty(value = "分项工程",order = 4)
     private String subentryProject;
 
     /**
      * 子分项工程
      */
     @ApiModelProperty(value = "子分项工程")
+    @ExcelProperty(value = "子分项工程",order = 5)
     private String subentryChildProject;
 
     /**
      * 工序
      */
     @ApiModelProperty(value = "工序")
+    @ExcelProperty(value = "工序",order = 6)
     private String process;
 
     //施工台账信息 start ==================================
@@ -66,6 +82,7 @@ public class NeiYeLedgerVO {
      * 审批状态
      */
     @ApiModelProperty(value = "审批状态,1未上报,2待审批,3已审批")
+    @ExcelProperty(value = "审批状态",order = 7)
     private String taskStatus;
 
     /**
@@ -89,22 +106,26 @@ public class NeiYeLedgerVO {
      * 是否填写了日期
      */
     @ApiModelProperty(value = "是否填写了日期")
-    private Integer dateIsComplete;
+    @ExcelProperty(value = "日期是否完整",order = 9)
+    private String dateIsComplete;
     /**
      * 文件提名
      */
     @ApiModelProperty(value = "文件提名")
+    @ExcelProperty(value = "文件提名",order = 8)
     private String infoQueryName;
 
     /**
      * 文件pdf路径
      */
     @ApiModelProperty(value = "路径")
+    @ExcelProperty(value = "文件地址",order = 11)
     private String pdfUrl;
     /**
      * 附件报告
      */
     @ApiModelProperty(value = "附件报告")
+    @ExcelProperty(value = "附件报告",index = 10)
     private String fileTypeMsg;
 
     public NeiYeLedgerVO(String... values) {

+ 1 - 1
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/QueryProcessDataVO.java

@@ -36,7 +36,7 @@ public class QueryProcessDataVO {
     /**
      * 是否填写了日期
      */
-    private Integer dateIsComplete;
+    private String dateIsComplete;
     /**
      * 文件提名
      */

+ 30 - 4
blade-service/blade-business/src/main/java/org/springblade/business/controller/NeiYeController.java

@@ -2,6 +2,7 @@ package org.springblade.business.controller;
 
 import cn.hutool.core.date.DateUtil;
 import com.aliyun.oss.ServiceException;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.BeanUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -25,6 +26,7 @@ import org.springblade.business.vo.NeiYeQueryVO;
 import org.springblade.business.vo.QueryProcessDataVO;
 import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
+import org.springblade.core.excel.util.ExcelUtil;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.BeanUtil;
@@ -39,6 +41,7 @@ import org.springblade.manager.feign.WbsTreeContractClient;
 import org.springblade.manager.feign.WbsTreePrivateClient;
 import org.springblade.manager.vo.WbsTreeContractTreeVOS;
 import org.springblade.system.entity.DictBiz;
+import org.springblade.system.entity.Region;
 import org.springframework.core.io.ByteArrayResource;
 import org.springframework.core.io.Resource;
 import org.springframework.http.HttpHeaders;
@@ -49,6 +52,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.core.SingleColumnRowMapper;
 import org.springframework.web.bind.annotation.*;
 import org.springblade.core.mp.support.Query;
+import springfox.documentation.annotations.ApiIgnore;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.ByteArrayOutputStream;
@@ -122,13 +126,13 @@ public class NeiYeController {
             //不是工序,则查询当前节点下的所有填报节点
             List<QueryProcessDataVO> queryDataResult;
             //有些填报节点的MajorDataType为0
-            if (!new Integer("6").equals(node.getNodeType()) && ObjectUtil.isNotEmpty(node.getMajorDataType()) &&!Arrays.asList("1,2,3,4".split(",")).contains(node.getMajorDataType().toString())
+            if (!new Integer("6").equals(node.getNodeType()) && (ObjectUtil.isEmpty(node.getMajorDataType()) || !Arrays.asList("1,2,3,4".split(",")).contains(node.getMajorDataType().toString()))
                     && !node.getNodeName().contains("开工报告") && !node.getNodeName().contains("质量检验评定表")) {
                 //非填报节点
                 if (node.getParentId() == 0) {
                     queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractIdTwo("", contractType, contractId, queryVO.getDateIsComplete());
                 } else {
-                    queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractIdTwo(node.getPKeyId().toString(), contractType, contractId, queryVO.getDateIsComplete());
+                    queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractIdTwo(node.getAncestorsPId() + "," + node.getPKeyId(), contractType, contractId, queryVO.getDateIsComplete());
                 }
             } else {
                 //填报节点
@@ -280,8 +284,13 @@ public class NeiYeController {
                     return R.data(300, null, "未查询到数据");
                 }
                 //分组
-                List<List<QueryProcessDataVO>> groupList = CommonUtil.getBatchSize(queryDataResult, queryVO.getSize());
-                List<QueryProcessDataVO> groupQueryList = groupList.get(queryVO.getCurrent() == 0 ? 0 : queryVO.getCurrent() - 1);
+                List<QueryProcessDataVO> groupQueryList = null;
+                if(queryVO.getSize() != null && queryVO.getSize() > 0){
+                    List<List<QueryProcessDataVO>> groupList = CommonUtil.getBatchSize(queryDataResult, queryVO.getSize());
+                     groupQueryList = groupList.get(queryVO.getCurrent() == 0 ? 0 : queryVO.getCurrent() - 1);
+                }else{
+                    groupQueryList = queryDataResult;
+                }
 
                 //获取所有施工日志记录
                 List<String> primaryKeyIds = groupQueryList.stream().map(QueryProcessDataVO::getPrimaryKeyId).distinct().collect(Collectors.toList());
@@ -597,4 +606,21 @@ public class NeiYeController {
         }
     }
 
+
+    /**
+     * 导出行政区划数据
+     */
+    @PostMapping("export")
+    @ApiOperationSupport(order = 11)
+    @ApiOperation(value = "导出业内台账", notes = "传入user")
+    public void exportRegion(@RequestBody NeiYeQueryVO queryVO,HttpServletResponse response) {
+        //导出所有
+        queryVO.setSize(-1);
+        R<IPage<NeiYeLedgerVO>> iPageR = queryCurrentNodeNeiYeLedger(queryVO);
+        //获取数据
+        if(iPageR.isSuccess()){
+            List<NeiYeLedgerVO> list = iPageR.getData().getRecords();
+            ExcelUtil.export(response, "业内台账" + org.springblade.core.tool.utils.DateUtil.time(), "行政区划数据表", list, NeiYeLedgerVO.class);
+        }
+    }
 }

+ 3 - 3
blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.xml

@@ -434,7 +434,7 @@
                wtc.p_key_id,
                wtc.ancestors,
                wtc.major_data_type,
-               wtc.date_is_complete AS dateIsComplete,
+               case when wtc.date_is_complete = 1 then '是' else '否' end AS dateIsComplete,
                IFNULL(if(length(trim(wtc.full_name)) > 0, wtc.full_name, wtc.node_name), wtc.node_name) AS     title,
                wtc.parent_id                                                                            AS     parentId,
                uiq.id                                                                                   AS     informationQueryId,
@@ -821,7 +821,7 @@
     </select>
     <select id="queryProcessDataByParentIdAndContractIdTwo" resultMap="queryProcessDataMap">
         SELECT wtc.id                                                                                   AS treeId,
-               wtc.date_is_complete                                                                     AS dateIsComplete,
+               case when wtc.date_is_complete = 1 then '是' else '否' end                                AS dateIsComplete,
                wtc.p_key_id,
                wtc.ancestors,
                wtc.major_data_type,
@@ -845,7 +845,7 @@
                  left join m_wbs_tree_private p on wtc.is_type_private_pid = p.p_key_id
         WHERE wtc.type = 1
           AND wtc.major_data_type in (0, 1, 2, 3, 4)
-          AND wtc.ancestors like concat('%', #{parentId}, '%')
+          AND wtc.ancestors_p_id like concat(#{parentId}, '%')
           AND wtc.contract_id = #{contractId}
           AND wtc.is_deleted = 0
           AND wtc.status = 1