From efe98e89b2d03f053aad877678f46f7512c63248 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期五, 12 九月 2025 16:12:35 +0800
Subject: [PATCH] 修改数据库连接密码为强密码2
---
basic-server/src/main/java/com/ruoyi/basic/controller/CapacityScopeController.java | 250 +-------------------------------------------------
1 files changed, 5 insertions(+), 245 deletions(-)
diff --git a/basic-server/src/main/java/com/ruoyi/basic/controller/CapacityScopeController.java b/basic-server/src/main/java/com/ruoyi/basic/controller/CapacityScopeController.java
index a18e4a1..2f5df2e 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/controller/CapacityScopeController.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/controller/CapacityScopeController.java
@@ -1,41 +1,26 @@
package com.ruoyi.basic.controller;
-import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.poi.excel.ExcelUtil;
import com.alibaba.excel.EasyExcel;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.common.core.domain.Result;
-import com.ruoyi.common.core.domain.entity.SysDictData;
-import com.ruoyi.system.service.ISysDictTypeService;
import com.ruoyi.basic.dto.PageTestObjectDto;
import com.ruoyi.basic.dto.ProductDTO1;
import com.ruoyi.basic.excel.StructureTestObjectData;
import com.ruoyi.basic.excel.StructureTestObjectListener;
import com.ruoyi.basic.pojo.Product;
-import com.ruoyi.basic.pojo.StandardTemplate;
import com.ruoyi.basic.pojo.StructureItemParameter;
import com.ruoyi.basic.pojo.StructureTestObject;
import com.ruoyi.basic.service.CapacityScopeService;
import com.ruoyi.basic.service.ProductService;
-import com.ruoyi.basic.service.StandardTemplateService;
import com.ruoyi.basic.service.StructureItemParameterService;
+import com.ruoyi.common.core.domain.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
-import org.apache.commons.lang3.ObjectUtils;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.stream.Collectors;
/**
* 妫�楠岄」鐩弬鏁�(StructureItemParameter)琛ㄦ帶鍒跺眰
@@ -55,13 +40,10 @@
private StructureItemParameterService structureItemParameterService;
- private ISysDictTypeService dictTypeService;
-
- private StandardTemplateService standardTemplateService;
@ApiOperation(value = "鑾峰彇椤圭洰妫�楠屽弬鏁板垪琛�")
@GetMapping("/selectItemParameterList")
- public Result selectItemParameterList(Page page,StructureItemParameter itemParameter) throws Exception {
+ public Result selectItemParameterList(Page page,StructureItemParameter itemParameter) {
return Result.success(capacityScopeService.selectItemParameterList(page, itemParameter));
}
@@ -85,7 +67,7 @@
@ApiOperation(value = "鑾峰彇妫�楠屽璞�")
@GetMapping("/selectTestObjectList")
- public Result selectTestObjectList(Page page,PageTestObjectDto pageTestObjectDto) throws Exception {
+ public Result selectTestObjectList(Page page,PageTestObjectDto pageTestObjectDto) {
return Result.success(capacityScopeService.selectTestObjectList(page, pageTestObjectDto));
}
@@ -121,7 +103,7 @@
@ApiOperation(value = "缁存姢妫�楠屽璞$殑浜у搧")
@GetMapping("/selectProductListByObjectId")
- public Result selectProductListByObjectId(Page page,ProductDTO1 productDTO) throws Exception {
+ public Result selectProductListByObjectId(Page page,ProductDTO1 productDTO) {
return Result.success(productService.selectProductListByObjectId(page, productDTO));
}
@@ -154,229 +136,7 @@
@PostMapping("/importEquipData")
@Transactional
public Result importEquipData(@RequestParam("file") MultipartFile file) throws Exception {
- InputStream inputStream = file.getInputStream();
- List<StructureItemParameter> lists = new ArrayList<>();
- AtomicReference<String> sample = new AtomicReference<>();
- ExcelUtil.readBySax(inputStream, -1, (i, l, list1) -> {
- if (l == 1) {
- sample.set(list1.get(1) + "");
- }
- if (l >= 1) {
- StructureItemParameter str = new StructureItemParameter();
- // 娴嬭瘯瀵硅薄
- if (list1.get(1) == null) {
- str.setSample(null);
- } else {
- String brand = (String) list1.get(1);
- StringBuilder builder = new StringBuilder();
- builder.append("[");
- // 浜у搧
- if (ObjectUtil.isNotEmpty(list1.get(2))) {
- String production = (String) list1.get(2);
- if (!production.contains("锛�")) {
- builder.append(String.format("[\"%s\",\"%s\"]", brand, production));
- } else {
- Arrays.stream(production.split("锛�")).forEach(item -> {
- builder.append(String.format("[\"%s\",\"%s\"],", brand, item));
- });
- builder.deleteCharAt(builder.length() - 1);
- }
- } else {
- builder.append("[");
- builder.append(String.format("\"%s\"", brand));
- builder.append("]");
- }
- builder.append("]");
- str.setSample(builder.toString());
- }
- // 妫�楠岄」
- str.setInspectionItem(list1.get(4).toString().trim());
- // 妫�楠岄」鑻辨枃
- if (list1.get(5) != null) {
- str.setInspectionItemEn(list1.get(5).toString());
- }
- // 妫�楠屽瓙椤�
- if (list1.get(6) == null) {
- str.setInspectionItemSubclass(null);
- } else {
- str.setInspectionItemSubclass(list1.get(6).toString().trim());
- }
- // 妫�楠屽瓙椤硅嫳鏂�
- if (list1.get(7) == null) {
- str.setInspectionItemSubclassEn(null);
- } else {
- str.setInspectionItemSubclassEn(String.valueOf(list1.get(7).toString()));
- }
- // 妫�楠岄」鍒嗙被
- if (list1.get(22) != null && list1.get(22) != "") {
- str.setInspectionItemClass(list1.get(22).toString().trim());
- } else {
- str.setInspectionItemClass(null);
- }
- // 妫�楠岄」鍒嗙被鑻辨枃
- if (list1.get(23) != null && list1.get(23) != "") {
- str.setInspectionItemClassEn(list1.get(23) + "");
- } else {
- str.setInspectionItemClassEn(null);
- }
-
- LambdaQueryWrapper<StructureItemParameter> wrapper = Wrappers.lambdaQuery(StructureItemParameter.class)
- .eq(StructureItemParameter::getInspectionItem, str.getInspectionItem())
- .eq(StructureItemParameter::getSample, str.getSample())
-
- .last("limit 1");
- // 鍒ゆ柇鏄惁鏈夋楠岄」绫诲瀷
- if (ObjectUtils.isNotEmpty(str.getInspectionItemClass())) {
- wrapper.eq(StructureItemParameter::getInspectionItemClass, str.getInspectionItemClass());
- }
-
- // 鍒ゆ柇鏄惁鏈夋楠屽瓙椤�
- if (ObjectUtils.isNotEmpty(str.getInspectionItemSubclass())) {
- wrapper.eq(StructureItemParameter::getInspectionItemSubclass, str.getInspectionItemSubclass());
- }
- StructureItemParameter db_str = structureItemParameterService.getOne(wrapper);
- if (ObjectUtils.isNotEmpty(db_str)) {
- str.setId(db_str.getId());
- }
- // 鏂规硶鍚嶇О
- if (list1.get(8) == null) {
- str.setMethod(null);
- } else {
- StringBuffer buffer = new StringBuffer();
- String input = list1.get(8).toString();
- buffer.append("[");
- String[] values = input.split("锛�");
- for (String value : values) {
- buffer.append("\"").append(value.trim()).append("\",");
- }
- buffer.deleteCharAt(buffer.length() - 1);
- buffer.append("]");
- str.setMethod(buffer.toString());
- }
- // 璇曢獙瀹�
- if (list1.get(9) == null) {
- str.setSonLaboratory(null);
- } else {
- str.setSonLaboratory(list1.get(9).toString());
- }
- // 璁¢噺鍗曚綅
- if (list1.get(10) == null) {
- str.setUnit(null);
- } else {
- str.setUnit(list1.get(10).toString());
- }
- // 瑕佹眰鍊�
- if (list1.get(11) == null) {
- str.setAskTell(null);
- } else {
- str.setAskTell(list1.get(11).toString());
- }
- // 瑕佹眰鎻忚堪
- if (list1.get(12) == null) {
- str.setAsk(null);
- } else {
- str.setAsk(list1.get(12).toString());
- }
- // 鍗曚环
- if (list1.get(13) == null) {
- str.setPrice(null);
- } else {
- str.setPrice(list1.get(13) + "");
- }
- // 宸ユ椂绯绘暟
- if (list1.get(14) == null) {
- str.setManHour(null);
- } else {
- str.setManHour(Double.valueOf(list1.get(14).toString()));
- }
- // 宸ユ椂鍒嗙粍
- if (list1.get(15) == null) {
- str.setManHourGroup(null);
- } else {
- str.setManHourGroup(list1.get(15).toString());
- }
- // 棰勮瀹屾垚鏃堕棿
- if (list1.get(16) == null) {
- str.setManDay(null);
- } else {
- str.setManDay(Integer.valueOf(list1.get(16).toString()));
- }
- // 鏁版嵁绫诲瀷
- String jy;
- if (list1.get(17).toString().equals("闈為噰闆嗙被鍨�")) {
- jy = "0";
- } else {
- jy = "1";
- }
- str.setInspectionItemType(jy);
- // 妫�楠岄」绫诲瀷
- String validateValueType = list1.get(18).toString();
- if (ObjectUtils.isNotEmpty(validateValueType)) {
- List<SysDictData> enums = dictTypeService.selectDictDataByName("妫�楠屽�肩被鍨�")
- .stream().filter(sysDictData -> sysDictData.getDictLabel().equals(validateValueType)).collect(Collectors.toList());
- str.setInspectionValueType(enums.get(0).getDictValue());
- }
- int bsm;
- //鐗规畩鏍囪瘑
- if (list1.get(19).toString().equals("鍚�")) {
- bsm = 0;
- } else {
- bsm = 1;
- }
- str.setBsm(bsm + "");
- // 鏁板瓧瀛楀吀
- if (list1.get(20) != null) {
- str.setDic(list1.get(20) + "");
- } else {
- str.setDic(null);
- }
- // 鍘熷璁板綍妯℃澘
- StandardTemplate standTempIdByName = standardTemplateService.getStandTempIdByName(String.valueOf(list1.get(21)));
- if (standTempIdByName != null) {
- str.setTemplateId(standTempIdByName.getId());
- } else {
- str.setTemplateId(null);
- }
- try {
- if (list1.get(24) != null) {
- str.setLaboratory(list1.get(24) + "");
- }
- } catch (Exception e) {
- }
-
- // 鏉′欢
- if (list1.get(25) == null) {
- str.setRadiusList(null);
- } else {
- StringBuffer buffer = new StringBuffer();
- String input = list1.get(25).toString();
- buffer.append("[");
- String[] values = input.split("锛�");
- for (String value : values) {
- buffer.append("\"").append(value.trim()).append("\",");
- }
- buffer.deleteCharAt(buffer.length() - 1);
- buffer.append("]");
- str.setRadiusList(buffer.toString());
- }
- // 鏀惰垂鏍囧噯
- if (list1.get(26) == null) {
- str.setRates(null);
- } else {
- str.setRates(list1.get(26) + "");
- }
-
- lists.add(str);
- }
- });
-// structureItemParameterService.removeNoSample(sample.get());
- // 濡傛灉鏁版嵁搴撻噷闈㈢殑鏁版嵁瀛樺湪閭d箞灏辨墽琛屾洿鏂版嫹璐濇搷浣�
- try {
- structureItemParameterService.saveOrUpdateBatch(lists);
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException("鏈嶅姟绔姤閿�");
- }
+ structureItemParameterService.importEquipData(file);
return Result.success();
}
--
Gitblit v1.9.3