diff --git a/bin/clean.bat b/bin/clean.bat index af841d8e004e1f0c8f615840c0ab40cd73ee3232..18f25884063fc7729dcf832496d6a5ac16762b33 100644 --- a/bin/clean.bat +++ b/bin/clean.bat @@ -1,12 +1,12 @@ -@echo off -echo. -echo [信息] 清理工程target生成路径。 -echo. - -%~d0 -cd %~dp0 - -cd .. -call mvn clean - -pause \ No newline at end of file +@echo off +echo. +echo 鍚姩web +echo. + +%~d0 +cd %~dp0 + +cd .. +call mvn clean + +pause diff --git a/bin/package.bat b/bin/package.bat index af8af8eceed5f11cc32e7c7793e9ac9d35fd8b81..48f580a468b12e434d45fe6c31aee5021d812f02 100644 --- a/bin/package.bat +++ b/bin/package.bat @@ -1,12 +1,12 @@ @echo off echo. -echo [信息] 打包Web工程,生成war/jar包文件。 +echo 寮濮嬫墦鍖 echo. %~d0 cd %~dp0 cd .. -call mvn clean package -Dmaven.test.skip=true +call mvn clean package -DskipTests=true -pause \ No newline at end of file +pause diff --git a/bin/run.bat b/bin/run.bat index 99c49921b01bb65b370e6ee6146e13413c669974..5f5e7500ad2debf7fe10761c1912e39813017f8b 100644 --- a/bin/run.bat +++ b/bin/run.bat @@ -1,14 +1,14 @@ @echo off echo. -echo [信息] 使用Jar命令运行Web工程。 +echo 鍚姩web echo. cd %~dp0 -cd ../ruoyi-admin/target +cd /data/ruoyi -set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m +set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m --spring.profiles.active=prod java -jar %JAVA_OPTS% ruoyi-admin.jar cd bin -pause \ No newline at end of file +pause diff --git a/pom.xml b/pom.xml index b7a16b2013c88ba59bb12489e7633c843398452d..ad37a2d24bdc2fc10279904003e9d60e1fa866bc 100644 --- a/pom.xml +++ b/pom.xml @@ -2,8 +2,8 @@ - 4.0.0 - + 4.0.0 + com.ruoyi ruoyi 3.8.3 @@ -11,7 +11,7 @@ ruoyi http://www.ruoyi.vip 鑻ヤ緷绠$悊绯荤粺 - + 3.8.3 UTF-8 @@ -32,8 +32,14 @@ 4.1.2 2.3 0.9.1 + 5.8.4 + 1.5.4 + 1.6.2 + 8.2.1 + 3.4.2 + 1.18.24 - + @@ -186,6 +192,62 @@ ${ruoyi.version} + + + cn.hutool + hutool-all + ${hutool.version} + + + + + ma.glasnost.orika + orika-core + ${orika.version} + + + + + io.swagger + swagger-annotations + ${swagger.annotations.version} + + + + + io.minio + minio + ${minio.version} + + + + + com.baomidou + mybatis-plus-boot-starter + ${mybatis.plus.version} + + + + + org.projectlombok + lombok + ${lombok.version} + + + + + net.postgis + postgis-jdbc + 2.5.0 + + + + + com.github.xiaoymin + knife4j-spring-boot-starter + 3.0.3 + + @@ -244,4 +306,4 @@ - \ No newline at end of file + diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index 140d9ee8c83dd4f7ada15e061355723016656979..aaeb257d92a32b09cbf51d3617a76bb19edf77d0 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -62,6 +62,17 @@ ruoyi-generator + + org.springframework.boot + spring-boot-starter-actuator + + + + com.github.xiaoymin + knife4j-spring-boot-starter + 3.0.3 + + @@ -81,17 +92,17 @@ - - org.apache.maven.plugins - maven-war-plugin - 3.1.0 + + org.apache.maven.plugins + maven-war-plugin + 3.1.0 false ${project.artifactId} - - + + ${project.artifactId} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusAuditRecordController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusAuditRecordController.java new file mode 100644 index 0000000000000000000000000000000000000000..350b9095b4b68cf12e9e32371957374b453ec98f --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusAuditRecordController.java @@ -0,0 +1,111 @@ +package com.ruoyi.web.controller.business; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.core.domain.R; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.business.domain.BusAuditRecord; +import com.ruoyi.business.service.IBusAuditRecordService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 瀹℃牳璁板綍Controller + * + * @author ruoyi + * @date 2022-07-13 + */ +@RestController +@RequestMapping("/business/record_data") +@Api(tags = "瀹℃牳璁板綍Controller") +public class BusAuditRecordController extends BaseController +{ + @Autowired + private IBusAuditRecordService busAuditRecordService; + + /** + * 鏌ヨ瀹℃牳璁板綍鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('business:record_data:list')") + @GetMapping("/list") + @ApiResponse + public TableDataInfo list(BusAuditRecord busAuditRecord) + { + startPage(); + List list = busAuditRecordService.selectBusAuditRecordList(busAuditRecord); + return new TableDataInfo<>(list); + } + + /** + * 瀵煎嚭瀹℃牳璁板綍鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('business:record_data:export')") + @Log(title = "瀹℃牳璁板綍", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, BusAuditRecord busAuditRecord) + { + List list = busAuditRecordService.selectBusAuditRecordList(busAuditRecord); + ExcelUtil util = new ExcelUtil(BusAuditRecord.class); + util.exportExcel(response, list, "瀹℃牳璁板綍鏁版嵁"); + } + + /** + * 鑾峰彇瀹℃牳璁板綍璇︾粏淇℃伅 + */ + @PreAuthorize("@ss.hasPermi('business:record_data:query')") + @GetMapping(value = "/{auditId}") + public R getInfo(@PathVariable("auditId") Long auditId) + { + return R.ok(busAuditRecordService.selectBusAuditRecordByAuditId(auditId)); + } + + /** + * 鏂板瀹℃牳璁板綍 + */ + @PreAuthorize("@ss.hasPermi('business:record_data:add')") + @Log(title = "瀹℃牳璁板綍", businessType = BusinessType.INSERT) + @PostMapping + public R add(@RequestBody BusAuditRecord busAuditRecord) + { + return toAjax(busAuditRecordService.insertBusAuditRecord(busAuditRecord)); + } + + /** + * 淇敼瀹℃牳璁板綍 + */ + @PreAuthorize("@ss.hasPermi('business:record_data:edit')") + @Log(title = "瀹℃牳璁板綍", businessType = BusinessType.UPDATE) + @PutMapping + public R edit(@RequestBody BusAuditRecord busAuditRecord) + { + return toAjax(busAuditRecordService.updateBusAuditRecord(busAuditRecord)); + } + + /** + * 鍒犻櫎瀹℃牳璁板綍 + */ + @PreAuthorize("@ss.hasPermi('business:record_data:remove')") + @Log(title = "瀹℃牳璁板綍", businessType = BusinessType.DELETE) + @DeleteMapping("/{auditIds}") + public R remove(@PathVariable Long[] auditIds) + { + return toAjax(busAuditRecordService.deleteBusAuditRecordByAuditIds(auditIds)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusFileController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusFileController.java new file mode 100644 index 0000000000000000000000000000000000000000..32b248122f49ac8d3f2cdb1c9ccac26c09c43faf --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusFileController.java @@ -0,0 +1,87 @@ +package com.ruoyi.web.controller.business; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.core.domain.R; +import io.swagger.annotations.Api; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.business.domain.BusFile; +import com.ruoyi.business.service.IBusFileService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 鏂囦欢璁板綍Controller + * + * @author ruoyi + * @date 2022-07-15 + */ +@RestController +@RequestMapping("/business/file") +@Api(tags = "鏂囦欢璁板綍Controller") +public class BusFileController extends BaseController +{ + @Autowired + private IBusFileService busFileService; + + /** + * 鏌ヨ鏂囦欢璁板綍鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('business:file:list')") + @GetMapping("/list") + public TableDataInfo list(BusFile busFile) + { + startPage(); + List list = busFileService.selectBusFileList(busFile); + return new TableDataInfo<>(list); + } + + /** + * 瀵煎嚭鏂囦欢璁板綍鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('business:file:export')") + @Log(title = "鏂囦欢璁板綍", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, BusFile busFile) + { + List list = busFileService.selectBusFileList(busFile); + ExcelUtil util = new ExcelUtil(BusFile.class); + util.exportExcel(response, list, "鏂囦欢璁板綍鏁版嵁"); + } + + /** + * 鑾峰彇鏂囦欢璁板綍璇︾粏淇℃伅 + */ + @PreAuthorize("@ss.hasPermi('business:file:query')") + @GetMapping(value = "/{fileId}") + public R getInfo(@PathVariable("fileId") Long fileId) + { + return R.ok(busFileService.selectBusFileByFileId(fileId)); + } + + + /** + * 鍒犻櫎鏂囦欢璁板綍 + */ + @PreAuthorize("@ss.hasPermi('business:file:remove')") + @Log(title = "鏂囦欢璁板綍", businessType = BusinessType.DELETE) + @DeleteMapping("/{fileIds}") + public R remove(@PathVariable Long[] fileIds) + { + return toAjax(busFileService.deleteBusFileByFileIds(fileIds)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusInjectionController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusInjectionController.java new file mode 100644 index 0000000000000000000000000000000000000000..0053932af0725066f9c929f0f26b971b331a3250 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusInjectionController.java @@ -0,0 +1,112 @@ +package com.ruoyi.web.controller.business; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.business.domain.dto.BusInjectionSaveCmd; +import com.ruoyi.business.domain.dto.BusInjectionUpdateCmd; +import com.ruoyi.business.domain.query.BusInjectionQuery; +import com.ruoyi.business.domain.vo.BusInjectionVo; +import com.ruoyi.common.core.domain.R; +import io.swagger.annotations.Api; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.business.domain.BusInjection; +import com.ruoyi.business.service.IBusInjectionService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 娉ㄥ共绠$悊鏁版嵁Controller + * + * @author ruoyi + * @date 2022-07-20 + */ +@RestController +@RequestMapping("/business/injection_data") +@Api(tags = "娉ㄥ共绠$悊鏁版嵁Controller") +public class BusInjectionController extends BaseController +{ + @Autowired + private IBusInjectionService busInjectionService; + + /** + * 鏌ヨ娉ㄥ共绠$悊鏁版嵁鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('business:injection_data:list')") + @GetMapping("/list") + public TableDataInfo list(BusInjectionQuery query) + { + startPage(); + List list = busInjectionService.selectList(query); + return new TableDataInfo<>(list); + } + + /** + * 瀵煎嚭娉ㄥ共绠$悊鏁版嵁鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('business:injection_data:export')") + @Log(title = "娉ㄥ共绠$悊鏁版嵁", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, BusInjectionQuery query) + { + List list = busInjectionService.selectList(query); + ExcelUtil util = new ExcelUtil(BusInjectionVo.class); + util.exportExcel(response, list, "娉ㄥ共绠$悊鏁版嵁鏁版嵁"); + } + + /** + * 鑾峰彇娉ㄥ共绠$悊鏁版嵁璇︾粏淇℃伅 + */ + @PreAuthorize("@ss.hasPermi('business:injection_data:query')") + @GetMapping(value = "/{id}") + public R getInfo(@PathVariable("id") Long id) + { + return R.ok(busInjectionService.selectById(id)); + } + + /** + * 鏂板娉ㄥ共绠$悊鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:injection_data:add')") + @Log(title = "娉ㄥ共绠$悊鏁版嵁", businessType = BusinessType.INSERT) + @PostMapping + public R add(@RequestBody BusInjectionSaveCmd saveCmd) + { + return toAjax(busInjectionService.save(saveCmd)); + } + + /** + * 淇敼娉ㄥ共绠$悊鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:injection_data:edit')") + @Log(title = "娉ㄥ共绠$悊鏁版嵁", businessType = BusinessType.UPDATE) + @PutMapping + public R edit(@RequestBody BusInjectionUpdateCmd updateCmd) + { + return toAjax(busInjectionService.update(updateCmd)); + } + + /** + * 鍒犻櫎娉ㄥ共绠$悊鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:injection_data:remove')") + @Log(title = "娉ㄥ共绠$悊鏁版嵁", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public R remove(@PathVariable Long[] ids) + { + return toAjax(busInjectionService.deleteByIds(ids)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusInjectionMaintainController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusInjectionMaintainController.java new file mode 100644 index 0000000000000000000000000000000000000000..ff6e9b764f2e7bee50969080bfaae463e0851eef --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusInjectionMaintainController.java @@ -0,0 +1,119 @@ +package com.ruoyi.web.controller.business; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.business.domain.dto.BusInjectionMaintainSaveCmd; +import com.ruoyi.business.domain.dto.BusInjectionMaintainUpdateCmd; +import com.ruoyi.business.domain.query.BusInjectionMaintainQuery; +import com.ruoyi.business.domain.vo.BusInjectionMaintainVo; +import com.ruoyi.common.core.domain.R; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.business.domain.BusInjectionMaintain; +import com.ruoyi.business.service.IBusInjectionMaintainService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 娉ㄥ共缁存姢鏁版嵁Controller + * + * @author ruoyi + * @date 2022-07-20 + */ +@RestController +@RequestMapping("/business/injection_maintain_data") +@Api(tags = "娉ㄥ共缁存姢鏁版嵁Controller") +public class BusInjectionMaintainController extends BaseController +{ + @Autowired + private IBusInjectionMaintainService busInjectionMaintainService; + + /** + * 鏌ヨ娉ㄥ共缁存姢鏁版嵁鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('business:injection_maintain_data:list')") + @GetMapping("/list") + @ApiOperation(value = "鏌ヨ娉ㄥ共缁存姢鏁版嵁鍒楄〃") + public TableDataInfo list(BusInjectionMaintainQuery query) + { + startPage(); + List list = busInjectionMaintainService.selectList(query); + return new TableDataInfo<>(list); + } + + /** + * 瀵煎嚭娉ㄥ共缁存姢鏁版嵁鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('business:injection_maintain_data:export')") + @Log(title = "娉ㄥ共缁存姢鏁版嵁", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ApiOperation(value = "瀵煎嚭娉ㄥ共缁存姢鏁版嵁鍒楄〃") + public void export(HttpServletResponse response, BusInjectionMaintainQuery query) + { + List list = busInjectionMaintainService.selectList(query); + ExcelUtil util = new ExcelUtil(BusInjectionMaintainVo.class); + util.exportExcel(response, list, "娉ㄥ共缁存姢鏁版嵁鏁版嵁"); + } + + /** + * 鑾峰彇娉ㄥ共缁存姢鏁版嵁璇︾粏淇℃伅 + */ + @PreAuthorize("@ss.hasPermi('business:injection_maintain_data:query')") + @GetMapping(value = "/{id}") + @ApiOperation(value = "鑾峰彇娉ㄥ共缁存姢鏁版嵁璇︾粏淇℃伅") + public R getInfo(@PathVariable("id") Long id) + { + return R.ok(busInjectionMaintainService.selectById(id)); + } + + /** + * 鏂板娉ㄥ共缁存姢鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:injection_maintain_data:add')") + @Log(title = "娉ㄥ共缁存姢鏁版嵁", businessType = BusinessType.INSERT) + @PostMapping + @ApiOperation(value = "鏂板娉ㄥ共缁存姢鏁版嵁") + public R add(@RequestBody BusInjectionMaintainSaveCmd saveCmd) + { + return toAjax(busInjectionMaintainService.save(saveCmd)); + } + + /** + * 淇敼娉ㄥ共缁存姢鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:injection_maintain_data:edit')") + @Log(title = "娉ㄥ共缁存姢鏁版嵁", businessType = BusinessType.UPDATE) + @PutMapping + @ApiOperation(value = "淇敼娉ㄥ共缁存姢鏁版嵁") + public R edit(@RequestBody BusInjectionMaintainUpdateCmd updateCmd) + { + return toAjax(busInjectionMaintainService.update(updateCmd)); + } + + /** + * 鍒犻櫎娉ㄥ共缁存姢鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:injection_maintain_data:remove')") + @Log(title = "娉ㄥ共缁存姢鏁版嵁", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + @ApiOperation(value = "鍒犻櫎娉ㄥ共缁存姢鏁版嵁") + public R remove(@PathVariable Long[] ids) + { + return toAjax(busInjectionMaintainService.deleteByIds(ids)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusSamplingController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusSamplingController.java new file mode 100644 index 0000000000000000000000000000000000000000..d20b140ac01c5a28452616403a9ae0567d93485f --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusSamplingController.java @@ -0,0 +1,132 @@ +package com.ruoyi.web.controller.business; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.business.domain.dto.BusSamplingDetectionCmd; +import com.ruoyi.business.domain.dto.BusSamplingSaveCmd; +import com.ruoyi.business.domain.dto.BusSamplingUpdateCmd; +import com.ruoyi.business.domain.query.BusSamplingQuery; +import com.ruoyi.business.domain.vo.BusSamplingVo; +import com.ruoyi.common.core.domain.R; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.business.service.IBusSamplingService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 鍙栨牱鏁版嵁Controller + * + * @author ruoyi + * @date 2022-07-13 + */ +@RestController +@RequestMapping("/business/sampling_data") +@Api(tags = "鍙栨牱鏁版嵁Controller") +public class BusSamplingController extends BaseController +{ + @Autowired + private IBusSamplingService busSamplingService; + + /** + * 鏌ヨ鍙栨牱鏁版嵁鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('business:sampling_data:list')") + @GetMapping("/list") + @ApiOperation(value = "鏌ヨ鍙栨牱鏁版嵁鍒楄〃") + public TableDataInfo list(BusSamplingQuery query) + { + startPage(); + List list = busSamplingService.selectList(query); + return new TableDataInfo<>(list); + } + + /** + * 瀵煎嚭鍙栨牱鏁版嵁鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('business:sampling_data:export')") + @Log(title = "鍙栨牱鏁版嵁", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ApiOperation(value = "瀵煎嚭鍙栨牱鏁版嵁鍒楄〃") + public void export(HttpServletResponse response, BusSamplingQuery busSampling) + { + List list = busSamplingService.selectList(busSampling); + ExcelUtil util = new ExcelUtil<>(BusSamplingVo.class); + util.exportExcel(response, list, "鍙栨牱鏁版嵁鏁版嵁"); + } + + /** + * 鑾峰彇鍙栨牱鏁版嵁璇︾粏淇℃伅 + */ + @PreAuthorize("@ss.hasPermi('business:sampling_data:query')") + @GetMapping(value = "/{id}") + @ApiOperation(value = "鑾峰彇鍙栨牱鏁版嵁璇︾粏淇℃伅") + public R getInfo(@PathVariable("id") Long id) + { + return R.ok(busSamplingService.selectById(id)); + } + + /** + * 鏂板鍙栨牱鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:sampling_data:add')") + @Log(title = "鍙栨牱鏁版嵁", businessType = BusinessType.INSERT) + @PostMapping + @ApiOperation(value = "鏂板鍙栨牱鏁版嵁") + public R add(@RequestBody BusSamplingSaveCmd saveCmd) + { + return toAjax(busSamplingService.save(saveCmd)); + } + + /** + * 淇敼鍙栨牱鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:sampling_data:edit')") + @Log(title = "鍙栨牱鏁版嵁", businessType = BusinessType.UPDATE) + @PutMapping + @ApiOperation(value = "淇敼鍙栨牱鏁版嵁") + public R edit(@RequestBody BusSamplingUpdateCmd updateCmd) + { + return toAjax(busSamplingService.update(updateCmd)); + } + + /** + * 鍒犻櫎鍙栨牱鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:sampling_data:remove')") + @Log(title = "鍙栨牱鏁版嵁", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + @ApiOperation(value = "鍒犻櫎鍙栨牱鏁版嵁") + public R remove(@PathVariable Long[] ids) + { + return toAjax(busSamplingService.deleteByIds(ids)); + } + + + /** + * 妫娴嬪彇鏍锋暟鎹 + */ + @PreAuthorize("@ss.hasPermi('business:sampling_data:edit')") + @Log(title = "妫娴嬪彇鏍锋暟鎹", businessType = BusinessType.UPDATE) + @PutMapping("/detection") + @ApiOperation(value = "妫娴嬪彇鏍锋暟鎹") + public R detection(@RequestBody BusSamplingDetectionCmd detectionCmd) + { + return toAjax(busSamplingService.detection(detectionCmd)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusScalingController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusScalingController.java new file mode 100644 index 0000000000000000000000000000000000000000..56dd8cf2eab0bbf095478ef8a3bdc20aab38ab8c --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusScalingController.java @@ -0,0 +1,118 @@ +package com.ruoyi.web.controller.business; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.business.domain.dto.BusScalingSaveCmd; +import com.ruoyi.business.domain.dto.BusScalingUpdateCmd; +import com.ruoyi.business.domain.query.BusScalingQuery; +import com.ruoyi.business.domain.vo.BusScalingVo; +import com.ruoyi.common.core.domain.R; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.business.service.IBusScalingService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 瀹氭爣鏁版嵁Controller + * + * @author ruoyi + * @date 2022-07-13 + */ +@RestController +@RequestMapping("/business/scaling_data") +@Api(tags = "瀹氭爣鏁版嵁Controller") +public class BusScalingController extends BaseController +{ + @Autowired + private IBusScalingService busScalingService; + + /** + * 鏌ヨ瀹氭爣鏁版嵁鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('business:scaling_data:list')") + @GetMapping("/list") + @ApiOperation(value = "鏌ヨ瀹氭爣鏁版嵁鍒楄〃") + public TableDataInfo list(BusScalingQuery busScaling) + { + startPage(); + List list = busScalingService.selectList(busScaling); + return new TableDataInfo<>(list); + } + + /** + * 瀵煎嚭瀹氭爣鏁版嵁鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('business:scaling_data:export')") + @Log(title = "瀹氭爣鏁版嵁", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ApiOperation(value = "瀹氭爣鏁版嵁瀵煎嚭") + public void export(HttpServletResponse response, BusScalingQuery busScaling) + { + List list = busScalingService.selectList(busScaling); + ExcelUtil util = new ExcelUtil<>(BusScalingVo.class); + util.exportExcel(response, list, "瀹氭爣鏁版嵁鏁版嵁"); + } + + /** + * 鑾峰彇瀹氭爣鏁版嵁璇︾粏淇℃伅 + */ + @PreAuthorize("@ss.hasPermi('business:scaling_data:query')") + @GetMapping(value = "/{id}") + @ApiOperation(value = "鑾峰彇瀹氭爣鏁版嵁璇︾粏淇℃伅") + public R getInfo(@PathVariable("id") Long id) + { + return R.ok(busScalingService.selectById(id)); + } + + /** + * 鏂板瀹氭爣鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:scaling_data:add')") + @Log(title = "瀹氭爣鏁版嵁", businessType = BusinessType.INSERT) + @PostMapping + @ApiOperation(value = "鏂板瀹氭爣鏁版嵁") + public R add(@RequestBody BusScalingSaveCmd busScaling) + { + return toAjax(busScalingService.save(busScaling)); + } + + /** + * 淇敼瀹氭爣鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:scaling_data:edit')") + @Log(title = "瀹氭爣鏁版嵁", businessType = BusinessType.UPDATE) + @PutMapping + @ApiOperation(value = "淇敼瀹氭爣鏁版嵁") + public R edit(@RequestBody BusScalingUpdateCmd busScaling) + { + return toAjax(busScalingService.update(busScaling)); + } + + /** + * 鍒犻櫎瀹氭爣鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:scaling_data:remove')") + @Log(title = "瀹氭爣鏁版嵁", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + @ApiOperation(value = "鍒犻櫎瀹氭爣鏁版嵁") + public R remove(@PathVariable Long[] ids) + { + return toAjax(busScalingService.deleteByIds(ids)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusTransportController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusTransportController.java new file mode 100644 index 0000000000000000000000000000000000000000..393228d2b218dc6ee6532989b55bac42732b6aaa --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusTransportController.java @@ -0,0 +1,134 @@ +package com.ruoyi.web.controller.business; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.business.domain.dto.BusTransportCollectCmd; +import com.ruoyi.business.domain.dto.BusTransportSaveCmd; +import com.ruoyi.business.domain.dto.BusTransportUpdateCmd; +import com.ruoyi.business.domain.query.BusTransportQuery; +import com.ruoyi.business.domain.vo.BusTransportVo; +import com.ruoyi.business.domain.vo.BusTreatVo; +import com.ruoyi.common.core.domain.R; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.business.domain.BusTransport; +import com.ruoyi.business.service.IBusTransportService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 杩愯緭鏁版嵁Controller + * + * @author ruoyi + * @date 2022-07-13 + */ +@RestController +@RequestMapping("/business/transport_data") +@Api(tags = "杩愯緭鏁版嵁Controller") +public class BusTransportController extends BaseController +{ + @Autowired + private IBusTransportService busTransportService; + + /** + * 鏌ヨ杩愯緭鏁版嵁鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('business:transport_data:list')") + @GetMapping("/list") + @ApiOperation(value = "鏌ヨ杩愯緭鏁版嵁鍒楄〃") + public TableDataInfo list(BusTransportQuery query) + { + startPage(); + List list = busTransportService.selectList(query); + return new TableDataInfo<>(list); + } + + /** + * 瀵煎嚭杩愯緭鏁版嵁鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('business:transport_data:export')") + @Log(title = "杩愯緭鏁版嵁", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ApiOperation(value = "瀵煎嚭杩愯緭鏁版嵁鍒楄〃") + public void export(HttpServletResponse response, BusTransportQuery query) + { + List list = busTransportService.selectList(query); + ExcelUtil util = new ExcelUtil(BusTransportVo.class); + util.exportExcel(response, list, "杩愯緭鏁版嵁鏁版嵁"); + } + + /** + * 鑾峰彇杩愯緭鏁版嵁璇︾粏淇℃伅 + */ + @PreAuthorize("@ss.hasPermi('business:transport_data:query')") + @GetMapping(value = "/{id}") + @ApiOperation(value = "鑾峰彇杩愯緭鏁版嵁璇︾粏淇℃伅") + public R getInfo(@PathVariable("id") Long id) + { + return R.ok(busTransportService.selectById(id)); + } + + /** + * 鏂板杩愯緭鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:transport_data:add')") + @Log(title = "杩愯緭鏁版嵁", businessType = BusinessType.INSERT) + @PostMapping + @ApiOperation(value = "鏂板杩愯緭鏁版嵁") + public R add(@RequestBody BusTransportSaveCmd saveCmd) + { + return toAjax(busTransportService.save(saveCmd)); + } + + /** + * 淇敼杩愯緭鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:transport_data:edit')") + @Log(title = "鍙戣溅鏁版嵁", businessType = BusinessType.UPDATE) + @PutMapping + @ApiOperation(value = "鍙戣溅鏁版嵁") + public R edit(@RequestBody BusTransportUpdateCmd updateCmd) + { + return toAjax(busTransportService.update(updateCmd)); + } + + /** + * 鍒犻櫎杩愯緭鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:transport_data:remove')") + @Log(title = "杩愯緭鏁版嵁", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + @ApiOperation(value = "鍒犻櫎杩愯緭鏁版嵁") + public R remove(@PathVariable Long[] ids) + { + return toAjax(busTransportService.deleteByIds(ids)); + } + + + /** + * 淇敼杩愯緭鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:transport_data:edit')") + @Log(title = "鏀惰溅鏁版嵁", businessType = BusinessType.UPDATE) + @PutMapping("/collect") + @ApiOperation(value = "鏀惰溅鏁版嵁") + public R collect(@RequestBody BusTransportCollectCmd collectCmd) + { + return toAjax(busTransportService.collect(collectCmd)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusTreatController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusTreatController.java new file mode 100644 index 0000000000000000000000000000000000000000..46886926273fd5c5bc71aaec47e927de393fd566 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/BusTreatController.java @@ -0,0 +1,119 @@ +package com.ruoyi.web.controller.business; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.business.domain.dto.BusTreatSaveCmd; +import com.ruoyi.business.domain.dto.BusTreatUpdateCmd; +import com.ruoyi.business.domain.query.BusTreatQuery; +import com.ruoyi.business.domain.vo.BusTreatVo; +import com.ruoyi.common.core.domain.R; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.business.domain.BusTreat; +import com.ruoyi.business.service.IBusTreatService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 闄ゆ不鏁版嵁Controller + * + * @author ruoyi + * @date 2022-07-13 + */ +@RestController +@RequestMapping("/business/treat_data") +@Api(tags = "闄ゆ不鏁版嵁Controller") +public class BusTreatController extends BaseController +{ + @Autowired + private IBusTreatService busTreatService; + + /** + * 鏌ヨ闄ゆ不鏁版嵁鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('business:treat_data:list')") + @GetMapping("/list") + @ApiOperation(value = "鏌ヨ闄ゆ不鏁版嵁鍒楄〃") + public TableDataInfo list(BusTreatQuery query) + { + startPage(); + List list = busTreatService.selectList(query); + return new TableDataInfo<>(list); + } + + /** + * 瀵煎嚭闄ゆ不鏁版嵁鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('business:treat_data:export')") + @Log(title = "闄ゆ不鏁版嵁", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ApiOperation(value = "瀵煎嚭闄ゆ不鏁版嵁鍒楄〃") + public void export(HttpServletResponse response, BusTreatQuery query) + { + List list = busTreatService.selectList(query); + ExcelUtil util = new ExcelUtil(BusTreatVo.class); + util.exportExcel(response, list, "闄ゆ不鏁版嵁鏁版嵁"); + } + + /** + * 鑾峰彇闄ゆ不鏁版嵁璇︾粏淇℃伅 + */ + @PreAuthorize("@ss.hasPermi('business:treat_data:query')") + @GetMapping(value = "/{id}") + @ApiOperation(value = "鑾峰彇闄ゆ不鏁版嵁璇︾粏淇℃伅") + public R getInfo(@PathVariable("id") Long id) + { + return R.ok(busTreatService.selectById(id)); + } + + /** + * 鏂板闄ゆ不鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:treat_data:add')") + @Log(title = "闄ゆ不鏁版嵁", businessType = BusinessType.INSERT) + @PostMapping + @ApiOperation(value = "鏂板闄ゆ不鏁版嵁") + public R add(@RequestBody BusTreatSaveCmd saveCmd) + { + return toAjax(busTreatService.save(saveCmd)); + } + + /** + * 淇敼闄ゆ不鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:treat_data:edit')") + @Log(title = "闄ゆ不鏁版嵁", businessType = BusinessType.UPDATE) + @PutMapping + @ApiOperation(value = "淇敼闄ゆ不鏁版嵁") + public R edit(@RequestBody BusTreatUpdateCmd updateCmd) + { + return toAjax(busTreatService.update(updateCmd)); + } + + /** + * 鍒犻櫎闄ゆ不鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:treat_data:remove')") + @Log(title = "闄ゆ不鏁版嵁", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + @ApiOperation(value = "鍒犻櫎闄ゆ不鏁版嵁") + public R remove(@PathVariable Long[] ids) + { + return toAjax(busTreatService.deleteByIds(ids)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/XiaobanController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/XiaobanController.java new file mode 100644 index 0000000000000000000000000000000000000000..c93f5a016c97d6bc839ccf08210ef7311074f8c0 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/XiaobanController.java @@ -0,0 +1,74 @@ +package com.ruoyi.web.controller.business; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.business.domain.Xiaoban; +import com.ruoyi.business.service.IXiaobanService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 鏋椾笟灏忕彮Controller + * + * @author ruoyi + * @date 2022-07-21 + */ +@RestController +@RequestMapping("/system/xiaoban") +public class XiaobanController extends BaseController +{ + @Autowired + private IXiaobanService xiaobanService; + + /** + * 鏌ヨ鏋椾笟灏忕彮鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('system:xiaoban:list')") + @GetMapping("/list") + public TableDataInfo list(Xiaoban xiaoban) + { + startPage(); + List list = xiaobanService.selectXiaobanList(xiaoban); + return getDataTable(list); + } + + /** + * 瀵煎嚭鏋椾笟灏忕彮鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('system:xiaoban:export')") + @Log(title = "鏋椾笟灏忕彮", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, Xiaoban xiaoban) + { + List list = xiaobanService.selectXiaobanList(xiaoban); + ExcelUtil util = new ExcelUtil(Xiaoban.class); + util.exportExcel(response, list, "鏋椾笟灏忕彮鏁版嵁"); + } + + /** + * 鑾峰彇鏋椾笟灏忕彮璇︾粏淇℃伅 + */ + @PreAuthorize("@ss.hasPermi('system:xiaoban:query')") + @GetMapping(value = "/{gid}") + public AjaxResult getInfo(@PathVariable("gid") Integer gid) + { + return AjaxResult.success(xiaobanService.selectXiaobanByGid(gid)); + } + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/app/AppBusInjectionController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/app/AppBusInjectionController.java new file mode 100644 index 0000000000000000000000000000000000000000..cc6a3fd8d0811880a3a423299126445babf3ed6d --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/app/AppBusInjectionController.java @@ -0,0 +1,71 @@ +package com.ruoyi.web.controller.business.app; + +import com.ruoyi.business.domain.dto.app.AppBusInjectionSaveCmd; +import com.ruoyi.business.domain.query.BusInjectionQuery; +import com.ruoyi.business.domain.vo.app.AppBusInjectionVo; +import com.ruoyi.business.service.IBusInjectionService; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 娉ㄥ共绠$悊鏁版嵁Controller + * + * @author ruoyi + * @date 2022-07-13 + */ +@RestController +@RequestMapping("/app/business/injection_data") +@Api(tags = "APP娉ㄥ共绠$悊鏁版嵁Controller") +public class AppBusInjectionController extends BaseController +{ + @Autowired + private IBusInjectionService busInjectionService; + + /** + * 鏌ヨ瀹氭爣鏁版嵁鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('business:injection_data:list')") + @GetMapping("/list") + @ApiOperation(value = "鏌ヨ娉ㄥ共绠$悊鏁版嵁鍒楄〃") + public TableDataInfo list(BusInjectionQuery query) + { + startPage(); + List list = busInjectionService.selectAppList(query); + return new TableDataInfo<>(list); + } + + /** + * 鏂板娉ㄥ共绠$悊鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:injection_data:add')") + @Log(title = "娉ㄥ共绠$悊鏁版嵁", businessType = BusinessType.INSERT) + @PostMapping + @ApiOperation(value = "鏂板娉ㄥ共绠$悊鏁版嵁") + public R add(@RequestBody AppBusInjectionSaveCmd saveCmd) + { + return toAjax(busInjectionService.saveApp(saveCmd)); + } + + /** + * 鍒犻櫎娉ㄥ共绠$悊鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:injection_data:remove')") + @Log(title = "娉ㄥ共绠$悊鏁版嵁", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + @ApiOperation(value = "鍒犻櫎娉ㄥ共绠$悊鏁版嵁") + public R remove(@PathVariable Long[] ids) + { + return toAjax(busInjectionService.deleteByIds(ids)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/app/AppBusInjectionMaintainController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/app/AppBusInjectionMaintainController.java new file mode 100644 index 0000000000000000000000000000000000000000..7c08628b386f5c5867f2fce86a26b30b095aedd3 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/app/AppBusInjectionMaintainController.java @@ -0,0 +1,72 @@ +package com.ruoyi.web.controller.business.app; + +import com.ruoyi.business.domain.dto.app.AppBusInjectionMaintainSaveCmd; +import com.ruoyi.business.domain.query.BusInjectionMaintainQuery; +import com.ruoyi.business.domain.vo.app.AppBusInjectionMaintainVo; +import com.ruoyi.business.domain.vo.app.AppBusInjectionVo; +import com.ruoyi.business.service.IBusInjectionMaintainService; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 娉ㄥ共缁存姢鏁版嵁Controller + * + * @author ruoyi + * @date 2022-07-13 + */ +@RestController +@RequestMapping("/app/business/injection_maintain_data") +@Api(tags = "APP娉ㄥ共缁存姢鏁版嵁Controller") +public class AppBusInjectionMaintainController extends BaseController +{ + @Autowired + private IBusInjectionMaintainService busInjectionMaintainService; + + /** + * 鏌ヨ娉ㄥ共缁存姢鏁版嵁鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('business:injection_maintain_data:list')") + @GetMapping("/list") + @ApiOperation(value = "鏌ヨ娉ㄥ共缁存姢鏁版嵁鍒楄〃") + public TableDataInfo list(BusInjectionMaintainQuery query) + { + startPage(); + List list = busInjectionMaintainService.selectAppList(query); + return new TableDataInfo<>(list); + } + + /** + * 鏂板娉ㄥ共缁存姢鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:injection_maintain_data:add')") + @Log(title = "娉ㄥ共缁存姢鏁版嵁", businessType = BusinessType.INSERT) + @PostMapping + @ApiOperation(value = "鏂板娉ㄥ共缁存姢鏁版嵁") + public R add(@RequestBody AppBusInjectionMaintainSaveCmd saveCmd) + { + return toAjax(busInjectionMaintainService.saveApp(saveCmd)); + } + + /** + * 鍒犻櫎娉ㄥ共缁存姢鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:injection_maintain_data:remove')") + @Log(title = "娉ㄥ共缁存姢鏁版嵁", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + @ApiOperation(value = "鍒犻櫎娉ㄥ共缁存姢鏁版嵁") + public R remove(@PathVariable Long[] ids) + { + return toAjax(busInjectionMaintainService.deleteByIds(ids)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/app/AppBusSamplingController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/app/AppBusSamplingController.java new file mode 100644 index 0000000000000000000000000000000000000000..f0152a36c60c42e87cbc8300ab6f989bade1eb16 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/app/AppBusSamplingController.java @@ -0,0 +1,84 @@ +package com.ruoyi.web.controller.business.app; + +import com.ruoyi.business.domain.dto.app.AppBusSamplingDetectionCmd; +import com.ruoyi.business.domain.dto.app.AppBusSamplingSaveCmd; +import com.ruoyi.business.domain.query.BusSamplingQuery; +import com.ruoyi.business.domain.vo.app.AppBusSamplingVo; +import com.ruoyi.business.service.IBusSamplingService; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 鍙栨牱鏁版嵁Controller + * + * @author ruoyi + * @date 2022-07-13 + */ +@RestController +@RequestMapping("/app/business/sampling_data") +@Api(tags = "APP鍙栨牱鏁版嵁Controller") +public class AppBusSamplingController extends BaseController +{ + @Autowired + private IBusSamplingService busSamplingService; + + /** + * 鏌ヨ瀹氭爣鏁版嵁鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('business:sampling_data:list')") + @GetMapping("/list") + @ApiOperation(value = "鏌ヨ鍙栨牱鏁版嵁鍒楄〃") + public TableDataInfo list(BusSamplingQuery query) + { + startPage(); + List list = busSamplingService.selectAppList(query); + return new TableDataInfo<>(list); + } + + /** + * 鏂板鍙栨牱鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:sampling_data:add')") + @Log(title = "鍙栨牱鏁版嵁", businessType = BusinessType.INSERT) + @PostMapping + @ApiOperation(value = "鏂板鍙栨牱鏁版嵁") + public R add(@RequestBody AppBusSamplingSaveCmd saveCmd) + { + return toAjax(busSamplingService.saveApp(saveCmd)); + } + + /** + * 鍒犻櫎鍙栨牱鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:sampling_data:remove')") + @Log(title = "鍙栨牱鏁版嵁", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + @ApiOperation(value = "鍒犻櫎鍙栨牱鏁版嵁") + public R remove(@PathVariable Long[] ids) + { + return toAjax(busSamplingService.deleteByIds(ids)); + } + + /** + * 妫娴嬪彇鏍锋暟鎹 + */ + @PreAuthorize("@ss.hasPermi('business:sampling_data:edit')") + @Log(title = "鍙栨牱鏁版嵁妫娴", businessType = BusinessType.UPDATE) + @PutMapping("/detection") + @ApiOperation(value = "鍙栨牱鏁版嵁妫娴") + public R detection(@RequestBody AppBusSamplingDetectionCmd detectionCmd) + { + return toAjax(busSamplingService.appDetection(detectionCmd)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/app/AppBusScalingController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/app/AppBusScalingController.java new file mode 100644 index 0000000000000000000000000000000000000000..ff24f590dda4e38cec3c456b5f2e130c44bc7525 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/app/AppBusScalingController.java @@ -0,0 +1,71 @@ +package com.ruoyi.web.controller.business.app; + +import com.ruoyi.business.domain.dto.app.AppBusScalingSaveCmd; +import com.ruoyi.business.domain.query.BusScalingQuery; +import com.ruoyi.business.domain.vo.app.AppBusScalingVo; +import com.ruoyi.business.service.IBusScalingService; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 瀹氭爣鏁版嵁Controller + * + * @author ruoyi + * @date 2022-07-13 + */ +@RestController +@RequestMapping("/app/business/scaling_data") +@Api(tags = "APP瀹氭爣鏁版嵁Controller") +public class AppBusScalingController extends BaseController +{ + @Autowired + private IBusScalingService busScalingService; + + /** + * 鏌ヨ瀹氭爣鏁版嵁鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('business:scaling_data:list')") + @GetMapping("/list") + @ApiOperation(value = "鏌ヨ瀹氭爣鏁版嵁鍒楄〃") + public TableDataInfo list(BusScalingQuery query) + { + startPage(); + List list = busScalingService.selectAppList(query); + return new TableDataInfo<>(list); + } + + /** + * 鏂板瀹氭爣鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:scaling_data:add')") + @Log(title = "瀹氭爣鏁版嵁", businessType = BusinessType.INSERT) + @PostMapping + @ApiOperation(value = "鏂板瀹氭爣鏁版嵁") + public R add(@RequestBody AppBusScalingSaveCmd saveCmd) + { + return toAjax(busScalingService.saveApp(saveCmd)); + } + + /** + * 鍒犻櫎瀹氭爣鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:scaling_data:remove')") + @Log(title = "瀹氭爣鏁版嵁", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + @ApiOperation(value = "鍒犻櫎瀹氭爣鏁版嵁") + public R remove(@PathVariable Long[] ids) + { + return toAjax(busScalingService.deleteByIds(ids)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/app/AppBusTransportController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/app/AppBusTransportController.java new file mode 100644 index 0000000000000000000000000000000000000000..354344067b7237be5519e6bf9ffe3554ac95e296 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/app/AppBusTransportController.java @@ -0,0 +1,90 @@ +package com.ruoyi.web.controller.business.app; + +import com.ruoyi.business.domain.dto.BusTransportCollectCmd; +import com.ruoyi.business.domain.dto.BusTransportSaveCmd; +import com.ruoyi.business.domain.dto.BusTransportUpdateCmd; +import com.ruoyi.business.domain.dto.app.AppBusTransportCollectCmd; +import com.ruoyi.business.domain.dto.app.AppBusTransportSaveCmd; +import com.ruoyi.business.domain.query.BusTransportQuery; +import com.ruoyi.business.domain.vo.BusTransportVo; +import com.ruoyi.business.domain.vo.app.AppBusTransportVo; +import com.ruoyi.business.service.IBusTransportService; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 杩愯緭鏁版嵁Controller + * + * @author ruoyi + * @date 2022-07-13 + */ +@RestController +@RequestMapping("/app/business/transport_data") +@Api(tags = "APP杩愯緭鏁版嵁Controller") +public class AppBusTransportController extends BaseController +{ + @Autowired + private IBusTransportService busTransportService; + + /** + * 鏌ヨ杩愯緭鏁版嵁鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('business:transport_data:list')") + @GetMapping("/list") + @ApiOperation(value = "鏌ヨ杩愯緭鏁版嵁鍒楄〃") + public TableDataInfo list(BusTransportQuery query) + { + startPage(); + List list = busTransportService.selectAppList(query); + return new TableDataInfo<>(list); + } + + /** + * 鏂板杩愯緭鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:transport_data:add')") + @Log(title = "杩愯緭鏁版嵁", businessType = BusinessType.INSERT) + @PostMapping + @ApiOperation(value = "鏂板鍙戣溅鏁版嵁") + public R add(@RequestBody AppBusTransportSaveCmd saveCmd) + { + return toAjax(busTransportService.saveApp(saveCmd)); + } + + /** + * 鍒犻櫎杩愯緭鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:transport_data:remove')") + @Log(title = "杩愯緭鏁版嵁", businessType = BusinessType.DELETE) + @DeleteMapping("/{transportIds}") + @ApiOperation(value = "鍒犻櫎杩愯緭鏁版嵁") + public R remove(@PathVariable Long[] transportIds) + { + return toAjax(busTransportService.deleteByIds(transportIds)); + } + + /** + * 淇敼杩愯緭鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:transport_data:edit')") + @Log(title = "鏀惰溅鏁版嵁", businessType = BusinessType.UPDATE) + @PutMapping("/collect") + @ApiOperation(value = "鏀惰溅鏁版嵁") + public R collect(@RequestBody AppBusTransportCollectCmd collectCmd) + { + return toAjax(busTransportService.collectApp(collectCmd)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/app/AppBusTreatController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/app/AppBusTreatController.java new file mode 100644 index 0000000000000000000000000000000000000000..c4cd6617044a059363ad281df05b7fcfd89cb64a --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/app/AppBusTreatController.java @@ -0,0 +1,73 @@ +package com.ruoyi.web.controller.business.app; + +import com.ruoyi.business.domain.dto.BusTreatSaveCmd; +import com.ruoyi.business.domain.dto.BusTreatUpdateCmd; +import com.ruoyi.business.domain.dto.app.AppBusTreatSaveCmd; +import com.ruoyi.business.domain.query.BusTreatQuery; +import com.ruoyi.business.domain.vo.BusTreatVo; +import com.ruoyi.business.domain.vo.app.AppBusTreatVo; +import com.ruoyi.business.service.IBusTreatService; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 闄ゆ不鏁版嵁Controller + * + * @author ruoyi + * @date 2022-07-13 + */ +@RestController +@RequestMapping("/app/business/treat_data") +@Api(tags = "APP闄ゆ不鏁版嵁Controller") +public class AppBusTreatController extends BaseController +{ + @Autowired + private IBusTreatService busTreatService; + + /** + * 鏌ヨ闄ゆ不鏁版嵁鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('business:treat_data:list')") + @GetMapping("/list") + public TableDataInfo list(BusTreatQuery query) + { + startPage(); + List list = busTreatService.selectAppList(query); + return new TableDataInfo<>(list); + } + + /** + * 鏂板闄ゆ不鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:treat_data:add')") + @Log(title = "闄ゆ不鏁版嵁", businessType = BusinessType.INSERT) + @PostMapping + public R add(@RequestBody AppBusTreatSaveCmd saveCmd) + { + return toAjax(busTreatService.saveApp(saveCmd)); + } + + /** + * 鍒犻櫎闄ゆ不鏁版嵁 + */ + @PreAuthorize("@ss.hasPermi('business:treat_data:remove')") + @Log(title = "闄ゆ不鏁版嵁", businessType = BusinessType.DELETE) + @DeleteMapping("/{treatIds}") + public R remove(@PathVariable Long[] treatIds) + { + return toAjax(busTreatService.deleteByIds(treatIds)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java index e8800b948fcd71a3817069c4e0467d7041af160a..6c19e8db154ada46b0751cdce98673b3efdd5163 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java @@ -6,6 +6,9 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Resource; import javax.imageio.ImageIO; import javax.servlet.http.HttpServletResponse; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.FastByteArrayOutputStream; import org.springframework.web.bind.annotation.GetMapping; @@ -22,10 +25,11 @@ import com.ruoyi.system.service.ISysConfigService; /** * 楠岃瘉鐮佹搷浣滃鐞 - * + * * @author ruoyi */ @RestController +@Api(tags = "楠岃瘉鐮佹搷浣滃鐞") public class CaptchaController { @Resource(name = "captchaProducer") @@ -36,13 +40,14 @@ public class CaptchaController @Autowired private RedisCache redisCache; - + @Autowired private ISysConfigService configService; /** * 鐢熸垚楠岃瘉鐮 */ @GetMapping("/captchaImage") + @ApiOperation(value = "鐢熸垚楠岃瘉鐮") public AjaxResult getCode(HttpServletResponse response) throws IOException { AjaxResult ajax = AjaxResult.success(); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java index d51d61d00238ef031a326c6f49106e67bdbc215c..71e7eda53350f670def43a905d6c44cce7d30746 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java @@ -1,163 +1,205 @@ package com.ruoyi.web.controller.common; import java.util.ArrayList; +import java.util.Collection; import java.util.List; +import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.ruoyi.business.domain.query.UploadFileQuery; +import com.ruoyi.business.domain.vo.BusFileVo; +import com.ruoyi.business.service.IBusFileService; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.domain.vo.SysFileVo; +import com.ruoyi.common.exception.ServiceException; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.common.utils.file.FileUtils; import com.ruoyi.framework.config.ServerConfig; /** * 閫氱敤璇锋眰澶勭悊 - * + * * @author ruoyi */ @RestController @RequestMapping("/common") -public class CommonController -{ - private static final Logger log = LoggerFactory.getLogger(CommonController.class); +@Api(tags = "閫氱敤璇锋眰澶勭悊") +public class CommonController { + private static final Logger log = LoggerFactory.getLogger(CommonController.class); - @Autowired - private ServerConfig serverConfig; + @Autowired + private ServerConfig serverConfig; - private static final String FILE_DELIMETER = ","; + @Autowired + private IBusFileService fileService; - /** - * 閫氱敤涓嬭浇璇锋眰 - * - * @param fileName 鏂囦欢鍚嶇О - * @param delete 鏄惁鍒犻櫎 - */ - @GetMapping("/download") - public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) - { - try - { - if (!FileUtils.checkAllowDownload(fileName)) - { - throw new Exception(StringUtils.format("鏂囦欢鍚嶇О({})闈炴硶锛屼笉鍏佽涓嬭浇銆 ", fileName)); - } - String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); - String filePath = RuoYiConfig.getDownloadPath() + fileName; + private static final String FILE_DELIMETER = ","; - response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); - FileUtils.setAttachmentResponseHeader(response, realFileName); - FileUtils.writeBytes(filePath, response.getOutputStream()); - if (delete) - { - FileUtils.deleteFile(filePath); - } - } - catch (Exception e) - { - log.error("涓嬭浇鏂囦欢澶辫触", e); - } - } + /** + * 閫氱敤涓嬭浇璇锋眰 + * + * @param fileName 鏂囦欢鍚嶇О + * @param delete 鏄惁鍒犻櫎 + */ + @GetMapping("/download") + @ApiOperation(value = "閫氱敤涓嬭浇璇锋眰") + public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) { + try { + if (!FileUtils.checkAllowDownload(fileName)) { + throw new Exception(StringUtils.format("鏂囦欢鍚嶇О({})闈炴硶锛屼笉鍏佽涓嬭浇銆 ", fileName)); + } + String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); + String filePath = RuoYiConfig.getDownloadPath() + fileName; - /** - * 閫氱敤涓婁紶璇锋眰锛堝崟涓級 - */ - @PostMapping("/upload") - public AjaxResult uploadFile(MultipartFile file) throws Exception - { - try - { - // 涓婁紶鏂囦欢璺緞 - String filePath = RuoYiConfig.getUploadPath(); - // 涓婁紶骞惰繑鍥炴柊鏂囦欢鍚嶇О - String fileName = FileUploadUtils.upload(filePath, file); - String url = serverConfig.getUrl() + fileName; - AjaxResult ajax = AjaxResult.success(); - ajax.put("url", url); - ajax.put("fileName", fileName); - ajax.put("newFileName", FileUtils.getName(fileName)); - ajax.put("originalFilename", file.getOriginalFilename()); - return ajax; - } - catch (Exception e) - { - return AjaxResult.error(e.getMessage()); - } - } + response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); + FileUtils.setAttachmentResponseHeader(response, realFileName); + FileUtils.writeBytes(filePath, response.getOutputStream()); + if (delete) { + FileUtils.deleteFile(filePath); + } + } catch (Exception e) { + log.error("涓嬭浇鏂囦欢澶辫触", e); + } + } - /** - * 閫氱敤涓婁紶璇锋眰锛堝涓級 - */ - @PostMapping("/uploads") - public AjaxResult uploadFiles(List files) throws Exception - { - try - { - // 涓婁紶鏂囦欢璺緞 - String filePath = RuoYiConfig.getUploadPath(); - List urls = new ArrayList(); - List fileNames = new ArrayList(); - List newFileNames = new ArrayList(); - List originalFilenames = new ArrayList(); - for (MultipartFile file : files) - { - // 涓婁紶骞惰繑鍥炴柊鏂囦欢鍚嶇О - String fileName = FileUploadUtils.upload(filePath, file); - String url = serverConfig.getUrl() + fileName; - urls.add(url); - fileNames.add(fileName); - newFileNames.add(FileUtils.getName(fileName)); - originalFilenames.add(file.getOriginalFilename()); - } - AjaxResult ajax = AjaxResult.success(); - ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER)); - ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER)); - ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER)); - ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER)); - return ajax; - } - catch (Exception e) - { - return AjaxResult.error(e.getMessage()); - } - } + /** + * 閫氱敤涓婁紶璇锋眰锛堝崟涓級 + */ + @PostMapping("/upload") + @ApiOperation(value = "閫氱敤涓婁紶璇锋眰锛堝崟涓級") + public AjaxResult uploadFile(MultipartFile file) throws Exception { + try { + // 涓婁紶鏂囦欢璺緞 +// String filePath = RuoYiConfig.getUploadPath(); + // 涓婁紶骞惰繑鍥炴柊鏂囦欢鍚嶇О + BusFileVo busFile = fileService.uploadFile(file); + String url = busFile.getUrl(); + AjaxResult ajax = AjaxResult.success(); + ajax.put("url", url); + ajax.put("fileName", busFile.getOriginalFileName()); + ajax.put("newFileName", FileUtils.getName(busFile.getFileName())); + ajax.put("originalFilename", file.getOriginalFilename()); + return ajax; + } catch (Exception e) { + return AjaxResult.error(e.getMessage()); + } + } - /** - * 鏈湴璧勬簮閫氱敤涓嬭浇 - */ - @GetMapping("/download/resource") - public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response) - throws Exception - { - try - { - if (!FileUtils.checkAllowDownload(resource)) - { - throw new Exception(StringUtils.format("璧勬簮鏂囦欢({})闈炴硶锛屼笉鍏佽涓嬭浇銆 ", resource)); - } - // 鏈湴璧勬簮璺緞 - String localPath = RuoYiConfig.getProfile(); - // 鏁版嵁搴撹祫婧愬湴鍧 - String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX); - // 涓嬭浇鍚嶇О - String downloadName = StringUtils.substringAfterLast(downloadPath, "/"); - response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); - FileUtils.setAttachmentResponseHeader(response, downloadName); - FileUtils.writeBytes(downloadPath, response.getOutputStream()); - } - catch (Exception e) - { - log.error("涓嬭浇鏂囦欢澶辫触", e); + /** + * 閫氱敤涓婁紶璇锋眰锛堝涓級 + */ + @PostMapping("/uploads") + @ApiOperation(value = "閫氱敤涓婁紶璇锋眰锛堝涓級") + public AjaxResult uploadFiles(List files) throws Exception { + try { + // 涓婁紶鏂囦欢璺緞 +// String filePath = RuoYiConfig.getUploadPath(); + List urls = new ArrayList(); + List fileNames = new ArrayList(); + List newFileNames = new ArrayList(); + List originalFilenames = new ArrayList(); + for (MultipartFile file : files) { + // 涓婁紶骞惰繑鍥炴柊鏂囦欢鍚嶇О + BusFileVo busFile = fileService.uploadFile(file); + String fileName = busFile.getOriginalFileName(); + String url = busFile.getUrl(); + urls.add(url); + fileNames.add(fileName); + newFileNames.add(FileUtils.getName(busFile.getFileName())); + originalFilenames.add(busFile.getOriginalFileName()); + } + AjaxResult ajax = AjaxResult.success(); + ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER)); + ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER)); + ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER)); + ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER)); + return ajax; + } catch (Exception e) { + return AjaxResult.error(e.getMessage()); + } + } + + /** + * 鏈湴璧勬簮閫氱敤涓嬭浇 + */ + @GetMapping("/download/resource") + @ApiOperation(value = "鏈湴璧勬簮閫氱敤涓嬭浇") + public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response) + throws Exception { + try { + if (!FileUtils.checkAllowDownload(resource)) { + throw new Exception(StringUtils.format("璧勬簮鏂囦欢({})闈炴硶锛屼笉鍏佽涓嬭浇銆 ", resource)); + } + // 鏈湴璧勬簮璺緞 + String localPath = RuoYiConfig.getProfile(); + // 鏁版嵁搴撹祫婧愬湴鍧 + String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX); + // 涓嬭浇鍚嶇О + String downloadName = StringUtils.substringAfterLast(downloadPath, "/"); + response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); + FileUtils.setAttachmentResponseHeader(response, downloadName); + FileUtils.writeBytes(downloadPath, response.getOutputStream()); + } catch (Exception e) { + log.error("涓嬭浇鏂囦欢澶辫触", e); + } + } + + /** + * 鑷畾涔 Minio 鏈嶅姟鍣ㄤ笂浼犺姹 + */ + @PostMapping("/uploadMinio") + @ResponseBody + @ApiOperation(value = "鑷畾涔 Minio 鏈嶅姟鍣ㄤ笂浼犺姹") + public R uploadFileMinio(UploadFileQuery query) throws Exception { + if(ObjectUtil.isEmpty(query.getFile())){ + throw new ServiceException("娌℃湁閫夋嫨鏂囦欢"); } - } + try { + // 涓婁紶骞惰繑鍥炴柊鏂囦欢鍚嶇О + BusFileVo busFile = fileService.uploadFile(query.getFile(), query.getType()); + return R.ok(busFile); + } catch (Exception e) { + return R.fail(e.getMessage()); + } + } + + + /** + * 鑾峰彇鏂囦欢璺緞 + */ + @GetMapping("/get/file") + @ResponseBody + @ApiOperation(value = "鑾峰彇鏂囦欢璺緞") + public R> getFileByMinio(String fileIds, String type) { + List data = new ArrayList<>(); + if (StrUtil.isBlank(fileIds)) { + return R.ok(data); + } + String[] ids = fileIds.split(Constants.SEPARATOR); + List files = new ArrayList<>(); + for (String id : ids) { + if(StrUtil.isNotBlank(id)){ + files.add(Long.parseLong(id)); + } + } + Map fileVoMap = fileService.getFileByIds(files, type); + Collection values = fileVoMap.values(); + data.addAll(values); + return R.ok(data); + } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java index cbd20619cd050a7ae7dca778f40f6a3a67e6cce6..819d5dcf4e088d85f3b84ec8d5a485cb87448be5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java @@ -7,6 +7,8 @@ import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; + +import io.swagger.annotations.Api; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisCallback; import org.springframework.data.redis.core.RedisTemplate; @@ -23,11 +25,12 @@ import com.ruoyi.system.domain.SysCache; /** * 缂撳瓨鐩戞帶 - * + * * @author ruoyi */ @RestController @RequestMapping("/monitor/cache") +@Api(tags = "缂撳瓨鐩戞帶") public class CacheController { @Autowired diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java index 082027beb4ac1677039959042bb60c0229acac6b..7f066e61c8474b8ee897ace528f53d111b6b3baa 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java @@ -1,5 +1,7 @@ package com.ruoyi.web.controller.monitor; +import com.ruoyi.common.core.domain.R; +import io.swagger.annotations.Api; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -9,19 +11,20 @@ import com.ruoyi.framework.web.domain.Server; /** * 鏈嶅姟鍣ㄧ洃鎺 - * + * * @author ruoyi */ @RestController @RequestMapping("/monitor/server") +@Api(tags = "鏈嶅姟鍣ㄧ洃鎺") public class ServerController { @PreAuthorize("@ss.hasPermi('monitor:server:list')") @GetMapping() - public AjaxResult getInfo() throws Exception + public R getInfo() throws Exception { Server server = new Server(); server.copyTo(); - return AjaxResult.success(server); + return R.ok(server); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java index 5bd40baedb8d6bc1b69693f05785df278463d0b5..60fd680fa1d1ad474c6872b926206c236e8f0367 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java @@ -2,6 +2,9 @@ package com.ruoyi.web.controller.monitor; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.core.domain.R; +import io.swagger.annotations.Api; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.DeleteMapping; @@ -21,11 +24,12 @@ import com.ruoyi.system.service.ISysLogininforService; /** * 绯荤粺璁块棶璁板綍 - * + * * @author ruoyi */ @RestController @RequestMapping("/monitor/logininfor") +@Api(tags = "绯荤粺璁块棶璁板綍") public class SysLogininforController extends BaseController { @Autowired @@ -33,11 +37,11 @@ public class SysLogininforController extends BaseController @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')") @GetMapping("/list") - public TableDataInfo list(SysLogininfor logininfor) + public TableDataInfo list(SysLogininfor logininfor) { startPage(); List list = logininforService.selectLogininforList(logininfor); - return getDataTable(list); + return new TableDataInfo<>(list); } @Log(title = "鐧诲綍鏃ュ織", businessType = BusinessType.EXPORT) @@ -53,7 +57,7 @@ public class SysLogininforController extends BaseController @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") @Log(title = "鐧诲綍鏃ュ織", businessType = BusinessType.DELETE) @DeleteMapping("/{infoIds}") - public AjaxResult remove(@PathVariable Long[] infoIds) + public R remove(@PathVariable Long[] infoIds) { return toAjax(logininforService.deleteLogininforByIds(infoIds)); } @@ -61,9 +65,9 @@ public class SysLogininforController extends BaseController @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") @Log(title = "鐧诲綍鏃ュ織", businessType = BusinessType.CLEAN) @DeleteMapping("/clean") - public AjaxResult clean() + public R clean() { logininforService.cleanLogininfor(); - return AjaxResult.success(); + return R.ok(); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java index 4ce126a542e6d7e8522a747f86bdb3e0639b4675..cf79c17a5af7113917a651b2e9e0242786210f92 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java @@ -2,6 +2,9 @@ package com.ruoyi.web.controller.monitor; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.core.domain.R; +import io.swagger.annotations.Api; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.DeleteMapping; @@ -21,11 +24,12 @@ import com.ruoyi.system.service.ISysOperLogService; /** * 鎿嶄綔鏃ュ織璁板綍 - * + * * @author ruoyi */ @RestController @RequestMapping("/monitor/operlog") +@Api(tags = "鎿嶄綔鏃ュ織璁板綍") public class SysOperlogController extends BaseController { @Autowired @@ -33,11 +37,11 @@ public class SysOperlogController extends BaseController @PreAuthorize("@ss.hasPermi('monitor:operlog:list')") @GetMapping("/list") - public TableDataInfo list(SysOperLog operLog) + public TableDataInfo list(SysOperLog operLog) { startPage(); List list = operLogService.selectOperLogList(operLog); - return getDataTable(list); + return new TableDataInfo<>(list); } @Log(title = "鎿嶄綔鏃ュ織", businessType = BusinessType.EXPORT) @@ -53,7 +57,7 @@ public class SysOperlogController extends BaseController @Log(title = "鎿嶄綔鏃ュ織", businessType = BusinessType.DELETE) @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") @DeleteMapping("/{operIds}") - public AjaxResult remove(@PathVariable Long[] operIds) + public R remove(@PathVariable Long[] operIds) { return toAjax(operLogService.deleteOperLogByIds(operIds)); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java index 6c2b3bef6aafa85a8a80f2c6c2ad587d9f8e3808..335d90266b37e94a088764b3fc68048853042c45 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java @@ -4,6 +4,8 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; + +import io.swagger.annotations.Api; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.DeleteMapping; @@ -25,11 +27,12 @@ import com.ruoyi.system.service.ISysUserOnlineService; /** * 鍦ㄧ嚎鐢ㄦ埛鐩戞帶 - * + * * @author ruoyi */ @RestController @RequestMapping("/monitor/online") +@Api(tags = "鍦ㄧ嚎鐢ㄦ埛鐩戞帶") public class SysUserOnlineController extends BaseController { @Autowired @@ -40,7 +43,7 @@ public class SysUserOnlineController extends BaseController @PreAuthorize("@ss.hasPermi('monitor:online:list')") @GetMapping("/list") - public TableDataInfo list(String ipaddr, String userName) + public TableDataInfo list(String ipaddr, String userName) { Collection keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*"); List userOnlineList = new ArrayList(); @@ -75,7 +78,7 @@ public class SysUserOnlineController extends BaseController } Collections.reverse(userOnlineList); userOnlineList.removeAll(Collections.singleton(null)); - return getDataTable(userOnlineList); + return new TableDataInfo<>(userOnlineList); } /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/LoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/LoginController.java new file mode 100644 index 0000000000000000000000000000000000000000..d69f0caa7e92eb83657f9439ea105f79853e451e --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/LoginController.java @@ -0,0 +1,107 @@ +package com.ruoyi.web.controller.system; + + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.framework.web.service.MobileLoginService; +import com.ruoyi.framework.web.service.TokenService; +import com.ruoyi.system.domain.AppLoginParams; +import com.ruoyi.system.domain.AppLoginVo; +import com.ruoyi.system.domain.LoginParams; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; + +/** + * 鐧诲綍鎺у埗鍣 + * + * @author SK + * @since 2018/6/13 + */ +@RestController +@RequestMapping("/mobile/login") +@Api(tags = "App鐧诲綍鎺у埗鍣") +public class LoginController{ + + @Autowired(required = false) + private TokenService tokenService; + + @Autowired(required = false) + private MobileLoginService loginService; + + + + /** + * 浼氬憳鐧诲綍 + * @return -1 鐢ㄦ埛鍚嶆垨瀵嗙爜閿欒 -2 璐﹀彿鍐荤粨 -3 璐﹀彿閿佸畾 1 鎴愬姛 -4 楠岃瘉鐮侀敊璇 + */ + @PostMapping("/loginByPassword") + @ResponseBody + @ApiOperation(value = "浼氬憳鐧诲綍 -1 鐢ㄦ埛鍚嶆垨瀵嗙爜閿欒 -2 璐﹀彿鍐荤粨 -3 璐﹀彿閿佸畾 1 鎴愬姛 -4 楠岃瘉鐮侀敊璇") + public AjaxResult loginByPassword(HttpServletRequest request) { + String username = request.getParameter("username"); + String password = request.getParameter("password"); + String phoneNo = request.getParameter("phoneNo"); + String validCode = request.getParameter("validCode"); + String loginType = request.getParameter("loginType"); + // 鐧诲綍缁撴灉 + LoginParams loginParams = new LoginParams(); + loginParams.setUsername(username); + loginParams.setPassword(password); + loginParams.setPhoneNo(phoneNo); + loginParams.setValidCode(validCode); + loginParams.setLoginType(loginType); + return loginService.login(loginParams); + } + + + /** + * 浼氬憳鐧诲綍 + * @return -1 鐢ㄦ埛鍚嶆垨瀵嗙爜閿欒 -2 璐﹀彿鍐荤粨 -3 璐﹀彿閿佸畾 1 鎴愬姛 -4 楠岃瘉鐮侀敊璇 + */ + @PostMapping("/loginByPassword/param") + @ResponseBody + @ApiOperation(value = "浼氬憳鐧诲綍棰濆鍙傛暟 -1 鐢ㄦ埛鍚嶆垨瀵嗙爜閿欒 -2 璐﹀彿鍐荤粨 -3 璐﹀彿閿佸畾 1 鎴愬姛 -4 楠岃瘉鐮侀敊璇") + public AppLoginVo loginByPassword(@RequestBody AppLoginParams params) { + // 鐧诲綍缁撴灉 + LoginParams loginParams = new LoginParams(); + loginParams.setUsername(params.getUsername()); + loginParams.setPassword(params.getPassword()); + loginParams.setPhoneNo(params.getPhoneNo()); + loginParams.setValidCode(params.getValidCode()); + loginParams.setLoginType(params.getLoginType()); + return loginService.login(loginParams); + } + + /** + * 鍙戦侀獙璇佺爜 + */ + @PostMapping("/sendCode") + @ResponseBody + @ApiOperation(value = "鍙戦侀獙璇佺爜") + public R sendRegisterCode(HttpServletRequest request) { + String phoneNo = request.getParameter("phoneNo"); + String validCodeType = request.getParameter("validCodeType"); + // 鐧诲綍缁撴灉 + LoginParams loginParams = new LoginParams(); + loginParams.setPhoneNo(phoneNo); + loginParams.setValidCodeType(validCodeType); + return loginService.sendCode(loginParams); + } + + @GetMapping("/logout") + @ResponseBody + @ApiOperation(value = "閫鍑虹櫥褰") + public R logout(HttpServletRequest request) { + LoginUser loginUser = tokenService.getLoginUser(request); + if(null != loginUser){ + tokenService.delLoginUser(loginUser.getToken()); + } + return R.ok("閫鍑烘垚鍔燂紒"); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java index 04f71629a9cc2482ac0aa77c96d40ec8f09d0292..69db16e2a641106cd3a29af13da730befdf3d148 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java @@ -2,6 +2,10 @@ package com.ruoyi.web.controller.system; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.core.domain.R; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -25,11 +29,12 @@ import com.ruoyi.system.service.ISysConfigService; /** * 鍙傛暟閰嶇疆 淇℃伅鎿嶄綔澶勭悊 - * + * * @author ruoyi */ @RestController @RequestMapping("/system/config") +@Api(tags = "鍙傛暟閰嶇疆 ") public class SysConfigController extends BaseController { @Autowired @@ -40,16 +45,18 @@ public class SysConfigController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:config:list')") @GetMapping("/list") - public TableDataInfo list(SysConfig config) + @ApiOperation("鑾峰彇鍙傛暟閰嶇疆鍒楄〃") + public TableDataInfo list(SysConfig config) { startPage(); List list = configService.selectConfigList(config); - return getDataTable(list); + return new TableDataInfo<>(list); } @Log(title = "鍙傛暟绠$悊", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:config:export')") @PostMapping("/export") + @ApiOperation("瀵煎嚭鍙傛暟閰嶇疆鍒楄〃") public void export(HttpServletResponse response, SysConfig config) { List list = configService.selectConfigList(config); @@ -62,18 +69,20 @@ public class SysConfigController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:config:query')") @GetMapping(value = "/{configId}") - public AjaxResult getInfo(@PathVariable Long configId) + @ApiOperation("鏍规嵁鍙傛暟缂栧彿鑾峰彇璇︾粏淇℃伅") + public R getInfo(@PathVariable Long configId) { - return AjaxResult.success(configService.selectConfigById(configId)); + return R.ok(configService.selectConfigById(configId)); } /** * 鏍规嵁鍙傛暟閿悕鏌ヨ鍙傛暟鍊 */ @GetMapping(value = "/configKey/{configKey}") - public AjaxResult getConfigKey(@PathVariable String configKey) + @ApiOperation("鏍规嵁鍙傛暟閿悕鏌ヨ鍙傛暟鍊") + public R getConfigKey(@PathVariable String configKey) { - return AjaxResult.success(configService.selectConfigByKey(configKey)); + return R.ok(configService.selectConfigByKey(configKey)); } /** @@ -82,11 +91,12 @@ public class SysConfigController extends BaseController @PreAuthorize("@ss.hasPermi('system:config:add')") @Log(title = "鍙傛暟绠$悊", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@Validated @RequestBody SysConfig config) + @ApiOperation("鏂板鍙傛暟閰嶇疆") + public R add(@Validated @RequestBody SysConfig config) { if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) { - return AjaxResult.error("鏂板鍙傛暟'" + config.getConfigName() + "'澶辫触锛屽弬鏁伴敭鍚嶅凡瀛樺湪"); + return R.fail("鏂板鍙傛暟'" + config.getConfigName() + "'澶辫触锛屽弬鏁伴敭鍚嶅凡瀛樺湪"); } config.setCreateBy(getUsername()); return toAjax(configService.insertConfig(config)); @@ -98,11 +108,12 @@ public class SysConfigController extends BaseController @PreAuthorize("@ss.hasPermi('system:config:edit')") @Log(title = "鍙傛暟绠$悊", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@Validated @RequestBody SysConfig config) + @ApiOperation("淇敼鍙傛暟閰嶇疆") + public R edit(@Validated @RequestBody SysConfig config) { if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) { - return AjaxResult.error("淇敼鍙傛暟'" + config.getConfigName() + "'澶辫触锛屽弬鏁伴敭鍚嶅凡瀛樺湪"); + return R.fail("淇敼鍙傛暟'" + config.getConfigName() + "'澶辫触锛屽弬鏁伴敭鍚嶅凡瀛樺湪"); } config.setUpdateBy(getUsername()); return toAjax(configService.updateConfig(config)); @@ -114,7 +125,8 @@ public class SysConfigController extends BaseController @PreAuthorize("@ss.hasPermi('system:config:remove')") @Log(title = "鍙傛暟绠$悊", businessType = BusinessType.DELETE) @DeleteMapping("/{configIds}") - public AjaxResult remove(@PathVariable Long[] configIds) + @ApiOperation("鍒犻櫎鍙傛暟閰嶇疆") + public R remove(@PathVariable Long[] configIds) { configService.deleteConfigByIds(configIds); return success(); @@ -126,9 +138,10 @@ public class SysConfigController extends BaseController @PreAuthorize("@ss.hasPermi('system:config:remove')") @Log(title = "鍙傛暟绠$悊", businessType = BusinessType.CLEAN) @DeleteMapping("/refreshCache") - public AjaxResult refreshCache() + @ApiOperation("鍒锋柊鍙傛暟缂撳瓨") + public R refreshCache() { configService.resetConfigCache(); - return AjaxResult.success(); + return R.ok(); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java index 6ec2f3ef087b7d39dccf8a0bed34ac6bf76ffcbd..0011debb28d7b69e5599722a317c8eec0a3b23c8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java @@ -2,6 +2,13 @@ package com.ruoyi.web.controller.system; import java.util.Iterator; import java.util.List; + +import cn.hutool.core.util.ObjectUtil; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.domain.TreeSelect; +import com.ruoyi.common.core.domain.entity.SysDictData; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.ArrayUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; @@ -25,11 +32,12 @@ import com.ruoyi.system.service.ISysDeptService; /** * 閮ㄩ棬淇℃伅 - * + * * @author ruoyi */ @RestController @RequestMapping("/system/dept") +@Api(tags = "閮ㄩ棬淇℃伅 ") public class SysDeptController extends BaseController { @Autowired @@ -40,10 +48,11 @@ public class SysDeptController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:dept:list')") @GetMapping("/list") - public AjaxResult list(SysDept dept) + @ApiOperation("鑾峰彇閮ㄩ棬鍒楄〃") + public R> list(SysDept dept) { List depts = deptService.selectDeptList(dept); - return AjaxResult.success(depts); + return R.ok(depts); } /** @@ -51,7 +60,8 @@ public class SysDeptController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:dept:list')") @GetMapping("/list/exclude/{deptId}") - public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) + @ApiOperation("鏌ヨ閮ㄩ棬鍒楄〃锛堟帓闄よ妭鐐癸級") + public R> excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) { List depts = deptService.selectDeptList(new SysDept()); Iterator it = depts.iterator(); @@ -64,7 +74,7 @@ public class SysDeptController extends BaseController it.remove(); } } - return AjaxResult.success(depts); + return R.ok(depts); } /** @@ -72,26 +82,31 @@ public class SysDeptController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:dept:query')") @GetMapping(value = "/{deptId}") - public AjaxResult getInfo(@PathVariable Long deptId) + @ApiOperation("鏍规嵁閮ㄩ棬缂栧彿鑾峰彇璇︾粏淇℃伅") + public R getInfo(@PathVariable Long deptId) { deptService.checkDeptDataScope(deptId); - return AjaxResult.success(deptService.selectDeptById(deptId)); + SysDept sysDept = deptService.selectDeptById(deptId); + sysDept.covertTypes(); + return R.ok(sysDept); } /** * 鑾峰彇閮ㄩ棬涓嬫媺鏍戝垪琛 */ @GetMapping("/treeselect") - public AjaxResult treeselect(SysDept dept) + @ApiOperation("鑾峰彇閮ㄩ棬涓嬫媺鏍戝垪琛") + public R> treeselect(SysDept dept) { List depts = deptService.selectDeptList(dept); - return AjaxResult.success(deptService.buildDeptTreeSelect(depts)); + return R.ok(deptService.buildDeptTreeSelect(depts)); } /** * 鍔犺浇瀵瑰簲瑙掕壊閮ㄩ棬鍒楄〃鏍 */ @GetMapping(value = "/roleDeptTreeselect/{roleId}") + @ApiOperation("鍔犺浇瀵瑰簲瑙掕壊閮ㄩ棬鍒楄〃鏍") public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId) { List depts = deptService.selectDeptList(new SysDept()); @@ -107,12 +122,14 @@ public class SysDeptController extends BaseController @PreAuthorize("@ss.hasPermi('system:dept:add')") @Log(title = "閮ㄩ棬绠$悊", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@Validated @RequestBody SysDept dept) + @ApiOperation("鏂板閮ㄩ棬") + public R add(@Validated @RequestBody SysDept dept) { if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) { - return AjaxResult.error("鏂板閮ㄩ棬'" + dept.getDeptName() + "'澶辫触锛岄儴闂ㄥ悕绉板凡瀛樺湪"); + return R.fail("鏂板閮ㄩ棬'" + dept.getDeptName() + "'澶辫触锛岄儴闂ㄥ悕绉板凡瀛樺湪"); } + dept.covertType(); dept.setCreateBy(getUsername()); return toAjax(deptService.insertDept(dept)); } @@ -123,22 +140,24 @@ public class SysDeptController extends BaseController @PreAuthorize("@ss.hasPermi('system:dept:edit')") @Log(title = "閮ㄩ棬绠$悊", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@Validated @RequestBody SysDept dept) + @ApiOperation("淇敼閮ㄩ棬") + public R edit(@Validated @RequestBody SysDept dept) { Long deptId = dept.getDeptId(); deptService.checkDeptDataScope(deptId); if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) { - return AjaxResult.error("淇敼閮ㄩ棬'" + dept.getDeptName() + "'澶辫触锛岄儴闂ㄥ悕绉板凡瀛樺湪"); + return R.fail("淇敼閮ㄩ棬'" + dept.getDeptName() + "'澶辫触锛岄儴闂ㄥ悕绉板凡瀛樺湪"); } else if (dept.getParentId().equals(deptId)) { - return AjaxResult.error("淇敼閮ㄩ棬'" + dept.getDeptName() + "'澶辫触锛屼笂绾ч儴闂ㄤ笉鑳芥槸鑷繁"); + return R.fail("淇敼閮ㄩ棬'" + dept.getDeptName() + "'澶辫触锛屼笂绾ч儴闂ㄤ笉鑳芥槸鑷繁"); } else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) { - return AjaxResult.error("璇ラ儴闂ㄥ寘鍚湭鍋滅敤鐨勫瓙閮ㄩ棬锛"); + return R.fail("璇ラ儴闂ㄥ寘鍚湭鍋滅敤鐨勫瓙閮ㄩ棬锛"); } + dept.covertType(); dept.setUpdateBy(getUsername()); return toAjax(deptService.updateDept(dept)); } @@ -149,17 +168,28 @@ public class SysDeptController extends BaseController @PreAuthorize("@ss.hasPermi('system:dept:remove')") @Log(title = "閮ㄩ棬绠$悊", businessType = BusinessType.DELETE) @DeleteMapping("/{deptId}") - public AjaxResult remove(@PathVariable Long deptId) + @ApiOperation("鍒犻櫎閮ㄩ棬") + public R remove(@PathVariable Long deptId) { if (deptService.hasChildByDeptId(deptId)) { - return AjaxResult.error("瀛樺湪涓嬬骇閮ㄩ棬,涓嶅厑璁稿垹闄"); + return R.fail("瀛樺湪涓嬬骇閮ㄩ棬,涓嶅厑璁稿垹闄"); } if (deptService.checkDeptExistUser(deptId)) { - return AjaxResult.error("閮ㄩ棬瀛樺湪鐢ㄦ埛,涓嶅厑璁稿垹闄"); + return R.fail("閮ㄩ棬瀛樺湪鐢ㄦ埛,涓嶅厑璁稿垹闄"); } deptService.checkDeptDataScope(deptId); return toAjax(deptService.deleteDeptById(deptId)); } + + /** + * 鑾峰彇閮ㄩ棬绫诲瀷 + */ + @GetMapping("/type/{deptId}") + @ApiOperation("鑾峰彇閮ㄩ棬绫诲瀷") + public R> getType(@PathVariable Long deptId) + { + return R.ok(deptService.getType(deptId)); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java index eea89fd0d4d5e236e73842e81ffae7acfc1d2821..bb827499718151b87f982cf164a804e1527bd9fb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java @@ -3,6 +3,10 @@ package com.ruoyi.web.controller.system; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.core.domain.R; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -27,11 +31,12 @@ import com.ruoyi.system.service.ISysDictTypeService; /** * 鏁版嵁瀛楀吀淇℃伅 - * + * * @author ruoyi */ @RestController @RequestMapping("/system/dict/data") +@Api(tags = "鏁版嵁瀛楀吀淇℃伅 ") public class SysDictDataController extends BaseController { @Autowired @@ -42,16 +47,18 @@ public class SysDictDataController extends BaseController @PreAuthorize("@ss.hasPermi('system:dict:list')") @GetMapping("/list") - public TableDataInfo list(SysDictData dictData) + @ApiOperation("鑾峰彇瀛楀吀鏁版嵁鍒楄〃") + public TableDataInfo list(SysDictData dictData) { startPage(); List list = dictDataService.selectDictDataList(dictData); - return getDataTable(list); + return new TableDataInfo<>(list); } @Log(title = "瀛楀吀鏁版嵁", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:dict:export')") @PostMapping("/export") + @ApiOperation("瀵煎嚭瀛楀吀鏁版嵁鍒楄〃") public void export(HttpServletResponse response, SysDictData dictData) { List list = dictDataService.selectDictDataList(dictData); @@ -64,23 +71,25 @@ public class SysDictDataController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:dict:query')") @GetMapping(value = "/{dictCode}") - public AjaxResult getInfo(@PathVariable Long dictCode) + @ApiOperation("鏌ヨ瀛楀吀鏁版嵁璇︾粏") + public R getInfo(@PathVariable Long dictCode) { - return AjaxResult.success(dictDataService.selectDictDataById(dictCode)); + return R.ok(dictDataService.selectDictDataById(dictCode)); } /** * 鏍规嵁瀛楀吀绫诲瀷鏌ヨ瀛楀吀鏁版嵁淇℃伅 */ @GetMapping(value = "/type/{dictType}") - public AjaxResult dictType(@PathVariable String dictType) + @ApiOperation("鏍规嵁瀛楀吀绫诲瀷鏌ヨ瀛楀吀鏁版嵁淇℃伅") + public R> dictType(@PathVariable String dictType) { List data = dictTypeService.selectDictDataByType(dictType); if (StringUtils.isNull(data)) { data = new ArrayList(); } - return AjaxResult.success(data); + return R.ok(data); } /** @@ -89,7 +98,8 @@ public class SysDictDataController extends BaseController @PreAuthorize("@ss.hasPermi('system:dict:add')") @Log(title = "瀛楀吀鏁版嵁", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@Validated @RequestBody SysDictData dict) + @ApiOperation("鏂板瀛楀吀绫诲瀷") + public R add(@Validated @RequestBody SysDictData dict) { dict.setCreateBy(getUsername()); return toAjax(dictDataService.insertDictData(dict)); @@ -101,7 +111,8 @@ public class SysDictDataController extends BaseController @PreAuthorize("@ss.hasPermi('system:dict:edit')") @Log(title = "瀛楀吀鏁版嵁", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@Validated @RequestBody SysDictData dict) + @ApiOperation("淇敼淇濆瓨瀛楀吀绫诲瀷") + public R edit(@Validated @RequestBody SysDictData dict) { dict.setUpdateBy(getUsername()); return toAjax(dictDataService.updateDictData(dict)); @@ -113,9 +124,33 @@ public class SysDictDataController extends BaseController @PreAuthorize("@ss.hasPermi('system:dict:remove')") @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.DELETE) @DeleteMapping("/{dictCodes}") - public AjaxResult remove(@PathVariable Long[] dictCodes) + @ApiOperation("鍒犻櫎瀛楀吀绫诲瀷") + public R remove(@PathVariable Long[] dictCodes) { dictDataService.deleteDictDataByIds(dictCodes); return success(); } + + + + /** + * 鏍规嵁瀛楀吀绫诲瀷鏌ヨ瀛楀吀鏁版嵁淇℃伅 + */ + @GetMapping(value = "/default/{dictType}") + @ApiOperation("鏍规嵁瀛楀吀绫诲瀷鏌ヨ瀛楀吀鏁版嵁淇℃伅") + public R getDefaultByType(@PathVariable String dictType) + { + List data = dictTypeService.selectDictDataByType(dictType); + if (StringUtils.isNull(data)) + { + data = new ArrayList(); + } + SysDictData dictData = new SysDictData(); + for (SysDictData datum : data) { + if(datum.getDefault()){ + dictData = datum; + } + } + return R.ok(dictData); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java index 0dd3474cf4d2c1210b589bffdd7117055e712bea..a4bfa535ec761b5b7af02c6798a521cc49fc05b2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java @@ -2,6 +2,10 @@ package com.ruoyi.web.controller.system; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.core.domain.R; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -25,11 +29,12 @@ import com.ruoyi.system.service.ISysDictTypeService; /** * 鏁版嵁瀛楀吀淇℃伅 - * + * * @author ruoyi */ @RestController @RequestMapping("/system/dict/type") +@Api(tags = "鏁版嵁瀛楀吀绫诲瀷 ") public class SysDictTypeController extends BaseController { @Autowired @@ -37,16 +42,18 @@ public class SysDictTypeController extends BaseController @PreAuthorize("@ss.hasPermi('system:dict:list')") @GetMapping("/list") - public TableDataInfo list(SysDictType dictType) + @ApiOperation("鏌ヨ瀛楀吀绫诲瀷鍒楄〃") + public TableDataInfo list(SysDictType dictType) { startPage(); List list = dictTypeService.selectDictTypeList(dictType); - return getDataTable(list); + return new TableDataInfo<>(list); } @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:dict:export')") @PostMapping("/export") + @ApiOperation("瀵煎嚭瀛楀吀绫诲瀷") public void export(HttpServletResponse response, SysDictType dictType) { List list = dictTypeService.selectDictTypeList(dictType); @@ -59,9 +66,10 @@ public class SysDictTypeController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:dict:query')") @GetMapping(value = "/{dictId}") - public AjaxResult getInfo(@PathVariable Long dictId) + @ApiOperation("鏌ヨ瀛楀吀绫诲瀷璇︾粏") + public R getInfo(@PathVariable Long dictId) { - return AjaxResult.success(dictTypeService.selectDictTypeById(dictId)); + return R.ok(dictTypeService.selectDictTypeById(dictId)); } /** @@ -70,11 +78,12 @@ public class SysDictTypeController extends BaseController @PreAuthorize("@ss.hasPermi('system:dict:add')") @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@Validated @RequestBody SysDictType dict) + @ApiOperation("鏂板瀛楀吀绫诲瀷") + public R add(@Validated @RequestBody SysDictType dict) { if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) { - return AjaxResult.error("鏂板瀛楀吀'" + dict.getDictName() + "'澶辫触锛屽瓧鍏哥被鍨嬪凡瀛樺湪"); + return R.fail("鏂板瀛楀吀'" + dict.getDictName() + "'澶辫触锛屽瓧鍏哥被鍨嬪凡瀛樺湪"); } dict.setCreateBy(getUsername()); return toAjax(dictTypeService.insertDictType(dict)); @@ -86,11 +95,12 @@ public class SysDictTypeController extends BaseController @PreAuthorize("@ss.hasPermi('system:dict:edit')") @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@Validated @RequestBody SysDictType dict) + @ApiOperation("淇敼瀛楀吀绫诲瀷") + public R edit(@Validated @RequestBody SysDictType dict) { if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) { - return AjaxResult.error("淇敼瀛楀吀'" + dict.getDictName() + "'澶辫触锛屽瓧鍏哥被鍨嬪凡瀛樺湪"); + return R.fail("淇敼瀛楀吀'" + dict.getDictName() + "'澶辫触锛屽瓧鍏哥被鍨嬪凡瀛樺湪"); } dict.setUpdateBy(getUsername()); return toAjax(dictTypeService.updateDictType(dict)); @@ -102,7 +112,8 @@ public class SysDictTypeController extends BaseController @PreAuthorize("@ss.hasPermi('system:dict:remove')") @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.DELETE) @DeleteMapping("/{dictIds}") - public AjaxResult remove(@PathVariable Long[] dictIds) + @ApiOperation("鍒犻櫎瀛楀吀绫诲瀷") + public R remove(@PathVariable Long[] dictIds) { dictTypeService.deleteDictTypeByIds(dictIds); return success(); @@ -113,20 +124,22 @@ public class SysDictTypeController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:dict:remove')") @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.CLEAN) + @ApiOperation("鍒锋柊瀛楀吀缂撳瓨") @DeleteMapping("/refreshCache") - public AjaxResult refreshCache() + public R refreshCache() { dictTypeService.resetDictCache(); - return AjaxResult.success(); + return R.ok(); } /** * 鑾峰彇瀛楀吀閫夋嫨妗嗗垪琛 */ @GetMapping("/optionselect") - public AjaxResult optionselect() + @ApiOperation("鑾峰彇瀛楀吀閫夋嫨妗嗗垪琛") + public R> optionselect() { List dictTypes = dictTypeService.selectDictTypeAll(); - return AjaxResult.success(dictTypes); + return R.ok(dictTypes); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java index 009219e0259dfce4d49ad4a45a727af19b2ebfce..f7241e6932e0a2eba8ff957e2a6c5927e70d3afb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java @@ -1,5 +1,7 @@ package com.ruoyi.web.controller.system; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -12,6 +14,7 @@ import com.ruoyi.common.utils.StringUtils; * @author ruoyi */ @RestController +@Api(tags = "棣栭〉 ") public class SysIndexController { /** 绯荤粺鍩虹閰嶇疆 */ @@ -22,6 +25,7 @@ public class SysIndexController * 璁块棶棣栭〉锛屾彁绀鸿 */ @RequestMapping("/") + @ApiOperation("璁块棶棣栭〉锛屾彁绀鸿") public String index() { return StringUtils.format("娆㈣繋浣跨敤{}鍚庡彴绠$悊妗嗘灦锛屽綋鍓嶇増鏈細v{}锛岃閫氳繃鍓嶇鍦板潃璁块棶銆", ruoyiConfig.getName(), ruoyiConfig.getVersion()); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java index dab2bf8792394a2aff3a9f7df74ba20a947719f2..d87b0a1e5e2ecbedd79c294a7fe8c45da1944c75 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java @@ -2,6 +2,11 @@ package com.ruoyi.web.controller.system; import java.util.List; import java.util.Set; + +import com.ruoyi.common.core.domain.R; +import com.ruoyi.system.domain.vo.RouterVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -19,10 +24,11 @@ import com.ruoyi.system.service.ISysMenuService; /** * 鐧诲綍楠岃瘉 - * + * * @author ruoyi */ @RestController +@Api(tags = "鐧诲綍楠岃瘉 ") public class SysLoginController { @Autowired @@ -36,11 +42,12 @@ public class SysLoginController /** * 鐧诲綍鏂规硶 - * + * * @param loginBody 鐧诲綍淇℃伅 * @return 缁撴灉 */ @PostMapping("/login") + @ApiOperation("鐧诲綍鏂规硶") public AjaxResult login(@RequestBody LoginBody loginBody) { AjaxResult ajax = AjaxResult.success(); @@ -53,10 +60,11 @@ public class SysLoginController /** * 鑾峰彇鐢ㄦ埛淇℃伅 - * + * * @return 鐢ㄦ埛淇℃伅 */ @GetMapping("getInfo") + @ApiOperation("鑾峰彇鐢ㄦ埛淇℃伅") public AjaxResult getInfo() { SysUser user = SecurityUtils.getLoginUser().getUser(); @@ -73,14 +81,29 @@ public class SysLoginController /** * 鑾峰彇璺敱淇℃伅 - * + * * @return 璺敱淇℃伅 */ @GetMapping("getRouters") - public AjaxResult getRouters() + @ApiOperation("鑾峰彇璺敱淇℃伅") + public R> getRouters() { Long userId = SecurityUtils.getUserId(); List menus = menuService.selectMenuTreeByUserId(userId); - return AjaxResult.success(menuService.buildMenus(menus)); + return R.ok(menuService.buildMenus(menus)); + } + + /** + * 鑾峰彇璺敱淇℃伅 + * + * @return 璺敱淇℃伅 + */ + @GetMapping("getAppRouters") + @ApiOperation("鑾峰彇App璺敱淇℃伅") + public R> getAppRouters() + { + Long userId = SecurityUtils.getUserId(); + List menus = menuService.selectAppMenuTreeByUserId(userId); + return R.ok(menuService.buildMenus(menus)); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java index 9ab14d2abdb7f5264ace448ed57edf475f907fd1..2b1db5e54de9f067af820bb020e11b0404e14a02 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java @@ -1,6 +1,10 @@ package com.ruoyi.web.controller.system; import java.util.List; + +import com.ruoyi.common.core.domain.R; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -23,11 +27,12 @@ import com.ruoyi.system.service.ISysMenuService; /** * 鑿滃崟淇℃伅 - * + * * @author ruoyi */ @RestController @RequestMapping("/system/menu") +@Api(tags = "鑿滃崟淇℃伅 ") public class SysMenuController extends BaseController { @Autowired @@ -38,6 +43,7 @@ public class SysMenuController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:menu:list')") @GetMapping("/list") + @ApiOperation("鑾峰彇鑿滃崟鍒楄〃") public AjaxResult list(SysMenu menu) { List menus = menuService.selectMenuList(menu, getUserId()); @@ -49,6 +55,7 @@ public class SysMenuController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:menu:query')") @GetMapping(value = "/{menuId}") + @ApiOperation("鏍规嵁鑿滃崟缂栧彿鑾峰彇璇︾粏淇℃伅") public AjaxResult getInfo(@PathVariable Long menuId) { return AjaxResult.success(menuService.selectMenuById(menuId)); @@ -58,6 +65,7 @@ public class SysMenuController extends BaseController * 鑾峰彇鑿滃崟涓嬫媺鏍戝垪琛 */ @GetMapping("/treeselect") + @ApiOperation("鑾峰彇鑿滃崟涓嬫媺鏍戝垪琛") public AjaxResult treeselect(SysMenu menu) { List menus = menuService.selectMenuList(menu, getUserId()); @@ -68,6 +76,7 @@ public class SysMenuController extends BaseController * 鍔犺浇瀵瑰簲瑙掕壊鑿滃崟鍒楄〃鏍 */ @GetMapping(value = "/roleMenuTreeselect/{roleId}") + @ApiOperation("鍔犺浇瀵瑰簲瑙掕壊鑿滃崟鍒楄〃鏍") public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) { List menus = menuService.selectMenuList(getUserId()); @@ -81,17 +90,18 @@ public class SysMenuController extends BaseController * 鏂板鑿滃崟 */ @PreAuthorize("@ss.hasPermi('system:menu:add')") + @ApiOperation("鏂板鑿滃崟") @Log(title = "鑿滃崟绠$悊", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@Validated @RequestBody SysMenu menu) + public R add(@Validated @RequestBody SysMenu menu) { if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) { - return AjaxResult.error("鏂板鑿滃崟'" + menu.getMenuName() + "'澶辫触锛岃彍鍗曞悕绉板凡瀛樺湪"); + return R.fail("鏂板鑿滃崟'" + menu.getMenuName() + "'澶辫触锛岃彍鍗曞悕绉板凡瀛樺湪"); } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) { - return AjaxResult.error("鏂板鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屽湴鍧蹇呴』浠ttp(s)://寮澶"); + return R.fail("鏂板鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屽湴鍧蹇呴』浠ttp(s)://寮澶"); } menu.setCreateBy(getUsername()); return toAjax(menuService.insertMenu(menu)); @@ -103,19 +113,20 @@ public class SysMenuController extends BaseController @PreAuthorize("@ss.hasPermi('system:menu:edit')") @Log(title = "鑿滃崟绠$悊", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@Validated @RequestBody SysMenu menu) + @ApiOperation("淇敼鑿滃崟") + public R edit(@Validated @RequestBody SysMenu menu) { if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) { - return AjaxResult.error("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛岃彍鍗曞悕绉板凡瀛樺湪"); + return R.fail("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛岃彍鍗曞悕绉板凡瀛樺湪"); } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) { - return AjaxResult.error("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屽湴鍧蹇呴』浠ttp(s)://寮澶"); + return R.fail("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屽湴鍧蹇呴』浠ttp(s)://寮澶"); } else if (menu.getMenuId().equals(menu.getParentId())) { - return AjaxResult.error("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屼笂绾ц彍鍗曚笉鑳介夋嫨鑷繁"); + return R.fail("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屼笂绾ц彍鍗曚笉鑳介夋嫨鑷繁"); } menu.setUpdateBy(getUsername()); return toAjax(menuService.updateMenu(menu)); @@ -127,16 +138,17 @@ public class SysMenuController extends BaseController @PreAuthorize("@ss.hasPermi('system:menu:remove')") @Log(title = "鑿滃崟绠$悊", businessType = BusinessType.DELETE) @DeleteMapping("/{menuId}") - public AjaxResult remove(@PathVariable("menuId") Long menuId) + @ApiOperation("鍒犻櫎鑿滃崟") + public R remove(@PathVariable("menuId") Long menuId) { if (menuService.hasChildByMenuId(menuId)) { - return AjaxResult.error("瀛樺湪瀛愯彍鍗,涓嶅厑璁稿垹闄"); + return R.fail("瀛樺湪瀛愯彍鍗,涓嶅厑璁稿垹闄"); } if (menuService.checkMenuExistRole(menuId)) { - return AjaxResult.error("鑿滃崟宸插垎閰,涓嶅厑璁稿垹闄"); + return R.fail("鑿滃崟宸插垎閰,涓嶅厑璁稿垹闄"); } return toAjax(menuService.deleteMenuById(menuId)); } -} \ No newline at end of file +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java index 258024829883102b540bfa2c63c6c47fe82974e6..cb86bbe97a3a240fb0f98400328a0cf61f4e5adb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java @@ -1,6 +1,10 @@ package com.ruoyi.web.controller.system; import java.util.List; + +import com.ruoyi.common.core.domain.R; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -22,11 +26,12 @@ import com.ruoyi.system.service.ISysNoticeService; /** * 鍏憡 淇℃伅鎿嶄綔澶勭悊 - * + * * @author ruoyi */ @RestController @RequestMapping("/system/notice") +@Api(tags = "鍏憡 淇℃伅鎿嶄綔澶勭悊 ") public class SysNoticeController extends BaseController { @Autowired @@ -37,11 +42,12 @@ public class SysNoticeController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:notice:list')") @GetMapping("/list") - public TableDataInfo list(SysNotice notice) + @ApiOperation("鑾峰彇閫氱煡鍏憡鍒楄〃") + public TableDataInfo list(SysNotice notice) { startPage(); List list = noticeService.selectNoticeList(notice); - return getDataTable(list); + return new TableDataInfo<>(list); } /** @@ -49,6 +55,7 @@ public class SysNoticeController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:notice:query')") @GetMapping(value = "/{noticeId}") + @ApiOperation("鏍规嵁閫氱煡鍏憡缂栧彿鑾峰彇璇︾粏淇℃伅") public AjaxResult getInfo(@PathVariable Long noticeId) { return AjaxResult.success(noticeService.selectNoticeById(noticeId)); @@ -60,7 +67,8 @@ public class SysNoticeController extends BaseController @PreAuthorize("@ss.hasPermi('system:notice:add')") @Log(title = "閫氱煡鍏憡", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@Validated @RequestBody SysNotice notice) + @ApiOperation("鏂板閫氱煡鍏憡") + public R add(@Validated @RequestBody SysNotice notice) { notice.setCreateBy(getUsername()); return toAjax(noticeService.insertNotice(notice)); @@ -72,7 +80,8 @@ public class SysNoticeController extends BaseController @PreAuthorize("@ss.hasPermi('system:notice:edit')") @Log(title = "閫氱煡鍏憡", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@Validated @RequestBody SysNotice notice) + @ApiOperation("淇敼閫氱煡鍏憡") + public R edit(@Validated @RequestBody SysNotice notice) { notice.setUpdateBy(getUsername()); return toAjax(noticeService.updateNotice(notice)); @@ -84,7 +93,8 @@ public class SysNoticeController extends BaseController @PreAuthorize("@ss.hasPermi('system:notice:remove')") @Log(title = "閫氱煡鍏憡", businessType = BusinessType.DELETE) @DeleteMapping("/{noticeIds}") - public AjaxResult remove(@PathVariable Long[] noticeIds) + @ApiOperation("鍒犻櫎閫氱煡鍏憡") + public R remove(@PathVariable Long[] noticeIds) { return toAjax(noticeService.deleteNoticeByIds(noticeIds)); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java index 1a2b408edb042f3cc58dd78fb52d7d46e15cc0ef..60147addb3ee30e9d2a3f68a349736064ad8e93c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java @@ -2,6 +2,10 @@ package com.ruoyi.web.controller.system; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.core.domain.R; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -25,11 +29,12 @@ import com.ruoyi.system.service.ISysPostService; /** * 宀椾綅淇℃伅鎿嶄綔澶勭悊 - * + * * @author ruoyi */ @RestController @RequestMapping("/system/post") +@Api(tags = "宀椾綅淇℃伅鎿嶄綔澶勭悊") public class SysPostController extends BaseController { @Autowired @@ -40,16 +45,18 @@ public class SysPostController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:post:list')") @GetMapping("/list") - public TableDataInfo list(SysPost post) + @ApiOperation("鑾峰彇宀椾綅鍒楄〃") + public TableDataInfo list(SysPost post) { startPage(); List list = postService.selectPostList(post); - return getDataTable(list); + return new TableDataInfo<>(list); } - + @Log(title = "宀椾綅绠$悊", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:post:export')") @PostMapping("/export") + @ApiOperation("瀵煎嚭宀椾綅鍒楄〃") public void export(HttpServletResponse response, SysPost post) { List list = postService.selectPostList(post); @@ -62,6 +69,7 @@ public class SysPostController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:post:query')") @GetMapping(value = "/{postId}") + @ApiOperation("鏍规嵁宀椾綅缂栧彿鑾峰彇璇︾粏淇℃伅") public AjaxResult getInfo(@PathVariable Long postId) { return AjaxResult.success(postService.selectPostById(postId)); @@ -73,15 +81,16 @@ public class SysPostController extends BaseController @PreAuthorize("@ss.hasPermi('system:post:add')") @Log(title = "宀椾綅绠$悊", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@Validated @RequestBody SysPost post) + @ApiOperation("鏂板宀椾綅") + public R add(@Validated @RequestBody SysPost post) { if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) { - return AjaxResult.error("鏂板宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶅悕绉板凡瀛樺湪"); + return R.fail("鏂板宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶅悕绉板凡瀛樺湪"); } else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) { - return AjaxResult.error("鏂板宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶇紪鐮佸凡瀛樺湪"); + return R.fail("鏂板宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶇紪鐮佸凡瀛樺湪"); } post.setCreateBy(getUsername()); return toAjax(postService.insertPost(post)); @@ -93,15 +102,16 @@ public class SysPostController extends BaseController @PreAuthorize("@ss.hasPermi('system:post:edit')") @Log(title = "宀椾綅绠$悊", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@Validated @RequestBody SysPost post) + @ApiOperation("淇敼宀椾綅") + public R edit(@Validated @RequestBody SysPost post) { if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) { - return AjaxResult.error("淇敼宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶅悕绉板凡瀛樺湪"); + return R.fail("淇敼宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶅悕绉板凡瀛樺湪"); } else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) { - return AjaxResult.error("淇敼宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶇紪鐮佸凡瀛樺湪"); + return R.fail("淇敼宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶇紪鐮佸凡瀛樺湪"); } post.setUpdateBy(getUsername()); return toAjax(postService.updatePost(post)); @@ -113,7 +123,8 @@ public class SysPostController extends BaseController @PreAuthorize("@ss.hasPermi('system:post:remove')") @Log(title = "宀椾綅绠$悊", businessType = BusinessType.DELETE) @DeleteMapping("/{postIds}") - public AjaxResult remove(@PathVariable Long[] postIds) + @ApiOperation("鍒犻櫎宀椾綅") + public R remove(@PathVariable Long[] postIds) { return toAjax(postService.deletePostByIds(postIds)); } @@ -122,9 +133,10 @@ public class SysPostController extends BaseController * 鑾峰彇宀椾綅閫夋嫨妗嗗垪琛 */ @GetMapping("/optionselect") - public AjaxResult optionselect() + @ApiOperation("鑾峰彇宀椾綅閫夋嫨妗嗗垪琛") + public R> optionselect() { List posts = postService.selectPostAll(); - return AjaxResult.success(posts); + return R.fail(posts); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java index 848c9ca3d0a5a4d1554a01c7b2c2dfafa32e5bc5..1879494e9f216fe0cde7c9a5082ee4c3c3f8d5ae 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java @@ -1,5 +1,12 @@ package com.ruoyi.web.controller.system; +import com.ruoyi.business.domain.vo.BusFileVo; +import com.ruoyi.business.service.IBusFileService; +import com.ruoyi.common.config.MinioConfig; +import com.ruoyi.common.core.domain.model.MinioFile; +import com.ruoyi.common.utils.ServletUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -26,15 +33,18 @@ import com.ruoyi.system.service.ISysUserService; /** * 涓汉淇℃伅 涓氬姟澶勭悊 - * + * * @author ruoyi */ @RestController @RequestMapping("/system/user/profile") +@Api(tags = "涓汉淇℃伅 涓氬姟澶勭悊") public class SysProfileController extends BaseController { @Autowired private ISysUserService userService; + @Autowired + private IBusFileService fileService; @Autowired private TokenService tokenService; @@ -43,6 +53,7 @@ public class SysProfileController extends BaseController * 涓汉淇℃伅 */ @GetMapping + @ApiOperation("涓汉淇℃伅") public AjaxResult profile() { LoginUser loginUser = getLoginUser(); @@ -58,6 +69,7 @@ public class SysProfileController extends BaseController */ @Log(title = "涓汉淇℃伅", businessType = BusinessType.UPDATE) @PutMapping + @ApiOperation("淇敼鐢ㄦ埛") public AjaxResult updateProfile(@RequestBody SysUser user) { LoginUser loginUser = getLoginUser(); @@ -93,6 +105,7 @@ public class SysProfileController extends BaseController */ @Log(title = "涓汉淇℃伅", businessType = BusinessType.UPDATE) @PutMapping("/updatePwd") + @ApiOperation("閲嶇疆瀵嗙爜") public AjaxResult updatePwd(String oldPassword, String newPassword) { LoginUser loginUser = getLoginUser(); @@ -121,18 +134,24 @@ public class SysProfileController extends BaseController */ @Log(title = "鐢ㄦ埛澶村儚", businessType = BusinessType.UPDATE) @PostMapping("/avatar") + @ApiOperation("澶村儚涓婁紶") public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception { if (!file.isEmpty()) { LoginUser loginUser = getLoginUser(); - String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION); - if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) + BusFileVo busFileVo = fileService.uploadFile(file); + // 杞崲url涓洪暱鏈熸湁鏁堝湴鍧 + String url = busFileVo.getUrl(); + url = url.substring(0, url.indexOf('?')); + url = ServletUtils.urlDecode(url); + + if (userService.updateUserAvatar(loginUser.getUsername(), url)) { AjaxResult ajax = AjaxResult.success(); - ajax.put("imgUrl", avatar); + ajax.put("imgUrl", url); // 鏇存柊缂撳瓨鐢ㄦ埛澶村儚 - loginUser.getUser().setAvatar(avatar); + loginUser.getUser().setAvatar(url); tokenService.setLoginUser(loginUser); return ajax; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java index f1552e0334dcccf001c97d58697051487171b072..54ecab750090339d3d9c107032cc5b4b1111596c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java @@ -1,5 +1,8 @@ package com.ruoyi.web.controller.system; +import com.ruoyi.common.core.domain.R; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -13,10 +16,11 @@ import com.ruoyi.system.service.ISysConfigService; /** * 娉ㄥ唽楠岃瘉 - * + * * @author ruoyi */ @RestController +@Api(tags = "娉ㄥ唽楠岃瘉") public class SysRegisterController extends BaseController { @Autowired @@ -26,7 +30,8 @@ public class SysRegisterController extends BaseController private ISysConfigService configService; @PostMapping("/register") - public AjaxResult register(@RequestBody RegisterBody user) + @ApiOperation("娉ㄥ唽楠岃瘉") + public R register(@RequestBody RegisterBody user) { if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java index 10b62f1f51b46852bb0479f94c2174b6cadba2b6..9569be7585c09490a53a120ead6bb60af973fcb7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java @@ -2,6 +2,11 @@ package com.ruoyi.web.controller.system; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.core.domain.R; +import com.ruoyi.system.domain.vo.RoleKeyVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -32,11 +37,12 @@ import com.ruoyi.system.service.ISysUserService; /** * 瑙掕壊淇℃伅 - * + * * @author ruoyi */ @RestController @RequestMapping("/system/role") +@Api(tags = "瑙掕壊淇℃伅") public class SysRoleController extends BaseController { @Autowired @@ -44,25 +50,27 @@ public class SysRoleController extends BaseController @Autowired private TokenService tokenService; - + @Autowired private SysPermissionService permissionService; - + @Autowired private ISysUserService userService; @PreAuthorize("@ss.hasPermi('system:role:list')") @GetMapping("/list") - public TableDataInfo list(SysRole role) + @ApiOperation("瑙掕壊淇℃伅鍒楄〃") + public TableDataInfo list(SysRole role) { startPage(); List list = roleService.selectRoleList(role); - return getDataTable(list); + return new TableDataInfo<>(list); } @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:role:export')") @PostMapping("/export") + @ApiOperation("瀵煎嚭瑙掕壊淇℃伅鍒楄〃") public void export(HttpServletResponse response, SysRole role) { List list = roleService.selectRoleList(role); @@ -75,6 +83,7 @@ public class SysRoleController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:role:query')") @GetMapping(value = "/{roleId}") + @ApiOperation("鏍规嵁瑙掕壊缂栧彿鑾峰彇璇︾粏淇℃伅") public AjaxResult getInfo(@PathVariable Long roleId) { roleService.checkRoleDataScope(roleId); @@ -85,17 +94,18 @@ public class SysRoleController extends BaseController * 鏂板瑙掕壊 */ @PreAuthorize("@ss.hasPermi('system:role:add')") + @ApiOperation("鏂板瑙掕壊") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@Validated @RequestBody SysRole role) + public R add(@Validated @RequestBody SysRole role) { if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) { - return AjaxResult.error("鏂板瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹插悕绉板凡瀛樺湪"); + return R.fail("鏂板瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹插悕绉板凡瀛樺湪"); } else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) { - return AjaxResult.error("鏂板瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹叉潈闄愬凡瀛樺湪"); + return R.fail("鏂板瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹叉潈闄愬凡瀛樺湪"); } role.setCreateBy(getUsername()); return toAjax(roleService.insertRole(role)); @@ -108,20 +118,21 @@ public class SysRoleController extends BaseController @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@Validated @RequestBody SysRole role) + @ApiOperation("淇敼淇濆瓨瑙掕壊") + public R edit(@Validated @RequestBody SysRole role) { roleService.checkRoleAllowed(role); roleService.checkRoleDataScope(role.getRoleId()); if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) { - return AjaxResult.error("淇敼瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹插悕绉板凡瀛樺湪"); + return R.fail("淇敼瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹插悕绉板凡瀛樺湪"); } else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) { - return AjaxResult.error("淇敼瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹叉潈闄愬凡瀛樺湪"); + return R.fail("淇敼瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹叉潈闄愬凡瀛樺湪"); } role.setUpdateBy(getUsername()); - + if (roleService.updateRole(role) > 0) { // 鏇存柊缂撳瓨鐢ㄦ埛鏉冮檺 @@ -132,9 +143,9 @@ public class SysRoleController extends BaseController loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName())); tokenService.setLoginUser(loginUser); } - return AjaxResult.success(); + return R.ok(); } - return AjaxResult.error("淇敼瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑱旂郴绠$悊鍛"); + return R.fail("淇敼瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑱旂郴绠$悊鍛"); } /** @@ -143,7 +154,8 @@ public class SysRoleController extends BaseController @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.UPDATE) @PutMapping("/dataScope") - public AjaxResult dataScope(@RequestBody SysRole role) + @ApiOperation("淇敼淇濆瓨鏁版嵁鏉冮檺") + public R dataScope(@RequestBody SysRole role) { roleService.checkRoleAllowed(role); roleService.checkRoleDataScope(role.getRoleId()); @@ -156,7 +168,8 @@ public class SysRoleController extends BaseController @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.UPDATE) @PutMapping("/changeStatus") - public AjaxResult changeStatus(@RequestBody SysRole role) + @ApiOperation("鐘舵佷慨鏀") + public R changeStatus(@RequestBody SysRole role) { roleService.checkRoleAllowed(role); roleService.checkRoleDataScope(role.getRoleId()); @@ -170,7 +183,8 @@ public class SysRoleController extends BaseController @PreAuthorize("@ss.hasPermi('system:role:remove')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.DELETE) @DeleteMapping("/{roleIds}") - public AjaxResult remove(@PathVariable Long[] roleIds) + @ApiOperation("鍒犻櫎瑙掕壊") + public R remove(@PathVariable Long[] roleIds) { return toAjax(roleService.deleteRoleByIds(roleIds)); } @@ -180,9 +194,10 @@ public class SysRoleController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:role:query')") @GetMapping("/optionselect") - public AjaxResult optionselect() + @ApiOperation("鑾峰彇瑙掕壊閫夋嫨妗嗗垪琛") + public R> optionselect() { - return AjaxResult.success(roleService.selectRoleAll()); + return R.ok(roleService.selectRoleAll()); } /** @@ -190,11 +205,12 @@ public class SysRoleController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:role:list')") @GetMapping("/authUser/allocatedList") - public TableDataInfo allocatedList(SysUser user) + @ApiOperation("鏌ヨ宸插垎閰嶇敤鎴疯鑹插垪琛") + public TableDataInfo allocatedList(SysUser user) { startPage(); List list = userService.selectAllocatedList(user); - return getDataTable(list); + return new TableDataInfo<>(list); } /** @@ -202,7 +218,8 @@ public class SysRoleController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:role:list')") @GetMapping("/authUser/unallocatedList") - public TableDataInfo unallocatedList(SysUser user) + @ApiOperation("鏌ヨ鏈垎閰嶇敤鎴疯鑹插垪琛") + public TableDataInfo unallocatedList(SysUser user) { startPage(); List list = userService.selectUnallocatedList(user); @@ -215,7 +232,8 @@ public class SysRoleController extends BaseController @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.GRANT) @PutMapping("/authUser/cancel") - public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) + @ApiOperation("鍙栨秷鎺堟潈鐢ㄦ埛") + public R cancelAuthUser(@RequestBody SysUserRole userRole) { return toAjax(roleService.deleteAuthUser(userRole)); } @@ -226,7 +244,8 @@ public class SysRoleController extends BaseController @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.GRANT) @PutMapping("/authUser/cancelAll") - public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) + @ApiOperation("鎵归噺鍙栨秷鎺堟潈鐢ㄦ埛") + public R cancelAuthUserAll(Long roleId, Long[] userIds) { return toAjax(roleService.deleteAuthUsers(roleId, userIds)); } @@ -237,9 +256,22 @@ public class SysRoleController extends BaseController @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.GRANT) @PutMapping("/authUser/selectAll") - public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) + @ApiOperation("鎵归噺閫夋嫨鐢ㄦ埛鎺堟潈") + public R selectAuthUserAll(Long roleId, Long[] userIds) { roleService.checkRoleDataScope(roleId); return toAjax(roleService.insertAuthUsers(roleId, userIds)); } + + /** + * 鏌ヨ + */ + @PreAuthorize("@ss.hasPermi('system:role:query')") + @GetMapping("/roleKey") + @ApiOperation("鏌ヨ瑙掕壊绫诲瀷") + public R> selectRoleKey() + { + return R.ok(roleService.selectRoleKey()); + } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java index 60d9de07fbcda2f316f0ee222ec2ac6a74725fcf..24562c0471ad9b051a0b790b55cd18126fd49ea1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java @@ -3,6 +3,10 @@ package com.ruoyi.web.controller.system; import java.util.List; import java.util.stream.Collectors; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.core.domain.R; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.ArrayUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; @@ -33,11 +37,12 @@ import com.ruoyi.system.service.ISysUserService; /** * 鐢ㄦ埛淇℃伅 - * + * * @author ruoyi */ @RestController @RequestMapping("/system/user") +@Api(tags = "鐢ㄦ埛淇℃伅") public class SysUserController extends BaseController { @Autowired @@ -54,16 +59,18 @@ public class SysUserController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:user:list')") @GetMapping("/list") - public TableDataInfo list(SysUser user) + @ApiOperation("鑾峰彇鐢ㄦ埛鍒楄〃") + public TableDataInfo list(SysUser user) { startPage(); List list = userService.selectUserList(user); - return getDataTable(list); + return new TableDataInfo<>(list); } @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:user:export')") @PostMapping("/export") + @ApiOperation("瀵煎嚭鐢ㄦ埛鍒楄〃") public void export(HttpServletResponse response, SysUser user) { List list = userService.selectUserList(user); @@ -74,6 +81,7 @@ public class SysUserController extends BaseController @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.IMPORT) @PreAuthorize("@ss.hasPermi('system:user:import')") @PostMapping("/importData") + @ApiOperation("瀵煎叆鐢ㄦ埛鍒楄〃") public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { ExcelUtil util = new ExcelUtil(SysUser.class); @@ -84,6 +92,7 @@ public class SysUserController extends BaseController } @PostMapping("/importTemplate") + @ApiOperation("涓嬭浇瀵煎嚭妯℃澘") public void importTemplate(HttpServletResponse response) { ExcelUtil util = new ExcelUtil(SysUser.class); @@ -95,6 +104,7 @@ public class SysUserController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:user:query')") @GetMapping(value = { "/", "/{userId}" }) + @ApiOperation("鏍规嵁鐢ㄦ埛缂栧彿鑾峰彇璇︾粏淇℃伅") public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) { userService.checkUserDataScope(userId); @@ -118,21 +128,22 @@ public class SysUserController extends BaseController @PreAuthorize("@ss.hasPermi('system:user:add')") @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@Validated @RequestBody SysUser user) + @ApiOperation("鏂板鐢ㄦ埛") + public R add(@Validated @RequestBody SysUser user) { if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName()))) { - return AjaxResult.error("鏂板鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛岀櫥褰曡处鍙峰凡瀛樺湪"); + return R.fail("鏂板鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛岀櫥褰曡处鍙峰凡瀛樺湪"); } else if (StringUtils.isNotEmpty(user.getPhonenumber()) && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) { - return AjaxResult.error("鏂板鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛屾墜鏈哄彿鐮佸凡瀛樺湪"); + return R.fail("鏂板鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛屾墜鏈哄彿鐮佸凡瀛樺湪"); } else if (StringUtils.isNotEmpty(user.getEmail()) && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) { - return AjaxResult.error("鏂板鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛岄偖绠辫处鍙峰凡瀛樺湪"); + return R.fail("鏂板鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛岄偖绠辫处鍙峰凡瀛樺湪"); } user.setCreateBy(getUsername()); user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); @@ -145,19 +156,20 @@ public class SysUserController extends BaseController @PreAuthorize("@ss.hasPermi('system:user:edit')") @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@Validated @RequestBody SysUser user) + @ApiOperation("淇敼鐢ㄦ埛") + public R edit(@Validated @RequestBody SysUser user) { userService.checkUserAllowed(user); userService.checkUserDataScope(user.getUserId()); if (StringUtils.isNotEmpty(user.getPhonenumber()) && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) { - return AjaxResult.error("淇敼鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛屾墜鏈哄彿鐮佸凡瀛樺湪"); + return R.fail("淇敼鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛屾墜鏈哄彿鐮佸凡瀛樺湪"); } else if (StringUtils.isNotEmpty(user.getEmail()) && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) { - return AjaxResult.error("淇敼鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛岄偖绠辫处鍙峰凡瀛樺湪"); + return R.fail("淇敼鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛岄偖绠辫处鍙峰凡瀛樺湪"); } user.setUpdateBy(getUsername()); return toAjax(userService.updateUser(user)); @@ -169,7 +181,8 @@ public class SysUserController extends BaseController @PreAuthorize("@ss.hasPermi('system:user:remove')") @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.DELETE) @DeleteMapping("/{userIds}") - public AjaxResult remove(@PathVariable Long[] userIds) + @ApiOperation("鍒犻櫎鐢ㄦ埛") + public R remove(@PathVariable Long[] userIds) { if (ArrayUtils.contains(userIds, getUserId())) { @@ -184,7 +197,8 @@ public class SysUserController extends BaseController @PreAuthorize("@ss.hasPermi('system:user:resetPwd')") @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.UPDATE) @PutMapping("/resetPwd") - public AjaxResult resetPwd(@RequestBody SysUser user) + @ApiOperation("閲嶇疆瀵嗙爜") + public R resetPwd(@RequestBody SysUser user) { userService.checkUserAllowed(user); userService.checkUserDataScope(user.getUserId()); @@ -199,7 +213,8 @@ public class SysUserController extends BaseController @PreAuthorize("@ss.hasPermi('system:user:edit')") @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.UPDATE) @PutMapping("/changeStatus") - public AjaxResult changeStatus(@RequestBody SysUser user) + @ApiOperation("鐘舵佷慨鏀") + public R changeStatus(@RequestBody SysUser user) { userService.checkUserAllowed(user); userService.checkUserDataScope(user.getUserId()); @@ -212,6 +227,7 @@ public class SysUserController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:user:query')") @GetMapping("/authRole/{userId}") + @ApiOperation("鏍规嵁鐢ㄦ埛缂栧彿鑾峰彇鎺堟潈瑙掕壊") public AjaxResult authRole(@PathVariable("userId") Long userId) { AjaxResult ajax = AjaxResult.success(); @@ -228,7 +244,8 @@ public class SysUserController extends BaseController @PreAuthorize("@ss.hasPermi('system:user:edit')") @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.GRANT) @PutMapping("/authRole") - public AjaxResult insertAuthRole(Long userId, Long[] roleIds) + @ApiOperation("鐢ㄦ埛鎺堟潈瑙掕壊") + public R insertAuthRole(Long userId, Long[] roleIds) { userService.checkUserDataScope(userId); userService.insertUserAuth(userId, roleIds); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/UserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/UserController.java new file mode 100644 index 0000000000000000000000000000000000000000..1aca8d5199e081f6b37b1b238f43adecc34b33c0 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/UserController.java @@ -0,0 +1,101 @@ +package com.ruoyi.web.controller.system; + + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.web.service.MobileLoginService; +import com.ruoyi.framework.web.service.TokenService; +import com.ruoyi.system.domain.AppUserVo; +import com.ruoyi.system.domain.LoginParams; +import com.ruoyi.system.service.ISysUserService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; + +/** + * 鐧诲綍鎺у埗鍣 + * + * @author SK + * @since 2018/6/13 + */ +@RestController +@RequestMapping("/mobile/user") +@Api(tags = "App鐢ㄦ埛淇℃伅鎺ュ彛") +public class UserController { + + @Autowired + private ISysUserService sysUserService; + + + @Autowired + private TokenService tokenService; + + @Autowired + private MobileLoginService loginService; + + /** + * 娉ㄥ唽鐢ㄦ埛 + * + * @return -1 鐢ㄦ埛鍚嶆垨瀵嗙爜閿欒 -2 璐﹀彿鍐荤粨 -3 璐﹀彿閿佸畾 1 鎴愬姛 -4 楠岃瘉鐮侀敊璇 + */ + @PostMapping("/registerUser") + @ResponseBody + @ApiOperation(value = "娉ㄥ唽鐢ㄦ埛 -1 鐢ㄦ埛鍚嶆垨瀵嗙爜閿欒 -2 璐﹀彿鍐荤粨 -3 璐﹀彿閿佸畾 1 鎴愬姛 -4 楠岃瘉鐮侀敊璇") + public AjaxResult registerUser(HttpServletRequest request) { + String phoneNo = request.getParameter("phoneNo"); + String validCode = request.getParameter("validCode"); + // 鐧诲綍缁撴灉 + LoginParams loginParams = new LoginParams(); + loginParams.setPhoneNo(phoneNo); + loginParams.setValidCode(validCode); + return loginService.registerUser(loginParams); + } + + /** + * 鑾峰彇鐢ㄦ埛淇℃伅 + * + * @return 鐢ㄦ埛淇℃伅 + */ + @GetMapping("getUserInfo") + @ApiOperation(value = "鑾峰彇鐢ㄦ埛淇℃伅") + public AppUserVo getUserInfo(HttpServletRequest request) { + LoginUser loginUser = tokenService.getLoginUser(request); + SysUser user = sysUserService.selectUserById(loginUser.getUser().getUserId()); + AppUserVo ajax = AppUserVo.success(); + ajax.setUser( user); + return ajax; + } + + @PostMapping({"saveUserInfo"}) + @ResponseBody + @ApiOperation(value = "涓汉淇℃伅淇敼") + public R saveUserInfo(SysUser user, HttpServletRequest request) { + SysUser currentUser = SecurityUtils.getLoginUser().getUser(); + currentUser = sysUserService.selectUserById(currentUser.getUserId()); + if (StringUtils.isNotBlank(user.getNickName())) { + currentUser.setNickName(user.getNickName()); + } + if (StringUtils.isNotBlank(user.getEmail())) { + currentUser.setEmail(user.getEmail()); + } else { + currentUser.setEmail(""); + } + if (StringUtils.isNotBlank(user.getPhonenumber())) { + currentUser.setPhonenumber(user.getPhonenumber()); + } else { + currentUser.setPhonenumber(""); + } + if (StringUtils.isNotBlank(user.getSex())) { + currentUser.setSex(user.getSex()); + } + sysUserService.updateUser(currentUser); + return R.ok("涓汉淇℃伅淇敼鎴愬姛锛"); + } +} diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml new file mode 100644 index 0000000000000000000000000000000000000000..c7119cc29a5361bcf26d972385f4242397969bb1 --- /dev/null +++ b/ruoyi-admin/src/main/resources/application-dev.yml @@ -0,0 +1,193 @@ +# 椤圭洰鐩稿叧閰嶇疆 +ruoyi: + # 鍚嶇О + name: RuoYi + # 鐗堟湰 + version: 3.8.3 + # 鐗堟潈骞翠唤 + copyrightYear: 2022 + # 瀹炰緥婕旂ず寮鍏 + demoEnabled: true + # 鏂囦欢璺緞 绀轰緥锛 Windows閰嶇疆D:/ruoyi/uploadPath锛孡inux閰嶇疆 /home/ruoyi/uploadPath锛 + profile: D:/ruoyi/uploadPath + # 鑾峰彇ip鍦板潃寮鍏 + addressEnabled: true + # 楠岃瘉鐮佺被鍨 math 鏁扮粍璁$畻 char 瀛楃楠岃瘉 + captchaType: math + +# 寮鍙戠幆澧冮厤缃 +server: + # 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负80 + port: 8080 + servlet: + # 搴旂敤鐨勮闂矾寰 + context-path: / + # undertow 閰嶇疆 + undertow: + # HTTP post鍐呭鐨勬渶澶уぇ灏忋傚綋鍊间负-1鏃讹紝榛樿鍊间负澶у皬鏄棤闄愮殑 + max-http-post-size: -1 + # 浠ヤ笅鐨勯厤缃細褰卞搷buffer,杩欎簺buffer浼氱敤浜庢湇鍔″櫒杩炴帴鐨処O鎿嶄綔,鏈夌偣绫讳技netty鐨勬睜鍖栧唴瀛樼鐞 + # 姣忓潡buffer鐨勭┖闂村ぇ灏,瓒婂皬鐨勭┖闂磋鍒╃敤瓒婂厖鍒 + buffer-size: 512 + # 璁剧疆IO绾跨▼鏁, 瀹冧富瑕佹墽琛岄潪闃诲鐨勪换鍔,瀹冧滑浼氳礋璐e涓繛鎺, 榛樿璁剧疆姣忎釜CPU鏍稿績涓涓嚎绋 + io-threads: 8 + # 闃诲浠诲姟绾跨▼姹, 褰撴墽琛岀被浼約ervlet璇锋眰闃诲鎿嶄綔, undertow浼氫粠杩欎釜绾跨▼姹犱腑鍙栧緱绾跨▼,瀹冪殑鍊艰缃彇鍐充簬绯荤粺鐨勮礋杞 + worker-threads: 256 + # 鏄惁鍒嗛厤鐨勭洿鎺ュ唴瀛 + direct-buffers: true +# 鏃ュ織閰嶇疆 +logging: + level: + com.ruoyi: debug + org.springframework: warn + +# token閰嶇疆 +token: + # 浠ょ墝鑷畾涔夋爣璇 + header: Authorization + # 浠ょ墝瀵嗛挜 + secret: abcdefghijklmnopqrstuvwxyz + # 浠ょ墝鏈夋晥鏈燂紙榛樿30鍒嗛挓锛 + expireTime: 30 + + +# MyBatis Plus閰嶇疆 +mybatis-plus: + # 鎼滅储鎸囧畾鍖呭埆鍚 + typeAliasesPackage: com.ruoyi.**.domain + # 閰嶇疆mapper鐨勬壂鎻忥紝鎵惧埌鎵鏈夌殑mapper.xml鏄犲皠鏂囦欢 + mapperLocations: classpath*:mapper/**/*Mapper.xml + # 鍔犺浇鍏ㄥ眬鐨勯厤缃枃浠 + configLocation: classpath:mybatis/mybatis-config.xml + global-config: + db-config: + logic-delete-field: del_flag # 鍏ㄥ眬閫昏緫鍒犻櫎鐨勫疄浣撳瓧娈靛悕(since 3.3.0,閰嶇疆鍚庡彲浠ュ拷鐣ヤ笉閰嶇疆姝ラ2) + logic-delete-value: 1 # 閫昏緫宸插垹闄ゅ(榛樿涓 1) + logic-not-delete-value: 0 # 閫昏緫鏈垹闄ゅ(榛樿涓 0) + +# PageHelper鍒嗛〉鎻掍欢 +pagehelper: + helperDialect: postgresql + reasonable: true + supportMethodsArguments: true + params: count=countSql + +# Swagger閰嶇疆 +swagger: + # 鏄惁寮鍚痵wagger + enabled: true + # 璇锋眰鍓嶇紑 + pathMapping: /dev-api + +# 闃叉XSS鏀诲嚮 +xss: + # 杩囨护寮鍏 + enabled: true + # 鎺掗櫎閾炬帴锛堝涓敤閫楀彿鍒嗛殧锛 + excludes: /system/notice + # 鍖归厤閾炬帴 + urlPatterns: /system/*,/monitor/*,/tool/* + +# Minio閰嶇疆 +minio: + url: http://localhost:9000 + accessKey: minioadmin + secretKey: minioadmin + bucketName: common + +# Spring閰嶇疆 +spring: + # 璧勬簮淇℃伅 + messages: + # 鍥介檯鍖栬祫婧愭枃浠惰矾寰 + basename: i18n/messages + # 鏂囦欢涓婁紶 + servlet: + multipart: + # 鍗曚釜鏂囦欢澶у皬 + max-file-size: 10MB + # 璁剧疆鎬讳笂浼犵殑鏂囦欢澶у皬 + max-request-size: 20MB + # 鏈嶅姟妯″潡 + devtools: + restart: + # 鐑儴缃插紑鍏 + enabled: true + # redis 閰嶇疆 + redis: + # 鍦板潃 + host: localhost + # 绔彛锛岄粯璁や负6379 + port: 6379 + # 鏁版嵁搴撶储寮 + database: 0 + # 瀵嗙爜 +# password: + password: tz@wc2018 + # 杩炴帴瓒呮椂鏃堕棿 + timeout: 10s + lettuce: + pool: + # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺 + min-idle: 0 + # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺 + max-idle: 8 + # 杩炴帴姹犵殑鏈澶ф暟鎹簱杩炴帴鏁 + max-active: 8 + # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷艰〃绀烘病鏈夐檺鍒讹級 + max-wait: -1ms + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driverClassName: org.postgresql.Driver + druid: + # 涓诲簱鏁版嵁婧 + master: + url: jdbc:postgresql://122.112.162.132:5432/yimu?useUnicode=true&useSSL=false&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai + username: postgres + password: 1314Root! + # 浠庡簱鏁版嵁婧 + slave: + # 浠庢暟鎹簮寮鍏/榛樿鍏抽棴 + enabled: false + url: + username: + password: + # 鍒濆杩炴帴鏁 + initialSize: 5 + # 鏈灏忚繛鎺ユ睜鏁伴噺 + minIdle: 10 + # 鏈澶ц繛鎺ユ睜鏁伴噺 + maxActive: 20 + # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂 + maxWait: 60000 + # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣 + timeBetweenEvictionRunsMillis: 60000 + # 閰嶇疆涓涓繛鎺ュ湪姹犱腑鏈灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣 + minEvictableIdleTimeMillis: 300000 + # 閰嶇疆涓涓繛鎺ュ湪姹犱腑鏈澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣 + maxEvictableIdleTimeMillis: 900000 + # 閰嶇疆妫娴嬭繛鎺ユ槸鍚︽湁鏁 + validationQuery: SELECT version() + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + webStatFilter: + enabled: true + statViewServlet: + enabled: true + # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂 + allow: + url-pattern: /druid/* + # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮 + login-username: ruoyi + login-password: 123456 + filter: + stat: + enabled: true + # 鎱QL璁板綍 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: true diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index c7ead09f9f2ba3464bef2a9b3a07d5fd0f1bf36e..d595f5206af0ae1af767d539deef0d4790013077 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -6,9 +6,9 @@ spring: druid: # 涓诲簱鏁版嵁婧 master: - url: jdbc:postgresql://localhost:5432/ruoyi?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai + url: jdbc:postgresql://122.112.162.132:5432/yimu?useUnicode=true&useSSL=false&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai username: postgres - password: lcck1345 + password: 1314Root! # 浠庡簱鏁版嵁婧 slave: # 浠庢暟鎹簮寮鍏/榛樿鍏抽棴 diff --git a/ruoyi-admin/src/main/resources/application-prod.yml b/ruoyi-admin/src/main/resources/application-prod.yml new file mode 100644 index 0000000000000000000000000000000000000000..3d62a2e0edd8b9f8211db03c28a82549c9eddc26 --- /dev/null +++ b/ruoyi-admin/src/main/resources/application-prod.yml @@ -0,0 +1,194 @@ +# 椤圭洰鐩稿叧閰嶇疆 +ruoyi: + # 鍚嶇О + name: RuoYi + # 鐗堟湰 + version: 3.8.3 + # 鐗堟潈骞翠唤 + copyrightYear: 2022 + # 瀹炰緥婕旂ず寮鍏 + demoEnabled: true + # 鏂囦欢璺緞 绀轰緥锛 Windows閰嶇疆D:/ruoyi/uploadPath锛孡inux閰嶇疆 /home/ruoyi/uploadPath锛 + profile: /data/ruoyi/uploadPath + # 鑾峰彇ip鍦板潃寮鍏 + addressEnabled: true + # 楠岃瘉鐮佺被鍨 math 鏁扮粍璁$畻 char 瀛楃楠岃瘉 + captchaType: math + +# 寮鍙戠幆澧冮厤缃 +server: + # 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负80 + port: 8080 + servlet: + # 搴旂敤鐨勮闂矾寰 + context-path: / + # undertow 閰嶇疆 + undertow: + # HTTP post鍐呭鐨勬渶澶уぇ灏忋傚綋鍊间负-1鏃讹紝榛樿鍊间负澶у皬鏄棤闄愮殑 + max-http-post-size: -1 + # 浠ヤ笅鐨勯厤缃細褰卞搷buffer,杩欎簺buffer浼氱敤浜庢湇鍔″櫒杩炴帴鐨処O鎿嶄綔,鏈夌偣绫讳技netty鐨勬睜鍖栧唴瀛樼鐞 + # 姣忓潡buffer鐨勭┖闂村ぇ灏,瓒婂皬鐨勭┖闂磋鍒╃敤瓒婂厖鍒 + buffer-size: 512 + # 璁剧疆IO绾跨▼鏁, 瀹冧富瑕佹墽琛岄潪闃诲鐨勪换鍔,瀹冧滑浼氳礋璐e涓繛鎺, 榛樿璁剧疆姣忎釜CPU鏍稿績涓涓嚎绋 + io-threads: 8 + # 闃诲浠诲姟绾跨▼姹, 褰撴墽琛岀被浼約ervlet璇锋眰闃诲鎿嶄綔, undertow浼氫粠杩欎釜绾跨▼姹犱腑鍙栧緱绾跨▼,瀹冪殑鍊艰缃彇鍐充簬绯荤粺鐨勮礋杞 + worker-threads: 256 + # 鏄惁鍒嗛厤鐨勭洿鎺ュ唴瀛 + direct-buffers: true +# 鏃ュ織閰嶇疆 +logging: + level: + com.ruoyi: debug + org.springframework: warn + + +# token閰嶇疆 +token: + # 浠ょ墝鑷畾涔夋爣璇 + header: Authorization + # 浠ょ墝瀵嗛挜 + secret: abcdefghijklmnopqrstuvwxyz + # 浠ょ墝鏈夋晥鏈燂紙榛樿30鍒嗛挓锛 + expireTime: 30 + + +# MyBatis Plus閰嶇疆 +mybatis-plus: + # 鎼滅储鎸囧畾鍖呭埆鍚 + typeAliasesPackage: com.ruoyi.**.domain + # 閰嶇疆mapper鐨勬壂鎻忥紝鎵惧埌鎵鏈夌殑mapper.xml鏄犲皠鏂囦欢 + mapperLocations: classpath*:mapper/**/*Mapper.xml + # 鍔犺浇鍏ㄥ眬鐨勯厤缃枃浠 + configLocation: classpath:mybatis/mybatis-config.xml + global-config: + db-config: + logic-delete-field: del_flag # 鍏ㄥ眬閫昏緫鍒犻櫎鐨勫疄浣撳瓧娈靛悕(since 3.3.0,閰嶇疆鍚庡彲浠ュ拷鐣ヤ笉閰嶇疆姝ラ2) + logic-delete-value: 1 # 閫昏緫宸插垹闄ゅ(榛樿涓 1) + logic-not-delete-value: 0 # 閫昏緫鏈垹闄ゅ(榛樿涓 0) + +# PageHelper鍒嗛〉鎻掍欢 +pagehelper: + helperDialect: postgresql + reasonable: true + supportMethodsArguments: true + params: count=countSql + +# Swagger閰嶇疆 +swagger: + # 鏄惁寮鍚痵wagger + enabled: true + # 璇锋眰鍓嶇紑 + pathMapping: /prod-api + +# 闃叉XSS鏀诲嚮 +xss: + # 杩囨护寮鍏 + enabled: true + # 鎺掗櫎閾炬帴锛堝涓敤閫楀彿鍒嗛殧锛 + excludes: /system/notice + # 鍖归厤閾炬帴 + urlPatterns: /system/*,/monitor/*,/tool/* + +# Minio閰嶇疆 +minio: + url: http://122.112.162.132:19000 + accessKey: jueying + secretKey: 1314Root! + bucketName: common + +# Spring閰嶇疆 +spring: + # 璧勬簮淇℃伅 + messages: + # 鍥介檯鍖栬祫婧愭枃浠惰矾寰 + basename: i18n/messages + # 鏂囦欢涓婁紶 + servlet: + multipart: + # 鍗曚釜鏂囦欢澶у皬 + max-file-size: 10MB + # 璁剧疆鎬讳笂浼犵殑鏂囦欢澶у皬 + max-request-size: 20MB + # 鏈嶅姟妯″潡 + devtools: + restart: + # 鐑儴缃插紑鍏 + enabled: true + # redis 閰嶇疆 + redis: + # 鍦板潃 + host: localhost + # 绔彛锛岄粯璁や负6379 + port: 6379 + # 鏁版嵁搴撶储寮 + database: 0 + # 瀵嗙爜 + password: 1314Root! + # password: tz@wc2018 + # 杩炴帴瓒呮椂鏃堕棿 + timeout: 10s + lettuce: + pool: + # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺 + min-idle: 0 + # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺 + max-idle: 8 + # 杩炴帴姹犵殑鏈澶ф暟鎹簱杩炴帴鏁 + max-active: 8 + # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷艰〃绀烘病鏈夐檺鍒讹級 + max-wait: -1ms + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driverClassName: org.postgresql.Driver + druid: + # 涓诲簱鏁版嵁婧 + master: + url: jdbc:postgresql://localhost:5432/yimu?useUnicode=true&useSSL=false&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai + username: postgres + password: 1314Root! + # 浠庡簱鏁版嵁婧 + slave: + # 浠庢暟鎹簮寮鍏/榛樿鍏抽棴 + enabled: false + url: + username: + password: + # 鍒濆杩炴帴鏁 + initialSize: 5 + # 鏈灏忚繛鎺ユ睜鏁伴噺 + minIdle: 10 + # 鏈澶ц繛鎺ユ睜鏁伴噺 + maxActive: 20 + # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂 + maxWait: 60000 + # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣 + timeBetweenEvictionRunsMillis: 60000 + # 閰嶇疆涓涓繛鎺ュ湪姹犱腑鏈灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣 + minEvictableIdleTimeMillis: 300000 + # 閰嶇疆涓涓繛鎺ュ湪姹犱腑鏈澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣 + maxEvictableIdleTimeMillis: 900000 + # 閰嶇疆妫娴嬭繛鎺ユ槸鍚︽湁鏁 + validationQuery: SELECT version() + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + webStatFilter: + enabled: true + statViewServlet: + enabled: true + # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂 + allow: + url-pattern: /druid/* + # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮 + login-username: ruoyi + login-password: 123456 + filter: + stat: + enabled: true + # 鎱QL璁板綍 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: true diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 35e33327fb67ba3d23663ee1f61a9b3f11eca660..422e9158f0137c78c36e18bf91ca5534a79f8e4f 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -1,124 +1,3 @@ -# 椤圭洰鐩稿叧閰嶇疆 -ruoyi: - # 鍚嶇О - name: RuoYi - # 鐗堟湰 - version: 3.8.3 - # 鐗堟潈骞翠唤 - copyrightYear: 2022 - # 瀹炰緥婕旂ず寮鍏 - demoEnabled: true - # 鏂囦欢璺緞 绀轰緥锛 Windows閰嶇疆D:/ruoyi/uploadPath锛孡inux閰嶇疆 /home/ruoyi/uploadPath锛 - profile: D:/ruoyi/uploadPath - # 鑾峰彇ip鍦板潃寮鍏 - addressEnabled: false - # 楠岃瘉鐮佺被鍨 math 鏁扮粍璁$畻 char 瀛楃楠岃瘉 - captchaType: math - -# 寮鍙戠幆澧冮厤缃 -server: - # 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负8080 - port: 8080 - servlet: - # 搴旂敤鐨勮闂矾寰 - context-path: / - tomcat: - # tomcat鐨刄RI缂栫爜 - uri-encoding: UTF-8 - # 杩炴帴鏁版弧鍚庣殑鎺掗槦鏁帮紝榛樿涓100 - accept-count: 1000 - threads: - # tomcat鏈澶х嚎绋嬫暟锛岄粯璁や负200 - max: 800 - # Tomcat鍚姩鍒濆鍖栫殑绾跨▼鏁帮紝榛樿鍊10 - min-spare: 100 - -# 鏃ュ織閰嶇疆 -logging: - level: - com.ruoyi: debug - org.springframework: warn - -# Spring閰嶇疆 spring: - # 璧勬簮淇℃伅 - messages: - # 鍥介檯鍖栬祫婧愭枃浠惰矾寰 - basename: i18n/messages - profiles: - active: druid - # 鏂囦欢涓婁紶 - servlet: - multipart: - # 鍗曚釜鏂囦欢澶у皬 - max-file-size: 10MB - # 璁剧疆鎬讳笂浼犵殑鏂囦欢澶у皬 - max-request-size: 20MB - # 鏈嶅姟妯″潡 - devtools: - restart: - # 鐑儴缃插紑鍏 - enabled: true - # redis 閰嶇疆 - redis: - # 鍦板潃 - host: localhost - # 绔彛锛岄粯璁や负6379 - port: 6379 - # 鏁版嵁搴撶储寮 - database: 0 - # 瀵嗙爜 - password: - # 杩炴帴瓒呮椂鏃堕棿 - timeout: 10s - lettuce: - pool: - # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺 - min-idle: 0 - # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺 - max-idle: 8 - # 杩炴帴姹犵殑鏈澶ф暟鎹簱杩炴帴鏁 - max-active: 8 - # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷艰〃绀烘病鏈夐檺鍒讹級 - max-wait: -1ms - -# token閰嶇疆 -token: - # 浠ょ墝鑷畾涔夋爣璇 - header: Authorization - # 浠ょ墝瀵嗛挜 - secret: abcdefghijklmnopqrstuvwxyz - # 浠ょ墝鏈夋晥鏈燂紙榛樿30鍒嗛挓锛 - expireTime: 30 - -# MyBatis閰嶇疆 -mybatis: - # 鎼滅储鎸囧畾鍖呭埆鍚 - typeAliasesPackage: com.ruoyi.**.domain - # 閰嶇疆mapper鐨勬壂鎻忥紝鎵惧埌鎵鏈夌殑mapper.xml鏄犲皠鏂囦欢 - mapperLocations: classpath*:mapper/**/*Mapper.xml - # 鍔犺浇鍏ㄥ眬鐨勯厤缃枃浠 - configLocation: classpath:mybatis/mybatis-config.xml - -# PageHelper鍒嗛〉鎻掍欢 -pagehelper: - helperDialect: postgresql - reasonable: true - supportMethodsArguments: true - params: count=countSql - -# Swagger閰嶇疆 -swagger: - # 鏄惁寮鍚痵wagger - enabled: true - # 璇锋眰鍓嶇紑 - pathMapping: /dev-api - -# 闃叉XSS鏀诲嚮 -xss: - # 杩囨护寮鍏 - enabled: true - # 鎺掗櫎閾炬帴锛堝涓敤閫楀彿鍒嗛殧锛 - excludes: /system/notice - # 鍖归厤閾炬帴 - urlPatterns: /system/*,/monitor/*,/tool/* + profiles: + active: dev diff --git a/ruoyi-admin/src/main/resources/i18n/messages.properties b/ruoyi-admin/src/main/resources/i18n/messages.properties index 5a41f8c7b21e12137d3ed1cd17fcbd2daff568d2..ddeafa44fb4fbc183655fc9a7848d5cf378fc28b 100644 --- a/ruoyi-admin/src/main/resources/i18n/messages.properties +++ b/ruoyi-admin/src/main/resources/i18n/messages.properties @@ -15,7 +15,7 @@ length.not.valid=闀垮害蹇呴』鍦▄min}鍒皗max}涓瓧绗︿箣闂 user.username.not.valid=* 2鍒20涓眽瀛椼佸瓧姣嶃佹暟瀛楁垨涓嬪垝绾跨粍鎴愶紝涓斿繀椤讳互闈炴暟瀛楀紑澶 user.password.not.valid=* 5-50涓瓧绗 - + user.email.not.valid=閭鏍煎紡閿欒 user.mobile.phone.number.not.valid=鎵嬫満鍙锋牸寮忛敊璇 user.login.success=鐧诲綍鎴愬姛 diff --git a/ruoyi-admin/src/main/resources/logback.xml b/ruoyi-admin/src/main/resources/logback.xml index d69a5720739777fb1bc9feef127220071296d5ca..3a4d0759e7d4e7753f275fec9c4992308098b08b 100644 --- a/ruoyi-admin/src/main/resources/logback.xml +++ b/ruoyi-admin/src/main/resources/logback.xml @@ -1,7 +1,7 @@ - + @@ -11,7 +11,7 @@ ${log.pattern} - + ${log.path}/sys-info.log @@ -34,7 +34,7 @@ DENY - + ${log.path}/sys-error.log @@ -56,7 +56,7 @@ DENY - + ${log.path}/sys-user.log @@ -70,7 +70,7 @@ ${log.pattern} - + @@ -79,15 +79,15 @@ - + - + - \ No newline at end of file + diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 31486d7d17b733233a182369a7fa37f3c4b6ab79..0c69efd6d511985aeb5e3eb915b1da319b7e7ce6 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -125,6 +125,48 @@ javax.servlet-api + + + cn.hutool + hutool-all + + + + + ma.glasnost.orika + orika-core + + + + + io.swagger + swagger-annotations + + + + + io.minio + minio + + + + + com.baomidou + mybatis-plus-boot-starter + 3.4.2 + + + + + org.projectlombok + lombok + + + + + net.postgis + postgis-jdbc + \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/MinioConfig.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/MinioConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..2e380010ee128c76ea62d6c0371e8de3357d9fb4 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/MinioConfig.java @@ -0,0 +1,82 @@ +package com.ruoyi.common.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import io.minio.MinioClient; + +/** + * Minio 閰嶇疆淇℃伅 + * + * @author ruoyi + */ +@Configuration +@ConfigurationProperties(prefix = "minio") +public class MinioConfig +{ + /** + * 鏈嶅姟鍦板潃 + */ + private static String url; + + /** + * 鐢ㄦ埛鍚 + */ + private static String accessKey; + + /** + * 瀵嗙爜 + */ + private static String secretKey; + + /** + * 瀛樺偍妗跺悕绉 + */ + private static String bucketName; + + public static String getUrl() + { + return url; + } + + public void setUrl(String url) + { + MinioConfig.url = url; + } + + public static String getAccessKey() + { + return accessKey; + } + + public void setAccessKey(String accessKey) + { + MinioConfig.accessKey = accessKey; + } + + public static String getSecretKey() + { + return secretKey; + } + + public void setSecretKey(String secretKey) + { + MinioConfig.secretKey = secretKey; + } + + public static String getBucketName() + { + return bucketName; + } + + public void setBucketName(String bucketName) + { + MinioConfig.bucketName = bucketName; + } + + @Bean + public MinioClient getMinioClient() + { + return MinioClient.builder().endpoint(url).credentials(accessKey, secretKey).build(); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java index 2dbdbe64885bd1ffc382c94f02cb96a26c749a38..6fda5a75be765b849c43e094f1fd2bf91d408f2a 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java @@ -4,7 +4,7 @@ import io.jsonwebtoken.Claims; /** * 閫氱敤甯搁噺淇℃伅 - * + * * @author ruoyi */ public class Constants @@ -58,7 +58,7 @@ public class Constants * 鐧诲綍澶辫触 */ public static final String LOGIN_FAIL = "Error"; - + /** * 楠岃瘉鐮佹湁鏁堟湡锛堝垎閽燂級 */ @@ -134,4 +134,14 @@ public class Constants */ public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml", "org.springframework", "org.apache", "com.ruoyi.common.utils.file" }; + + /** + * 鍒嗛殧绗 + */ + public static final String SEPARATOR = ","; + + /** + * 妯潬 + */ + public static final String RUNG = "-"; } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/DeptConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/DeptConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..813186cd4b10a4d6647a446ff6faf04a34b008ab --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/DeptConstants.java @@ -0,0 +1,14 @@ +package com.ruoyi.common.constant; + +/** + * 閮ㄩ棬甯搁噺淇℃伅 + * + * @author ruoyi + */ +public class DeptConstants +{ + /** + * 棰勫畾涔夎鑹叉墍鍦ㄩ儴闂 + */ + public static final Long PARENT_DEPT_ID = 100L; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/DictDataConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/DictDataConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..c84a0adf385d25c96a97db7ef28a1a932ccccbec --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/DictDataConstants.java @@ -0,0 +1,14 @@ +package com.ruoyi.common.constant; + +/** + * 閮ㄩ棬甯搁噺淇℃伅 + * + * @author ruoyi + */ +public class DictDataConstants +{ + /** + * 闄ゆ不鐘舵 0锛氬凡闄ゆ不 + */ + public static final String BUSINESS_SCALING_TREAT_STATUS_HAS = "1"; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java index e7382b3f1d2b892749fe70d915deb80e69452713..ac3216e6aadfe3dbf9a4862122e8a31ea9c81cc6 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java @@ -32,18 +32,24 @@ public class GenConstants public static final String PARENT_MENU_NAME = "parentMenuName"; /** 鏁版嵁搴撳瓧绗︿覆绫诲瀷 */ - public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2" }; + public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2" , "character varying" }; /** 鏁版嵁搴撴枃鏈被鍨 */ public static final String[] COLUMNTYPE_TEXT = { "tinytext", "text", "mediumtext", "longtext" }; /** 鏁版嵁搴撴椂闂寸被鍨 */ - public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" }; + public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp", "timestamp without time zone" }; /** 鏁版嵁搴撴暟瀛楃被鍨 */ - public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer", + public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer","numeric", "bit", "bigint", "float", "double", "decimal" }; + /** 鏁版嵁搴搃nteger绫诲瀷 */ + public static final String[] COLUMNTYPE_INTEGER = { "tinyint", "smallint", "mediumint", "int", "integer"}; + /** 鏁版嵁搴揇ECIMAL绫诲瀷 */ + public static final String[] COLUMNTYPE_DECIMAL = { "decimal", "float", "numeric","double"}; + /** 鏁版嵁搴揕ong绫诲瀷 */ + public static final String[] COLUMNTYPE_LONG = { "bigint"}; /** 椤甸潰涓嶉渶瑕佺紪杈戝瓧娈 */ public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" }; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java index b96d93c0b1703988fc9f9fd3522db7aedda31bbc..2792f68a299c1f3a2cae80e4c6b7550963466ba3 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java @@ -3,6 +3,8 @@ package com.ruoyi.common.core.controller; import java.beans.PropertyEditorSupport; import java.util.Date; import java.util.List; + +import com.ruoyi.common.core.domain.R; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.bind.WebDataBinder; @@ -23,7 +25,7 @@ import com.ruoyi.common.utils.sql.SqlUtil; /** * web灞傞氱敤鏁版嵁澶勭悊 - * + * * @author ruoyi */ public class BaseController @@ -82,64 +84,59 @@ public class BaseController @SuppressWarnings({ "rawtypes", "unchecked" }) protected TableDataInfo getDataTable(List> list) { - TableDataInfo rspData = new TableDataInfo(); - rspData.setCode(HttpStatus.SUCCESS); - rspData.setMsg("鏌ヨ鎴愬姛"); - rspData.setRows(list); - rspData.setTotal(new PageInfo(list).getTotal()); - return rspData; + return new TableDataInfo(list); } /** * 杩斿洖鎴愬姛 */ - public AjaxResult success() + public R success() { - return AjaxResult.success(); + return R.ok(); } /** * 杩斿洖澶辫触娑堟伅 */ - public AjaxResult error() + public R error() { - return AjaxResult.error(); + return R.fail(); } /** * 杩斿洖鎴愬姛娑堟伅 */ - public AjaxResult success(String message) + public R success(String message) { - return AjaxResult.success(message); + return R.ok(message); } /** * 杩斿洖澶辫触娑堟伅 */ - public AjaxResult error(String message) + public R error(String message) { - return AjaxResult.error(message); + return R.fail(message); } /** * 鍝嶅簲杩斿洖缁撴灉 - * + * * @param rows 褰卞搷琛屾暟 * @return 鎿嶄綔缁撴灉 */ - protected AjaxResult toAjax(int rows) + protected R toAjax(int rows) { - return rows > 0 ? AjaxResult.success() : AjaxResult.error(); + return rows > 0 ? R.ok() : R.fail(); } /** * 鍝嶅簲杩斿洖缁撴灉 - * + * * @param result 缁撴灉 * @return 鎿嶄綔缁撴灉 */ - protected AjaxResult toAjax(boolean result) + protected R toAjax(boolean result) { return result ? success() : error(); } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AuditBaseEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AuditBaseEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..9123047633db5102cb66577b666a146a07bc6e5c --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AuditBaseEntity.java @@ -0,0 +1,112 @@ +package com.ruoyi.common.core.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.io.Serializable; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * Entity鍩虹被 + * + * @author ruoyi + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class AuditBaseEntity extends BusinessEntity implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 浼佷笟瀹℃牳鐘舵侊紙0 浼佷笟寰呭鏍 1 浼佷笟宸插鏍 2 浼佷笟搴熷純锛 */ + @ApiModelProperty(value = "浼佷笟瀹℃牳鐘舵侊紙0 浼佷笟寰呭鏍 1 浼佷笟宸插鏍 2 浼佷笟搴熷純锛") + private String enterpriseStatus; + + /** 浼佷笟瀹℃牳鏃堕棿 */ + @ApiModelProperty(value = "浼佷笟瀹℃牳鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date enterpriseTime; + + /** 浼佷笟瀹℃牳浜哄憳 */ + @ApiModelProperty(value = "浼佷笟瀹℃牳浜哄憳") + private String enterpriseBy; + + /** 浼佷笟瀹℃牳浜哄憳id */ + @ApiModelProperty(value = "浼佷笟瀹℃牳浜哄憳id") + private Long enterpriseById; + + /** 浼佷笟瀹℃牳IP */ + @ApiModelProperty(value = "浼佷笟瀹℃牳IP") + private String enterpriseIp; + + /** 琛楅亾瀹℃牳鐘舵侊紙0 琛楅亾寰呭鏍 1 琛楅亾宸插鏍 2 琛楅亾閫鍥烇級 */ + @ApiModelProperty(value = "琛楅亾瀹℃牳鐘舵侊紙0 琛楅亾寰呭鏍 1 琛楅亾宸插鏍 2 琛楅亾閫鍥烇級 ") + private String streetStatus; + + /** 琛楅亾瀹℃牳鏃堕棿 */ + @ApiModelProperty(value = "琛楅亾瀹℃牳鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date streetTime; + + /** 琛楅亾瀹℃牳浜哄憳 */ + @ApiModelProperty(value = "琛楅亾瀹℃牳浜哄憳") + private String streetBy; + + /** 琛楅亾瀹℃牳浜哄憳id */ + @ApiModelProperty(value = "琛楅亾瀹℃牳浜哄憳id") + private Long streetById; + /** 琛楅亾瀹℃牳IP */ + @ApiModelProperty(value = "琛楅亾瀹℃牳IP") + private String streetIp; + + /** 鍖哄鏍哥姸鎬侊紙0 鍖哄緟瀹℃牳 1 鍖哄凡瀹℃牳锛 */ + @ApiModelProperty(value = "鍖哄鏍哥姸鎬侊紙0 鍖哄緟瀹℃牳 1 鍖哄凡瀹℃牳锛") + private String districtStatus; + + /** 鍖哄鏍告椂闂 */ + @ApiModelProperty(value = "鍖哄鏍告椂闂") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date districtTime; + + /** 鍖哄鏍镐汉鍛 */ + @ApiModelProperty(value = "鍖哄鏍镐汉鍛") + private String districtBy; + + /** 鍖哄鏍镐汉鍛榠d */ + @ApiModelProperty(value = "鍖哄鏍镐汉鍛榠d") + private Long districtById; + + /** 鍖哄鏍窱P */ + @ApiModelProperty(value = "鍖哄鏍窱P") + private String districtIp; + + /** 鏈杩戜竴娆″鏍哥姸鎬侊紙0 浼佷笟寰呭鏍 1 浼佷笟搴熷純 2 琛楅亾寰呭鏍 3 琛楅亾閫鍥 4 鍖哄緟瀹℃牳 5 鍖哄凡瀹℃牳锛 */ + @ApiModelProperty(value = "鏈杩戜竴娆″鏍哥姸鎬侊紙0 浼佷笟寰呭鏍 1 浼佷笟搴熷純 2 琛楅亾寰呭鏍 3 琛楅亾閫鍥 4 鍖哄緟瀹℃牳 5 鍖哄凡瀹℃牳锛") + private String auditStatus; + + /** 鏈杩戜竴娆″鏍告椂闂 */ + @Excel(name = "鏈杩戜竴娆″鏍告椂闂") + @ApiModelProperty(value = "鏈杩戜竴娆″鏍告椂闂") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date auditTime; + + /** 鏈杩戜竴娆″鏍镐汉鍛 */ + @ApiModelProperty(value = "鏈杩戜竴娆″鏍镐汉鍛") + private String auditBy; + + /** 鏈杩戜竴娆″鏍镐汉鍛榠d */ + @ApiModelProperty(value = "鏈杩戜竴娆″鏍镐汉鍛榠d") + private Long auditById; + + /** 鏈杩戜竴娆″鏍窱P */ + @ApiModelProperty(value = "鏈杩戜竴娆″鏍窱P") + private String auditIp; + + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java index 0fc68beb5b04c4aa1f7dff778a0d3ffb9e90acd3..b423d3c9a643b6114b4a0d57da25510a4235780f 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java @@ -4,111 +4,57 @@ import java.io.Serializable; import java.util.Date; import java.util.HashMap; import java.util.Map; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; /** * Entity鍩虹被 * * @author ruoyi */ +@Data public class BaseEntity implements Serializable { private static final long serialVersionUID = 1L; /** 鎼滅储鍊 */ + @TableField(exist = false) private String searchValue; /** 鍒涘缓鑰 */ + @ApiModelProperty(value = "鍒涘缓鑰") + @TableField(fill = FieldFill.INSERT) private String createBy; /** 鍒涘缓鏃堕棿 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "鍒涘缓鏃堕棿") + @TableField(fill = FieldFill.INSERT) private Date createTime; /** 鏇存柊鑰 */ + @ApiModelProperty(value = "鏇存柊鑰") + @TableField(fill = FieldFill.UPDATE) private String updateBy; /** 鏇存柊鏃堕棿 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "鏇存柊鏃堕棿") + @TableField(fill = FieldFill.UPDATE) private Date updateTime; /** 澶囨敞 */ + @ApiModelProperty(value = "澶囨敞") private String remark; /** 璇锋眰鍙傛暟 */ - private Map params; - - public String getSearchValue() - { - return searchValue; - } - - public void setSearchValue(String searchValue) - { - this.searchValue = searchValue; - } - - public String getCreateBy() - { - return createBy; - } - - public void setCreateBy(String createBy) - { - this.createBy = createBy; - } - - public Date getCreateTime() - { - return createTime; - } - - public void setCreateTime(Date createTime) - { - this.createTime = createTime; - } - - public String getUpdateBy() - { - return updateBy; - } - - public void setUpdateBy(String updateBy) - { - this.updateBy = updateBy; - } - - public Date getUpdateTime() - { - return updateTime; - } - - public void setUpdateTime(Date updateTime) - { - this.updateTime = updateTime; - } - - public String getRemark() - { - return remark; - } - - public void setRemark(String remark) - { - this.remark = remark; - } - - public Map getParams() - { - if (params == null) - { - params = new HashMap<>(); - } - return params; - } - - public void setParams(Map params) - { - this.params = params; - } + @TableField(exist = false) + private Map params = new HashMap<>();; } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BusinessEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BusinessEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..17a24a95424f54e59a90657953a42258b42271c6 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BusinessEntity.java @@ -0,0 +1,55 @@ +package com.ruoyi.common.core.domain; + +import com.baomidou.mybatisplus.annotation.*; +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.io.Serializable; + +/** + * Entity鍩虹被 + * + * @author ruoyi + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class BusinessEntity extends BaseEntity implements Serializable +{ + private static final long serialVersionUID = 1L; + /** ID锛堢郴缁熻嚜鍔ㄧ敓鎴愮殑搴忓彿锛 */ + @ApiModelProperty(value = "ID锛堢郴缁熻嚜鍔ㄧ敓鎴愮殑搴忓彿锛") + @TableId(type = IdType.AUTO) + private Long id; + + /** 闄ゆ不瀛e害 */ + @ApiModelProperty(value = "闄ゆ不瀛e害") + private String year; + + /** 缂栧彿 */ + @ApiModelProperty(value = "缂栧彿") + private String code; + + /** 閮ㄩ棬ID */ + @ApiModelProperty(value = "閮ㄩ棬ID") + @TableField(fill = FieldFill.INSERT) + private Long deptId; + + /** 鍒涘缓浜篿d */ + @ApiModelProperty(value = "鍒涘缓浜篿d") + @TableField(fill = FieldFill.INSERT) + private Long createById; + + /** 鏇存柊鑰卛d */ + @ApiModelProperty(value = "鏇存柊鑰卛d") + @TableField(fill = FieldFill.UPDATE) + private Long updateById; + + /** 鍒犻櫎鐘舵侊紙鍒犻櫎鏍囧織锛0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛 */ + @TableLogic + private String delFlag; + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java index c3df6aefe3e1c820c6a195c5b373aea810111225..842d890281f0fc59417332ffc687e2b249c54218 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java @@ -24,6 +24,17 @@ public class R implements Serializable private T data; + /** + * 鍝嶅簲杩斿洖缁撴灉 + * + * @param rows 褰卞搷琛屾暟 + * @return 鎿嶄綔缁撴灉 + */ + protected R toR(int rows) + { + return rows > 0 ? R.ok() : R.fail(); + } + public static R ok() { return restResult(null, SUCCESS, "鎿嶄綔鎴愬姛"); diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/BaseCmd.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/BaseCmd.java new file mode 100644 index 0000000000000000000000000000000000000000..986719fa28f7e0df8f6a5a59484fc8512427dee2 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/BaseCmd.java @@ -0,0 +1,25 @@ +package com.ruoyi.common.core.domain.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.io.Serializable; + +/** + * @ClassName BaseUpdateCmd + * @Description TODO + * @Author jueying 2022/7/15 22:13 + * @Version 1.0 + * @since jdk1.8 + */ +@Data +public class BaseCmd implements Serializable { + + /** 澶囨敞 */ + @ApiModelProperty(value = "澶囨敞") + private String remark; + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/BusinessCmd.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/BusinessCmd.java new file mode 100644 index 0000000000000000000000000000000000000000..89375a4a75e7b70bf0a28ecbcbbc7524277c6111 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/BusinessCmd.java @@ -0,0 +1,28 @@ +package com.ruoyi.common.core.domain.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * @ClassName BaseUpdateCmd + * @Description TODO + * @Author jueying 2022/7/15 22:13 + * @Version 1.0 + * @since jdk1.8 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class BusinessCmd extends BaseCmd { + + /** 闄ゆ不瀛e害 */ + @ApiModelProperty(value = "闄ゆ不瀛e害") + private String year; + + /** 缂栧彿 */ + @ApiModelProperty(value = "缂栧彿") + private String code; + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java index 693461b9fc1f989725df8f3f74d903a4d6b4e9a3..cc77ddf75d457dab848ea4edab424fd430562a70 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java @@ -1,18 +1,25 @@ package com.ruoyi.common.core.domain.entity; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; + +import cn.hutool.core.collection.CollUtil; +import com.ruoyi.common.constant.Constants; +import io.swagger.annotations.ApiModelProperty; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.core.domain.BaseEntity; /** * 閮ㄩ棬琛 sys_dept - * + * * @author ruoyi */ public class SysDept extends BaseEntity @@ -20,39 +27,61 @@ public class SysDept extends BaseEntity private static final long serialVersionUID = 1L; /** 閮ㄩ棬ID */ + + @ApiModelProperty(value = "閮ㄩ棬ID") private Long deptId; /** 鐖堕儴闂↖D */ + @ApiModelProperty(value = "鐖堕儴闂↖D") private Long parentId; /** 绁栫骇鍒楄〃 */ + @ApiModelProperty(value = "绁栫骇鍒楄〃") private String ancestors; /** 閮ㄩ棬鍚嶇О */ + @ApiModelProperty(value = "閮ㄩ棬鍚嶇О") private String deptName; /** 鏄剧ず椤哄簭 */ + @ApiModelProperty(value = "鏄剧ず椤哄簭") private Integer orderNum; /** 璐熻矗浜 */ + @ApiModelProperty(value = "璐熻矗浜") private String leader; /** 鑱旂郴鐢佃瘽 */ + @ApiModelProperty(value = "鑱旂郴鐢佃瘽") private String phone; /** 閭 */ + @ApiModelProperty(value = "閭") private String email; /** 閮ㄩ棬鐘舵:0姝e父,1鍋滅敤 */ + @ApiModelProperty(value = "閮ㄩ棬鐘舵:0姝e父,1鍋滅敤") private String status; /** 鍒犻櫎鏍囧織锛0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛 */ + @ApiModelProperty(value = "鍒犻櫎鏍囧織锛0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛") private String delFlag; /** 鐖堕儴闂ㄥ悕绉 */ + @ApiModelProperty(value = "鐖堕儴闂ㄥ悕绉") private String parentName; - + + + /** 閮ㄩ棬绫诲瀷 */ + @ApiModelProperty(value = "閮ㄩ棬绫诲瀷") + private String type; + + /** 鏄剧ず椤哄簭 */ + @ApiModelProperty(value = "鏄剧ず椤哄簭") + private List types; + /** 瀛愰儴闂 */ + @ApiModelProperty(value = "瀛愰儴闂") private List children = new ArrayList(); public Long getDeptId() @@ -181,6 +210,22 @@ public class SysDept extends BaseEntity this.children = children; } + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public List getTypes() { + return types; + } + + public void setTypes(List types) { + this.types = types; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -198,6 +243,23 @@ public class SysDept extends BaseEntity .append("createTime", getCreateTime()) .append("updateBy", getUpdateBy()) .append("updateTime", getUpdateTime()) + .append("type", getType()) .toString(); } + + public void covertTypes(){ + List types = new ArrayList<>(); + if(StringUtils.isBlank(getType())){ + this.types = types; + return; + } + this.types = CollUtil.newArrayList(getType().split(Constants.SEPARATOR)); + } + + + public void covertType(){ + if(CollUtil.isNotEmpty(getTypes())){ + this.type = CollUtil.join(getTypes(), Constants.SEPARATOR); + } + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java index 229f41803359c12a08f11c6530243307614c5c23..1c937306549b67ae3563a3a2f89aface42cc5a10 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java @@ -63,6 +63,10 @@ public class SysMenu extends BaseEntity /** 鑿滃崟鍥炬爣 */ private String icon; + + /** 鏄惁涓篴pp */ + private String isApp; + /** 瀛愯彍鍗 */ private List children = new ArrayList(); @@ -232,7 +236,15 @@ public class SysMenu extends BaseEntity { this.children = children; } - + + public String getIsApp() { + return isApp; + } + + public void setIsApp(String isApp) { + this.isApp = isApp; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java index 60992f21b98000e170093c0785edd5c9000e107e..bbe801cd6fd1c719edba1ee4ad4c3c4a42166474 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java @@ -3,6 +3,8 @@ package com.ruoyi.common.core.domain.entity; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; + +import io.swagger.annotations.ApiModelProperty; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; @@ -11,217 +13,229 @@ import com.ruoyi.common.core.domain.BaseEntity; /** * 瑙掕壊琛 sys_role - * + * * @author ruoyi */ -public class SysRole extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 瑙掕壊ID */ - @Excel(name = "瑙掕壊搴忓彿", cellType = ColumnType.NUMERIC) - private Long roleId; - - /** 瑙掕壊鍚嶇О */ - @Excel(name = "瑙掕壊鍚嶇О") - private String roleName; - - /** 瑙掕壊鏉冮檺 */ - @Excel(name = "瑙掕壊鏉冮檺") - private String roleKey; - - /** 瑙掕壊鎺掑簭 */ - @Excel(name = "瑙掕壊鎺掑簭") - private Integer roleSort; - - /** 鏁版嵁鑼冨洿锛1锛氭墍鏈夋暟鎹潈闄愶紱2锛氳嚜瀹氫箟鏁版嵁鏉冮檺锛3锛氭湰閮ㄩ棬鏁版嵁鏉冮檺锛4锛氭湰閮ㄩ棬鍙婁互涓嬫暟鎹潈闄愶紱5锛氫粎鏈汉鏁版嵁鏉冮檺锛 */ - @Excel(name = "鏁版嵁鑼冨洿", readConverterExp = "1=鎵鏈夋暟鎹潈闄,2=鑷畾涔夋暟鎹潈闄,3=鏈儴闂ㄦ暟鎹潈闄,4=鏈儴闂ㄥ強浠ヤ笅鏁版嵁鏉冮檺,5=浠呮湰浜烘暟鎹潈闄") - private String dataScope; - - /** 鑿滃崟鏍戦夋嫨椤规槸鍚﹀叧鑱旀樉绀猴紙 0锛氱埗瀛愪笉浜掔浉鍏宠仈鏄剧ず 1锛氱埗瀛愪簰鐩稿叧鑱旀樉绀猴級 */ - private boolean menuCheckStrictly; - - /** 閮ㄩ棬鏍戦夋嫨椤规槸鍚﹀叧鑱旀樉绀猴紙0锛氱埗瀛愪笉浜掔浉鍏宠仈鏄剧ず 1锛氱埗瀛愪簰鐩稿叧鑱旀樉绀 锛 */ - private boolean deptCheckStrictly; - - /** 瑙掕壊鐘舵侊紙0姝e父 1鍋滅敤锛 */ - @Excel(name = "瑙掕壊鐘舵", readConverterExp = "0=姝e父,1=鍋滅敤") - private String status; - - /** 鍒犻櫎鏍囧織锛0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛 */ - private String delFlag; - - /** 鐢ㄦ埛鏄惁瀛樺湪姝よ鑹叉爣璇 榛樿涓嶅瓨鍦 */ - private boolean flag = false; - - /** 鑿滃崟缁 */ - private Long[] menuIds; - - /** 閮ㄩ棬缁勶紙鏁版嵁鏉冮檺锛 */ - private Long[] deptIds; - - public SysRole() - { - - } - - public SysRole(Long roleId) - { - this.roleId = roleId; - } - - public Long getRoleId() - { - return roleId; - } - - public void setRoleId(Long roleId) - { - this.roleId = roleId; - } - - public boolean isAdmin() - { - return isAdmin(this.roleId); - } - - public static boolean isAdmin(Long roleId) - { - return roleId != null && 1L == roleId; - } - - @NotBlank(message = "瑙掕壊鍚嶇О涓嶈兘涓虹┖") - @Size(min = 0, max = 30, message = "瑙掕壊鍚嶇О闀垮害涓嶈兘瓒呰繃30涓瓧绗") - public String getRoleName() - { - return roleName; - } - - public void setRoleName(String roleName) - { - this.roleName = roleName; - } - - @NotBlank(message = "鏉冮檺瀛楃涓嶈兘涓虹┖") - @Size(min = 0, max = 100, message = "鏉冮檺瀛楃闀垮害涓嶈兘瓒呰繃100涓瓧绗") - public String getRoleKey() - { - return roleKey; - } - - public void setRoleKey(String roleKey) - { - this.roleKey = roleKey; - } - - @NotNull(message = "鏄剧ず椤哄簭涓嶈兘涓虹┖") - public Integer getRoleSort() - { - return roleSort; - } - - public void setRoleSort(Integer roleSort) - { - this.roleSort = roleSort; - } - - public String getDataScope() - { - return dataScope; - } - - public void setDataScope(String dataScope) - { - this.dataScope = dataScope; - } - - public boolean isMenuCheckStrictly() - { - return menuCheckStrictly; - } - - public void setMenuCheckStrictly(boolean menuCheckStrictly) - { - this.menuCheckStrictly = menuCheckStrictly; - } - - public boolean isDeptCheckStrictly() - { - return deptCheckStrictly; - } - - public void setDeptCheckStrictly(boolean deptCheckStrictly) - { - this.deptCheckStrictly = deptCheckStrictly; - } - - public String getStatus() - { - return status; - } - - public void setStatus(String status) - { - this.status = status; - } - - public String getDelFlag() - { - return delFlag; - } - - public void setDelFlag(String delFlag) - { - this.delFlag = delFlag; - } - - public boolean isFlag() - { - return flag; - } - - public void setFlag(boolean flag) - { - this.flag = flag; - } - - public Long[] getMenuIds() - { - return menuIds; - } - - public void setMenuIds(Long[] menuIds) - { - this.menuIds = menuIds; - } - - public Long[] getDeptIds() - { - return deptIds; - } - - public void setDeptIds(Long[] deptIds) - { - this.deptIds = deptIds; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("roleId", getRoleId()) - .append("roleName", getRoleName()) - .append("roleKey", getRoleKey()) - .append("roleSort", getRoleSort()) - .append("dataScope", getDataScope()) - .append("menuCheckStrictly", isMenuCheckStrictly()) - .append("deptCheckStrictly", isDeptCheckStrictly()) - .append("status", getStatus()) - .append("delFlag", getDelFlag()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("remark", getRemark()) - .toString(); - } +public class SysRole extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** 瑙掕壊ID */ + @Excel(name = "瑙掕壊搴忓彿", cellType = ColumnType.NUMERIC) + @ApiModelProperty(value = "瑙掕壊搴忓彿") + private Long roleId; + + /** 瑙掕壊鍚嶇О */ + @Excel(name = "瑙掕壊鍚嶇О") + @ApiModelProperty(value = "瑙掕壊鍚嶇О") + private String roleName; + + /** 瑙掕壊鏉冮檺 */ + @Excel(name = "瑙掕壊鏉冮檺") + @ApiModelProperty(value = "瑙掕壊鏉冮檺") + private String roleKey; + + /** 瑙掕壊鎺掑簭 */ + @Excel(name = "瑙掕壊鎺掑簭") + @ApiModelProperty(value = "瑙掕壊鎺掑簭") + private Integer roleSort; + + /** 鏁版嵁鑼冨洿锛1锛氭墍鏈夋暟鎹潈闄愶紱2锛氳嚜瀹氫箟鏁版嵁鏉冮檺锛3锛氭湰閮ㄩ棬鏁版嵁鏉冮檺锛4锛氭湰閮ㄩ棬鍙婁互涓嬫暟鎹潈闄愶紱5锛氫粎鏈汉鏁版嵁鏉冮檺锛 */ + @Excel(name = "鏁版嵁鑼冨洿", readConverterExp = "1=鎵鏈夋暟鎹潈闄,2=鑷畾涔夋暟鎹潈闄,3=鏈儴闂ㄦ暟鎹潈闄,4=鏈儴闂ㄥ強浠ヤ笅鏁版嵁鏉冮檺,5=浠呮湰浜烘暟鎹潈闄") + @ApiModelProperty(value = "鏁版嵁鑼冨洿锛1锛氭墍鏈夋暟鎹潈闄愶紱2锛氳嚜瀹氫箟鏁版嵁鏉冮檺锛3锛氭湰閮ㄩ棬鏁版嵁鏉冮檺锛4锛氭湰閮ㄩ棬鍙婁互涓嬫暟鎹潈闄愶紱5锛氫粎鏈汉鏁版嵁鏉冮檺锛") + private String dataScope; + + /** 鑿滃崟鏍戦夋嫨椤规槸鍚﹀叧鑱旀樉绀猴紙 0锛氱埗瀛愪笉浜掔浉鍏宠仈鏄剧ず 1锛氱埗瀛愪簰鐩稿叧鑱旀樉绀猴級 */ + @ApiModelProperty(value = "鑿滃崟鏍戦夋嫨椤规槸鍚﹀叧鑱旀樉绀猴紙 0锛氱埗瀛愪笉浜掔浉鍏宠仈鏄剧ず 1锛氱埗瀛愪簰鐩稿叧鑱旀樉绀猴級") + private boolean menuCheckStrictly; + + /** 閮ㄩ棬鏍戦夋嫨椤规槸鍚﹀叧鑱旀樉绀猴紙0锛氱埗瀛愪笉浜掔浉鍏宠仈鏄剧ず 1锛氱埗瀛愪簰鐩稿叧鑱旀樉绀 锛 */ + @ApiModelProperty(value = "閮ㄩ棬鏍戦夋嫨椤规槸鍚﹀叧鑱旀樉绀猴紙0锛氱埗瀛愪笉浜掔浉鍏宠仈鏄剧ず 1锛氱埗瀛愪簰鐩稿叧鑱旀樉绀 锛") + private boolean deptCheckStrictly; + + /** 瑙掕壊鐘舵侊紙0姝e父 1鍋滅敤锛 */ + @ApiModelProperty(value = " 瑙掕壊鐘舵侊紙0姝e父 1鍋滅敤锛") + @Excel(name = "瑙掕壊鐘舵", readConverterExp = "0=姝e父,1=鍋滅敤") + private String status; + + /** 鍒犻櫎鏍囧織锛0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛 */ + @ApiModelProperty(value = " 鍒犻櫎鏍囧織锛0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛") + private String delFlag; + + /** 鐢ㄦ埛鏄惁瀛樺湪姝よ鑹叉爣璇 榛樿涓嶅瓨鍦 */ + @ApiModelProperty(value = " 鐢ㄦ埛鏄惁瀛樺湪姝よ鑹叉爣璇 榛樿涓嶅瓨鍦") + private boolean flag = false; + + /** 鑿滃崟缁 */ + @ApiModelProperty(value = " 鑿滃崟缁") + private Long[] menuIds; + + /** 閮ㄩ棬缁勶紙鏁版嵁鏉冮檺锛 */ + @ApiModelProperty(value = " 閮ㄩ棬缁勶紙鏁版嵁鏉冮檺锛") + private Long[] deptIds; + + /** + * 閮ㄩ棬id锛堜富瑕佺敤鏉ュ尯鍒嗚鑹茬殑鏁版嵁鏉冮檺锛 + */ + @ApiModelProperty(value = "閮ㄩ棬id锛堜富瑕佺敤鏉ュ尯鍒嗚鑹茬殑鏁版嵁鏉冮檺锛") + private Long deptId; + + + @ApiModelProperty(value = "閮ㄩ棬淇℃伅") + private SysDept dept; + + public SysRole() { + + } + + public SysRole(Long roleId) { + this.roleId = roleId; + } + + public Long getRoleId() { + return roleId; + } + + public void setRoleId(Long roleId) { + this.roleId = roleId; + } + + public boolean isAdmin() { + return isAdmin(this.roleId); + } + + public static boolean isAdmin(Long roleId) { + return roleId != null && 1L == roleId; + } + + @NotBlank(message = "瑙掕壊鍚嶇О涓嶈兘涓虹┖") + @Size(min = 0, max = 30, message = "瑙掕壊鍚嶇О闀垮害涓嶈兘瓒呰繃30涓瓧绗") + public String getRoleName() { + return roleName; + } + + public void setRoleName(String roleName) { + this.roleName = roleName; + } + + @NotBlank(message = "鏉冮檺瀛楃涓嶈兘涓虹┖") + @Size(min = 0, max = 100, message = "鏉冮檺瀛楃闀垮害涓嶈兘瓒呰繃100涓瓧绗") + public String getRoleKey() { + return roleKey; + } + + public void setRoleKey(String roleKey) { + this.roleKey = roleKey; + } + + @NotNull(message = "鏄剧ず椤哄簭涓嶈兘涓虹┖") + public Integer getRoleSort() { + return roleSort; + } + + public void setRoleSort(Integer roleSort) { + this.roleSort = roleSort; + } + + public String getDataScope() { + return dataScope; + } + + public void setDataScope(String dataScope) { + this.dataScope = dataScope; + } + + public boolean isMenuCheckStrictly() { + return menuCheckStrictly; + } + + public void setMenuCheckStrictly(boolean menuCheckStrictly) { + this.menuCheckStrictly = menuCheckStrictly; + } + + public boolean isDeptCheckStrictly() { + return deptCheckStrictly; + } + + public void setDeptCheckStrictly(boolean deptCheckStrictly) { + this.deptCheckStrictly = deptCheckStrictly; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getDelFlag() { + return delFlag; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public boolean isFlag() { + return flag; + } + + public void setFlag(boolean flag) { + this.flag = flag; + } + + public Long[] getMenuIds() { + return menuIds; + } + + public void setMenuIds(Long[] menuIds) { + this.menuIds = menuIds; + } + + public Long[] getDeptIds() { + return deptIds; + } + + public void setDeptIds(Long[] deptIds) { + this.deptIds = deptIds; + } + + public Long getDeptId() { + return deptId; + } + + public void setDeptId(Long deptId) { + this.deptId = deptId; + } + + public SysDept getDept() { + return dept; + } + + public void setDept(SysDept dept) { + this.dept = dept; + } + + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("roleId", getRoleId()) + .append("roleName", getRoleName()) + .append("roleKey", getRoleKey()) + .append("roleSort", getRoleSort()) + .append("dataScope", getDataScope()) + .append("menuCheckStrictly", isMenuCheckStrictly()) + .append("deptCheckStrictly", isDeptCheckStrictly()) + .append("status", getStatus()) + .append("delFlag", getDelFlag()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .append("deptId", getDeptId()) + .append("dept", getDept()) + .toString(); + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java index 8d4d4c566f1fb4fc68394eb5bd1642ef7f3565a4..86c0c985585d1b3374b78e1e0f6ad2c72fb2e739 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java @@ -3,6 +3,8 @@ package com.ruoyi.common.core.domain.entity; import java.util.Date; import java.util.List; import javax.validation.constraints.*; + +import io.swagger.annotations.ApiModelProperty; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; @@ -14,7 +16,7 @@ import com.ruoyi.common.xss.Xss; /** * 鐢ㄦ埛瀵硅薄 sys_user - * + * * @author ruoyi */ public class SysUser extends BaseEntity @@ -23,51 +25,64 @@ public class SysUser extends BaseEntity /** 鐢ㄦ埛ID */ @Excel(name = "鐢ㄦ埛搴忓彿", cellType = ColumnType.NUMERIC, prompt = "鐢ㄦ埛缂栧彿") + @ApiModelProperty(value = "鐢ㄦ埛搴忓彿") private Long userId; /** 閮ㄩ棬ID */ @Excel(name = "閮ㄩ棬缂栧彿", type = Type.IMPORT) + @ApiModelProperty(value = "閮ㄩ棬缂栧彿") private Long deptId; /** 鐢ㄦ埛璐﹀彿 */ @Excel(name = "鐧诲綍鍚嶇О") + @ApiModelProperty(value = "鐧诲綍鍚嶇О") private String userName; /** 鐢ㄦ埛鏄电О */ @Excel(name = "鐢ㄦ埛鍚嶇О") + @ApiModelProperty(value = "鐢ㄦ埛鍚嶇О") private String nickName; /** 鐢ㄦ埛閭 */ @Excel(name = "鐢ㄦ埛閭") + @ApiModelProperty(value = "鐢ㄦ埛閭") private String email; /** 鎵嬫満鍙风爜 */ @Excel(name = "鎵嬫満鍙风爜") + @ApiModelProperty(value = "鎵嬫満鍙风爜") private String phonenumber; /** 鐢ㄦ埛鎬у埆 */ @Excel(name = "鐢ㄦ埛鎬у埆", readConverterExp = "0=鐢,1=濂,2=鏈煡") + @ApiModelProperty(value = "鐢ㄦ埛鎬у埆 0=鐢,1=濂,2=鏈煡") private String sex; /** 鐢ㄦ埛澶村儚 */ + @ApiModelProperty(value = "鐢ㄦ埛澶村儚") private String avatar; /** 瀵嗙爜 */ + @ApiModelProperty(value = "瀵嗙爜") private String password; /** 甯愬彿鐘舵侊紙0姝e父 1鍋滅敤锛 */ @Excel(name = "甯愬彿鐘舵", readConverterExp = "0=姝e父,1=鍋滅敤") + @ApiModelProperty(value = "甯愬彿鐘舵侊紙0姝e父 1鍋滅敤锛") private String status; /** 鍒犻櫎鏍囧織锛0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛 */ + @ApiModelProperty(value = "鍒犻櫎鏍囧織锛0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛") private String delFlag; /** 鏈鍚庣櫥褰旾P */ @Excel(name = "鏈鍚庣櫥褰旾P", type = Type.EXPORT) + @ApiModelProperty(value = "鏈鍚庣櫥褰旾P") private String loginIp; /** 鏈鍚庣櫥褰曟椂闂 */ @Excel(name = "鏈鍚庣櫥褰曟椂闂", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) + @ApiModelProperty(value = "鏈鍚庣櫥褰曟椂闂") private Date loginDate; /** 閮ㄩ棬瀵硅薄 */ @@ -75,18 +90,24 @@ public class SysUser extends BaseEntity @Excel(name = "閮ㄩ棬鍚嶇О", targetAttr = "deptName", type = Type.EXPORT), @Excel(name = "閮ㄩ棬璐熻矗浜", targetAttr = "leader", type = Type.EXPORT) }) + @ApiModelProperty(value = "閮ㄩ棬瀵硅薄") private SysDept dept; /** 瑙掕壊瀵硅薄 */ + + @ApiModelProperty(value = "瑙掕壊瀵硅薄") private List roles; /** 瑙掕壊缁 */ + @ApiModelProperty(value = "瑙掕壊缁") private Long[] roleIds; /** 宀椾綅缁 */ + @ApiModelProperty(value = "宀椾綅缁") private Long[] postIds; /** 瑙掕壊ID */ + @ApiModelProperty(value = "瑙掕壊ID") private Long roleId; public SysUser() diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java index 41490e7768d8d440878ea30ec3b4273e25960081..0e9081cf4c05700de7aed1195f61ba5e118b89fc 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java @@ -2,6 +2,8 @@ package com.ruoyi.common.core.domain.model; import java.util.Collection; import java.util.Set; + +import io.swagger.annotations.ApiModelProperty; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import com.alibaba.fastjson2.annotation.JSONField; @@ -9,7 +11,7 @@ import com.ruoyi.common.core.domain.entity.SysUser; /** * 鐧诲綍鐢ㄦ埛韬唤鏉冮檺 - * + * * @author ruoyi */ public class LoginUser implements UserDetails @@ -19,56 +21,67 @@ public class LoginUser implements UserDetails /** * 鐢ㄦ埛ID */ + @ApiModelProperty(value = "鐢ㄦ埛ID") private Long userId; /** * 閮ㄩ棬ID */ + @ApiModelProperty(value = "閮ㄩ棬ID") private Long deptId; /** * 鐢ㄦ埛鍞竴鏍囪瘑 */ + @ApiModelProperty(value = "鐢ㄦ埛鍞竴鏍囪瘑") private String token; /** * 鐧诲綍鏃堕棿 */ + @ApiModelProperty(value = "鐧诲綍鏃堕棿") private Long loginTime; /** * 杩囨湡鏃堕棿 */ + @ApiModelProperty(value = "杩囨湡鏃堕棿") private Long expireTime; /** * 鐧诲綍IP鍦板潃 */ + @ApiModelProperty(value = "鐧诲綍IP鍦板潃") private String ipaddr; /** * 鐧诲綍鍦扮偣 */ + @ApiModelProperty(value = "鐧诲綍鍦扮偣") private String loginLocation; /** * 娴忚鍣ㄧ被鍨 */ + @ApiModelProperty(value = "娴忚鍣ㄧ被鍨") private String browser; /** * 鎿嶄綔绯荤粺 */ + @ApiModelProperty(value = "鎿嶄綔绯荤粺") private String os; /** * 鏉冮檺鍒楄〃 */ + @ApiModelProperty(value = "鏉冮檺鍒楄〃") private Set permissions; /** * 鐢ㄦ埛淇℃伅 */ + @ApiModelProperty(value = "鐢ㄦ埛淇℃伅") private SysUser user; public Long getUserId() @@ -144,7 +157,7 @@ public class LoginUser implements UserDetails /** * 鎸囧畾鐢ㄦ埛鏄惁瑙i攣,閿佸畾鐨勭敤鎴锋棤娉曡繘琛岃韩浠介獙璇 - * + * * @return */ @JSONField(serialize = false) @@ -156,7 +169,7 @@ public class LoginUser implements UserDetails /** * 鎸囩ず鏄惁宸茶繃鏈熺殑鐢ㄦ埛鐨勫嚟鎹(瀵嗙爜),杩囨湡鐨勫嚟鎹槻姝㈣璇 - * + * * @return */ @JSONField(serialize = false) @@ -168,7 +181,7 @@ public class LoginUser implements UserDetails /** * 鏄惁鍙敤 ,绂佺敤鐨勭敤鎴蜂笉鑳借韩浠介獙璇 - * + * * @return */ @JSONField(serialize = false) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/MinioFile.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/MinioFile.java new file mode 100644 index 0000000000000000000000000000000000000000..7c1911325569edb52587d07d06a0fa272ae6157f --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/MinioFile.java @@ -0,0 +1,30 @@ +package com.ruoyi.common.core.domain.model; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + * 鐧诲綍鐢ㄦ埛韬唤鏉冮檺 + * + * @author ruoyi + */ +@Data +public class MinioFile implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 瀛樺偍妗跺悕绉 + */ + private String bucketName; + + /** + * 鏂囦欢鍚嶇О + */ + private String fileName; + /** + * 鏂囦欢璺緞 + */ + private String path; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/query/QueryAuditEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/query/QueryAuditEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..21c1eb1e164497a2c416bb188f19a19ae845f950 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/query/QueryAuditEntity.java @@ -0,0 +1,41 @@ +package com.ruoyi.common.core.domain.query; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.io.Serializable; + +/** + * Entity鍩虹被 + * + * @author ruoyi + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class QueryAuditEntity extends QueryBusinessEntity implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 瀹℃牳鐘舵 */ + @ApiModelProperty(value = "瀹℃牳鐘舵侊紙鍓嶇瀹℃牳鐘舵侊級0 浼佷笟寰呭鏍 1 浼佷笟宸插鏍 2 浼佷笟搴熷純 3 琛楅亾寰呭鏍 4 琛楅亾宸插鏍 5 琛楅亾閫鍥 6 鍖哄緟瀹℃牳 7 鍖哄凡瀹℃牳") + private String auditStatus; + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("code", getCode()) + .append("deptId", getDeptId()) + .append("year", getYear()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .append("auditStatus", getAuditStatus()) + .toString(); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/query/QueryBusinessEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/query/QueryBusinessEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..444797c624e9e82ebd62631ab30c8ebd45c3ec89 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/query/QueryBusinessEntity.java @@ -0,0 +1,36 @@ +package com.ruoyi.common.core.domain.query; + +import com.ruoyi.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.io.Serializable; + +/** + * Entity鍩虹被 + * + * @author ruoyi + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class QueryBusinessEntity extends BaseEntity implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 闄ゆ不瀛e害 */ + @ApiModelProperty(value = "闄ゆ不瀛e害") + private String year; + + /** 缂栧彿 */ + @ApiModelProperty(value = "缂栧彿") + private String code; + + /** 閮ㄩ棬ID */ + @ApiModelProperty(value = "閮ㄩ棬ID") + private Long deptId; + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/vo/SysDeptVo.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/vo/SysDeptVo.java new file mode 100644 index 0000000000000000000000000000000000000000..9ad151974a7aa369ea4068c0a2e134a02d2e5b9f --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/vo/SysDeptVo.java @@ -0,0 +1,31 @@ +package com.ruoyi.common.core.domain.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.io.Serializable; +import java.util.Date; + +/** + * @ClassName BusinessVo + * @Description TODO + * @Author jueying 2022/7/13 21:32 + * @Version 1.0 + * @since jdk1.8 + */ +@Data +public class SysDeptVo implements Serializable { + + /** 閮ㄩ棬id */ + @ApiModelProperty(value = "閮ㄩ棬id") + private String deptId; + /** 閮ㄩ棬 */ + @ApiModelProperty(value = "閮ㄩ棬") + private String deptName; + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/vo/SysFileVo.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/vo/SysFileVo.java new file mode 100644 index 0000000000000000000000000000000000000000..0409861a1b8f4bd84f795afac7bf3c31a888e5ca --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/vo/SysFileVo.java @@ -0,0 +1,41 @@ +package com.ruoyi.common.core.domain.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName BusinessVo + * @Description TODO + * @Author jueying 2022/7/13 21:32 + * @Version 1.0 + * @since jdk1.8 + */ +@Data +public class SysFileVo implements Serializable { + + /** 鏂囦欢璺緞 */ + @ApiModelProperty(value = "鏂囦欢璺緞") + private String url; + + /** 鍘熸枃浠跺悕绉 */ + @ApiModelProperty(value = "鍘熸枃浠跺悕绉") + private String fileName; + + /** 鍘熸枃浠跺悕绉 */ + @ApiModelProperty(value = "鍘熸枃浠跺悕绉") + private String fileNames; + + /** 鏂版枃浠跺悕绉 */ + @ApiModelProperty(value = "鏂版枃浠跺悕绉") + private String newFileName; + + /** 鍘熸枃浠跺悕绉 */ + @ApiModelProperty(value = "鍘熸枃浠跺悕绉") + private String originalFilename; + + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/vo/SysLoginVo.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/vo/SysLoginVo.java new file mode 100644 index 0000000000000000000000000000000000000000..7b8187a08fcea45ce95b1b7166a6a2041fa57290 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/vo/SysLoginVo.java @@ -0,0 +1,22 @@ +package com.ruoyi.common.core.domain.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName BusinessVo + * @Description TODO + * @Author jueying 2022/7/13 21:32 + * @Version 1.0 + * @since jdk1.8 + */ +@Data +public class SysLoginVo implements Serializable { + + /** token */ + @ApiModelProperty(value = "token") + private String token; + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/vo/SysUserVo.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/vo/SysUserVo.java new file mode 100644 index 0000000000000000000000000000000000000000..95e05422ea7ddb726bf16d411416cfeb420addde --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/vo/SysUserVo.java @@ -0,0 +1,34 @@ +package com.ruoyi.common.core.domain.vo; + +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.io.Serializable; + +/** + * @ClassName BusinessVo + * @Description TODO + * @Author jueying 2022/7/13 21:32 + * @Version 1.0 + * @since jdk1.8 + */ +@Data +public class SysUserVo implements Serializable { + + /** 鐢ㄦ埛ID */ + @ApiModelProperty(value = "鐢ㄦ埛ID") + private Long userId; + + /** 鐢ㄦ埛璐﹀彿 */ + @ApiModelProperty(value = "鐧诲綍鍚嶇О") + private String userName; + + /** 鐢ㄦ埛鏄电О */ + @ApiModelProperty(value = "鐢ㄦ埛鍚嶇О") + private String nickName; + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/vo/base/AuditBaseVo.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/vo/base/AuditBaseVo.java new file mode 100644 index 0000000000000000000000000000000000000000..44b7e9644a30052c69adedaed76b7273acc9ef68 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/vo/base/AuditBaseVo.java @@ -0,0 +1,92 @@ +package com.ruoyi.common.core.domain.vo.base; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.Date; + +/** + * @ClassName AuditBaseEntityVo + * @Description TODO + * @Author jueying 2022/7/13 21:31 + * @Version 1.0 + * @since jdk1.8 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class AuditBaseVo extends BusinessVo{ + + /** 浼佷笟瀹℃牳鐘舵侊紙0 浼佷笟寰呭鏍 1 浼佷笟宸插鏍 2 浼佷笟搴熷純锛 */ + @ApiModelProperty(value = "浼佷笟瀹℃牳鐘舵侊紙0 浼佷笟寰呭鏍 1 浼佷笟宸插鏍 2 浼佷笟搴熷純锛") + private String enterpriseStatus; + + /** 浼佷笟瀹℃牳鏃堕棿 */ + @ApiModelProperty(value = "浼佷笟瀹℃牳鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date enterpriseTime; + + /** 浼佷笟瀹℃牳浜哄憳 */ + @ApiModelProperty(value = "浼佷笟瀹℃牳浜哄憳") + private String enterpriseBy; + + /** 浼佷笟瀹℃牳IP */ + @ApiModelProperty(value = "浼佷笟瀹℃牳IP") + private String enterpriseIp; + + /** 琛楅亾瀹℃牳鐘舵侊紙0 琛楅亾寰呭鏍 1 琛楅亾宸插鏍 2 琛楅亾閫鍥烇級 */ + @ApiModelProperty(value = "琛楅亾瀹℃牳鐘舵侊紙0 琛楅亾寰呭鏍 1 琛楅亾宸插鏍 2 琛楅亾閫鍥烇級 ") + private String streetStatus; + + /** 琛楅亾瀹℃牳鏃堕棿 */ + @ApiModelProperty(value = "琛楅亾瀹℃牳鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date streetTime; + + /** 琛楅亾瀹℃牳浜哄憳 */ + @ApiModelProperty(value = "琛楅亾瀹℃牳浜哄憳") + private String streetBy; + + /** 琛楅亾瀹℃牳IP */ + @ApiModelProperty(value = "琛楅亾瀹℃牳IP") + private String streetIp; + + /** 鍖哄鏍哥姸鎬侊紙0 鍖哄緟瀹℃牳 1 鍖哄凡瀹℃牳锛 */ + @ApiModelProperty(value = "鍖哄鏍哥姸鎬侊紙0 鍖哄緟瀹℃牳 1 鍖哄凡瀹℃牳锛") + private String districtStatus; + + /** 鍖哄鏍告椂闂 */ + @ApiModelProperty(value = "鍖哄鏍告椂闂") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date districtTime; + + /** 鍖哄鏍镐汉鍛 */ + @ApiModelProperty(value = "鍖哄鏍镐汉鍛") + private String districtBy; + + /** 鍖哄鏍窱P */ + @ApiModelProperty(value = "鍖哄鏍窱P") + private String districtIp; + + /** 鏈杩戜竴娆″鏍哥姸鎬侊紙0 浼佷笟寰呭鏍 1 浼佷笟搴熷純 2 琛楅亾寰呭鏍 3 琛楅亾閫鍥 4 鍖哄緟瀹℃牳 5 鍖哄凡瀹℃牳锛 */ + @ApiModelProperty(value = "鏈杩戜竴娆″鏍哥姸鎬侊紙0 浼佷笟寰呭鏍 1 浼佷笟搴熷純 2 琛楅亾寰呭鏍 3 琛楅亾閫鍥 4 鍖哄緟瀹℃牳 5 鍖哄凡瀹℃牳锛") + private String auditStatus; + + /** 鏈杩戜竴娆″鏍告椂闂 */ + @ApiModelProperty(value = "鏈杩戜竴娆″鏍告椂闂") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date auditTime; + + /** 鏈杩戜竴娆″鏍镐汉鍛 */ + @ApiModelProperty(value = "鏈杩戜竴娆″鏍镐汉鍛") + private String auditBy; + + /** 鏈杩戜竴娆″鏍窱P */ + @ApiModelProperty(value = "鏈杩戜竴娆″鏍窱P") + private String auditIp; + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/vo/base/BaseVo.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/vo/base/BaseVo.java new file mode 100644 index 0000000000000000000000000000000000000000..ad3a19f3a92e241f5b1e4b4281e9ef6413e5e2d0 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/vo/base/BaseVo.java @@ -0,0 +1,51 @@ +package com.ruoyi.common.core.domain.vo.base; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.Excels; +import com.ruoyi.common.core.domain.vo.SysDeptVo; +import com.ruoyi.common.core.domain.vo.SysUserVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.io.Serializable; +import java.util.Date; + +/** + * @ClassName BusinessVo + * @Description TODO + * @Author jueying 2022/7/13 21:32 + * @Version 1.0 + * @since jdk1.8 + */ +@Data +public class BaseVo implements Serializable { + + /** 鍒涘缓鑰 */ + @ApiModelProperty(value = "鍒涘缓鑰") + private String createBy; + + /** 涓婁紶鏃堕棿 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "涓婁紶鏃堕棿") + private Date createTime; + + /** 鏇存柊鑰 */ + @ApiModelProperty(value = "鏇存柊鑰") + private String updateBy; + + /** 鏇存柊鏃堕棿 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "鏇存柊鏃堕棿") + private Date updateTime; + + /** 澶囨敞 */ + @ApiModelProperty(value = "澶囨敞") + @Excel(name = "澶囨敞") + private String remark; + + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/vo/base/BusinessVo.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/vo/base/BusinessVo.java new file mode 100644 index 0000000000000000000000000000000000000000..da3956eb695e5fc45d5909415a35bacd4917863c --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/vo/base/BusinessVo.java @@ -0,0 +1,44 @@ +package com.ruoyi.common.core.domain.vo.base; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.Excels; +import com.ruoyi.common.core.domain.entity.SysDept; +import com.ruoyi.common.core.domain.vo.SysDeptVo; +import com.ruoyi.common.core.domain.vo.SysUserVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * @ClassName BusinessVo + * @Description TODO + * @Author jueying 2022/7/13 21:32 + * @Version 1.0 + * @since jdk1.8 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class BusinessVo extends BaseVo { + /** ID锛堢郴缁熻嚜鍔ㄧ敓鎴愮殑搴忓彿锛 */ + @ApiModelProperty(value = "ID锛堢郴缁熻嚜鍔ㄧ敓鎴愮殑搴忓彿锛") + private Long id; + + /** 闄ゆ不瀛e害 */ + @ApiModelProperty(value = "闄ゆ不瀛e害") + private String year; + + /** 缂栧彿 */ + @ApiModelProperty(value = "缂栧彿") + private String code; + + /** 閮ㄩ棬ID */ + @ApiModelProperty(value = "閮ㄩ棬ID") + private Long deptId; + + /** 閮ㄩ棬瀵硅薄 */ + @ApiModelProperty(value = "閮ㄩ棬淇℃伅") + private SysDeptVo dept; + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java index a3487b8ed118c9dfbe2e8394c64f4a11aaf57c1b..e4f32435399bb10aa3743286b1b40bd47a5fa657 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java @@ -1,27 +1,36 @@ package com.ruoyi.common.core.page; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.constant.HttpStatus; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; import java.util.List; /** * 琛ㄦ牸鍒嗛〉鏁版嵁瀵硅薄 - * + * * @author ruoyi */ -public class TableDataInfo implements Serializable +public class TableDataInfo implements Serializable { private static final long serialVersionUID = 1L; /** 鎬昏褰曟暟 */ + @ApiModelProperty(value = "鎬昏褰曟暟") private long total; /** 鍒楄〃鏁版嵁 */ - private List> rows; + @ApiModelProperty(value = "鏁版嵁") + private List rows; /** 娑堟伅鐘舵佺爜 */ + @ApiModelProperty(value = "娑堟伅鐘舵佺爜") private int code; /** 娑堟伅鍐呭 */ + @ApiModelProperty(value = "娑堟伅鍐呭") private String msg; /** @@ -30,14 +39,24 @@ public class TableDataInfo implements Serializable public TableDataInfo() { } + /** + * 琛ㄦ牸鏁版嵁瀵硅薄 + */ + public TableDataInfo(List list) + { + this.setCode(HttpStatus.SUCCESS); + this.setMsg("鏌ヨ鎴愬姛"); + this.setRows(list); + this.setTotal(new PageInfo<>(list).getTotal()); + } /** * 鍒嗛〉 - * + * * @param list 鍒楄〃鏁版嵁 * @param total 鎬昏褰曟暟 */ - public TableDataInfo(List> list, int total) + public TableDataInfo(List list, int total) { this.rows = list; this.total = total; @@ -53,12 +72,12 @@ public class TableDataInfo implements Serializable this.total = total; } - public List> getRows() + public List getRows() { return rows; } - public void setRows(List> rows) + public void setRows(List rows) { this.rows = rows; } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/FileType.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/FileType.java new file mode 100644 index 0000000000000000000000000000000000000000..e2914b6ae3ee765bd25dd844e4cda10e7ba15621 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/FileType.java @@ -0,0 +1,89 @@ +package com.ruoyi.common.enums; + +import cn.hutool.core.collection.CollUtil; +import com.ruoyi.common.utils.file.FileUploadUtils; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 鏂囦欢绫诲瀷瀵瑰簲BucketName + * + * @author ruoyi + * + */ +public enum FileType +{ + /** + * 鐢ㄦ埛澶村儚 + */ + USER("0", "common"), + /** + * 瀹氭爣 + */ + SCALING("1", "scaling"), + /** + * 鍙栨牱鏂囦欢 + */ + SAMPLING("2", "sampling"), + /** + * 闄ゆ不鏂囦欢 + */ + TREAT("3", "treat"), + /** + * 杩愯緭鏂囦欢 + */ + TRANSPORT("4", "transport"), + /** + * ,琛楅亾鐩戠鏂囦欢 + */ + STREET_REGULATORY("5", "street-regulatory"), + /** + * 鍖虹骇鐩戠鏂囦欢 + */ + DISTRICT_REGULATORY("6", "district-regulatory"), + /** + * ,娉ㄥ共鏂囦欢 + */ + INJECTION("7", "injection"), + /** + * 娉ㄥ共缁存姢鏂囦欢 + */ + INJECTION_MAINTAIN("8", "injection-maintain"), + /** + * 闃查歌鏂囦欢 + */ + EPIDEMIC_PREVENTION_BAG("9", "epidemic-prevention-bag"); + + private final String type; + private final String bucketName; + + FileType(String type, String bucketName) + { + this.type = type; + this.bucketName = bucketName; + } + + public String getType() + { + return type; + } + + public String getBucketName() + { + return bucketName; + } + + + public static String getBucketNameByType(String type) + { + FileType[] values = values(); + for (FileType value : values) { + if(value.type.equals(type) ){ + return value.bucketName; + } + } + return FileUploadUtils.getBucketName(); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/RoleKey.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/RoleKey.java new file mode 100644 index 0000000000000000000000000000000000000000..fef118179ac2ec125d7d5675fbdbab9b36007db3 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/RoleKey.java @@ -0,0 +1,109 @@ +package com.ruoyi.common.enums; + +import cn.hutool.core.collection.CollUtil; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 鐢ㄦ埛鐘舵 + * + * @author ruoyi + */ +public enum RoleKey +{ + ADMIN("admin", "瓒呯骇绠$悊鍛"), + + DISTRICT("district", "鍖虹骇绠$悊鍛"), + + DISTRICT_REGULATORY("district_regulatory", "鍖虹骇鐩戠浜哄憳"), + + DISTRICT_ENTERPRISE_REGULATORY("district_enterprise_regulatory", "鍖虹骇鐩戠浼佷笟浜哄憳"), + + STREET("street", "琛楅亾绠$悊鍛"), + STREET_REGULATORY("street_regulatory", "琛楅亾鐩戠"), + + SCALING("scaling", "瀹氭爣浜哄憳"), + + TREAT("treat", "闄ゆ不浜哄憳"), + + ENTERPRISE_REGULATORY("enterprise_regulatory", "浼佷笟鐩戠浜哄憳"), + + ENTERPRISE("enterprise", "浼佷笟绠$悊鍛"), + + SAMPLING("sampling", "鍙栨牱浜哄憳"), + + DETECTION("detection", "妫娴嬩汉鍛"), + + TRANSPORT("transport", "鐤湪杩愯緭"), + + INJECTION("injection", "娉ㄥ共绠$悊"), + + OTHER("other", "鍏朵粬"); + + private final String code; + private final String info; + + RoleKey(String code, String info) + { + this.code = code; + this.info = info; + } + + public String getCode() + { + return code; + } + + public String getInfo() + { + return info; + } + + + public static String getInfoByCode(String code) + { + RoleKey[] values = values(); + for (RoleKey value : values) { + if(value.code.equals(code) ){ + return value.info; + } + } + return ""; + } + + // 瀹氫箟姣忕閮ㄩ棬绫诲瀷鍏宠仈鐨勬潈闄愬瓧绗﹀叧绯 + public static List getRoleKeysByType(String type) + { + Map> typeReRoleKey = new HashMap<>(10); + + // 宕傚北鍖鸿嚜鐒惰祫婧愬眬 + typeReRoleKey.put("-1", CollUtil.newArrayList(DISTRICT.getCode(), DISTRICT_REGULATORY.getCode())); + // 鍖虹骇鐩戠悊鍏徃 + typeReRoleKey.put("4", CollUtil.newArrayList(ENTERPRISE.getCode(),DISTRICT_ENTERPRISE_REGULATORY.getCode())); + // 瀹氭爣鍏徃 + typeReRoleKey.put("0", CollUtil.newArrayList(SCALING.getCode(),ENTERPRISE.getCode(),SAMPLING.getCode())); + // 闄ゆ不鍏徃 + typeReRoleKey.put("1", CollUtil.newArrayList(TREAT.getCode(),ENTERPRISE.getCode(),SAMPLING.getCode(),TRANSPORT.getCode())); + // 鐩戠悊鍏徃 + typeReRoleKey.put("2", CollUtil.newArrayList(ENTERPRISE_REGULATORY.getCode(),ENTERPRISE.getCode())); + // 琛楅亾 + typeReRoleKey.put("3", CollUtil.newArrayList(STREET.getCode(),STREET_REGULATORY.getCode())); + // 鍙栨牱鍏徃 + typeReRoleKey.put("5", CollUtil.newArrayList(SAMPLING.getCode(),ENTERPRISE.getCode())); + // 妫娴嬪叕鍙 + typeReRoleKey.put("6", CollUtil.newArrayList(DETECTION.getCode(),ENTERPRISE.getCode())); + // 娉ㄥ共鍏徃 + typeReRoleKey.put("7", CollUtil.newArrayList(INJECTION.getCode(),ENTERPRISE.getCode())); + + if(typeReRoleKey.containsKey(type)){ + return typeReRoleKey.get(type); + }else { + return CollUtil.newArrayList(); + } + } + + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/handler/MyGeometryTypeHandler.java b/ruoyi-common/src/main/java/com/ruoyi/common/handler/MyGeometryTypeHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..ba573520817bc3faa3716418555cd313cf0ba255 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/handler/MyGeometryTypeHandler.java @@ -0,0 +1,56 @@ +package com.ruoyi.common.handler; + +import org.apache.ibatis.type.BaseTypeHandler; +import org.apache.ibatis.type.JdbcType; +import org.apache.ibatis.type.MappedTypes; +import org.postgis.Geometry; +import org.postgis.PGgeometry; + +import java.sql.CallableStatement; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +/** + * @ClassName MyGeometryTypeHandler + * @Description TODO + * @Author jueying 2022/7/19 18:02 + * @Version 1.0 + * @since jdk1.8 + */ +@MappedTypes({String.class}) +public class MyGeometryTypeHandler extends BaseTypeHandler { + + @Override + public void setNonNullParameter(PreparedStatement ps, int i, String parameter, JdbcType jdbcType) throws SQLException { + PGgeometry pGgeometry = new PGgeometry(parameter); +// Geometry geometry = pGgeometry.getGeometry(); +// geometry.setSrid(4326); + ps.setObject(i, pGgeometry); + } + + @Override + public String getNullableResult(ResultSet rs, String columnName) throws SQLException { + String string = rs.getString(columnName); + return getResult(string); + } + + @Override + public String getNullableResult(ResultSet rs, int columnIndex) throws SQLException { + String string = rs.getString(columnIndex); + return getResult(string); + } + + @Override + public String getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { + String string = cs.getString(columnIndex); + return getResult(string); + } + + + private String getResult(String string) throws SQLException { + PGgeometry pGgeometry = new PGgeometry(string); +// return pGgeometry.toString().replace("SRID=4326;", ""); + return pGgeometry.toString(); + } +} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/handler/MyMetaObjectHandler.java b/ruoyi-common/src/main/java/com/ruoyi/common/handler/MyMetaObjectHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..76b02a8c54b76c514c3bea3473a952401e7ba7a0 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/handler/MyMetaObjectHandler.java @@ -0,0 +1,48 @@ +package com.ruoyi.common.handler; + +import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.spring.SpringUtils; +import org.apache.ibatis.reflection.MetaObject; +import org.apache.ibatis.session.SqlSession; +import org.mybatis.spring.SqlSessionTemplate; +import org.mybatis.spring.SqlSessionUtils; +import org.postgis.Geometry; +import org.postgis.PGgeometry; +import org.postgresql.geometric.PGpoint; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Field; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Date; + +/** + * @ClassName MyMetaObjectHandler + * @Description TODO + * @Author jueying 2022/7/15 14:41 + * @Version 1.0 + * @since jdk1.8 + */ +@Component +public class MyMetaObjectHandler implements MetaObjectHandler { + + @Override + public void insertFill(MetaObject metaObject) { + // 璧峰鐗堟湰 3.3.0(鎺ㄨ崘浣跨敤) + this.strictInsertFill(metaObject, "createTime", Date.class, DateUtils.getNowDate()); + this.strictInsertFill(metaObject, "createBy", String.class, SecurityUtils.getLoginUser().getUsername()); + this.strictInsertFill(metaObject, "createById", Long.class, SecurityUtils.getLoginUser().getUserId()); + this.strictInsertFill(metaObject, "deptId", Long.class, SecurityUtils.getLoginUser().getDeptId()); + + } + + @Override + public void updateFill(MetaObject metaObject) { + // 璧峰鐗堟湰 3.3.0(鎺ㄨ崘) + this.strictUpdateFill(metaObject, "updateTime", Date.class, DateUtils.getNowDate()); + this.strictUpdateFill(metaObject, "updateBy", String.class, SecurityUtils.getLoginUser().getUsername()); + this.strictUpdateFill(metaObject, "updateById", Long.class, SecurityUtils.getLoginUser().getUserId()); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/orika/ByteToStringConvertor.java b/ruoyi-common/src/main/java/com/ruoyi/common/orika/ByteToStringConvertor.java new file mode 100644 index 0000000000000000000000000000000000000000..6cbd2daef6c0c5e79eaf1771d036d17a7d01aa30 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/orika/ByteToStringConvertor.java @@ -0,0 +1,24 @@ +package com.ruoyi.common.orika; + +import ma.glasnost.orika.MappingContext; +import ma.glasnost.orika.converter.BidirectionalConverter; +import ma.glasnost.orika.metadata.Type; + +import java.nio.charset.StandardCharsets; + +/** + * byte[] -> string + * @author lifeng + */ +public class ByteToStringConvertor extends BidirectionalConverter { + + @Override + public String convertTo(byte[] source, Type destinationType, MappingContext mappingContext) { + return source != null ? new String(source, StandardCharsets.UTF_8): null; + } + + @Override + public byte[] convertFrom(String source, Type destinationType, MappingContext mappingContext) { + return source != null ? source.getBytes(StandardCharsets.UTF_8) : null; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/orika/OrikaAutoConfiguration.java b/ruoyi-common/src/main/java/com/ruoyi/common/orika/OrikaAutoConfiguration.java new file mode 100644 index 0000000000000000000000000000000000000000..ce102d37fa7ac889f6bd312a916ac4fb7c74b82d --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/orika/OrikaAutoConfiguration.java @@ -0,0 +1,45 @@ +package com.ruoyi.common.orika; + +import ma.glasnost.orika.MapperFactory; +import ma.glasnost.orika.converter.builtin.PassThroughConverter; +import ma.glasnost.orika.impl.DefaultMapperFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.Ordered; +import org.springframework.core.annotation.Order; + +/** + * Orika 閰嶇疆 + * + * @author lifeng + */ +@Configuration +@ConditionalOnClass({MapperFactory.class}) +@ConditionalOnMissingBean(MapperFactory.class) +@Order(value = Ordered.HIGHEST_PRECEDENCE) +public class OrikaAutoConfiguration { + + private static final Logger log = LoggerFactory.getLogger(OrikaAutoConfiguration.class); + @Bean + public MapperFactory mapperFactory() { + log.debug("peregrine init :: orika mapper factory init"); + MapperFactory factory = new DefaultMapperFactory.Builder().build(); + factory.getConverterFactory().registerConverter(new ByteToStringConvertor()); + factory.getConverterFactory().registerConverter(new PassThroughConverter()); + OrikaUtils.setMapperFactory(factory); + return factory; + } + +// @Bean +// @ConditionalOnMissingBean +// public OrikaUtils orikaUtils(MapperFactory factory) { +// log.debug("peregrine init :: orika mapper util init"); +// OrikaUtils instance = OrikaUtils.get(); +// OrikaUtils.setMapperFactory(factory); +// return instance; +// } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/orika/OrikaMapper.java b/ruoyi-common/src/main/java/com/ruoyi/common/orika/OrikaMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..16d4997774b3e07fa0951cc2f4feffd8ed3885c3 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/orika/OrikaMapper.java @@ -0,0 +1,114 @@ +package com.ruoyi.common.orika; + +import ma.glasnost.orika.MapperFacade; +import ma.glasnost.orika.metadata.ClassMapBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.lang.reflect.ParameterizedType; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author lifeng + */ +public abstract class OrikaMapper { + private static final Logger log = LoggerFactory.getLogger(OrikaMapper.class); + + protected Class sourceClass; + + protected Class destClass; + + public OrikaMapper() { + this.sourceClass = (Class) ((ParameterizedType) this.getClass().getGenericSuperclass()).getActualTypeArguments()[0]; + this.destClass = (Class) ((ParameterizedType) this.getClass().getGenericSuperclass()).getActualTypeArguments()[1]; + configure(OrikaUtils.getMapperFactory().classMap(sourceClass, destClass)) + .byDefault() + .register(); + } + + protected ClassMapBuilder configure(ClassMapBuilder builder) { + return builder; + } + + public MapperFacade getMapperFacade() { + return OrikaUtils.getMapperFacade(); + } + + public D map(S source) { + if(source == null) { + return null; + } + return getMapperFacade().map(source, destClass); + } + + public D map(S source, D dest) { + if(source == null) { + return null; + } + if(dest == null) { + try { + dest = destClass.newInstance(); + } catch (InstantiationException | IllegalAccessException e) { + log.error(e.getMessage(), e); + return null; + } + } + getMapperFacade().map(source, dest); + return dest; + } + + /** + * D -> S + * @param dest 灏 D 鐨勫睘鎬у鍒跺埌 S + * @return S + */ + public S mapReverse(D dest) { + if(dest == null) { + return null; + } + return getMapperFacade().map(dest, sourceClass); + } + + /** + * D -> S + * @param dest 灏 D 鐨勫睘鎬у鍒跺埌 S, 鍙鍒 D 鍜 S 涓湁鐨勫睘鎬 + * @return S + */ + public S mapReverse(D dest, S source) { + if(dest == null) { + return null; + } + if(source == null) { + try { + source = sourceClass.newInstance(); + } catch (InstantiationException | IllegalAccessException e) { + log.error(e.getMessage(), e); + return null; + } + } + getMapperFacade().map(dest, source); + return source; + } + + public List mapList(List sourceList) { + if(sourceList == null) { + return null; + } + if(sourceList.isEmpty()) { + return Collections.emptyList(); + } + return sourceList.stream().map(this::map).collect(Collectors.toList()); + } + + public List mapReverseList(List destList) { + if(destList == null) { + return null; + } + if(destList.isEmpty()) { + return Collections.emptyList(); + } + return destList.stream().map(this::mapReverse).collect(Collectors.toList()); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/orika/OrikaUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/orika/OrikaUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..bd3b8851df01595b7580c0928d56964b59d2ab4b --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/orika/OrikaUtils.java @@ -0,0 +1,59 @@ +package com.ruoyi.common.orika; + +import ma.glasnost.orika.BoundMapperFacade; +import ma.glasnost.orika.MapperFacade; +import ma.glasnost.orika.MapperFactory; + +/** + * 瀵硅薄杞崲宸ュ叿绫 + * + * @author lifeng + */ +public final class OrikaUtils { + + private static MapperFactory factory; + + private OrikaUtils() { + } + + /** + * mapper factory + * + * @return MapperFactory + */ + public static MapperFactory getMapperFactory() { + return factory; + } + + /** + * mapper factory + * + * @return MapperFactory + */ + public static MapperFacade getMapperFacade() { + return factory.getMapperFacade(); + } + + /** + * 璁剧疆 MapperFactory + * @param mapperFactory + */ + public static void setMapperFactory(MapperFactory mapperFactory) { + if(factory == null) { + factory = mapperFactory; + } + } + + /** + * 鑾峰彇 Orika 瀵硅薄杞崲 mapper + * @param source 婧愮被鍨 + * @param dest 鐩爣绫诲瀷 + * @param 婧愮被鍨 + * @param 鐩爣绫诲瀷 + * @return mapper + */ + public static BoundMapperFacade getMapperFacade(Class source, Class dest) { + return factory.getMapperFacade(source, dest); + } + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/businessUtil/BusinessUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/businessUtil/BusinessUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..78247e1543ba446b03cc434eef7dee8847f1b7cb --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/businessUtil/BusinessUtils.java @@ -0,0 +1,153 @@ +package com.ruoyi.common.utils.businessUtil; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.domain.BusinessEntity; +import com.ruoyi.common.exception.ServiceException; +import org.apache.poi.ss.formula.functions.T; + +import java.util.Objects; +import java.util.function.Function; +import java.util.function.Predicate; + +/** + * 灏忕彮缂栧彿宸ュ叿绫 + * + * @author ruoyi + */ +public class BusinessUtils { + /** + * 鏍规嵁code鑾峰彇year + * + * @param entity 涓氬姟绫 + * @return 灏忕彮缂栧彿 + */ + public static void initEntity(BusinessEntity entity) { + checkCode(entity); + setYear(entity); + setSmallClass(entity); + } + + /** + * 鏍¢獙缂栧彿鏄惁瀛樺湪 + * + * @param entity + */ + private static void checkCode(BusinessEntity entity) { + String code = entity.getCode(); + if (StrUtil.isBlank(code)) { + throw new ServiceException("缂栧彿蹇呴』濉啓"); + } + String[] split = code.split(Constants.RUNG); + if (split.length != 2) { + throw new ServiceException("缂栧彿鏍煎紡涓嶆纭"); + } + // 澶勭悊闄ゆ不瀛 + // 鐤湪缂栧彿鏍煎紡锛氳閬撲唬鐮+骞翠唤+6浣嶇紪鍙凤紝濡侺21-065735 + // 杞﹁締缂栧彿鏍煎紡锛氬崟浣嶄唬鐮+杞︾墝鍙凤紙鍘绘帀姹夊瓧锛+骞村害+5浣嶇紪鐮侊紝濡俍B69FS321-00051涓璟涓轰腑闊╄閬撲唬鐮 + // 娉ㄥ共缂栧彿鏍煎紡锛氬崟浣嶄唬鐮+骞村害+搴忓彿锛屽JZ2022-00702 + String codeSplit = split[0]; + String seq = split[1]; + if (!( (codeSplit.length() == 3 && seq.length() == 6) + || (codeSplit.length() == 9 && seq.length() == 5) + || (codeSplit.length() == 6 && seq.length() == 5)) + ) { + throw new ServiceException("缂栧彿鏍煎紡涓嶆纭"); + } + } + + /** + * TODO 鑾峰彇灏忕彮缂栧彿 + * + * @param entity 涓氬姟绫 + * @return 灏忕彮缂栧彿 + */ + public static void setSmallClass(BusinessEntity entity) { + + } + + /** + * 鏍规嵁code鑾峰彇year + * + * @param entity 涓氬姟绫 + * @return 灏忕彮缂栧彿 + */ + public static void setYear(BusinessEntity entity) { + if (ObjectUtil.isEmpty(entity)) { + return; + } + String code = entity.getCode(); + if (StrUtil.isBlank(code)) { + return; + } + String[] split = code.split(Constants.RUNG); + String codeSplit = split[0]; + // 澶勭悊闄ゆ不瀛 + String year = "20" + codeSplit.substring(codeSplit.length() - 2, codeSplit.length()); + entity.setYear(year); + } + + + public static void check(Entity entity, Function getter, Function function) { + // 鍒濆鍖栭櫎娌诲锛屽皬鐝紪鍙风瓑 + BusinessUtils.initEntity(entity); + checkCodeUnique(entity, getter, function); + } + + /** + * 鏍¢獙缂栧彿鏄惁閲嶅 + * + * @param entity 瀹炰綋瀵硅薄 + */ + private static void checkCodeUnique(Entity entity, Function getter, Function function) { + checkUnique(entity, getter, function, "鐤湪缂栧彿閲嶅锛屾棤娉曟坊鍔犳垨淇敼鏁版嵁"); + } + + /** + * 鏍¢獙缂栧彿鏄惁閲嶅 + * + * @param entity 瀹炰綋瀵硅薄 + */ + private static void checkUnique(Entity entity, Function getter, Function function) { + checkUnique(entity, getter, function, "缂栧彿閲嶅锛屾棤娉曟坊鍔犳垨淇敼鏁版嵁"); + } + + /** + * 鏍¢獙缂栧彿鏄惁閲嶅 + * + * @param entity 瀹炰綋瀵硅薄 + */ + private static void checkUnique(Entity entity, Function getter, Function function, String message) { + if (getter.apply(entity) == null) { + return; + } + Object r = function.apply(entity); + if (getEntityId(entity).test(r)) { + if (StrUtil.isBlank(message)) { + message = "瀛楁閲嶅锛屾棤娉曟坊鍔犳垨淇敼鏁版嵁"; + } + fail(message); + } + } + + public static Predicate getEntityId(T entity) { + Predicate test; + if (entity.getId() != null) { + test = dbId -> Objects.nonNull(dbId) && !entity.getId().equals(dbId); + } else { + test = Objects::nonNull; + } + return test; + } + + /** + * 鎶涘嚭閿欒 + * + * @param message 閿欒淇℃伅 + * @see ServiceException + */ + public static void fail(String message) { + throw new ServiceException(message); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java index 4652a2985b454ec65856dfa966c4c64aa8ad912c..90c78aed943adfef874e41631f13c1714f98d7b1 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java @@ -4,8 +4,11 @@ import java.io.File; import java.io.IOException; import java.nio.file.Paths; import java.util.Objects; + +import com.ruoyi.common.core.domain.model.MinioFile; import org.apache.commons.io.FilenameUtils; import org.springframework.web.multipart.MultipartFile; +import com.ruoyi.common.config.MinioConfig; import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.exception.file.FileNameLengthLimitExceededException; @@ -17,7 +20,7 @@ import com.ruoyi.common.utils.uuid.Seq; /** * 鏂囦欢涓婁紶宸ュ叿绫 - * + * * @author ruoyi */ public class FileUploadUtils @@ -33,9 +36,14 @@ public class FileUploadUtils public static final int DEFAULT_FILE_NAME_LENGTH = 100; /** - * 榛樿涓婁紶鐨勫湴鍧 + * 鏈湴榛樿涓婁紶鐨勫湴鍧 */ private static String defaultBaseDir = RuoYiConfig.getProfile(); + + /** + * Minio榛樿涓婁紶鐨勫湴鍧 + */ + private static String bucketName = MinioConfig.getBucketName(); public static void setDefaultBaseDir(String defaultBaseDir) { @@ -46,6 +54,11 @@ public class FileUploadUtils { return defaultBaseDir; } + + public static String getBucketName() + { + return bucketName; + } /** * 浠ラ粯璁ら厤缃繘琛屾枃浠朵笂浼 @@ -117,16 +130,75 @@ public class FileUploadUtils return getPathFileName(baseDir, fileName); } + /** + * 浠ラ粯璁ucketName閰嶇疆涓婁紶鍒癕inio鏈嶅姟鍣 + * + * @param file 涓婁紶鐨勬枃浠 + * @return 鏂囦欢鍚嶇О + * @throws Exception + */ + public static MinioFile uploadMinio(MultipartFile file) throws IOException + { + try + { + return uploadMinio(getBucketName(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); + } + catch (Exception e) + { + throw new IOException(e.getMessage(), e); + } + } + + /** + * 鑷畾涔塨ucketName閰嶇疆涓婁紶鍒癕inio鏈嶅姟鍣 + * + * @param file 涓婁紶鐨勬枃浠 + * @return 鏂囦欢鍚嶇О + * @throws Exception + */ + public static MinioFile uploadMinio(MultipartFile file, String bucketName) throws IOException + { + try + { + return uploadMinio(bucketName, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); + } + catch (Exception e) + { + throw new IOException(e.getMessage(), e); + } + } + + public static MinioFile uploadMinio(String bucketName, MultipartFile file, String[] allowedExtension) + throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException, + InvalidExtensionException + { + int fileNameLength = file.getOriginalFilename().length(); + if (fileNameLength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) + { + throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH); + } + assertAllowed(file, allowedExtension); + try + { + String fileName = extractFilename(file); + return MinioUtil.uploadFile(bucketName, fileName, file); + } + catch (Exception e) + { + throw new IOException(e.getMessage(), e); + } + } + /** * 缂栫爜鏂囦欢鍚 */ - public static final String extractFilename(MultipartFile file) + public static String extractFilename(MultipartFile file) { return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(), FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file)); } - public static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException + public static File getAbsoluteFile(String uploadDir, String fileName) throws IOException { File desc = new File(uploadDir + File.separator + fileName); @@ -140,7 +212,7 @@ public class FileUploadUtils return desc; } - public static final String getPathFileName(String uploadDir, String fileName) throws IOException + public static String getPathFileName(String uploadDir, String fileName) throws IOException { int dirLastIndex = RuoYiConfig.getProfile().length() + 1; String currentDir = StringUtils.substring(uploadDir, dirLastIndex); @@ -155,7 +227,7 @@ public class FileUploadUtils * @throws FileSizeLimitExceededException 濡傛灉瓒呭嚭鏈澶уぇ灏 * @throws InvalidExtensionException */ - public static final void assertAllowed(MultipartFile file, String[] allowedExtension) + public static void assertAllowed(MultipartFile file, String[] allowedExtension) throws FileSizeLimitExceededException, InvalidExtensionException { long size = file.getSize(); @@ -202,7 +274,7 @@ public class FileUploadUtils * @param allowedExtension * @return */ - public static final boolean isAllowedExtension(String extension, String[] allowedExtension) + public static boolean isAllowedExtension(String extension, String[] allowedExtension) { for (String str : allowedExtension) { @@ -216,11 +288,11 @@ public class FileUploadUtils /** * 鑾峰彇鏂囦欢鍚嶇殑鍚庣紑 - * + * * @param file 琛ㄥ崟鏂囦欢 * @return 鍚庣紑鍚 */ - public static final String getExtension(MultipartFile file) + public static String getExtension(MultipartFile file) { String extension = FilenameUtils.getExtension(file.getOriginalFilename()); if (StringUtils.isEmpty(extension)) @@ -229,4 +301,4 @@ public class FileUploadUtils } return extension; } -} +} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MinioUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MinioUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..2478ef02c7be2f2b06773c31b8052bab41fbc558 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MinioUtil.java @@ -0,0 +1,71 @@ +package com.ruoyi.common.utils.file; + +import java.io.IOException; +import java.io.InputStream; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; + +import com.ruoyi.common.core.domain.model.MinioFile; +import io.minio.errors.*; +import org.springframework.web.multipart.MultipartFile; +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.spring.SpringUtils; +import io.minio.GetPresignedObjectUrlArgs; +import io.minio.MinioClient; +import io.minio.PutObjectArgs; +import io.minio.http.Method; + +/** + * Minio 鏂囦欢瀛樺偍宸ュ叿绫 + * + * @author ruoyi + */ +public class MinioUtil +{ + /** + * 涓婁紶鏂囦欢 + * + * @param bucketName 妗跺悕绉 + * @param fileName + * @throws IOException + */ + public static MinioFile uploadFile(String bucketName, String fileName, MultipartFile multipartFile) throws IOException + { + MinioFile minioFile = new MinioFile(); + minioFile.setBucketName(bucketName); + String[] fileSplit = fileName.split("_"); + minioFile.setFileName(fileSplit[fileSplit.length - 1]); + minioFile.setPath(fileName); + MinioClient minioClient = SpringUtils.getBean(MinioClient.class); + try (InputStream inputStream = multipartFile.getInputStream()) + { + minioClient.putObject(PutObjectArgs.builder().bucket(bucketName).object(fileName).stream(inputStream, multipartFile.getSize(), -1).contentType(multipartFile.getContentType()).build()); + return minioFile; + } + catch (Exception e) + { + throw new IOException(e.getMessage(), e); + } + } + /** + * 鑾峰彇鏂囦欢涓存椂璺緞 + * + * @param bucketName 妗跺悕绉 + * @param path 鏂囦欢璺緞 + * @throws IOException + */ + public static String getUrl(String bucketName, String path) + { + MinioClient minioClient = SpringUtils.getBean(MinioClient.class); + String url = ""; + try { + url = minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder().bucket(bucketName).object(path).method(Method.GET).build()); + } catch (ErrorResponseException | InsufficientDataException | InternalException | InvalidKeyException | + InvalidResponseException | NoSuchAlgorithmException | XmlParserException | ServerException | + IOException e) { + return url; + } + + return url; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index e868511aaa89bb0b3ddf03b76274bd2286b3c6f5..c18acb701e17c14bd8eb1a9e38cfe19cab123aef 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -1,13 +1,12 @@ package com.ruoyi.common.utils.poi; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; +import java.io.*; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.math.BigDecimal; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; import java.text.DecimalFormat; import java.time.LocalDate; import java.time.LocalDateTime; @@ -21,6 +20,7 @@ import java.util.Map; import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; +import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.RegExUtils; import org.apache.poi.hssf.usermodel.HSSFClientAnchor; @@ -518,8 +518,27 @@ public class ExcelUtil { try { - writeSheet(); - wb.write(response.getOutputStream()); + AjaxResult ajaxResult = exportExcel(); + String filePath =getAbsoluteFile((String) ajaxResult.get(AjaxResult.MSG_TAG)); + + // 鏂囦欢鐨勫瓨鏀捐矾寰 +// filePath = "D:\\椤圭洰璧勬枡\\闆锋矁鍐滄満\\l_biz_subsidy_2022.xlsx"; + + InputStream inputStream = Files.newInputStream(Paths.get(filePath)); + File file = new File(filePath); + long length = file.length(); + response.setContentLengthLong(length); + ServletOutputStream outputStream = response.getOutputStream(); + byte[] b = new byte[1024]; + int len; + //浠庤緭鍏ユ祦涓鍙栦竴瀹氭暟閲忕殑瀛楄妭锛屽苟灏嗗叾瀛樺偍鍦ㄧ紦鍐插尯瀛楄妭鏁扮粍涓紝璇诲埌鏈熬杩斿洖-1 + while ((len = inputStream.read(b)) > 0) { + outputStream.write(b, 0, len); + } + inputStream.close(); + +// writeSheet(); +// wb.write(response.getOutputStream()); } catch (Exception e) { diff --git a/ruoyi-framework/pom.xml b/ruoyi-framework/pom.xml index 105f38298f213d64f877cdf84a743088a155d2b3..c5d727089c5aa4ab5a1c6fc315971987ab262076 100644 --- a/ruoyi-framework/pom.xml +++ b/ruoyi-framework/pom.xml @@ -18,9 +18,21 @@ - + org.springframework.boot spring-boot-starter-web + + + spring-boot-starter-tomcat + org.springframework.boot + + + + + + + org.springframework.boot + spring-boot-starter-undertow diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java index ff84bcdd30d53a0f8cdaa5e31fc58cd495f39042..d8ee3979ae463157c55b2e1a9ca4ad52b8343dbe 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java @@ -139,7 +139,8 @@ public class DataScopeAspect */ private void clearDataScope(final JoinPoint joinPoint) { - Object params = joinPoint.getArgs()[0]; + Object[] args = joinPoint.getArgs(); + Object params = args[0]; if (StringUtils.isNotNull(params) && params instanceof BaseEntity) { BaseEntity baseEntity = (BaseEntity) params; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MyBatisConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MyBatisConfig.java deleted file mode 100644 index e30fe74fec45b42d196a193b18cb375ad71422bd..0000000000000000000000000000000000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MyBatisConfig.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.ruoyi.framework.config; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import javax.sql.DataSource; -import org.apache.ibatis.io.VFS; -import org.apache.ibatis.session.SqlSessionFactory; -import org.mybatis.spring.SqlSessionFactoryBean; -import org.mybatis.spring.boot.autoconfigure.SpringBootVFS; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.env.Environment; -import org.springframework.core.io.DefaultResourceLoader; -import org.springframework.core.io.Resource; -import org.springframework.core.io.support.PathMatchingResourcePatternResolver; -import org.springframework.core.io.support.ResourcePatternResolver; -import org.springframework.core.type.classreading.CachingMetadataReaderFactory; -import org.springframework.core.type.classreading.MetadataReader; -import org.springframework.core.type.classreading.MetadataReaderFactory; -import org.springframework.util.ClassUtils; -import com.ruoyi.common.utils.StringUtils; - -/** - * Mybatis鏀寔*鍖归厤鎵弿鍖 - * - * @author ruoyi - */ -@Configuration -public class MyBatisConfig -{ - @Autowired - private Environment env; - - static final String DEFAULT_RESOURCE_PATTERN = "**/*.class"; - - public static String setTypeAliasesPackage(String typeAliasesPackage) - { - ResourcePatternResolver resolver = (ResourcePatternResolver) new PathMatchingResourcePatternResolver(); - MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver); - List allResult = new ArrayList(); - try - { - for (String aliasesPackage : typeAliasesPackage.split(",")) - { - List result = new ArrayList(); - aliasesPackage = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX - + ClassUtils.convertClassNameToResourcePath(aliasesPackage.trim()) + "/" + DEFAULT_RESOURCE_PATTERN; - Resource[] resources = resolver.getResources(aliasesPackage); - if (resources != null && resources.length > 0) - { - MetadataReader metadataReader = null; - for (Resource resource : resources) - { - if (resource.isReadable()) - { - metadataReader = metadataReaderFactory.getMetadataReader(resource); - try - { - result.add(Class.forName(metadataReader.getClassMetadata().getClassName()).getPackage().getName()); - } - catch (ClassNotFoundException e) - { - e.printStackTrace(); - } - } - } - } - if (result.size() > 0) - { - HashSet hashResult = new HashSet(result); - allResult.addAll(hashResult); - } - } - if (allResult.size() > 0) - { - typeAliasesPackage = String.join(",", (String[]) allResult.toArray(new String[0])); - } - else - { - throw new RuntimeException("mybatis typeAliasesPackage 璺緞鎵弿閿欒,鍙傛暟typeAliasesPackage:" + typeAliasesPackage + "鏈壘鍒颁换浣曞寘"); - } - } - catch (IOException e) - { - e.printStackTrace(); - } - return typeAliasesPackage; - } - - public Resource[] resolveMapperLocations(String[] mapperLocations) - { - ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver(); - List resources = new ArrayList(); - if (mapperLocations != null) - { - for (String mapperLocation : mapperLocations) - { - try - { - Resource[] mappers = resourceResolver.getResources(mapperLocation); - resources.addAll(Arrays.asList(mappers)); - } - catch (IOException e) - { - // ignore - } - } - } - return resources.toArray(new Resource[resources.size()]); - } - - @Bean - public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception - { - String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage"); - String mapperLocations = env.getProperty("mybatis.mapperLocations"); - String configLocation = env.getProperty("mybatis.configLocation"); - typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage); - VFS.addImplClass(SpringBootVFS.class); - - final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); - sessionFactory.setDataSource(dataSource); - sessionFactory.setTypeAliasesPackage(typeAliasesPackage); - sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ","))); - sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation)); - return sessionFactory.getObject(); - } -} \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..f71218005f06c87f583fca3593278c5242b1ff59 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusConfig.java @@ -0,0 +1,62 @@ +package com.ruoyi.framework.config; + +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +/** + * Mybatis Plus 閰嶇疆 + * + * @author ruoyi + */ +@EnableTransactionManagement(proxyTargetClass = true) +@Configuration +public class MybatisPlusConfig +{ + @Bean + public MybatisPlusInterceptor mybatisPlusInterceptor() + { + MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); + // 鍒嗛〉鎻掍欢 + interceptor.addInnerInterceptor(paginationInnerInterceptor()); + // 涔愯閿佹彃浠 + interceptor.addInnerInterceptor(optimisticLockerInnerInterceptor()); + // 闃绘柇鎻掍欢 + interceptor.addInnerInterceptor(blockAttackInnerInterceptor()); + return interceptor; + } + + /** + * 鍒嗛〉鎻掍欢锛岃嚜鍔ㄨ瘑鍒暟鎹簱绫诲瀷 https://baomidou.com/guide/interceptor-pagination.html + */ + public PaginationInnerInterceptor paginationInnerInterceptor() + { + PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(); + // 璁剧疆鏁版嵁搴撶被鍨嬩负mysql + paginationInnerInterceptor.setDbType(DbType.MYSQL); + // 璁剧疆鏈澶у崟椤甸檺鍒舵暟閲忥紝榛樿 500 鏉★紝-1 涓嶅彈闄愬埗 + paginationInnerInterceptor.setMaxLimit(-1L); + return paginationInnerInterceptor; + } + + /** + * 涔愯閿佹彃浠 https://baomidou.com/guide/interceptor-optimistic-locker.html + */ + public OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor() + { + return new OptimisticLockerInnerInterceptor(); + } + + /** + * 濡傛灉鏄鍏ㄨ〃鐨勫垹闄ゆ垨鏇存柊鎿嶄綔锛屽氨浼氱粓姝㈣鎿嶄綔 https://baomidou.com/guide/interceptor-block-attack.html + */ + public BlockAttackInnerInterceptor blockAttackInnerInterceptor() + { + return new BlockAttackInnerInterceptor(); + } +} \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index dfad46e39f35a830dbfaceaa0f397a6f50eace57..ccadf3239823bb4474e197706519bd0ac93ebbbc 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -1,6 +1,8 @@ package com.ruoyi.framework.config; +import com.ruoyi.framework.security.authentication.AppUsernamePasswordAuthenticationProvider; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.http.HttpMethod; import org.springframework.security.authentication.AuthenticationManager; @@ -8,21 +10,19 @@ import org.springframework.security.config.annotation.authentication.builders.Au import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; -import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer; import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.security.web.authentication.logout.LogoutFilter; import org.springframework.web.filter.CorsFilter; -import com.ruoyi.framework.config.properties.PermitAllUrlProperties; import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter; import com.ruoyi.framework.security.handle.AuthenticationEntryPointImpl; import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl; /** * spring security閰嶇疆 - * + * * @author ruoyi */ @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) @@ -32,8 +32,13 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter * 鑷畾涔夌敤鎴疯璇侀昏緫 */ @Autowired + @Qualifier("userDetailsServiceImpl") private UserDetailsService userDetailsService; - + + @Autowired + @Qualifier("appDetailsServiceImpl") + private UserDetailsService appDetailsServiceImpl; + /** * 璁よ瘉澶辫触澶勭悊绫 */ @@ -51,19 +56,13 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter */ @Autowired private JwtAuthenticationTokenFilter authenticationTokenFilter; - + /** * 璺ㄥ煙杩囨护鍣 */ @Autowired private CorsFilter corsFilter; - /** - * 鍏佽鍖垮悕璁块棶鐨勫湴鍧 - */ - @Autowired - private PermitAllUrlProperties permitAllUrl; - /** * 瑙e喅 鏃犳硶鐩存帴娉ㄥ叆 AuthenticationManager * @@ -95,10 +94,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter @Override protected void configure(HttpSecurity httpSecurity) throws Exception { - // 娉ㄨВ鏍囪鍏佽鍖垮悕璁块棶鐨剈rl - ExpressionUrlAuthorizationConfigurer.ExpressionInterceptUrlRegistry registry = httpSecurity.authorizeRequests(); - permitAllUrl.getUrls().forEach(url -> registry.antMatchers(url).permitAll()); - httpSecurity // CSRF绂佺敤锛屽洜涓轰笉浣跨敤session .csrf().disable() @@ -110,14 +105,25 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter .authorizeRequests() // 瀵逛簬鐧诲綍login 娉ㄥ唽register 楠岃瘉鐮乧aptchaImage 鍏佽鍖垮悕璁块棶 .antMatchers("/login", "/register", "/captchaImage").anonymous() - // 闈欐佽祫婧愶紝鍙尶鍚嶈闂 - .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() - .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() + .antMatchers("/mobile/login/**").permitAll() + .antMatchers( + HttpMethod.GET, + "/", + "/*.html", + "/**/*.html", + "/**/*.css", + "/**/*.js", + "/profile/**" + ).permitAll() + .antMatchers("/swagger-ui.html").anonymous() + .antMatchers("/swagger-resources/**").anonymous() + .antMatchers("/webjars/**").anonymous() + .antMatchers("/*/api-docs").anonymous() + .antMatchers("/druid/**").anonymous() // 闄や笂闈㈠鐨勬墍鏈夎姹傚叏閮ㄩ渶瑕侀壌鏉冭璇 .anyRequest().authenticated() .and() .headers().frameOptions().disable(); - // 娣诲姞Logout filter httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler); // 娣诲姞JWT filter httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class); @@ -135,12 +141,35 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter return new BCryptPasswordEncoder(); } +// /** +// * 韬唤璁よ瘉鎺ュ彛 +// */ +// @Override +// protected void configure(AuthenticationManagerBuilder auth) throws Exception +// { +// auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder()); +// } + + /** * 韬唤璁よ瘉鎺ュ彛 */ @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { - auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder()); + //鑷畾涔塸rovider鍙妔ervice锛屼竴濂楄韩浠借璇 + auth.authenticationProvider(getAppUsernamePasswordAuthenticationProvider()) + //浣跨敤绯荤粺鑷甫provider锛屽強鑷畾涔塻ervice锛屽彟涓濂楄璇 + .userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder()); + } + + /** + * 鑷畾涔塸rovider锛屾敞鍏ヨ嚜瀹氫箟service + */ + public AppUsernamePasswordAuthenticationProvider getAppUsernamePasswordAuthenticationProvider() { + AppUsernamePasswordAuthenticationProvider provider = new AppUsernamePasswordAuthenticationProvider(); + provider.setPasswordEncoder(bCryptPasswordEncoder()); + provider.setUserDetailsService(appDetailsServiceImpl); + return provider; } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/authentication/AppUsernamePasswordAuthenticationProvider.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/authentication/AppUsernamePasswordAuthenticationProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..0d5694492ee937eded5a10a8a9bade566c2cb32c --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/authentication/AppUsernamePasswordAuthenticationProvider.java @@ -0,0 +1,19 @@ +package com.ruoyi.framework.security.authentication; + +import com.ruoyi.framework.security.authentication.AppUsernamePasswordAuthenticationToken; +import org.springframework.security.authentication.dao.DaoAuthenticationProvider; + +/** + * @ClassName AppUsernamePasswordAuthenticationProvider + * @Description TODO + * @Author jueying 2022/7/21 4:55 + * @Version 1.0 + * @since jdk1.8 + */ +public class AppUsernamePasswordAuthenticationProvider extends DaoAuthenticationProvider { + + + public boolean supports(Class> authentication) { + return (AppUsernamePasswordAuthenticationToken.class.isAssignableFrom(authentication)); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/authentication/AppUsernamePasswordAuthenticationToken.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/authentication/AppUsernamePasswordAuthenticationToken.java new file mode 100644 index 0000000000000000000000000000000000000000..b88cef8f681c494e41f57b8815bad36dc6a62c12 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/authentication/AppUsernamePasswordAuthenticationToken.java @@ -0,0 +1,22 @@ +package com.ruoyi.framework.security.authentication; + +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; + +/** + * @ClassName AppUsernamePasswordAuthenticationToken + * @Description TODO + * @Author jueying 2022/7/21 4:54 + * @Version 1.0 + * @since jdk1.8 + */ +public class AppUsernamePasswordAuthenticationToken extends UsernamePasswordAuthenticationToken { + + + public AppUsernamePasswordAuthenticationToken(Object principal, Object credentials) { + super(principal, credentials); + } + + private static final long serialVersionUID = 8665690993060353849L; + + +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppDetailsServiceImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppDetailsServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..f84b962ead549b3e4074857ec3e607cd95fbdc18 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppDetailsServiceImpl.java @@ -0,0 +1,65 @@ +package com.ruoyi.framework.web.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.enums.UserStatus; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.exception.base.BaseException; +import com.ruoyi.common.utils.MessageUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.service.ISysUserService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; + +/** + * @ClassName AppDetailsServiceImpl + * @Description TODO + * @Author jueying 2022/7/21 4:57 + * @Version 1.0 + * @since jdk1.8 + */ +@Service +public class AppDetailsServiceImpl implements UserDetailsService +{ + private static final Logger log = LoggerFactory.getLogger(AppDetailsServiceImpl.class); + + @Autowired + private ISysUserService userService; + + @Autowired + private SysPermissionService permissionService; + + @Override + public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException + { + SysUser user = userService.selectUserByUserName(username); + if (StringUtils.isNull(user)) + { + log.info("鐧诲綍鐢ㄦ埛锛歿} 涓嶅瓨鍦.", username); + throw new ServiceException("鐧诲綍鐢ㄦ埛锛" + username + " 涓嶅瓨鍦"); + } + else if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) + { + log.info("鐧诲綍鐢ㄦ埛锛歿} 宸茶鍒犻櫎.", username); + throw new ServiceException("瀵逛笉璧凤紝鎮ㄧ殑璐﹀彿锛" + username + " 宸茶鍒犻櫎"); + } + else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) + { + log.info("鐧诲綍鐢ㄦ埛锛歿} 宸茶鍋滅敤.", username); + throw new ServiceException("瀵逛笉璧凤紝鎮ㄧ殑璐﹀彿锛" + username + " 宸插仠鐢"); + } + + return createLoginUser(user); + } + + public UserDetails createLoginUser(SysUser user) + { + return new LoginUser(user.getUserId(), user.getDeptId(), user, permissionService.getAppMenuPermission(user)); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/MobileLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/MobileLoginService.java new file mode 100644 index 0000000000000000000000000000000000000000..8556fe498c319dcdd1ef7c16ae55dcfc27326939 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/MobileLoginService.java @@ -0,0 +1,229 @@ +package com.ruoyi.framework.web.service; + + +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.exception.user.UserPasswordNotMatchException; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.MessageUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.manager.AsyncManager; +import com.ruoyi.framework.manager.factory.AsyncFactory; +import com.ruoyi.framework.security.authentication.AppUsernamePasswordAuthenticationToken; +import com.ruoyi.system.domain.AppLoginVo; +import com.ruoyi.system.domain.LoginParams; +import com.ruoyi.system.service.ISysRoleService; +import com.ruoyi.system.service.ISysUserService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Objects; + +/** + * 绉诲姩绔櫥褰曟湇鍔℃帴鍙 + */ +@Component +public class MobileLoginService { + + private static final Logger log = LoggerFactory.getLogger(MobileLoginService.class); + + @Autowired(required = false) + private TokenService tokenService; + + @Autowired(required = false) + private SysLoginService sysLoginService; + + @Autowired(required = false) + private ISysRoleService sysRoleService; + + @Autowired(required = false) + private AuthenticationManager authenticationManager; + + @Autowired(required = false) + private ISysUserService sysUserService; + + @Autowired(required = false) + private PermissionService permissionService; + + /** + * 娉ㄥ叆redis鏈嶅姟 + */ + @Autowired(required = false) + private RedisCache redisCache; + + /** + * 璇锋眰鏃堕棿鎴宠繃鏈熸椂闂5鍒嗛挓 + */ + private static final int REQUEST_TIME_OUT = 1000 * 60 * 5; + + /** + * jwt瀵嗛挜 + */ + @Value("${token.secret}") + private String jwtSecretKey; + + public AppLoginVo login(LoginParams loginParams) { + log.debug("login and loginParams:{}", loginParams); + + if (Objects.isNull(loginParams)) { + return AppLoginVo.error(-6,"鐧诲綍鍙傛暟涓嶈兘涓虹┖"); + } + String loginType = loginParams.getLoginType(); + if(StringUtils.isBlank(loginType)){ + return AppLoginVo.error(-6,"鐧诲綍鏂瑰紡涓嶈兘涓虹┖"); + } + //鐧诲綍鏂瑰紡0楠岃瘉鐮佺櫥褰曪紝1鐢ㄦ埛鍚嶅瘑鐮佺櫥褰曪紝2鏈満涓閿櫥褰曪紝3寰俊鍗曠偣鐧诲綍 + if(loginType.equals("0")){ + String phoneNo = loginParams.getPhoneNo(); + if(StringUtils.isBlank(phoneNo)){ + return AppLoginVo.error(-6,"鐧诲綍鍚嶄笉鑳戒负绌"); + } + String validCode = loginParams.getValidCode(); + //2琛ㄧず鐧诲綍楠岃瘉鐮侊紝鏍¢獙楠岃瘉鐮佸悎娉曟 + //sysSmsSendService.checkValidCode(phoneNo,validCode,"2"); + loginParams.setUsername(phoneNo); + loginParams.setPassword("SSO_LOGIN"); + }else if(loginType.equals("1")){ + String password = loginParams.getPassword(); + if(StringUtils.isBlank(password)){ + return AppLoginVo.error(-6,"瀵嗙爜涓嶈兘涓虹┖"); + } + } + // 鐢ㄦ埛楠岃瘉 + Authentication authentication = null; + try + { +// authentication = authenticationManager.authenticate(new AppUsernamePasswordAuthenticationToken(loginParams.getUsername(), loginParams.getPassword())); + authentication = authenticationManager.authenticate(new AppUsernamePasswordAuthenticationToken(loginParams.getUsername(), loginParams.getPassword())); + } + catch (Exception e) + { + if (e instanceof BadCredentialsException) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(loginParams.getUsername(), Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); + throw new UserPasswordNotMatchException(); + } + else + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(loginParams.getUsername(), Constants.LOGIN_FAIL, e.getMessage())); + throw new ServiceException(e.getMessage()); + } + } + LoginUser loginUser = (LoginUser) authentication.getPrincipal(); + //loginUser.setSource("app"); + SysUser user = loginUser.getUser(); + // 鐢熸垚token + String token = tokenService.createToken(loginUser); + AsyncManager.me().execute(AsyncFactory.recordLogininfor(loginParams.getUsername(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); + sysLoginService.recordLoginInfo(user.getUserId()); + //鍒ゆ柇鐢ㄦ埛鏄惁瀛樺湪绠$悊鍛樿鑹 + // 瑙掕壊闆嗗悎 +// Set roles = permissionService.getRolePermission(user); +// boolean roleFlag = false; +// if(!CollectionUtils.isEmpty(roles)){ +// for (String roleKey : roles) { +// if(roleKey.equals("agent")){ +// roleFlag = true; +// break; +// } +// } +// } + + AppLoginVo ajax = AppLoginVo.success(""); + ajax.setToken(token); + ajax.setExpired(loginUser.getExpireTime()); + ajax.setUser(loginUser.getUser()); + ajax.setIsAgent(String.valueOf(true)); + return ajax; + } + /** + * 鍙戦佹敞鍐岄獙璇佺爜 + * @param loginParams + * @return + */ + public R sendCode(LoginParams loginParams) { + if (Objects.isNull(loginParams)) { + return R.fail(-6,"鍙傛暟涓虹┖"); + } + // 楠岃瘉楠岃瘉鐮 + if (StringUtils.isBlank(loginParams.getPhoneNo())) { + return R.fail(-6,"鍙戦佹墜鏈哄彿涓嶈兘涓虹┖"); + } + String validCodeType = "2"; + if (StringUtils.isNotBlank(loginParams.getValidCodeType())) { + validCodeType = loginParams.getValidCodeType(); + } + try{ + //SysSmsSend sysSmsSend = sysSmsSendService.sendMessage(loginParams.getPhoneNo(),validCodeType,true); + //String resultFlag = sysSmsSend.getResultFlag(); + String resultFlag = "n"; + if(resultFlag.equals("f")){ + return R.fail(-6,"瀵逛笉璧锋墜鏈哄彿銆"+loginParams.getPhoneNo()+"銆戝彂閫佺煭淇″け璐ワ細澶辫触鍘熷洜:"); + } + }catch (Exception e){ + throw new ServiceException(e.getMessage()); + } + return R.ok("楠岃瘉鐮佸彂閫佹垚鍔"); + } + + /** + * 鎵嬫満鍙烽獙璇佺爜娉ㄥ唽鐢ㄦ埛 + * @param loginParams + * @return + */ + @Transactional(readOnly = false) + public AppLoginVo registerUser(LoginParams loginParams) { + try{ + if (Objects.isNull(loginParams)) { + return AppLoginVo.error(-6,"鍙傛暟涓虹┖"); + } + String phoneNo = loginParams.getPhoneNo(); + if (StringUtils.isBlank(phoneNo)) { + return AppLoginVo.error(-6,"鍙戦佹墜鏈哄彿涓嶈兘涓虹┖"); + } + String validCode = loginParams.getValidCode(); + if (StringUtils.isBlank(validCode)) { + return AppLoginVo.error(-6,"楠岃瘉鐮佷笉鑳戒负绌"); + } + loginParams.setUsername(phoneNo); + loginParams.setPassword(phoneNo); + loginParams.setLoginType("1"); + return this.login(loginParams); + }catch (Exception e){ + throw new ServiceException(e.getMessage()); + } + } + + /** + * 璁剧疆娉ㄥ唽鐢ㄦ埛瑙掕壊閮ㄩ棬宀椾綅淇℃伅 + * @param registerUser + * @return + */ + private void setUserDefaultInfo(SysUser registerUser ){ + String registerRoleCode = DictUtils.getDictValue("sys_config","register_role_code",""); + if (StringUtils.isBlank(registerRoleCode)) { + throw new ServiceException("璇峰墠寰鏁版嵁瀛楀吀銆恠ys_config銆戜腑缁存姢娉ㄥ唽鐢ㄦ埛瑙掕壊缂栫爜銆恟egister_role_code銆"); + } + String registerDeptCode = DictUtils.getDictValue("sys_config","register_dept_code",""); + if (StringUtils.isBlank(registerDeptCode)) { + throw new ServiceException("璇峰墠寰鏁版嵁瀛楀吀銆恠ys_config銆戜腑缁存姢娉ㄥ唽鐢ㄦ埛閮ㄩ棬缂栫爜銆恟egister_dept_code銆"); + } + String registerPostCode = DictUtils.getDictValue("sys_config","register_post_code",""); + if (StringUtils.isBlank(registerPostCode)) { + throw new ServiceException("璇峰墠寰鏁版嵁瀛楀吀銆恠ys_config銆戜腑缁存姢娉ㄥ唽鐢ㄦ埛宀椾綅缂栫爜銆恟egister_post_code銆"); + } + + } + +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/PermissionService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/PermissionService.java index 3881053b5bd0b77325dfdafd131f1e0051e7fc1e..b093cbcfe8ebd12be309d9a7a34d5963f5ea28c4 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/PermissionService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/PermissionService.java @@ -127,7 +127,7 @@ public class PermissionService /** * 楠岃瘉鐢ㄦ埛鏄惁鍏锋湁浠ヤ笅浠绘剰涓涓鑹 * - * @param roles 浠 ROLE_NAMES_DELIMETER 涓哄垎闅旂鐨勮鑹插垪琛 + * @param roles 浠 ROLE_DELIMETER 涓哄垎闅旂鐨勮鑹插垪琛 * @return 鐢ㄦ埛鏄惁鍏锋湁浠ヤ笅浠绘剰涓涓鑹 */ public boolean hasAnyRoles(String roles) diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java index 19c4a5158c4a350040cb62fa714f49e86b7dd400..94af32688a28f5f7db3808426c6f760af008459f 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java @@ -10,7 +10,7 @@ import com.ruoyi.system.service.ISysRoleService; /** * 鐢ㄦ埛鏉冮檺澶勭悊 - * + * * @author ruoyi */ @Component @@ -24,7 +24,7 @@ public class SysPermissionService /** * 鑾峰彇瑙掕壊鏁版嵁鏉冮檺 - * + * * @param user 鐢ㄦ埛淇℃伅 * @return 瑙掕壊鏉冮檺淇℃伅 */ @@ -45,7 +45,7 @@ public class SysPermissionService /** * 鑾峰彇鑿滃崟鏁版嵁鏉冮檺 - * + * * @param user 鐢ㄦ埛淇℃伅 * @return 鑿滃崟鏉冮檺淇℃伅 */ @@ -63,4 +63,25 @@ public class SysPermissionService } return perms; } + + /** + * 鑾峰彇App鑿滃崟鏁版嵁鏉冮檺 + * + * @param user 鐢ㄦ埛淇℃伅 + * @return 鑿滃崟鏉冮檺淇℃伅 + */ + public Set getAppMenuPermission(SysUser user) + { + Set perms = new HashSet(); + // 绠$悊鍛樻嫢鏈夋墍鏈夋潈闄 + if (user.isAdmin()) + { + perms.add("*:*:*"); + } + else + { + perms.addAll(menuService.selectAppMenuPermsByUserId(user.getUserId())); + } + return perms; + } } diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java index 1620995f80e7c9954b88b9c34e91e686c6d16989..e6e5be949f6fe29dcf8b55633cbfac5322b26dcd 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java @@ -121,7 +121,7 @@ public class GenTableServiceImpl implements IGenTableService * @return 缁撴灉 */ @Override - @Transactional + @Transactional(rollbackFor = Exception.class) public void updateGenTable(GenTable genTable) { String options = JSON.toJSONString(genTable.getParams()); @@ -143,7 +143,7 @@ public class GenTableServiceImpl implements IGenTableService * @return 缁撴灉 */ @Override - @Transactional + @Transactional(rollbackFor = Exception.class) public void deleteGenTableByIds(Long[] tableIds) { genTableMapper.deleteGenTableByIds(tableIds); @@ -156,7 +156,7 @@ public class GenTableServiceImpl implements IGenTableService * @param tableList 瀵煎叆琛ㄥ垪琛 */ @Override - @Transactional + @Transactional(rollbackFor = Exception.class) public void importGenTable(List tableList) { String operName = SecurityUtils.getUsername(); @@ -282,7 +282,7 @@ public class GenTableServiceImpl implements IGenTableService * @param tableName 琛ㄥ悕绉 */ @Override - @Transactional + @Transactional(rollbackFor = Exception.class) public void synchDb(String tableName) { GenTable table = genTableMapper.selectGenTableByName(tableName); diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java index e28c0bb0e8645a399cd0f5a444b6a4510b1fe586..a55834c392b8d82c1465849cb3c9b9112d92da2b 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java @@ -34,7 +34,8 @@ public class GenUtils */ public static void initColumnField(GenTableColumn column, GenTable table) { - String dataType = getDbType(column.getColumnType()); + String columnType = column.getColumnType(); + String dataType = getDbType(columnType); String columnName = column.getColumnName(); column.setTableId(table.getTableId()); column.setCreateBy(table.getCreateBy()); @@ -47,7 +48,7 @@ public class GenUtils if (arraysContains(GenConstants.COLUMNTYPE_STR, dataType) || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType)) { // 瀛楃涓查暱搴﹁秴杩500璁剧疆涓烘枃鏈煙 - Integer columnLength = getColumnLength(column.getColumnType()); + Integer columnLength = getColumnLength(columnType); String htmlType = columnLength >= 500 || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType) ? GenConstants.HTML_TEXTAREA : GenConstants.HTML_INPUT; column.setHtmlType(htmlType); } @@ -61,11 +62,21 @@ public class GenUtils column.setHtmlType(GenConstants.HTML_INPUT); // 濡傛灉鏄诞鐐瑰瀷 缁熶竴鐢˙igDecimal - String[] str = StringUtils.split(StringUtils.substringBetween(column.getColumnType(), "(", ")"), ","); + String[] str = StringUtils.split(StringUtils.substringBetween(columnType, "(", ")"), ","); if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0) { column.setJavaType(GenConstants.TYPE_BIGDECIMAL); } + // 濡傛灉鏄痭umeric + else if (arraysContains(GenConstants.COLUMNTYPE_DECIMAL, dataType)) + { + column.setJavaType(GenConstants.TYPE_BIGDECIMAL); + } + // 濡傛灉鏄痠nteger + else if (arraysContains(GenConstants.COLUMNTYPE_INTEGER, dataType)) + { + column.setJavaType(GenConstants.TYPE_INTEGER); + } // 濡傛灉鏄暣褰 else if (str != null && str.length == 1 && Integer.parseInt(str[0]) <= 10) { diff --git a/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm b/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm index 116f6c544d5f09f966dc0d3e1e4274023c9377e1..29c7ed3d7b2c5be4567e9c73baffe577c5699ca2 100644 --- a/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm @@ -62,7 +62,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service * @return 缁撴灉 */ #if($table.sub) - @Transactional + @Transactional(rollbackFor = Exception.class) #end @Override public int insert${ClassName}(${ClassName} ${className}) @@ -88,7 +88,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service * @return 缁撴灉 */ #if($table.sub) - @Transactional + @Transactional(rollbackFor = Exception.class) #end @Override public int update${ClassName}(${ClassName} ${className}) @@ -112,7 +112,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service * @return 缁撴灉 */ #if($table.sub) - @Transactional + @Transactional(rollbackFor = Exception.class) #end @Override public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s) @@ -130,7 +130,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service * @return 缁撴灉 */ #if($table.sub) - @Transactional + @Transactional(rollbackFor = Exception.class) #end @Override public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}) diff --git a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm index 8daa05eccc30ef9303c81cfbcdb6e96f83ab4d79..c6a501fbdc5a9b0297d56daf561ea1f5533617f6 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm @@ -1,6 +1,21 @@ + + + + + + + + #foreach($column in $columns) #if($column.query) #set($dictType=$column.dictType) @@ -343,19 +358,38 @@ 鍙 娑 + + - - - - - - - - - 姝e湪鍔犺浇绯荤粺璧勬簮锛岃鑰愬績绛夊緟 - - - -