From d4cb55d98f33e5cf667d773af63f580b58f2cf4d Mon Sep 17 00:00:00 2001 From: mythxb Date: Fri, 19 May 2023 17:10:16 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-yun.yml | 3 +- .../src/main/resources/application.yml | 2 +- .../com/rzyc/controller/ImportController.java | 109 +++++++++++++++++- .../src/main/resources/application-dev.yml | 2 +- .../src/main/resources/application-prod.yml | 5 +- .../src/main/resources/application.yml | 2 +- 6 files changed, 115 insertions(+), 8 deletions(-) diff --git a/inventory-ent/src/main/resources/application-yun.yml b/inventory-ent/src/main/resources/application-yun.yml index 359dc20..42432d5 100644 --- a/inventory-ent/src/main/resources/application-yun.yml +++ b/inventory-ent/src/main/resources/application-yun.yml @@ -3,7 +3,8 @@ server: spring: redis: - host: 172.27.181.247 + #host: 172.27.181.247 + host: 127.0.0.1 # 进入哨兵项目-这个端口就不用了,除非是单体 port: 8011 # sentinel: diff --git a/inventory-ent/src/main/resources/application.yml b/inventory-ent/src/main/resources/application.yml index 7a61ab4..e4120de 100644 --- a/inventory-ent/src/main/resources/application.yml +++ b/inventory-ent/src/main/resources/application.yml @@ -1,6 +1,6 @@ spring: profiles: - active: dev #设定打包配置文件 + active: yun #设定打包配置文件 diff --git a/inventory-gov/src/main/java/com/rzyc/controller/ImportController.java b/inventory-gov/src/main/java/com/rzyc/controller/ImportController.java index 32094ab..0c51d76 100644 --- a/inventory-gov/src/main/java/com/rzyc/controller/ImportController.java +++ b/inventory-gov/src/main/java/com/rzyc/controller/ImportController.java @@ -13,9 +13,7 @@ import com.rzyc.model.check.ChkBillDetailWithBLOBs; import com.rzyc.model.check.ChkGovBillDetail; import com.rzyc.model.ent.*; import com.rzyc.model.oth.OthRefuge; -import com.rzyc.model.user.ListPerform; -import com.rzyc.model.user.SysUnit; -import com.rzyc.model.user.SysUser; +import com.rzyc.model.user.*; import com.rzyc.service.PcBusinessService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -3001,5 +2999,110 @@ public class ImportController extends com.rzyc.controller.BaseController { } + /** + * 导入新兴行业职责 + * @version v1.0 + * @author dong + * @date 2022/7/18 14:59 + */ + @ApiOperation(value = "导入新兴行业职责", notes = "导入新兴行业职责") + @RequestMapping(value = "/risingData", method = RequestMethod.POST) + @ResponseBody + public SingleResult risingData(@RequestBody MultipartFile multipartFile)throws Exception{ + SingleResult result = new SingleResult<>(); + Workbook wookbook = WorkbookFactory.create(multipartFile.getInputStream()); + Sheet sheet = wookbook.getSheetAt(0); + + //获得表头 + Row rowHead = sheet.getRow(0); + + System.out.println("getPhysicalNumberOfCells -> "+rowHead.getPhysicalNumberOfCells()); + //判断表头是否正确 + if(true){ + //获得数据的总行数 + int totalRowNum = sheet.getLastRowNum(); + + if(totalRowNum > 0){ + + Boolean isSubject = true; + DataFormatter dataFormatter = new DataFormatter(); + + + + + ChkBillDetailWithBLOBs chkBillDetail = new ChkBillDetailWithBLOBs(); + String workUnit = ""; + + + + List itemIds = new ArrayList<>(); + Map map = new HashMap<>(); + + Row row = sheet.getRow(0); + + Cell cell = row.getCell((short)1); + + for (int j = 1;j<=13;j++){ + cell = row.getCell((short)j); + String str = dataFormatter.formatCellValue(cell); + str = StringUtils.replaceBlank(str); + map.put(j,str); + } + + + System.out.println("map --> "+JSONArray.toJSONString(map)); + + + Integer index = 1; + //获得所有数据 + for(int i = 1 ; i <= totalRowNum ; i++){ + //获得第i行对象 + row = sheet.getRow(i); + if(null == row){ + break; + } + + cell = row.getCell((short)0); + String unitName = dataFormatter.formatCellValue(cell); + unitName = StringUtils.replaceBlank(unitName); + System.out.println("unitName ----> "+unitName); + ListPerform perform = listPerformMapper.findByName(unitName,"5bd164aa-dd43-45e3-a5a2-649bb2fd9fb9"); + if(null != perform){ + for (int k = 1;k<=13;k++){ + cell = row.getCell((short)k); + String listStr = dataFormatter.formatCellValue(cell); + listStr = StringUtils.replaceBlank(listStr); + if(StringUtils.isNotBlank(listStr)){ + System.out.println(perform.getListperformid()+" -----> listStr ---------> "+listStr); + ListSafeWithBLOBs listSafe = new ListSafeWithBLOBs(); + listSafe.setListsafeid(RandomNumber.getUUid()); + listSafe.setListperformid(perform.getListperformid()); + listSafe.setSafeduty(map.get(k)+":"+listStr); + listSafe.setSortid(i); + listSafe.setCreatedby("excel"); + listSafe.setModifiedby("excel"); + listSafe.setCreatedon(new Date()); + listSafe.setModifiedon(new Date()); + listSafeMapper.insert(listSafe); + + } + + } + } + + + + } + + + + + System.out.println(index); + } + } + return result; + } + + } diff --git a/inventory-gov/src/main/resources/application-dev.yml b/inventory-gov/src/main/resources/application-dev.yml index 6c0494d..3256901 100644 --- a/inventory-gov/src/main/resources/application-dev.yml +++ b/inventory-gov/src/main/resources/application-dev.yml @@ -49,7 +49,7 @@ spring: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://121.40.106.103:3306/inventory_copy?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&useSSL=false username: rzyc - password: ENC(FDlRK2MAcJBMF7UBHBJPLGzRkpWQ4T6dgYP2bDnTodQ=) + password: admin@rzyc2022.com## tomcat: max-active: 10 min-idle: 10 diff --git a/inventory-gov/src/main/resources/application-prod.yml b/inventory-gov/src/main/resources/application-prod.yml index fecb1b7..28f591c 100644 --- a/inventory-gov/src/main/resources/application-prod.yml +++ b/inventory-gov/src/main/resources/application-prod.yml @@ -30,11 +30,14 @@ spring: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://121.40.106.103:3306/inventory_copy?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&useSSL=false username: rzyc - password: ENC(FDlRK2MAcJBMF7UBHBJPLGzRkpWQ4T6dgYP2bDnTodQ=) + password: admin@rzyc2022.com## + testOnBorrow: true + validationQuery: SELECT 1 tomcat: max-active: 10 min-idle: 10 initial-size: 2 + testOnBorrow: true hikari: minimum-idle: 3 maximum-pool-size: 10 diff --git a/inventory-gov/src/main/resources/application.yml b/inventory-gov/src/main/resources/application.yml index a6560f0..cb53efc 100644 --- a/inventory-gov/src/main/resources/application.yml +++ b/inventory-gov/src/main/resources/application.yml @@ -1,6 +1,6 @@ spring: profiles: - active: dev #设定打包配置文件 + active: yun #设定打包配置文件