From be154c165b13603b3992088aaf8bbb86cc5b0c8c Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期五, 13 六月 2025 09:47:23 +0800 Subject: [PATCH] art:maven 依赖冲突,OSS管理类删除 --- /dev/null | 48 ------------------------ src/main/java/org/jeecg/modules/system/controller/SysUploadController.java | 16 +------- src/main/resources/application-dev.yml | 4 +- src/main/java/org/jeecg/JeecgSystemApplication.java | 3 + pom.xml | 48 ++++++++++++++++++++++++ 5 files changed, 54 insertions(+), 65 deletions(-) diff --git a/pom.xml b/pom.xml index ce728a7..7fe01c7 100644 --- a/pom.xml +++ b/pom.xml @@ -250,6 +250,14 @@ <groupId>org.apache.shiro</groupId> <artifactId>shiro-core</artifactId> </exclusion> + <exclusion> + <artifactId>guava</artifactId> + <groupId>com.google.guava</groupId> + </exclusion> + <exclusion> + <artifactId>commons-beanutils</artifactId> + <groupId>commons-beanutils</groupId> + </exclusion> </exclusions> </dependency> @@ -258,6 +266,12 @@ <groupId>com.github.xiaoymin</groupId> <artifactId>knife4j-spring-boot-starter</artifactId> <version>${knife4j-spring-boot-starter.version}</version> + <exclusions> + <exclusion> + <artifactId>guava</artifactId> + <groupId>com.google.guava</groupId> + </exclusion> + </exclusions> </dependency> <!-- 浠g爜鐢熸垚鍣� --> @@ -277,6 +291,10 @@ <exclusion> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> + </exclusion> + <exclusion> + <artifactId>xercesImpl</artifactId> + <groupId>xerces</groupId> </exclusion> </exclusions> </dependency> @@ -303,6 +321,12 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> + <exclusions> + <exclusion> + <artifactId>asm</artifactId> + <groupId>org.ow2.asm</groupId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>junit</groupId> @@ -325,6 +349,12 @@ <groupId>org.pegdown</groupId> <artifactId>pegdown</artifactId> <version>${pegdown.version}</version> + <exclusions> + <exclusion> + <artifactId>asm</artifactId> + <groupId>org.ow2.asm</groupId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.hibernate</groupId> @@ -359,6 +389,12 @@ <groupId>dom4j</groupId> <artifactId>dom4j</artifactId> <version>${dom4j.version}</version> + <exclusions> + <exclusion> + <artifactId>xml-apis</artifactId> + <groupId>xml-apis</groupId> + </exclusion> + </exclusions> </dependency> <!-- fileupload --> <dependency> @@ -407,6 +443,10 @@ <artifactId>okhttp</artifactId> <groupId>com.squareup.okhttp3</groupId> </exclusion> + <exclusion> + <artifactId>checker-qual</artifactId> + <groupId>org.checkerframework</groupId> + </exclusion> </exclusions> </dependency> <!-- 浼佷笟寰俊鍜岄拤閽� api --> @@ -423,6 +463,14 @@ <artifactId>commons-lang</artifactId> <groupId>commons-lang</groupId> </exclusion> + <exclusion> + <artifactId>commons-logging</artifactId> + <groupId>commons-logging</groupId> + </exclusion> + <exclusion> + <artifactId>commons-collections</artifactId> + <groupId>commons-collections</groupId> + </exclusion> </exclusions> </dependency> <!-- 绉湪鎶ヨ〃--> diff --git a/src/main/java/org/jeecg/JeecgSystemApplication.java b/src/main/java/org/jeecg/JeecgSystemApplication.java index 2e783c1..bb8b518 100644 --- a/src/main/java/org/jeecg/JeecgSystemApplication.java +++ b/src/main/java/org/jeecg/JeecgSystemApplication.java @@ -7,6 +7,7 @@ import org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.context.ConfigurableApplicationContext; @@ -20,7 +21,7 @@ * 鎶ラ敊鎻愰啋: 鏈泦鎴恗ongo鎶ラ敊锛屽彲浠ユ墦寮�鍚姩绫讳笂闈㈢殑娉ㄩ噴 exclude={MongoAutoConfiguration.class} */ @Slf4j -@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, +@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, MongoAutoConfiguration.class, ManagementWebSecurityAutoConfiguration.class, EventRegistryServicesAutoConfiguration.class}) public class JeecgSystemApplication extends SpringBootServletInitializer { diff --git a/src/main/java/org/jeecg/modules/oss/controller/OssFileController.java b/src/main/java/org/jeecg/modules/oss/controller/OssFileController.java deleted file mode 100644 index 7939759..0000000 --- a/src/main/java/org/jeecg/modules/oss/controller/OssFileController.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.jeecg.modules.oss.controller; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.shiro.authz.annotation.RequiresRoles; -import org.jeecg.common.api.vo.Result; -import org.jeecg.common.system.query.QueryGenerator; -import org.jeecg.modules.oss.entity.OssFile; -import org.jeecg.modules.oss.service.IOssFileService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; - -import lombok.extern.slf4j.Slf4j; - -/** - * 浜戝瓨鍌ㄧず渚� DEMO - * @author: jeecg-boot - */ -@Slf4j -@Controller -@RequestMapping("/sys/oss/file") -public class OssFileController { - - @Autowired - private IOssFileService ossFileService; - - @ResponseBody - @GetMapping("/list") - public Result<IPage<OssFile>> queryPageList(OssFile file, - @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, - @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { - Result<IPage<OssFile>> result = new Result<>(); - QueryWrapper<OssFile> queryWrapper = QueryGenerator.initQueryWrapper(file, req.getParameterMap()); - Page<OssFile> page = new Page<>(pageNo, pageSize); - IPage<OssFile> pageList = ossFileService.page(page, queryWrapper); - result.setSuccess(true); - result.setResult(pageList); - return result; - } - - @ResponseBody - @PostMapping("/upload") - //@RequiresRoles("admin") - public Result upload(@RequestParam("file") MultipartFile multipartFile) { - Result result = new Result(); - try { - ossFileService.upload(multipartFile); - result.success("涓婁紶鎴愬姛锛�"); - } - catch (Exception ex) { - log.info(ex.getMessage(), ex); - result.error500("涓婁紶澶辫触"); - } - return result; - } - - @ResponseBody - @DeleteMapping("/delete") - public Result delete(@RequestParam(name = "id") String id) { - Result result = new Result(); - OssFile file = ossFileService.getById(id); - if (file == null) { - result.error500("鏈壘鍒板搴斿疄浣�"); - }else { - boolean ok = ossFileService.delete(file); - result.success("鍒犻櫎鎴愬姛!"); - } - return result; - } - - /** - * 閫氳繃id鏌ヨ. - */ - @ResponseBody - @GetMapping("/queryById") - public Result<OssFile> queryById(@RequestParam(name = "id") String id) { - Result<OssFile> result = new Result<>(); - OssFile file = ossFileService.getById(id); - if (file == null) { - result.error500("鏈壘鍒板搴斿疄浣�"); - } - else { - result.setResult(file); - result.setSuccess(true); - } - return result; - } - -} diff --git a/src/main/java/org/jeecg/modules/oss/entity/OssFile.java b/src/main/java/org/jeecg/modules/oss/entity/OssFile.java deleted file mode 100644 index ba4e073..0000000 --- a/src/main/java/org/jeecg/modules/oss/entity/OssFile.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jeecg.modules.oss.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; -import org.jeecg.common.system.base.entity.JeecgEntity; -import org.jeecgframework.poi.excel.annotation.Excel; - -/** - * @Description: oss浜戝瓨鍌ㄥ疄浣撶被 - * @author: jeecg-boot - */ -@Data -@TableName("oss_file") -@EqualsAndHashCode(callSuper = false) -@Accessors(chain = true) -public class OssFile extends JeecgEntity { - - private static final long serialVersionUID = 1L; - - @Excel(name = "鏂囦欢鍚嶇О") - private String fileName; - - @Excel(name = "鏂囦欢鍦板潃") - private String url; - -} diff --git a/src/main/java/org/jeecg/modules/oss/mapper/OssFileMapper.java b/src/main/java/org/jeecg/modules/oss/mapper/OssFileMapper.java deleted file mode 100644 index 36a9955..0000000 --- a/src/main/java/org/jeecg/modules/oss/mapper/OssFileMapper.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jeecg.modules.oss.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.jeecg.modules.oss.entity.OssFile; - -/** - * @Description: oss浜戝瓨鍌∕apper - * @author: jeecg-boot - */ -public interface OssFileMapper extends BaseMapper<OssFile> { - -} diff --git a/src/main/java/org/jeecg/modules/oss/service/IOssFileService.java b/src/main/java/org/jeecg/modules/oss/service/IOssFileService.java deleted file mode 100644 index 815d7c4..0000000 --- a/src/main/java/org/jeecg/modules/oss/service/IOssFileService.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.jeecg.modules.oss.service; - -import java.io.IOException; - -import com.baomidou.mybatisplus.extension.service.IService; -import org.jeecg.modules.oss.entity.OssFile; -import org.springframework.web.multipart.MultipartFile; - -/** - * @Description: OOS浜戝瓨鍌╯ervice鎺ュ彛 - * @author: jeecg-boot - */ -public interface IOssFileService extends IService<OssFile> { - - /** - * oss鏂囦欢涓婁紶 - * @param multipartFile - * @throws IOException - */ - void upload(MultipartFile multipartFile) throws Exception; - - /** - * oss鏂囦欢鍒犻櫎 - * @param ossFile OSSFile瀵硅薄 - * @return - */ - boolean delete(OssFile ossFile); - -} diff --git a/src/main/java/org/jeecg/modules/oss/service/impl/OssFileServiceImpl.java b/src/main/java/org/jeecg/modules/oss/service/impl/OssFileServiceImpl.java deleted file mode 100644 index 33ce147..0000000 --- a/src/main/java/org/jeecg/modules/oss/service/impl/OssFileServiceImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jeecg.modules.oss.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.jeecg.common.util.CommonUtils; -import org.jeecg.common.util.oss.OssBootUtil; -import org.jeecg.modules.oss.entity.OssFile; -import org.jeecg.modules.oss.mapper.OssFileMapper; -import org.jeecg.modules.oss.service.IOssFileService; -import org.springframework.stereotype.Service; -import org.springframework.web.multipart.MultipartFile; - -import java.io.IOException; - -/** - * @Description: OSS浜戝瓨鍌ㄥ疄鐜扮被 - * @author: jeecg-boot - */ -@Service("ossFileService") -public class OssFileServiceImpl extends ServiceImpl<OssFileMapper, OssFile> implements IOssFileService { - - @Override - public void upload(MultipartFile multipartFile) throws Exception { - String fileName = multipartFile.getOriginalFilename(); - fileName = CommonUtils.getFileName(fileName); - OssFile ossFile = new OssFile(); - ossFile.setFileName(fileName); - String url = OssBootUtil.upload(multipartFile,"upload/test"); - //update-begin--Author:scott Date:20201227 for锛欽T-361銆愭枃浠堕瑙堛�戦樋閲屼簯鍘熺敓鍩熷悕鍙互鏂囦欢棰勮锛岃嚜宸辨槧灏勫煙鍚峩kfileview鎻愮ず鏂囦欢涓嬭浇澶辫触------------------- - // 杩斿洖闃块噷浜戝師鐢熷煙鍚嶅墠缂�URL - ossFile.setUrl(OssBootUtil.getOriginalUrl(url)); - //update-end--Author:scott Date:20201227 for锛欽T-361銆愭枃浠堕瑙堛�戦樋閲屼簯鍘熺敓鍩熷悕鍙互鏂囦欢棰勮锛岃嚜宸辨槧灏勫煙鍚峩kfileview鎻愮ず鏂囦欢涓嬭浇澶辫触------------------- - this.save(ossFile); - } - - @Override - public boolean delete(OssFile ossFile) { - try { - this.removeById(ossFile.getId()); - OssBootUtil.deleteUrl(ossFile.getUrl()); - } - catch (Exception ex) { - log.error(ex.getMessage(),ex); - return false; - } - return true; - } - -} diff --git a/src/main/java/org/jeecg/modules/system/controller/SysUploadController.java b/src/main/java/org/jeecg/modules/system/controller/SysUploadController.java index d83e1fe..1ca98be 100644 --- a/src/main/java/org/jeecg/modules/system/controller/SysUploadController.java +++ b/src/main/java/org/jeecg/modules/system/controller/SysUploadController.java @@ -1,21 +1,16 @@ package org.jeecg.modules.system.controller; -import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import io.swagger.annotations.Api; import lombok.extern.slf4j.Slf4j; import org.jeecg.common.api.vo.Result; import org.jeecg.common.exception.JeecgBootException; +import org.jeecg.common.system.base.entity.SysUpload; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.util.CommonUtils; import org.jeecg.common.util.MinioUtil; -import org.jeecg.common.util.StrUtils; import org.jeecg.common.util.oConvertUtils; -import org.jeecg.modules.oss.entity.OssFile; -import org.jeecg.modules.oss.service.IOssFileService; -import org.jeecg.common.system.base.entity.SysUpload; import org.jeecg.modules.system.service.IUploadService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -25,7 +20,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -37,8 +31,6 @@ @RestController @RequestMapping("/sys/upload") public class SysUploadController { - @Autowired - private IOssFileService ossFileService; @Autowired private IUploadService uploadService; @@ -71,11 +63,7 @@ if(oConvertUtils.isEmpty(fileUrl)){ return Result.error("涓婁紶澶辫触,璇锋鏌ラ厤缃俊鎭槸鍚︽纭�!"); } - //淇濆瓨鏂囦欢淇℃伅 - OssFile minioFile = new OssFile(); - minioFile.setFileName(orgName); - minioFile.setUrl(fileUrl); - ossFileService.save(minioFile); + result.setMessage(fileUrl); result.setSuccess(true); return result; diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 4bfb55e..a0ce195 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -126,9 +126,9 @@ connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 datasource: master: - url: jdbc:sqlserver://192.168.1.118:1433;databasename=LXZN_TEST_HANGYU;nullCatalogMeansCurrent=true + url: jdbc:sqlserver://127.0.0.1:1433;databasename=LXZN_TEST_HANGYU;nullCatalogMeansCurrent=true username: sa - password: 123 + password: sa123 driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver #redis 閰嶇疆 redis: -- Gitblit v1.9.3