Merge remote-tracking branch 'origin/master' into xin
# Conflicts:
# oying-system/src/main/java/com/oying/modules/system/rest/MerchantController.java
1 files added
1 files renamed
35 files modified
New file |
| | |
| | | package com.oying.utils; |
| | | |
| | | public interface ConstantsKey { |
| | | |
| | | } |
File was renamed from oying-system/src/main/java/com/oying/modules/pc/common/core/domain/R.java |
| | |
| | | package com.oying.modules.pc.common.core.domain; |
| | | package com.oying.utils; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | |
| | | |
| | | import com.oying.domain.GenConfig; |
| | | import com.oying.service.GenConfigService; |
| | | import com.oying.utils.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | |
| | | @ApiOperation("查询") |
| | | @GetMapping(value = "/{tableName}") |
| | | public ResponseEntity<GenConfig> queryGenConfig(@PathVariable String tableName){ |
| | | return new ResponseEntity<>(genConfigService.find(tableName), HttpStatus.OK); |
| | | public ResponseEntity<Object> queryGenConfig(@PathVariable String tableName) { |
| | | return new ResponseEntity<>(R.success(genConfigService.find(tableName)), HttpStatus.OK); |
| | | } |
| | | |
| | | @PutMapping |
| | | @ApiOperation("修改") |
| | | public ResponseEntity<GenConfig> updateGenConfig(@Validated @RequestBody GenConfig genConfig){ |
| | | return new ResponseEntity<>(genConfigService.update(genConfig.getTableName(), genConfig),HttpStatus.OK); |
| | | public ResponseEntity<Object> updateGenConfig(@Validated @RequestBody GenConfig genConfig) { |
| | | return new ResponseEntity<>(R.success(genConfigService.update(genConfig.getTableName(), genConfig)), HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | import com.oying.domain.dto.TableInfo; |
| | | import com.oying.service.GenConfigService; |
| | | import com.oying.service.GeneratorService; |
| | | import com.oying.utils.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | |
| | | |
| | | @ApiOperation("查询数据库数据") |
| | | @GetMapping(value = "/tables") |
| | | public ResponseEntity<PageResult<TableInfo>> queryTables(@RequestParam(defaultValue = "") String name, @RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size){ |
| | | return new ResponseEntity<>(generatorService.getTables(name, new Page<>(page, size)), HttpStatus.OK); |
| | | public ResponseEntity<Object> queryTables(@RequestParam(defaultValue = "") String name, @RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) { |
| | | return new ResponseEntity<>(R.success(generatorService.getTables(name, new Page<>(page, size))), HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("查询字段数据") |
| | | @GetMapping(value = "/columns") |
| | | public ResponseEntity<PageResult<ColumnInfo>> queryColumns(@RequestParam String tableName){ |
| | | public ResponseEntity<Object> queryColumns(@RequestParam String tableName) { |
| | | List<ColumnInfo> columnInfos = generatorService.getColumns(tableName); |
| | | return new ResponseEntity<>(PageUtil.toPage(columnInfos), HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(PageUtil.toPage(columnInfos)), HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("保存字段数据") |
| | | @PutMapping |
| | | public ResponseEntity<HttpStatus> saveColumn(@RequestBody List<ColumnInfo> columnInfos){ |
| | | public ResponseEntity<Object> saveColumn(@RequestBody List<ColumnInfo> columnInfos) { |
| | | generatorService.save(columnInfos); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("同步字段数据") |
| | | @PostMapping(value = "sync") |
| | | public ResponseEntity<HttpStatus> syncColumn(@RequestBody List<String> tables){ |
| | | public ResponseEntity<Object> syncColumn(@RequestBody List<String> tables) { |
| | | for (String table : tables) { |
| | | generatorService.sync(generatorService.getColumns(table), generatorService.query(table)); |
| | | } |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("生成代码") |
| | |
| | | } |
| | | switch (type){ |
| | | // 生成代码 |
| | | case 0: generatorService.generator(genConfigService.find(tableName), generatorService.getColumns(tableName)); |
| | | case 0: |
| | | generatorService.generator(genConfigService.find(tableName), generatorService.getColumns(tableName)); |
| | | break; |
| | | // 预览 |
| | | case 1: return generatorService.preview(genConfigService.find(tableName), generatorService.getColumns(tableName)); |
| | | case 1: |
| | | return generatorService.preview(genConfigService.find(tableName), generatorService.getColumns(tableName)); |
| | | // 打包 |
| | | case 2: generatorService.download(genConfigService.find(tableName), generatorService.getColumns(tableName), request, response); |
| | | case 2: |
| | | generatorService.download(genConfigService.find(tableName), generatorService.getColumns(tableName), request, response); |
| | | break; |
| | | default: throw new BadRequestException("没有这个选项"); |
| | | default: |
| | | throw new BadRequestException("没有这个选项"); |
| | | } |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | import com.oying.domain.SysLog; |
| | | import com.oying.domain.dto.SysLogQueryCriteria; |
| | | import com.oying.service.SysLogService; |
| | | import com.oying.utils.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | |
| | |
| | | @GetMapping |
| | | @ApiOperation("日志查询") |
| | | @PreAuthorize("@el.check()") |
| | | public ResponseEntity<PageResult<SysLog>> queryLog(SysLogQueryCriteria criteria){ |
| | | public ResponseEntity<Object> queryLog(SysLogQueryCriteria criteria) { |
| | | criteria.setLogType("INFO"); |
| | | Page<SysLog> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | return new ResponseEntity<>(sysLogService.queryAll(criteria,page), HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(sysLogService.queryAll(criteria, page)), HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/user") |
| | | @ApiOperation("用户日志查询") |
| | | public ResponseEntity<PageResult<SysLog>> queryUserLog(SysLogQueryCriteria criteria){ |
| | | public ResponseEntity<Object> queryUserLog(SysLogQueryCriteria criteria) { |
| | | criteria.setLogType("INFO"); |
| | | criteria.setUsername(SecurityUtils.getCurrentUsername()); |
| | | Page<SysLog> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | return new ResponseEntity<>(sysLogService.queryAllByUser(criteria,page), HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(sysLogService.queryAllByUser(criteria, page)), HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/error") |
| | | @ApiOperation("错误日志查询") |
| | | @PreAuthorize("@el.check()") |
| | | public ResponseEntity<PageResult<SysLog>> queryErrorLog(SysLogQueryCriteria criteria){ |
| | | public ResponseEntity<Object> queryErrorLog(SysLogQueryCriteria criteria) { |
| | | criteria.setLogType("ERROR"); |
| | | Page<SysLog> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | return new ResponseEntity<>(sysLogService.queryAll(criteria,page), HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(sysLogService.queryAll(criteria, page)), HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/error/{id}") |
| | | @ApiOperation("日志异常详情查询") |
| | | @PreAuthorize("@el.check()") |
| | | public ResponseEntity<Object> queryErrorLogDetail(@PathVariable Long id){ |
| | | return new ResponseEntity<>(sysLogService.findByErrDetail(id), HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(sysLogService.findByErrDetail(id)), HttpStatus.OK); |
| | | } |
| | | |
| | | @DeleteMapping(value = "/del/error") |
| | | @Log("删除所有ERROR日志") |
| | | @ApiOperation("删除所有ERROR日志") |
| | | @PreAuthorize("@el.check()") |
| | | public ResponseEntity<Object> delAllErrorLog(){ |
| | | sysLogService.delAllByError(); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | |
| | | @DeleteMapping(value = "/del/info") |
| | |
| | | @PreAuthorize("@el.check()") |
| | | public ResponseEntity<Object> delAllInfoLog(){ |
| | | sysLogService.delAllByInfo(); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | |
| | | <!-- 打包 --> |
| | | <build> |
| | | <finalName>oying</finalName> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import com.oying.annotation.rest.AnonymousGetMapping; |
| | | import com.oying.utils.SpringBeanHolder; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.context.ApplicationPidFileWriter; |
| | |
| | | import com.oying.modules.pc.category.domain.dto.PlatformCategoryUpdateRequest; |
| | | import com.oying.modules.pc.category.service.PlatformCategoryService; |
| | | import com.oying.modules.pc.category.view.PlatformCategoryView; |
| | | import com.oying.modules.pc.common.core.domain.R; |
| | | import com.oying.utils.R; |
| | | import com.oying.utils.PageResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import com.oying.modules.pc.category.view.PlatformCategoryCustomerView; |
| | | import com.oying.modules.pc.category.domain.dto.PlatformCategoryQueryCriteria; |
| | | import com.oying.modules.pc.category.service.PlatformCategoryService; |
| | | import com.oying.modules.pc.common.core.domain.R; |
| | | import com.oying.utils.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | package com.oying.modules.pc.product.rest; |
| | | |
| | | import com.oying.annotation.Log; |
| | | import com.oying.modules.pc.common.core.domain.R; |
| | | import com.oying.utils.R; |
| | | import com.oying.modules.pc.product.domain.Product; |
| | | import com.oying.modules.pc.product.service.ProductService; |
| | | import com.oying.modules.pc.product.domain.dto.ProductQueryCriteria; |
| | |
| | | |
| | | import cn.hutool.core.collection.ListUtil; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.oying.modules.pc.common.core.domain.R; |
| | | import com.oying.utils.R; |
| | | import com.oying.modules.pc.product.domain.Product; |
| | | import com.oying.modules.pc.product.domain.dto.ProductQueryCriteria; |
| | | import com.oying.modules.pc.product.service.ProductService; |
| | | import com.oying.modules.pc.product.view.ProductCustomerView; |
| | | import com.oying.modules.pc.product.view.ProductMerchantSimpleView; |
| | | import com.oying.utils.PageResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | |
| | | import cn.hutool.core.collection.ListUtil; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.oying.annotation.Log; |
| | | import com.oying.modules.pc.common.core.domain.R; |
| | | import com.oying.utils.R; |
| | | import com.oying.modules.pc.product.domain.Product; |
| | | import com.oying.modules.pc.product.domain.dto.ProductMerchantCreateRequest; |
| | | import com.oying.modules.pc.product.domain.dto.ProductMerchantUpdateRequest; |
| | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | package com.oying.modules.pc.search.rest; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.oying.modules.pc.common.core.domain.R; |
| | | import com.oying.utils.R; |
| | | import com.oying.modules.pc.search.domain.dto.NearbyStoreQueryCriteria; |
| | | import com.oying.modules.pc.search.domain.dto.StoreSearchDto; |
| | | import com.oying.modules.pc.search.view.StoreSearchView; |
| | |
| | | package com.oying.modules.pc.store.rest; |
| | | |
| | | import com.oying.annotation.Log; |
| | | import com.oying.modules.pc.common.core.domain.R; |
| | | import com.oying.utils.R; |
| | | import com.oying.modules.pc.store.domain.StoreCategory; |
| | | import com.oying.modules.pc.store.service.StoreCategoryService; |
| | | import com.oying.modules.pc.store.domain.dto.StoreCategoryQueryCriteria; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import io.swagger.annotations.*; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.oying.utils.PageResult; |
| | | |
| | | /** |
| | | * @author lzp |
| | |
| | | import cn.hutool.core.lang.tree.TreeNodeConfig; |
| | | import cn.hutool.core.lang.tree.TreeUtil; |
| | | import cn.hutool.core.util.BooleanUtil; |
| | | import com.oying.modules.pc.common.core.domain.R; |
| | | import com.oying.utils.R; |
| | | import com.oying.modules.pc.store.domain.StoreCategory; |
| | | import com.oying.modules.pc.store.domain.dto.StoreCategoryQueryCriteria; |
| | | import com.oying.modules.pc.store.service.StoreCategoryService; |
| | |
| | | import cn.hutool.core.lang.tree.TreeNodeConfig; |
| | | import cn.hutool.core.lang.tree.TreeUtil; |
| | | import cn.hutool.core.util.BooleanUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.oying.annotation.Log; |
| | | import com.oying.modules.pc.common.core.domain.R; |
| | | import com.oying.utils.R; |
| | | import com.oying.modules.pc.store.domain.StoreCategory; |
| | | import com.oying.modules.pc.store.domain.dto.*; |
| | | import com.oying.modules.pc.store.service.StoreCategoryService; |
| | |
| | | package com.oying.modules.pc.store.rest; |
| | | |
| | | import com.oying.modules.pc.common.core.domain.R; |
| | | import com.oying.utils.R; |
| | | import com.oying.modules.pc.common.id.StoreIdGenerator; |
| | | import com.oying.modules.pc.store.domain.Store; |
| | | import com.oying.modules.pc.store.domain.dto.*; |
| | |
| | | package com.oying.modules.pc.store.rest; |
| | | |
| | | import com.oying.modules.pc.common.core.domain.R; |
| | | import com.oying.utils.R; |
| | | import com.oying.modules.pc.store.domain.dto.StoreCustomerDetailDto; |
| | | import com.oying.modules.pc.store.domain.dto.StoreCustomerQueryCriteria; |
| | | import com.oying.modules.pc.store.service.StoreQueryService; |
| | |
| | | package com.oying.modules.pc.store.rest; |
| | | |
| | | import cn.hutool.core.collection.ListUtil; |
| | | import com.oying.modules.pc.common.core.domain.R; |
| | | import com.oying.utils.R; |
| | | import com.oying.modules.pc.store.domain.Store; |
| | | import com.oying.modules.pc.store.domain.dto.StoreCreateRequest; |
| | | import com.oying.modules.pc.store.domain.dto.StoreFieldUpdateRequest; |
| | |
| | | import com.oying.modules.pc.store.domain.StoreQualification; |
| | | import com.oying.modules.pc.store.domain.dto.StoreQualificationQueryCriteria; |
| | | import com.oying.modules.pc.store.service.StoreQualificationService; |
| | | import com.oying.utils.PageResult; |
| | | import com.oying.utils.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | |
| | | @GetMapping |
| | | @ApiOperation("查询店铺资质") |
| | | @PreAuthorize("@el.check('storeQualification:list')") |
| | | public ResponseEntity<PageResult<StoreQualification>> queryStoreQualification(StoreQualificationQueryCriteria criteria) { |
| | | public ResponseEntity<Object> queryStoreQualification(StoreQualificationQueryCriteria criteria) { |
| | | Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | return new ResponseEntity<>(storeQualificationService.queryAll(criteria, page), HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(storeQualificationService.queryAll(criteria, page)), HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | |
| | | @PreAuthorize("@el.check('storeQualification:add')") |
| | | public ResponseEntity<Object> createStoreQualification(@Validated @RequestBody StoreQualification resources) { |
| | | storeQualificationService.create(resources); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | |
| | | @PreAuthorize("@el.check('storeQualification:edit')") |
| | | public ResponseEntity<Object> updateStoreQualification(@Validated @RequestBody StoreQualification resources) { |
| | | storeQualificationService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | |
| | | @PreAuthorize("@el.check('storeQualification:del')") |
| | | public ResponseEntity<Object> deleteStoreQualification(@ApiParam(value = "传ID数组[]") @RequestBody List<Long> ids) { |
| | | storeQualificationService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | |
| | | import cn.hutool.core.collection.ListUtil; |
| | | import cn.hutool.core.util.ObjUtil; |
| | | import com.oying.modules.pc.common.core.domain.R; |
| | | import com.oying.utils.R; |
| | | import com.oying.modules.pc.store.domain.StoreQualification; |
| | | import com.oying.modules.pc.store.domain.dto.StoreQualificationQueryCriteria; |
| | | import com.oying.modules.pc.store.service.StoreQualificationService; |
| | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | import cn.hutool.core.collection.ListUtil; |
| | | import com.oying.annotation.Log; |
| | | import com.oying.modules.pc.common.core.domain.R; |
| | | import com.oying.utils.R; |
| | | import com.oying.modules.pc.store.domain.StoreQualification; |
| | | import com.oying.modules.pc.store.domain.dto.StoreQualificationCreateRequest; |
| | | import com.oying.modules.pc.store.domain.dto.StoreQualificationQueryCriteria; |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.oying.modules.quartz.domain.QuartzJob; |
| | | import com.oying.modules.quartz.domain.QuartzLog; |
| | | import com.oying.utils.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.Set; |
| | |
| | | @ApiOperation("查询定时任务") |
| | | @GetMapping |
| | | @PreAuthorize("@el.check('timing:list')") |
| | | public ResponseEntity<PageResult<QuartzJob>> queryQuartzJob(QuartzJobQueryCriteria criteria){ |
| | | public ResponseEntity<Object> queryQuartzJob(QuartzJobQueryCriteria criteria) { |
| | | Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | return new ResponseEntity<>(quartzJobService.queryAll(criteria,page), HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(quartzJobService.queryAll(criteria, page)), HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("导出任务数据") |
| | |
| | | @ApiOperation("查询任务执行日志") |
| | | @GetMapping(value = "/logs") |
| | | @PreAuthorize("@el.check('timing:list')") |
| | | public ResponseEntity<PageResult<QuartzLog>> queryQuartzJobLog(QuartzJobQueryCriteria criteria){ |
| | | public ResponseEntity<Object> queryQuartzJobLog(QuartzJobQueryCriteria criteria) { |
| | | Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | return new ResponseEntity<>(quartzJobService.queryAllLog(criteria,page), HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(quartzJobService.queryAllLog(criteria, page)), HttpStatus.OK); |
| | | } |
| | | |
| | | @Log("新增定时任务") |
| | |
| | | // 验证Bean是不是合法的,合法的定时任务 Bean 需要用 @Service 定义 |
| | | checkBean(resources.getBeanName()); |
| | | quartzJobService.create(resources); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.CREATED); |
| | | } |
| | | |
| | | @Log("修改定时任务") |
| | |
| | | // 验证Bean是不是合法的,合法的定时任务 Bean 需要用 @Service 定义 |
| | | checkBean(resources.getBeanName()); |
| | | quartzJobService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @Log("更改定时任务状态") |
| | |
| | | @PreAuthorize("@el.check('timing:edit')") |
| | | public ResponseEntity<Object> updateQuartzJobStatus(@PathVariable Long id){ |
| | | quartzJobService.updateIsPause(quartzJobService.getById(id)); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @Log("执行定时任务") |
| | |
| | | @PreAuthorize("@el.check('timing:edit')") |
| | | public ResponseEntity<Object> executionQuartzJob(@PathVariable Long id){ |
| | | quartzJobService.execution(quartzJobService.getById(id)); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @Log("删除定时任务") |
| | |
| | | @PreAuthorize("@el.check('timing:del')") |
| | | public ResponseEntity<Object> deleteQuartzJob(@RequestBody Set<Long> ids){ |
| | | quartzJobService.delete(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.OK); |
| | | } |
| | | |
| | | /** |
| | | * 验证Bean是不是合法的,合法的定时任务 Bean 需要用 @Service 定义 |
| | | * |
| | | * @param beanName Bean名称 |
| | | */ |
| | | private void checkBean(String beanName){ |
| | |
| | | import com.oying.modules.security.service.UserDetailsServiceImpl; |
| | | import com.oying.modules.security.service.dto.AuthUserDto; |
| | | import com.oying.modules.security.service.dto.JwtUserDto; |
| | | import com.oying.utils.*; |
| | | import com.wf.captcha.base.Captcha; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import com.oying.annotation.rest.AnonymousPostMapping; |
| | | import com.oying.config.properties.RsaProperties; |
| | | import com.oying.exception.BadRequestException; |
| | | import com.oying.utils.RsaUtils; |
| | | import com.oying.utils.RedisUtils; |
| | | import com.oying.utils.SecurityUtils; |
| | | import com.oying.utils.StringUtils; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | |
| | | import org.springframework.security.crypto.password.PasswordEncoder; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | |
| | | // 保存在线信息 |
| | | onlineUserService.save(jwtUser, token, request); |
| | | // 返回登录信息 |
| | | return ResponseEntity.ok(authInfo); |
| | | return ResponseEntity.ok(R.success(authInfo)); |
| | | } |
| | | |
| | | @ApiOperation("临时授权") |
| | |
| | | // 保存在线信息 |
| | | onlineUserService.save(jwtUser, token, request); |
| | | // 返回登录信息 |
| | | return ResponseEntity.ok(authInfo); |
| | | return ResponseEntity.ok(R.success(authInfo)); |
| | | } |
| | | |
| | | @ApiOperation("获取用户信息") |
| | | @GetMapping(value = "/info") |
| | | public ResponseEntity<UserDetails> getUserInfo() { |
| | | public ResponseEntity<Object> getUserInfo() { |
| | | JwtUserDto jwtUser = (JwtUserDto) SecurityUtils.getCurrentUser(); |
| | | return ResponseEntity.ok(jwtUser); |
| | | return ResponseEntity.ok(R.success(jwtUser)); |
| | | } |
| | | |
| | | @ApiOperation("获取验证码") |
| | |
| | | put("img", captcha.toBase64()); |
| | | put("uuid", uuid); |
| | | }}; |
| | | return ResponseEntity.ok(imgResult); |
| | | return ResponseEntity.ok(R.success(imgResult)); |
| | | } |
| | | |
| | | @ApiOperation("退出登录") |
| | |
| | | public ResponseEntity<Object> logout(HttpServletRequest request) { |
| | | String token = tokenProvider.getToken(request); |
| | | onlineUserService.logout(token); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.oying.modules.security.service.OnlineUserService; |
| | | import com.oying.modules.security.service.dto.OnlineUserDto; |
| | | import com.oying.utils.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.Set; |
| | |
| | | @ApiOperation("查询在线用户") |
| | | @GetMapping |
| | | @PreAuthorize("@el.check()") |
| | | public ResponseEntity<PageResult<OnlineUserDto>> queryOnlineUser(String username, Pageable pageable){ |
| | | return new ResponseEntity<>(onlineUserService.getAll(username, pageable),HttpStatus.OK); |
| | | public ResponseEntity<Object> queryOnlineUser(String username, Pageable pageable) { |
| | | return new ResponseEntity<>(R.success(onlineUserService.getAll(username, pageable)), HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("导出数据") |
| | |
| | | token = EncryptUtils.desDecrypt(token); |
| | | onlineUserService.logout(token); |
| | | } |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.oying.annotation.rest.AnonymousGetMapping; |
| | | import com.oying.utils.R; |
| | | import com.oying.utils.RedisUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | //创建验证码 |
| | | String verification = (int) ((Math.random() * 9 + 1) * 100000) + ""; |
| | | redisUtils.set(uuid, verification, time); |
| | | return ResponseEntity.ok(uuid); |
| | | return ResponseEntity.ok(R.success(uuid)); |
| | | } |
| | | } |
| | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.oying.modules.system.domain.Dept; |
| | | import com.oying.modules.system.domain.dto.DeptQueryCriteria; |
| | | import com.oying.utils.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | @ApiOperation("查询机构") |
| | | @GetMapping |
| | | @PreAuthorize("@el.check('user:list','dept:list')") |
| | | public ResponseEntity<PageResult<Dept>> queryDept(DeptQueryCriteria criteria) throws Exception { |
| | | public ResponseEntity<Object> queryDept(DeptQueryCriteria criteria) throws Exception { |
| | | List<Dept> depts = deptService.queryAll(criteria, true); |
| | | return new ResponseEntity<>(PageUtil.toPage(depts),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(PageUtil.toPage(depts)), HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("查询机构:根据ID获取同级与上级数据") |
| | |
| | | } |
| | | deptSet.addAll(depts); |
| | | } |
| | | return new ResponseEntity<>(deptService.buildTree(new ArrayList<>(deptSet)),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(deptService.buildTree(new ArrayList<>(deptSet))), HttpStatus.OK); |
| | | } |
| | | |
| | | @Log("新增机构") |
| | |
| | | throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); |
| | | } |
| | | deptService.create(resources); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.CREATED); |
| | | } |
| | | |
| | | @Log("修改机构") |
| | |
| | | @PreAuthorize("@el.check('dept:edit')") |
| | | public ResponseEntity<Object> updateDept(@Validated(Dept.Update.class) @RequestBody Dept resources){ |
| | | deptService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @Log("删除机构") |
| | |
| | | // 验证是否被角色或用户关联 |
| | | deptService.verification(depts); |
| | | deptService.delete(depts); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.oying.modules.system.domain.Dict; |
| | | import com.oying.modules.system.domain.dto.DictQueryCriteria; |
| | | import com.oying.utils.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | |
| | | @ApiOperation("查询字典") |
| | | @GetMapping(value = "/all") |
| | | @PreAuthorize("@el.check('dict:list')") |
| | | public ResponseEntity<List<Dict>> queryAllDict(){ |
| | | return new ResponseEntity<>(dictService.queryAll(new DictQueryCriteria()),HttpStatus.OK); |
| | | public ResponseEntity<Object> queryAllDict() { |
| | | return new ResponseEntity<>(R.success(dictService.queryAll(new DictQueryCriteria())), HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("查询字典") |
| | | @GetMapping |
| | | @PreAuthorize("@el.check('dict:list')") |
| | | public ResponseEntity<PageResult<Dict>> queryDict(DictQueryCriteria criteria){ |
| | | public ResponseEntity<Object> queryDict(DictQueryCriteria criteria) { |
| | | Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | return new ResponseEntity<>(dictService.queryAll(criteria, page),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(dictService.queryAll(criteria, page)), HttpStatus.OK); |
| | | } |
| | | |
| | | @Log("新增字典") |
| | |
| | | throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); |
| | | } |
| | | dictService.create(resources); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.CREATED); |
| | | } |
| | | |
| | | @Log("修改字典") |
| | |
| | | @PreAuthorize("@el.check('dict:edit')") |
| | | public ResponseEntity<Object> updateDict(@Validated(Dict.Update.class) @RequestBody Dict resources){ |
| | | dictService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @Log("删除字典") |
| | |
| | | @PreAuthorize("@el.check('dict:del')") |
| | | public ResponseEntity<Object> deleteDict(@RequestBody Set<Long> ids){ |
| | | dictService.delete(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.oying.modules.system.domain.DictDetail; |
| | | import com.oying.utils.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | |
| | | @ApiOperation("查询字典详情") |
| | | @GetMapping |
| | | public ResponseEntity<PageResult<DictDetail>> queryDictDetail(DictDetailQueryCriteria criteria){ |
| | | public ResponseEntity<Object> queryDictDetail(DictDetailQueryCriteria criteria) { |
| | | Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | return new ResponseEntity<>(dictDetailService.queryAll(criteria, page),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(dictDetailService.queryAll(criteria, page)), HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("查询多个字典详情") |
| | |
| | | for (String name : names) { |
| | | dictMap.put(name, dictDetailService.getDictByName(name)); |
| | | } |
| | | return new ResponseEntity<>(dictMap, HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(dictMap), HttpStatus.OK); |
| | | } |
| | | |
| | | @Log("新增字典详情") |
| | |
| | | throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); |
| | | } |
| | | dictDetailService.create(resources); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.CREATED); |
| | | } |
| | | |
| | | @Log("修改字典详情") |
| | |
| | | @PreAuthorize("@el.check('dict:edit')") |
| | | public ResponseEntity<Object> updateDictDetail(@Validated(DictDetail.Update.class) @RequestBody DictDetail resources){ |
| | | dictDetailService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @Log("删除字典详情") |
| | |
| | | @PreAuthorize("@el.check('dict:del')") |
| | | public ResponseEntity<Object> deleteDictDetail(@PathVariable Long id){ |
| | | dictDetailService.delete(id); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.oying.modules.system.domain.Job; |
| | | import com.oying.modules.system.domain.dto.JobQueryCriteria; |
| | | import com.oying.utils.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.Set; |
| | |
| | | @ApiOperation("查询岗位") |
| | | @GetMapping |
| | | @PreAuthorize("@el.check('job:list','user:list')") |
| | | public ResponseEntity<PageResult<Job>> queryJob(JobQueryCriteria criteria){ |
| | | public ResponseEntity<Object> queryJob(JobQueryCriteria criteria) { |
| | | Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | return new ResponseEntity<>(jobService.queryAll(criteria, page),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(jobService.queryAll(criteria, page)), HttpStatus.OK); |
| | | } |
| | | |
| | | @Log("新增岗位") |
| | |
| | | throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); |
| | | } |
| | | jobService.create(resources); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.CREATED); |
| | | } |
| | | |
| | | @Log("修改岗位") |
| | |
| | | @PreAuthorize("@el.check('job:edit')") |
| | | public ResponseEntity<Object> updateJob(@Validated(Job.Update.class) @RequestBody Job resources){ |
| | | jobService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @Log("删除岗位") |
| | |
| | | // 验证是否被用户关联 |
| | | jobService.verification(ids); |
| | | jobService.delete(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | import com.oying.modules.system.domain.Menu; |
| | | import com.oying.modules.system.domain.dto.MenuQueryCriteria; |
| | | import com.oying.modules.system.domain.dto.MenuVo; |
| | | import com.oying.utils.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | |
| | | @GetMapping(value = "/build") |
| | | @ApiOperation("获取前端所需菜单") |
| | | public ResponseEntity<List<MenuVo>> buildMenus(){ |
| | | public ResponseEntity<Object> buildMenus() { |
| | | List<Menu> menuList = menuService.findByUser(SecurityUtils.getCurrentUserId()); |
| | | List<Menu> menus = menuService.buildTree(menuList); |
| | | return new ResponseEntity<>(menuService.buildMenus(menus),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(menuService.buildMenus(menus)), HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("返回全部的菜单") |
| | | @GetMapping(value = "/lazy") |
| | | @PreAuthorize("@el.check('menu:list','roles:list')") |
| | | public ResponseEntity<List<Menu>> queryAllMenu(@RequestParam Long pid){ |
| | | return new ResponseEntity<>(menuService.getMenus(pid),HttpStatus.OK); |
| | | public ResponseEntity<Object> queryAllMenu(@RequestParam Long pid) { |
| | | return new ResponseEntity<>(R.success(menuService.getMenus(pid)), HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("根据菜单ID返回所有子节点ID,包含自身ID") |
| | |
| | | menuSet.add(menuService.getById(id)); |
| | | menuSet = menuService.getChildMenus(menuList, menuSet); |
| | | Set<Long> ids = menuSet.stream().map(Menu::getId).collect(Collectors.toSet()); |
| | | return new ResponseEntity<>(ids,HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(ids), HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping |
| | | @ApiOperation("查询菜单") |
| | | @PreAuthorize("@el.check('menu:list')") |
| | | public ResponseEntity<PageResult<Menu>> queryMenu(MenuQueryCriteria criteria) throws Exception { |
| | | public ResponseEntity<Object> queryMenu(MenuQueryCriteria criteria) throws Exception { |
| | | List<Menu> menuList = menuService.queryAll(criteria, true); |
| | | return new ResponseEntity<>(PageUtil.toPage(menuList),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(PageUtil.toPage(menuList)), HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("查询菜单:根据ID获取同级与上级数据") |
| | | @PostMapping("/superior") |
| | | @PreAuthorize("@el.check('menu:list')") |
| | | public ResponseEntity<List<Menu>> getMenuSuperior(@RequestBody List<Long> ids) { |
| | | public ResponseEntity<Object> getMenuSuperior(@RequestBody List<Long> ids) { |
| | | Set<Menu> menus = new LinkedHashSet<>(); |
| | | if(CollectionUtil.isNotEmpty(ids)){ |
| | | for (Long id : ids) { |
| | |
| | | } |
| | | // 编辑菜单时不显示自己以及自己下级的数据,避免出现PID数据环形问题 |
| | | menus = menus.stream().filter(i -> !ids.contains(i.getId())).collect(Collectors.toSet()); |
| | | return new ResponseEntity<>(menuService.buildTree(new ArrayList<>(menus)),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(menuService.buildTree(new ArrayList<>(menus))), HttpStatus.OK); |
| | | } |
| | | return new ResponseEntity<>(menuService.getMenus(null),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(menuService.getMenus(null)), HttpStatus.OK); |
| | | } |
| | | |
| | | @Log("新增菜单") |
| | |
| | | throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); |
| | | } |
| | | menuService.create(resources); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.CREATED); |
| | | } |
| | | |
| | | @Log("修改菜单") |
| | |
| | | @PreAuthorize("@el.check('menu:edit')") |
| | | public ResponseEntity<Object> updateMenu(@Validated(Menu.Update.class) @RequestBody Menu resources){ |
| | | menuService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @Log("删除菜单") |
| | |
| | | menuSet = menuService.getChildMenus(menuList, menuSet); |
| | | } |
| | | menuService.delete(menuSet); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | package com.oying.modules.system.rest; |
| | | |
| | | import com.oying.utils.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | @ApiOperation("查询服务监控") |
| | | @PreAuthorize("@el.check('monitor:list')") |
| | | public ResponseEntity<Object> queryMonitor(){ |
| | | return new ResponseEntity<>(serverService.getServers(),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(serverService.getServers()),HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | import cn.hutool.core.lang.Dict; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.oying.modules.system.domain.Role; |
| | | import com.oying.utils.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.Collections; |
| | |
| | | @ApiOperation("获取单个role") |
| | | @GetMapping(value = "/{id}") |
| | | @PreAuthorize("@el.check('roles:list')") |
| | | public ResponseEntity<Role> findRoleById(@PathVariable Long id){ |
| | | return new ResponseEntity<>(roleService.findById(id), HttpStatus.OK); |
| | | public ResponseEntity<Object> findRoleById(@PathVariable Long id) { |
| | | return new ResponseEntity<>(R.success(roleService.findById(id)), HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("导出角色数据") |
| | |
| | | @ApiOperation("返回全部的角色") |
| | | @GetMapping(value = "/all") |
| | | @PreAuthorize("@el.check('roles:list','user:add','user:edit')") |
| | | public ResponseEntity<List<Role>> queryAllRole(){ |
| | | return new ResponseEntity<>(roleService.queryAll(),HttpStatus.OK); |
| | | public ResponseEntity<Object> queryAllRole() { |
| | | return new ResponseEntity<>(R.success(roleService.queryAll()), HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("查询角色") |
| | | @GetMapping |
| | | @PreAuthorize("@el.check('roles:list')") |
| | | public ResponseEntity<PageResult<Role>> queryRole(RoleQueryCriteria criteria){ |
| | | public ResponseEntity<Object> queryRole(RoleQueryCriteria criteria) { |
| | | Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | return new ResponseEntity<>(roleService.queryAll(criteria, page),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(roleService.queryAll(criteria, page)), HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("获取用户级别") |
| | | @GetMapping(value = "/level") |
| | | public ResponseEntity<Object> getRoleLevel(){ |
| | | return new ResponseEntity<>(Dict.create().set("level", getLevels(null)),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(Dict.create().set("level", getLevels(null))), HttpStatus.OK); |
| | | } |
| | | |
| | | @Log("新增角色") |
| | |
| | | } |
| | | getLevels(resources.getLevel()); |
| | | roleService.create(resources); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.CREATED); |
| | | } |
| | | |
| | | @Log("修改角色") |
| | |
| | | public ResponseEntity<Object> updateRole(@Validated(Role.Update.class) @RequestBody Role resources){ |
| | | getLevels(resources.getLevel()); |
| | | roleService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @Log("修改角色菜单") |
| | |
| | | Role role = roleService.getById(resources.getId()); |
| | | getLevels(role.getLevel()); |
| | | roleService.updateMenu(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @Log("删除角色") |
| | |
| | | // 验证是否被用户关联 |
| | | roleService.verification(ids); |
| | | roleService.delete(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户的角色级别 |
| | | * |
| | | * @return / |
| | | */ |
| | | private int getLevels(Integer level){ |
| | |
| | | import com.oying.modules.system.domain.Role; |
| | | import com.oying.modules.system.domain.User; |
| | | import com.oying.modules.system.domain.dto.UserPassVo; |
| | | import com.oying.utils.*; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import com.oying.utils.PageResult; |
| | | import com.oying.utils.PageUtil; |
| | | import com.oying.utils.RsaUtils; |
| | | import com.oying.utils.SecurityUtils; |
| | | import com.oying.annotation.Log; |
| | | import com.oying.config.properties.RsaProperties; |
| | | import com.oying.modules.system.service.DataService; |
| | |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | |
| | | @ApiOperation("查询用户") |
| | | @GetMapping |
| | | @PreAuthorize("@el.check('user:list')") |
| | | public ResponseEntity<PageResult<User>> queryUser(UserQueryCriteria criteria){ |
| | | public ResponseEntity<Object> queryUser(UserQueryCriteria criteria) { |
| | | Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | if (!ObjectUtils.isEmpty(criteria.getDeptId())) { |
| | | criteria.getDeptIds().add(criteria.getDeptId()); |
| | |
| | | // 取交集 |
| | | criteria.getDeptIds().retainAll(dataScopes); |
| | | if(!CollectionUtil.isEmpty(criteria.getDeptIds())){ |
| | | return new ResponseEntity<>(userService.queryAll(criteria,page),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(userService.queryAll(criteria, page)), HttpStatus.OK); |
| | | } |
| | | } else { |
| | | // 否则取并集 |
| | | criteria.getDeptIds().addAll(dataScopes); |
| | | return new ResponseEntity<>(userService.queryAll(criteria,page),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(userService.queryAll(criteria, page)), HttpStatus.OK); |
| | | } |
| | | return new ResponseEntity<>(PageUtil.noData(),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | |
| | | @Log("新增用户") |
| | |
| | | // 默认密码 123456 |
| | | resources.setPassword(passwordEncoder.encode("123456")); |
| | | userService.create(resources); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @Log("修改用户") |
| | |
| | | public ResponseEntity<Object> updateUser(@Validated(User.Update.class) @RequestBody User resources) throws Exception { |
| | | checkLevel(resources); |
| | | userService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @Log("修改用户:个人中心") |
| | |
| | | throw new BadRequestException("不能修改他人资料"); |
| | | } |
| | | userService.updateCenter(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @Log("删除用户") |
| | |
| | | } |
| | | } |
| | | userService.delete(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("修改密码") |
| | |
| | | throw new BadRequestException("新密码不能与旧密码相同"); |
| | | } |
| | | userService.updatePass(user.getUsername(),passwordEncoder.encode(newPass)); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("重置密码") |
| | |
| | | public ResponseEntity<Object> resetPwd(@RequestBody Set<Long> ids) { |
| | | String pwd = passwordEncoder.encode("123456"); |
| | | userService.resetPwd(ids, pwd); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("修改头像") |
| | | @PostMapping(value = "/updateAvatar") |
| | | public ResponseEntity<Object> updateUserAvatar(@RequestParam MultipartFile avatar){ |
| | | return new ResponseEntity<>(userService.updateAvatar(avatar), HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(userService.updateAvatar(avatar)), HttpStatus.OK); |
| | | } |
| | | |
| | | @Log("修改邮箱") |
| | |
| | | } |
| | | verificationCodeService.validated(CodeEnum.EMAIL_RESET_EMAIL_CODE.getKey() + resources.getEmail(), code); |
| | | userService.updateEmail(user.getUsername(),resources.getEmail()); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.OK); |
| | | } |
| | | |
| | | /** |
| | | * 如果当前用户的角色级别低于创建用户的角色级别,则抛出权限不足的错误 |
| | | * |
| | | * @param resources / |
| | | */ |
| | | private void checkLevel(User resources) { |
| | |
| | | package com.oying.modules.system.rest; |
| | | |
| | | import com.oying.utils.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | public ResponseEntity<Object> resetEmail(@RequestParam String email){ |
| | | EmailDto emailDto = verificationCodeService.sendEmail(email, CodeEnum.EMAIL_RESET_EMAIL_CODE.getKey()); |
| | | emailService.send(emailDto,emailService.find()); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping(value = "/email/resetPass") |
| | |
| | | public ResponseEntity<Object> resetPass(@RequestParam String email){ |
| | | EmailDto emailDto = verificationCodeService.sendEmail(email, CodeEnum.EMAIL_RESET_PWD_CODE.getKey()); |
| | | emailService.send(emailDto,emailService.find()); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/validated") |
| | |
| | | default: |
| | | break; |
| | | } |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | package com.oying.rest; |
| | | |
| | | import com.oying.service.EmailService; |
| | | import com.oying.utils.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | |
| | | /** |
| | | * 发送邮件 |
| | | * |
| | | * @author Z |
| | | * @date 2018/09/28 6:55:53 |
| | | */ |
| | |
| | | private final EmailService emailService; |
| | | |
| | | @GetMapping |
| | | public ResponseEntity<EmailConfig> queryEmailConfig(){ |
| | | return new ResponseEntity<>(emailService.find(),HttpStatus.OK); |
| | | public ResponseEntity<Object> queryEmailConfig() { |
| | | return new ResponseEntity<>(R.success(emailService.find()), HttpStatus.OK); |
| | | } |
| | | |
| | | @Log("配置邮件") |
| | |
| | | @ApiOperation("配置邮件") |
| | | public ResponseEntity<Object> updateEmailConfig(@Validated @RequestBody EmailConfig emailConfig) throws Exception { |
| | | emailService.config(emailConfig, emailService.find()); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | |
| | | @Log("发送邮件") |
| | |
| | | @ApiOperation("发送邮件") |
| | | public ResponseEntity<Object> sendEmail(@Validated @RequestBody EmailDto emailDto){ |
| | | emailService.send(emailDto,emailService.find()); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.oying.service.LocalStorageService; |
| | | import com.oying.utils.R; |
| | | import lombok.RequiredArgsConstructor; |
| | | import com.oying.annotation.Log; |
| | | import com.oying.domain.LocalStorage; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import io.swagger.annotations.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | |
| | |
| | | @GetMapping |
| | | @ApiOperation("查询文件") |
| | | @PreAuthorize("@el.check('storage:list')") |
| | | public ResponseEntity<PageResult<LocalStorage>> queryFile(LocalStorageQueryCriteria criteria){ |
| | | public ResponseEntity<Object> queryFile(LocalStorageQueryCriteria criteria) { |
| | | Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | return new ResponseEntity<>(localStorageService.queryAll(criteria,page),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(localStorageService.queryAll(criteria, page)), HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("导出数据") |
| | |
| | | @PreAuthorize("@el.check('storage:add')") |
| | | public ResponseEntity<Object> createFile(@RequestParam String name, @RequestParam("file") MultipartFile file){ |
| | | localStorageService.create(name, file); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.CREATED); |
| | | } |
| | | |
| | | @ApiOperation("上传图片") |
| | | @PostMapping("/pictures") |
| | | public ResponseEntity<LocalStorage> uploadPicture(@RequestParam MultipartFile file){ |
| | | public ResponseEntity<Object> uploadPicture(@RequestParam MultipartFile file) { |
| | | // 判断文件是否为图片 |
| | | String suffix = FileUtil.getExtensionName(file.getOriginalFilename()); |
| | | if(!FileUtil.IMAGE.equals(FileUtil.getFileType(suffix))){ |
| | | throw new BadRequestException("只能上传图片"); |
| | | } |
| | | LocalStorage localStorage = localStorageService.create(null, file); |
| | | return new ResponseEntity<>(localStorage, HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(localStorage), HttpStatus.OK); |
| | | } |
| | | |
| | | @PutMapping |
| | |
| | | @PreAuthorize("@el.check('storage:edit')") |
| | | public ResponseEntity<Object> updateFile(@Validated @RequestBody LocalStorage resources){ |
| | | localStorageService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @Log("删除文件") |
| | |
| | | @ApiOperation("多选删除") |
| | | public ResponseEntity<Object> deleteFile(@RequestBody Long[] ids) { |
| | | localStorageService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | } |