Sfoglia il codice sorgente

完成web的开发

yq 3 anni fa
parent
commit
b4008161c0
18 ha cambiato i file con 124 aggiunte e 196 eliminazioni
  1. 0 53
      system-controller/src/main/java/com/bizmatics/system/controller/BaseController.java
  2. 15 21
      system-controller/src/main/java/com/bizmatics/system/controller/web/SysConfigController.java
  3. 5 13
      system-controller/src/main/java/com/bizmatics/system/controller/web/SysDictDataController.java
  4. 11 22
      system-controller/src/main/java/com/bizmatics/system/controller/web/SysDictTypeController.java
  5. 4 8
      system-controller/src/main/java/com/bizmatics/system/controller/web/SysFileController.java
  6. 5 25
      system-controller/src/main/resources/application-dev.properties
  7. 16 10
      system-controller/src/main/resources/application-prod.properties
  8. 16 10
      system-controller/src/main/resources/application-test.properties
  9. 1 1
      system-controller/src/main/resources/log4j2-spring-dev.xml
  10. 1 1
      system-controller/src/main/resources/log4j2-spring-prod.xml
  11. 1 1
      system-controller/src/main/resources/log4j2-spring-test.xml
  12. 2 0
      system-persistence/src/main/java/com/bizmatics/persistence/mapper/SysConfigMapper.java
  13. 1 0
      system-service/src/main/java/com/bizmatics/service/ISysAsyncTaskService.java
  14. 2 0
      system-service/src/main/java/com/bizmatics/service/dto/SysFileUploadRequest.java
  15. 10 0
      system-service/src/main/java/com/bizmatics/service/enums/AsyncResultType.java
  16. 7 5
      system-service/src/main/java/com/bizmatics/service/impl/FileServiceImpl.java
  17. 1 0
      system-service/src/main/java/com/bizmatics/service/impl/SysAsyncTaskServiceImpl.java
  18. 26 26
      system-service/src/main/java/com/bizmatics/service/impl/SysConfigServiceImpl.java

+ 0 - 53
system-controller/src/main/java/com/bizmatics/system/controller/BaseController.java

@@ -2,64 +2,11 @@ package com.bizmatics.system.controller;
 
 import com.bizmatics.common.core.bean.ApiResult;
 import com.bizmatics.common.core.exception.BusinessErrorCode;
-import com.bizmatics.common.core.util.DateUtils;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.WebDataBinder;
-import org.springframework.web.bind.annotation.InitBinder;
-
-import java.beans.PropertyEditorSupport;
-import java.util.Date;
-import java.util.List;
-import java.util.Objects;
 
 /**
  * web层通用数据处理
  */
 public class BaseController {
-    protected final Logger logger = LoggerFactory.getLogger(BaseController.class);
-
-    /**
-     * 将前台传递过来的日期格式的字符串,自动转化为Date类型
-     */
-    @InitBinder
-    public void initBinder(WebDataBinder binder) {
-        // Date 类型转换
-        binder.registerCustomEditor(Date.class, new PropertyEditorSupport() {
-            @Override
-            public void setAsText(String text) {
-                setValue(DateUtils.parseDate(text));
-            }
-        });
-    }
-
-    /**
-     * 设置请求分页数据
-     */
-    protected void startPage() {
-        PageDomain pageDomain = TableSupport.buildPageRequest();
-        Integer pageNum = pageDomain.getPageNum();
-        Integer pageSize = pageDomain.getPageSize();
-        if (Objects.nonNull(pageNum) && Objects.nonNull(pageSize)) {
-            String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
-            PageHelper.startPage(pageNum, pageSize, orderBy);
-        }
-    }
-
-    /**
-     * 响应请求分页数据
-     */
-    @SuppressWarnings({"rawtypes", "unchecked"})
-    protected TableDataInfo getDataTable(List<?> list) {
-        TableDataInfo rspData = new TableDataInfo();
-        rspData.setCode(HttpStatus.OK.value());
-        rspData.setRows(list);
-        rspData.setMsg("查询成功");
-        rspData.setTotal(new PageInfo(list).getTotal());
-        return rspData;
-    }
 
     /**
      * 响应返回结果

+ 15 - 21
system-controller/src/main/java/com/bizmatics/system/controller/web/SysConfigController.java

@@ -1,11 +1,13 @@
 package com.bizmatics.system.controller.web;
 
 import com.bizmatics.common.core.bean.ApiResult;
+import com.bizmatics.common.core.bean.CommonPage;
 import com.bizmatics.common.core.exception.BusinessErrorCode;
 import com.bizmatics.model.SysConfig;
 import com.bizmatics.service.ISysConfigService;
 import com.bizmatics.service.constants.SystemConst;
 import com.bizmatics.system.controller.BaseController;
+import com.google.protobuf.Api;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
@@ -17,26 +19,23 @@ import java.util.List;
  */
 @RestController
 @RequestMapping("/config")
-public class SysConfigController extends BaseController {
+public class SysConfigController {
     @Autowired
     private ISysConfigService configService;
 
     /**
      * 获取参数配置列表
      */
-    @PreAuthorize("@ss.hasPermi('system:config:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysConfig config) {
-        startPage();
-        List<SysConfig> list = configService.selectConfigList(config);
-        return getDataTable(list);
+    public ApiResult<List<SysConfig>> list(SysConfig config) {
+        return ApiResult.success(configService.selectConfigList(config));
     }
 
     /**
      * 根据参数编号获取详细信息
      */
     @GetMapping(value = "/{configId}")
-    public ApiResult getInfo(@PathVariable Long configId) {
+    public ApiResult<SysConfig> getInfo(@PathVariable Long configId) {
         return ApiResult.success(configService.selectConfigById(configId));
     }
 
@@ -44,51 +43,46 @@ public class SysConfigController extends BaseController {
      * 根据参数键名查询参数值
      */
     @GetMapping(value = "/configKey/{configKey}")
-    public ApiResult getConfigKey(@PathVariable String configKey) {
+    public ApiResult<String> getConfigKey(@PathVariable String configKey) {
         return ApiResult.success(configService.selectConfigByKey(configKey));
     }
 
     /**
      * 新增参数配置
      */
-    @PreAuthorize("@ss.hasPermi('system:config:add')")
     @PostMapping
-    public ApiResult add(@Validated @RequestBody SysConfig config) {
+    public ApiResult<Integer> add(@Validated @RequestBody SysConfig config) {
         if (SystemConst.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
             return ApiResult.error(BusinessErrorCode.BIZ_BUSINESS_ERROR.getCode(), "新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
         }
-        config.setCreateBy(SecurityUtils.getUser().getName());
-        return toAjax(configService.insertConfig(config));
+        return ApiResult.success(configService.insertConfig(config));
     }
 
     /**
      * 修改参数配置
      */
-    @PreAuthorize("@ss.hasPermi('system:config:edit')")
     @PutMapping
-    public ApiResult edit(@Validated @RequestBody SysConfig config) {
+    public ApiResult<Integer> edit(@Validated @RequestBody SysConfig config) {
         if (SystemConst.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
             return ApiResult.error(BusinessErrorCode.BIZ_BUSINESS_ERROR.getCode(), "修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
         }
-        config.setUpdateBy(SecurityUtils.getUser().getName());
-        return toAjax(configService.updateConfig(config));
+
+        return ApiResult.success(configService.updateConfig(config));
     }
 
     /**
      * 删除参数配置
      */
-    @PreAuthorize("@ss.hasPermi('system:config:remove')")
     @DeleteMapping("/{configIds}")
-    public ApiResult remove(@PathVariable Long[] configIds) {
-        return toAjax(configService.deleteConfigByIds(configIds));
+    public ApiResult<Integer> remove(@PathVariable Long[] configIds) {
+        return ApiResult.success(configService.deleteConfigByIds(configIds));
     }
 
     /**
      * 清空缓存
      */
-    @PreAuthorize("@ss.hasPermi('system:config:remove')")
     @DeleteMapping("/clearCache")
-    public ApiResult clearCache() {
+    public ApiResult<Void> clearCache() {
         configService.clearCache();
         return ApiResult.success();
     }

+ 5 - 13
system-controller/src/main/java/com/bizmatics/system/controller/web/SysDictDataController.java

@@ -5,6 +5,7 @@ import com.bizmatics.model.SysDictData;
 import com.bizmatics.service.ISysDictDataService;
 import com.bizmatics.service.ISysDictTypeService;
 import com.bizmatics.system.controller.BaseController;
+import com.google.protobuf.Api;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
@@ -23,20 +24,16 @@ public class SysDictDataController extends BaseController {
     @Autowired
     private ISysDictTypeService dictTypeService;
 
-    @PreAuthorize("@ss.hasPermi('system:dict:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysDictData dictData) {
-        startPage();
-        List<SysDictData> list = dictDataService.selectDictDataList(dictData);
-        return getDataTable(list);
+    public ApiResult<List<SysDictData>> list(SysDictData dictData) {
+        return ApiResult.success(dictDataService.selectDictDataList(dictData));
     }
 
     /**
      * 查询字典数据详细
      */
-    @PreAuthorize("@ss.hasPermi('system:dict:query')")
     @GetMapping(value = "/{dictCode}")
-    public ApiResult getInfo(@PathVariable Long dictCode) {
+    public ApiResult<SysDictData> getInfo(@PathVariable Long dictCode) {
         return ApiResult.success(dictDataService.selectDictDataById(dictCode));
     }
 
@@ -44,34 +41,29 @@ public class SysDictDataController extends BaseController {
      * 根据字典类型查询字典数据信息
      */
     @GetMapping(value = "/type/{dictType}")
-    public ApiResult dictType(@PathVariable String dictType) {
+    public ApiResult<List<SysDictData>> dictType(@PathVariable String dictType) {
         return ApiResult.success(dictTypeService.selectDictDataByType(dictType));
     }
 
     /**
      * 新增字典类型
      */
-    @PreAuthorize("@ss.hasPermi('system:dict:add')")
     @PostMapping
     public ApiResult add(@Validated @RequestBody SysDictData dict) {
-        dict.setCreateBy(SecurityUtils.getUser().getName());
         return toAjax(dictDataService.insertDictData(dict));
     }
 
     /**
      * 修改保存字典类型
      */
-    @PreAuthorize("@ss.hasPermi('system:dict:edit')")
     @PutMapping
     public ApiResult edit(@Validated @RequestBody SysDictData dict) {
-        dict.setUpdateBy(SecurityUtils.getUser().getName());
         return toAjax(dictDataService.updateDictData(dict));
     }
 
     /**
      * 删除字典类型
      */
-    @PreAuthorize("@ss.hasPermi('system:dict:remove')")
     @DeleteMapping("/{dictCodes}")
     public ApiResult remove(@PathVariable Long[] dictCodes) {
         return toAjax(dictDataService.deleteDictDataByIds(dictCodes));

+ 11 - 22
system-controller/src/main/java/com/bizmatics/system/controller/web/SysDictTypeController.java

@@ -2,14 +2,14 @@ package com.bizmatics.system.controller.web;
 
 import com.bizmatics.common.core.bean.ApiResult;
 import com.bizmatics.common.core.exception.BusinessErrorCode;
-import com.bizmatics.security.utils.SecurityUtils;
+
+import com.bizmatics.model.SysDictType;
+import com.bizmatics.service.ISysDictTypeService;
+import com.bizmatics.service.constants.SystemConst;
 import com.bizmatics.system.controller.BaseController;
-import com.bizmatics.system.model.SysDictType;
-import com.bizmatics.system.model.page.TableDataInfo;
-import com.bizmatics.system.service.ISysDictTypeService;
-import com.bizmatics.system.service.constants.SystemConst;
+import com.google.protobuf.Api;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
+
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
@@ -24,53 +24,44 @@ public class SysDictTypeController extends BaseController {
     @Autowired
     private ISysDictTypeService dictTypeService;
 
-    @PreAuthorize("@ss.hasPermi('system:dict:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysDictType dictType) {
-        startPage();
-        List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
-        return getDataTable(list);
+    public ApiResult<List<SysDictType>> list(SysDictType dictType) {
+        return ApiResult.success(dictTypeService.selectDictTypeList(dictType));
     }
 
     /**
      * 查询字典类型详细
      */
-    @PreAuthorize("@ss.hasPermi('system:dict:query')")
     @GetMapping(value = "/{dictId}")
-    public ApiResult getInfo(@PathVariable Long dictId) {
+    public ApiResult<SysDictType> getInfo(@PathVariable Long dictId) {
         return ApiResult.success(dictTypeService.selectDictTypeById(dictId));
     }
 
     /**
      * 新增字典类型
      */
-    @PreAuthorize("@ss.hasPermi('system:dict:add')")
     @PostMapping
     public ApiResult add(@Validated @RequestBody SysDictType dict) {
         if (SystemConst.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) {
             return ApiResult.error(BusinessErrorCode.BIZ_BUSINESS_ERROR.getCode(), "新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
         }
-        dict.setCreateBy(SecurityUtils.getUser().getName());
         return toAjax(dictTypeService.insertDictType(dict));
     }
 
     /**
      * 修改字典类型
      */
-    @PreAuthorize("@ss.hasPermi('system:dict:edit')")
     @PutMapping
     public ApiResult edit(@Validated @RequestBody SysDictType dict) {
         if (SystemConst.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) {
             return ApiResult.error(BusinessErrorCode.BIZ_BUSINESS_ERROR.getCode(), "修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
         }
-        dict.setUpdateBy(SecurityUtils.getUser().getName());
         return toAjax(dictTypeService.updateDictType(dict));
     }
 
     /**
      * 删除字典类型
      */
-    @PreAuthorize("@ss.hasPermi('system:dict:remove')")
     @DeleteMapping("/{dictIds}")
     public ApiResult remove(@PathVariable Long[] dictIds) {
         return toAjax(dictTypeService.deleteDictTypeByIds(dictIds));
@@ -79,7 +70,6 @@ public class SysDictTypeController extends BaseController {
     /**
      * 清空缓存
      */
-    @PreAuthorize("@ss.hasPermi('system:dict:remove')")
     @DeleteMapping("/clearCache")
     public ApiResult clearCache() {
         dictTypeService.clearCache();
@@ -90,8 +80,7 @@ public class SysDictTypeController extends BaseController {
      * 获取字典选择框列表
      */
     @GetMapping("/optionselect")
-    public ApiResult optionselect() {
-        List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
-        return ApiResult.success(dictTypes);
+    public ApiResult<List<SysDictType>> optionselect() {
+        return ApiResult.success(dictTypeService.selectDictTypeAll());
     }
 }

+ 4 - 8
system-controller/src/main/java/com/bizmatics/system/controller/web/SysFileController.java

@@ -7,6 +7,7 @@ import com.bizmatics.service.FileSerivce;
 import com.bizmatics.service.dto.SysFileDTO;
 import com.bizmatics.service.dto.SysFileQueryRequest;
 import com.bizmatics.service.dto.SysFileUploadRequest;
+import com.bizmatics.service.enums.UploadType;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.commons.CommonsMultipartFile;
@@ -31,30 +32,25 @@ public class SysFileController {
             @RequestParam("files") CommonsMultipartFile[] multipartFiles,
             @RequestParam("batchNo") String batchNo,
             @RequestParam("businessType") String businessType,
-            @RequestParam(value = "ossacl", required = false) OSSACL ossacl,
             @RequestParam(name = "uploadType", required = false) UploadType uploadType,
             @RequestParam(name = "expireAt", required = false) Date expireAt) {
         SysFileUploadRequest request = SysFileUploadRequest.builder()
                 .multipartFiles(Arrays.asList(multipartFiles))
                 .batchNo(batchNo)
                 .businessType(businessType)
-                .ossAcl(ossacl)
                 .uploadType(uploadType)
                 .expireAt(expireAt)
                 .build();
         if (uploadType == null) {
-            request.setUploadType(UploadType.File);
+            request.setUploadType(UploadType.FILE);
         }
-        List<com.bizmatics.system.service.dto.SysFileDTO> sysFileDTOList = fileSerivce.addFile(request);
-        List<SysFileDTO> sysFileDTOS = BeanMapperUtils.mapList(sysFileDTOList, com.bizmatics.system.service.dto.SysFileDTO.class, SysFileDTO.class);
-        return ApiResult.success(sysFileDTOS);
+        return ApiResult.success(fileSerivce.addFile(request));
     }
 
     @GetMapping
     @ResponseBody
     public ApiResult<List<SysFile>> getFile(SysFileQueryRequest sysFileQueryRequest) {
-        List<SysFile> sysFileList = BeanMapperUtils.mapList(fileSerivce.getFile(sysFileQueryRequest), com.bizmatics.system.model.SysFile.class, SysFile.class);
-        return ApiResult.success(sysFileList);
+        return ApiResult.success(fileSerivce.getFile(sysFileQueryRequest));
     }
 
     @GetMapping("/generateBatchNo")

+ 5 - 25
system-controller/src/main/resources/application-dev.properties

@@ -2,7 +2,7 @@ debug=true
 spring.main.lazy-initialization=false
 spring.main.allow-bean-definition-overriding=true
 # application
-server.port=8082
+server.port=8088
 # mybatis-plus
 mybatis-plus.mapper-locations=classpath*:mapper/**/*.xml
 mybatis-plus.configuration.lazy-loading-enabled=true
@@ -15,17 +15,10 @@ mybatis.refresh.delay-seconds=10
 mybatis.refresh.sleep-seconds=20
 # datasource
 spring.autoconfigure.exclude=com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
-spring.datasource.dynamic.primary=newtest
-#spring.datasource.dynamic.strict=true
-#spring.datasource.dynamic.seata=true
-#spring.datasource.dynamic.seata-mode=at
-#spring.datasource.dynamic.datasource.test.url=jdbc:mysql://localhost:3306/test?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
-#spring.datasource.dynamic.datasource.test.username=root
-#spring.datasource.dynamic.datasource.test.password=
-#老库
-spring.datasource.dynamic.datasource.newtest.url=jdbc:mysql://120.55.70.156:3306/newtest?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
-spring.datasource.dynamic.datasource.newtest.username=root
-spring.datasource.dynamic.datasource.newtest.password=123456
+spring.datasource.dynamic.primary=system
+spring.datasource.dynamic.datasource.system.url=jdbc:mysql://localhost:3306/system?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
+spring.datasource.dynamic.datasource.system.username=root
+spring.datasource.dynamic.datasource.system.password=
 spring.datasource.dynamic.druid.initial-size=5                                                                       
 spring.datasource.dynamic.druid.min-idle=5
 spring.datasource.dynamic.druid.max-active=30
@@ -69,16 +62,6 @@ spring.jackson.parser.allow-single-quotes=true
 server.compression.enabled=true
 server.compression.mime-types=application/javascript,text/css,application/json,application/xml,text/html,text/xml,text/plain
 
-#seata.enabled=true
-#seata.application-id=applicationName
-#seata.tx-service-group=my_test_tx_group
-#seata.enable-auto-data-source-proxy=false
-#seata.service.vgroup-mapping.my_test_tx_group=default
-#seata.service.grouplist.default=127.0.0.1:8091
-#seata.config.type=file
-#seata.registry.type=file
-
-
 # eureka
 #eureka.client.service-url.defaultZone=http://172.31.101.251:8099/eureka/,http://172.31.101.252:8099/eureka/
 #eureka.client.service-url.defaultZone=http://localhost:8088/eureka/
@@ -88,6 +71,3 @@ server.compression.mime-types=application/javascript,text/css,application/json,a
 #eureka.instance.lease-renewal-interval-in-seconds=30
 #eureka.instance.lease-expiration-duration-in-seconds=90
 #eureka.client.registryFetchIntervalSeconds=30
-
-
-spring.data.mongodb.uri= mongodb://120.55.70.156:27017/test

+ 16 - 10
system-controller/src/main/resources/application-prod.properties

@@ -2,7 +2,7 @@ debug=true
 spring.main.lazy-initialization=false
 spring.main.allow-bean-definition-overriding=true
 # application
-server.port=8082
+server.port=8088
 # mybatis-plus
 mybatis-plus.mapper-locations=classpath*:mapper/**/*.xml
 mybatis-plus.configuration.lazy-loading-enabled=true
@@ -15,15 +15,11 @@ mybatis.refresh.delay-seconds=10
 mybatis.refresh.sleep-seconds=20
 # datasource
 spring.autoconfigure.exclude=com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
-spring.datasource.dynamic.primary=product
-spring.datasource.dynamic.datasource.product.url=jdbc:mysql://dev1.shuqian.com:3306/product?allowMultiQueries=true&createDatabaseIfNotExist=true&autoReconnect=true&useUnicode=true&characterEncoding=utf8&useSSL=false&rewriteBatchedStatements=true&useCompression=true
-spring.datasource.dynamic.datasource.product.username=dev
-spring.datasource.dynamic.datasource.product.password=Coozo0628
-#老库
-spring.datasource.dynamic.datasource.old.url=jdbc:mysql://dev1.shuqian.com:3306/amazonold?allowMultiQueries=true&createDatabaseIfNotExist=true&autoReconnect=true&useUnicode=true&characterEncoding=utf8&useSSL=false&rewriteBatchedStatements=true
-spring.datasource.dynamic.datasource.old.username=dev
-spring.datasource.dynamic.datasource.old.password=Coozo0628
-spring.datasource.dynamic.druid.initial-size=5
+spring.datasource.dynamic.primary=system
+spring.datasource.dynamic.datasource.system.url=jdbc:mysql://localhost:3306/system?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
+spring.datasource.dynamic.datasource.system.username=root
+spring.datasource.dynamic.datasource.system.password=
+spring.datasource.dynamic.druid.initial-size=5                                                                       
 spring.datasource.dynamic.druid.min-idle=5
 spring.datasource.dynamic.druid.max-active=30
 spring.datasource.dynamic.druid.max-wait=60000
@@ -65,3 +61,13 @@ spring.jackson.parser.allow-single-quotes=true
 # gzip
 server.compression.enabled=true
 server.compression.mime-types=application/javascript,text/css,application/json,application/xml,text/html,text/xml,text/plain
+
+# eureka
+#eureka.client.service-url.defaultZone=http://172.31.101.251:8099/eureka/,http://172.31.101.252:8099/eureka/
+#eureka.client.service-url.defaultZone=http://localhost:8088/eureka/
+##eureka.client.healthcheck.enabled=true
+#eureka.instance.prefer-ip-address=true
+#eureka.instance.instance-id=${spring.application.name}:${spring.cloud.client.ip-address}:${server.port}
+#eureka.instance.lease-renewal-interval-in-seconds=30
+#eureka.instance.lease-expiration-duration-in-seconds=90
+#eureka.client.registryFetchIntervalSeconds=30

+ 16 - 10
system-controller/src/main/resources/application-test.properties

@@ -2,7 +2,7 @@ debug=true
 spring.main.lazy-initialization=false
 spring.main.allow-bean-definition-overriding=true
 # application
-server.port=8082
+server.port=8088
 # mybatis-plus
 mybatis-plus.mapper-locations=classpath*:mapper/**/*.xml
 mybatis-plus.configuration.lazy-loading-enabled=true
@@ -15,15 +15,11 @@ mybatis.refresh.delay-seconds=10
 mybatis.refresh.sleep-seconds=20
 # datasource
 spring.autoconfigure.exclude=com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
-spring.datasource.dynamic.primary=product
-spring.datasource.dynamic.datasource.product.url=jdbc:mysql://dev1.shuqian.com:3306/product?allowMultiQueries=true&createDatabaseIfNotExist=true&autoReconnect=true&useUnicode=true&characterEncoding=utf8&useSSL=false&rewriteBatchedStatements=true&useCompression=true
-spring.datasource.dynamic.datasource.product.username=dev
-spring.datasource.dynamic.datasource.product.password=Coozo0628
-#老库
-spring.datasource.dynamic.datasource.old.url=jdbc:mysql://dev1.shuqian.com:3306/amazonold?allowMultiQueries=true&createDatabaseIfNotExist=true&autoReconnect=true&useUnicode=true&characterEncoding=utf8&useSSL=false&rewriteBatchedStatements=true
-spring.datasource.dynamic.datasource.old.username=dev
-spring.datasource.dynamic.datasource.old.password=Coozo0628
-spring.datasource.dynamic.druid.initial-size=5
+spring.datasource.dynamic.primary=system
+spring.datasource.dynamic.datasource.system.url=jdbc:mysql://localhost:3306/system?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
+spring.datasource.dynamic.datasource.system.username=root
+spring.datasource.dynamic.datasource.system.password=
+spring.datasource.dynamic.druid.initial-size=5                                                                       
 spring.datasource.dynamic.druid.min-idle=5
 spring.datasource.dynamic.druid.max-active=30
 spring.datasource.dynamic.druid.max-wait=60000
@@ -65,3 +61,13 @@ spring.jackson.parser.allow-single-quotes=true
 # gzip
 server.compression.enabled=true
 server.compression.mime-types=application/javascript,text/css,application/json,application/xml,text/html,text/xml,text/plain
+
+# eureka
+#eureka.client.service-url.defaultZone=http://172.31.101.251:8099/eureka/,http://172.31.101.252:8099/eureka/
+#eureka.client.service-url.defaultZone=http://localhost:8088/eureka/
+##eureka.client.healthcheck.enabled=true
+#eureka.instance.prefer-ip-address=true
+#eureka.instance.instance-id=${spring.application.name}:${spring.cloud.client.ip-address}:${server.port}
+#eureka.instance.lease-renewal-interval-in-seconds=30
+#eureka.instance.lease-expiration-duration-in-seconds=90
+#eureka.client.registryFetchIntervalSeconds=30

+ 1 - 1
system-controller/src/main/resources/log4j2-spring-dev.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <configuration status="OFF">
     <properties>
-        <property name="LOG_HOME">./logs/product</property>
+        <property name="LOG_HOME">./logs/system</property>
         <Property name="CONSOLE_LOG_PATTERN">%clr{%d{yyyy-MM-dd HH:mm:ss.SSS}}{blue} %clr{%-5level}
             %clr{${sys:PID}}{magenta} %clr{---}{faint} %clr{[%15.15t]}{faint} %clr{%l}{cyan} %clr{:}{faint} %m%n%xwEx
         </Property>

+ 1 - 1
system-controller/src/main/resources/log4j2-spring-prod.xml

@@ -2,7 +2,7 @@
 <configuration status="OFF">
 
     <properties>
-        <property name="LOG_HOME">/data/logs/product</property>
+        <property name="LOG_HOME">/data/logs/system</property>
         <Property name="CONSOLE_LOG_PATTERN">%clr{%d{yyyy-MM-dd HH:mm:ss.SSS}}{blue} %clr{%-5level}
             %clr{${sys:PID}}{magenta} %clr{---}{faint} %clr{[%15.15t]}{faint} %clr{%l}{cyan} %clr{:}{faint} %m%n%xwEx
         </Property>

+ 1 - 1
system-controller/src/main/resources/log4j2-spring-test.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <configuration status="OFF">
     <properties>
-        <property name="LOG_HOME">/data/logs/product</property>
+        <property name="LOG_HOME">/data/logs/system</property>
     </properties>
     <appenders>
         <!-- 日志级别:ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < OFF -->

+ 2 - 0
system-persistence/src/main/java/com/bizmatics/persistence/mapper/SysConfigMapper.java

@@ -3,12 +3,14 @@ package com.bizmatics.persistence.mapper;
 
 
 import com.bizmatics.model.SysConfig;
+import org.springframework.stereotype.Repository;
 
 import java.util.List;
 
 /**
  * 参数配置 数据层
  */
+@Repository
 public interface SysConfigMapper {
     /**
      * 查询参数配置信息

+ 1 - 0
system-service/src/main/java/com/bizmatics/service/ISysAsyncTaskService.java

@@ -5,6 +5,7 @@ import com.bizmatics.common.mvc.base.CrudService;
 import com.bizmatics.model.SysAsyncTask;
 import com.bizmatics.model.vo.SysAsyncTaskVo;
 import com.bizmatics.service.dto.SysAsyncTaskDTO;
+import com.bizmatics.service.enums.AsyncResultType;
 
 import java.util.Date;
 

+ 2 - 0
system-service/src/main/java/com/bizmatics/service/dto/SysFileUploadRequest.java

@@ -1,6 +1,7 @@
 package com.bizmatics.service.dto;
 
 import com.bizmatics.service.enums.UploadType;
+import lombok.Builder;
 import lombok.Data;
 import org.springframework.web.multipart.commons.CommonsMultipartFile;
 
@@ -11,6 +12,7 @@ import java.util.List;
  * @author yq
  * @date 2021/6/30 14:45
  */
+@Builder
 @Data
 public class SysFileUploadRequest {
 

+ 10 - 0
system-service/src/main/java/com/bizmatics/service/enums/AsyncResultType.java

@@ -0,0 +1,10 @@
+package com.bizmatics.service.enums;
+
+/**
+ * @author yq
+ * @date 2021/7/1 10:10
+ */
+public enum AsyncResultType {
+
+    FILE;
+}

+ 7 - 5
system-service/src/main/java/com/bizmatics/service/impl/FileServiceImpl.java

@@ -184,6 +184,8 @@ public class FileServiceImpl extends AbstractCrudService<FileMapper, SysFile> im
     public SysFileDTO uploadToOss(File file, SysFileDTO sysFileDTO, SysFileUploadRequest sysFileUploadRequest) {
         try {
             prepareMetadata(file, sysFileDTO, sysFileUploadRequest);
+            sysFileDTO.setSuccess(true);
+            sysFileDTO.setMessage("success");
             if (sysFileDTO.getSuccess()) {
                 sysFileDTO.setId(UUIDUtils.shortUUID());
                 SysFile sysfile = BeanMapperUtils.map(sysFileDTO, SysFile.class);
@@ -245,19 +247,19 @@ public class FileServiceImpl extends AbstractCrudService<FileMapper, SysFile> im
     }
 
     private SysFileDTO prepareMetadata(File file, SysFileDTO sysFileDTO, SysFileUploadRequest sysFileUploadRequest) {
-        String ossKey;
+        String fileKey;
         if (StringUtils.isNotBlank(sysFileUploadRequest.getKey())) {
-            ossKey = sysFileUploadRequest.getKey();
+            fileKey = sysFileUploadRequest.getKey();
         } else {
-            ossKey = generateKey(file, sysFileUploadRequest.getBusinessType());
+            fileKey = generateKey(file, sysFileUploadRequest.getBusinessType());
         }
-        sysFileDTO.setOssKey(ossKey);
+        sysFileDTO.setOssKey(fileKey);
         sysFileDTO.setOriName(file.getName());
         sysFileDTO.setBatchNo(sysFileUploadRequest.getBatchNo());
         sysFileDTO.setBusinessType(sysFileUploadRequest.getBusinessType());
         sysFileDTO.setActiveFlag(0);
         sysFileDTO.setFileSize((int) file.length());
-        sysFileDTO.setFileType((StringUtils.isNotBlank(ossKey) && ossKey.lastIndexOf(".") > 0) ? ossKey.substring(ossKey.lastIndexOf(".") + 1) : "");
+        sysFileDTO.setFileType((StringUtils.isNotBlank(fileKey) && fileKey.lastIndexOf(".") > 0) ? fileKey.substring(fileKey.lastIndexOf(".") + 1) : "");
         sysFileDTO.setExpireAt(sysFileUploadRequest.getExpireAt());
         return sysFileDTO;
     }

+ 1 - 0
system-service/src/main/java/com/bizmatics/service/impl/SysAsyncTaskServiceImpl.java

@@ -17,6 +17,7 @@ import com.bizmatics.service.ISysAsyncTaskService;
 import com.bizmatics.service.ISysConfigService;
 import com.bizmatics.service.ISysDictDataService;
 import com.bizmatics.service.dto.SysAsyncTaskDTO;
+import com.bizmatics.service.enums.AsyncResultType;
 import com.bizmatics.service.expcetion.AsyncErrorCode;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;

+ 26 - 26
system-service/src/main/java/com/bizmatics/service/impl/SysConfigServiceImpl.java

@@ -24,19 +24,19 @@ public class SysConfigServiceImpl implements ISysConfigService {
     @Autowired
     private SysConfigMapper configMapper;
 
-    @Autowired
-    private RedisHelper redisHelper;
+//    @Autowired
+//    private RedisHelper redisHelper;
 
     /**
      * 项目启动时,初始化参数到缓存
      */
-    @PostConstruct
-    public void init() {
-        List<SysConfig> configsList = configMapper.selectConfigList(new SysConfig());
-        for (SysConfig config : configsList) {
-            redisHelper.set(getCacheKey(config.getConfigKey()), config.getConfigValue());
-        }
-    }
+//    @PostConstruct
+//    public void init() {
+//        List<SysConfig> configsList = configMapper.selectConfigList(new SysConfig());
+//        for (SysConfig config : configsList) {
+//            redisHelper.set(getCacheKey(config.getConfigKey()), config.getConfigValue());
+//        }
+//    }
 
     /**
      * 查询参数配置信息
@@ -59,15 +59,15 @@ public class SysConfigServiceImpl implements ISysConfigService {
      */
     @Override
     public String selectConfigByKey(String configKey) {
-        String configValue = Convert.toStr(redisHelper.get(getCacheKey(configKey)));
-        if (StringUtils.isNotEmpty(configValue)) {
-            return configValue;
-        }
+//        String configValue = Convert.toStr(redisHelper.get(getCacheKey(configKey)));
+//        if (StringUtils.isNotEmpty(configValue)) {
+//            return configValue;
+//        }
         SysConfig config = new SysConfig();
         config.setConfigKey(configKey);
         SysConfig retConfig = configMapper.selectConfig(config);
         if (Objects.nonNull(retConfig)) {
-            redisHelper.set(getCacheKey(configKey), retConfig.getConfigValue());
+//            redisHelper.set(getCacheKey(configKey), retConfig.getConfigValue());
             return retConfig.getConfigValue();
         }
         return StringUtils.EMPTY;
@@ -93,9 +93,9 @@ public class SysConfigServiceImpl implements ISysConfigService {
     @Override
     public int insertConfig(SysConfig config) {
         int row = configMapper.insertConfig(config);
-        if (row > 0) {
-            redisHelper.set(getCacheKey(config.getConfigKey()), config.getConfigValue());
-        }
+//        if (row > 0) {
+//            redisHelper.set(getCacheKey(config.getConfigKey()), config.getConfigValue());
+//        }
         return row;
     }
 
@@ -108,9 +108,9 @@ public class SysConfigServiceImpl implements ISysConfigService {
     @Override
     public int updateConfig(SysConfig config) {
         int row = configMapper.updateConfig(config);
-        if (row > 0) {
-            redisHelper.set(getCacheKey(config.getConfigKey()), config.getConfigValue());
-        }
+//        if (row > 0) {
+//            redisHelper.set(getCacheKey(config.getConfigKey()), config.getConfigValue());
+//        }
         return row;
     }
 
@@ -123,10 +123,10 @@ public class SysConfigServiceImpl implements ISysConfigService {
     @Override
     public int deleteConfigByIds(Long[] configIds) {
         int count = configMapper.deleteConfigByIds(configIds);
-        if (count > 0) {
-            Collection<String> keys = redisHelper.keys(CacheConst.SYS_CONFIG_KEY + "*");
-            redisHelper.delete(keys);
-        }
+//        if (count > 0) {
+//            Collection<String> keys = redisHelper.keys(CacheConst.SYS_CONFIG_KEY + "*");
+//            redisHelper.delete(keys);
+//        }
         return count;
     }
 
@@ -135,8 +135,8 @@ public class SysConfigServiceImpl implements ISysConfigService {
      */
     @Override
     public void clearCache() {
-        Collection<String> keys = redisHelper.keys(CacheConst.SYS_CONFIG_KEY + "*");
-        redisHelper.delete(keys);
+//        Collection<String> keys = redisHelper.keys(CacheConst.SYS_CONFIG_KEY + "*");
+//        redisHelper.delete(keys);
     }
 
     /**