From d7096ab256703c2c93b978989eabac5afb6f652d Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Mon, 31 Jul 2023 11:56:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=AF=95=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E6=8A=A5=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ding/controller/DingInfoPullController.java | 104 ++++++++++++++++++++- .../ningdatech/pmapi/irs/manage/AppIrsManage.java | 4 +- .../pmapi/projectlib/manage/ApplicationManage.java | 1 + .../pmapi/projectlib/model/dto/ProjectDTO.java | 3 + 4 files changed, 105 insertions(+), 7 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java index 2ae4310..617b0a5 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java @@ -4,6 +4,8 @@ import cn.hutool.core.util.StrUtil; import cn.hutool.crypto.SecureUtil; import cn.hutool.crypto.digest.HMac; import cn.hutool.crypto.digest.MD5; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Maps; import com.ningdatech.irs.service.IRefreshTokenService; import com.ningdatech.pmapi.common.util.CryptUtils; @@ -20,16 +22,24 @@ import com.sun.crypto.provider.HmacMD5KeyGenerator; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.ResponseEntity; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.util.Assert; import org.springframework.web.bind.annotation.*; import org.springframework.web.client.RestTemplate; import javax.annotation.Resource; -import java.io.UnsupportedEncodingException; +import java.io.*; import java.nio.charset.StandardCharsets; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; +import java.time.LocalDateTime; import java.util.Objects; /** @@ -119,9 +129,93 @@ public class DingInfoPullController { return procDefManage.initByArea(areaCode); } - @ApiOperation(value = "测试项目详情推送", notes = "测试项目详情推送") - @GetMapping("/test-push-project") - public String testPushProject(@ModelAttribute ProjectDTO projectDto) throws Exception { - return appIrsManage.pushProjectDetail(projectDto); + @ApiOperation(value = "项目详情推送", notes = "项目详情推送") + @GetMapping("/push-project") + public String pushProject() throws Exception { + File f = new File("/temp/遂昌归集项目信息(需补).xlsx"); +// File f = new File("C:\\Users\\PoffyZhang\\Desktop\\遂昌归集项目信息(需补).xlsx"); + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + Assert.notNull(wb,"文件流为空"); + Row row; + Integer sucessNum = 0; + if(wb != null){ + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + for (int i = 1; i