feat:web模块包名调整
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
package com.tiesheng.web.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.tiesheng.annotation.token.TokenIgnore;
|
||||
import com.tiesheng.web.pojos.dao.CoreConfigEnum;
|
||||
import com.tiesheng.web.pojos.dao.CoreConfigSystem;
|
||||
import com.tiesheng.web.pojos.dto.config.ConfigSystemDTO;
|
||||
import com.tiesheng.web.pojos.dto.config.EnumTypeDTO;
|
||||
import com.tiesheng.web.service.CoreConfigService;
|
||||
import com.tiesheng.web.service.TieshengWebConfigurer;
|
||||
import com.tiesheng.util.exception.ApiException;
|
||||
import com.tiesheng.util.pojos.ApiResp;
|
||||
import com.tiesheng.util.pojos.PageDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hao
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/config")
|
||||
public class ConfigController {
|
||||
|
||||
@Autowired
|
||||
CoreConfigService coreConfigService;
|
||||
@Autowired
|
||||
TieshengWebConfigurer tieshengWebConfigurer;
|
||||
|
||||
|
||||
/**
|
||||
* 系统配置列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/system/page")
|
||||
@TokenIgnore
|
||||
public ApiResp<List<CoreConfigSystem>> systemPage(PageDTO dto) {
|
||||
|
||||
QueryWrapper<CoreConfigSystem> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("is_deleted", 0);
|
||||
dto.likeColumns(queryWrapper, "config_key", "remark");
|
||||
queryWrapper.orderByAsc("config_key");
|
||||
|
||||
Page<CoreConfigSystem> page = dto.pageObj();
|
||||
coreConfigService.page(page, queryWrapper);
|
||||
|
||||
return ApiResp.respOK(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑配置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/system/update")
|
||||
public ApiResp<String> systemUpdate(@RequestBody ConfigSystemDTO dto) {
|
||||
|
||||
CoreConfigSystem configKey = coreConfigService.getOneByColumn("config_key", dto.getConfigKey());
|
||||
if (configKey == null) {
|
||||
throw new ApiException("该配置不存在,请检查");
|
||||
}
|
||||
if (configKey.getReadOnly() == 1) {
|
||||
throw new ApiException("该配置只读,不可修改");
|
||||
}
|
||||
configKey.setConfigVal(dto.getConfigVal());
|
||||
configKey.setRemark(dto.getRemark());
|
||||
configKey.setExtra(dto.getExtra());
|
||||
|
||||
tieshengWebConfigurer.configSystemCheck(configKey);
|
||||
coreConfigService.updateById(configKey);
|
||||
|
||||
return ApiResp.respOK("");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取枚举列表
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/enum/list")
|
||||
@TokenIgnore
|
||||
public ApiResp<List<CoreConfigEnum>> enumList(EnumTypeDTO dto) {
|
||||
|
||||
QueryWrapper<CoreConfigEnum> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("is_deleted", 0);
|
||||
if (!StrUtil.isEmpty(dto.getType())) {
|
||||
queryWrapper.eq("type", dto.getType());
|
||||
}
|
||||
List<CoreConfigEnum> selectList = coreConfigService.getEnumMapper().selectList(queryWrapper);
|
||||
|
||||
return ApiResp.respOK(selectList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.tiesheng.web.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.tiesheng.web.pojos.dao.CoreLogLogin;
|
||||
import com.tiesheng.web.pojos.dao.CoreLogMessage;
|
||||
import com.tiesheng.web.pojos.dao.CoreLogOperation;
|
||||
import com.tiesheng.web.pojos.dao.CoreLogProcess;
|
||||
import com.tiesheng.util.pojos.PageDTO;
|
||||
import com.tiesheng.web.pojos.vo.ProcessDetailVo;
|
||||
import com.tiesheng.web.service.CoreLogService;
|
||||
import com.tiesheng.util.pojos.ApiResp;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hao
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/manager/log")
|
||||
public class LogController {
|
||||
|
||||
@Autowired
|
||||
CoreLogService coreLogService;
|
||||
|
||||
|
||||
/**
|
||||
* 操作日志列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/operation/page")
|
||||
public ApiResp<List<CoreLogOperation>> operationPage(@Valid PageDTO dto) {
|
||||
|
||||
QueryWrapper<CoreLogOperation> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("is_deleted", 0);
|
||||
dto.likeColumns(queryWrapper, "user_name", "title", "subject");
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
|
||||
Page<CoreLogOperation> page = dto.pageObj();
|
||||
coreLogService.getBaseMapper().page(page, queryWrapper);
|
||||
|
||||
return ApiResp.respOK(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 登录日志列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/login/page")
|
||||
public ApiResp<List<CoreLogLogin>> loginPage(@Valid PageDTO dto) {
|
||||
|
||||
QueryWrapper<CoreLogLogin> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("is_deleted", 0);
|
||||
dto.likeColumns(queryWrapper, "user_name", "ip", "address");
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
|
||||
Page<CoreLogLogin> page = dto.pageObj();
|
||||
coreLogService.getLogLoginMapper().selectPage(page, queryWrapper);
|
||||
return ApiResp.respOK(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 登录日志列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/message/page")
|
||||
public ApiResp<List<CoreLogMessage>> messagePage(String result, @Valid PageDTO dto) {
|
||||
|
||||
QueryWrapper<CoreLogMessage> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("is_deleted", 0);
|
||||
if (!StrUtil.isEmpty(result)) {
|
||||
queryWrapper.eq("result", result);
|
||||
}
|
||||
dto.likeColumns(queryWrapper, "type", "target", "content", "resp_body");
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
|
||||
Page<CoreLogMessage> page = dto.pageObj();
|
||||
coreLogService.getLogMessageMapper().selectPage(page, queryWrapper);
|
||||
return ApiResp.respOK(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 过程日志列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/process/page")
|
||||
public ApiResp<List<CoreLogProcess>> processPage(String type, @Valid PageDTO dto) {
|
||||
|
||||
QueryWrapper<CoreLogProcess> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("is_deleted", 0);
|
||||
if (!StrUtil.isEmpty(type)) {
|
||||
queryWrapper.eq("type", type);
|
||||
}
|
||||
dto.likeColumns(queryWrapper, "title");
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
|
||||
Page<CoreLogProcess> page = dto.pageObj();
|
||||
coreLogService.getCoreLogProcessMapper().selectPage(page, queryWrapper);
|
||||
return ApiResp.respOK(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 过程日志详情
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/process/detail")
|
||||
public ApiResp<ProcessDetailVo> processPage(String id) {
|
||||
ProcessDetailVo processDetail = coreLogService.getProcessDetail(id);
|
||||
return ApiResp.respOK(processDetail);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package com.tiesheng.web.controller;
|
||||
|
||||
|
||||
import cn.hutool.captcha.LineCaptcha;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.tiesheng.annotation.token.TokenIgnore;
|
||||
import com.tiesheng.web.config.template.ToolTemplateHandler;
|
||||
import com.tiesheng.web.pojos.dto.*;
|
||||
import com.tiesheng.web.pojos.vo.TemplateInfoVO;
|
||||
import com.tiesheng.web.pojos.vo.PicVerifyVo;
|
||||
import com.tiesheng.web.service.FileUploadService;
|
||||
import com.tiesheng.web.service.TimedCacheService;
|
||||
import com.tiesheng.util.exception.ApiException;
|
||||
import com.tiesheng.util.pojos.ApiResp;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 工具类
|
||||
*
|
||||
* @author hao
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/tool")
|
||||
public class ToolController {
|
||||
|
||||
@Autowired
|
||||
TimedCacheService timedCacheService;
|
||||
@Autowired
|
||||
FileUploadService fileUploadService;
|
||||
@Autowired
|
||||
List<ToolTemplateHandler> templateHandlerList;
|
||||
|
||||
|
||||
/**
|
||||
* 图片验证码
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@TokenIgnore
|
||||
@GetMapping("/code/image")
|
||||
public ApiResp<PicVerifyVo> picVerifyV2(ImageCodeDTO dto) {
|
||||
|
||||
LineCaptcha lineCaptcha = dto.lineCaptcha();
|
||||
PicVerifyVo vo = new PicVerifyVo();
|
||||
vo.setBase64(lineCaptcha.getImageBase64Data());
|
||||
vo.setKey(IdUtil.simpleUUID());
|
||||
timedCacheService.setImageCode(vo.getKey(), lineCaptcha.getCode());
|
||||
|
||||
return ApiResp.respOK(vo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传整个文件
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@TokenIgnore
|
||||
@PostMapping("/file/whole_upload")
|
||||
public ApiResp<String> fileWholeUpload(@RequestParam("file") MultipartFile file) {
|
||||
String filePath = fileUploadService.saveMultipartFile(file);
|
||||
return ApiResp.respOK(filePath);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传超大文件,建议超过20M的使用这个方法
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@TokenIgnore
|
||||
@PostMapping(value = "/file/chunk_start")
|
||||
public ApiResp<String> fileChunkStart(@RequestBody ChunkStartDTO dto) {
|
||||
fileUploadService.chunkStart(dto.getFileExt());
|
||||
return ApiResp.respOK("");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验文件块
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@TokenIgnore
|
||||
@PostMapping("/file/chunk_check")
|
||||
public ApiResp<Boolean> fileChunkCheck(@RequestBody ChunkCheckDTO dto) {
|
||||
boolean exist = fileUploadService.chunkCheck(dto.getFileMd5(), dto.getChunk());
|
||||
return ApiResp.respOK(exist);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传文件块
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@TokenIgnore
|
||||
@PostMapping("/file/chunk_upload")
|
||||
public ApiResp<String> fileChunkUpload(@RequestParam("file") MultipartFile file, String fileMd5, Integer chunk) {
|
||||
fileUploadService.chunkUpload(file, fileMd5, chunk);
|
||||
return ApiResp.respOK("");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 合并文件
|
||||
*
|
||||
* @param fileMd5
|
||||
* @return
|
||||
*/
|
||||
@TokenIgnore
|
||||
@PostMapping("/file/chunk_merge")
|
||||
public ApiResp<String> fileChunkMerge(@RequestBody ChunkMergeDTO dto) {
|
||||
String path = fileUploadService.chunkMerge(dto.getFileMd5(), dto.getFileExt());
|
||||
return ApiResp.respOK(path);
|
||||
}
|
||||
|
||||
|
||||
@TokenIgnore
|
||||
@GetMapping("/template/info")
|
||||
public ApiResp<TemplateInfoVO> templateInfo(TemplateInfoDTO dto) {
|
||||
|
||||
List<ToolTemplateHandler> collect = templateHandlerList.stream()
|
||||
.filter(it -> Objects.equals(it.getAction(), dto.getAction()))
|
||||
.sorted((it, it2) -> it2.getSort() - it.getSort())
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(collect)) {
|
||||
throw new ApiException("没有找到对应的模版");
|
||||
}
|
||||
|
||||
ToolTemplateHandler toolTemplateHandler = collect.get(0);
|
||||
|
||||
TemplateInfoVO template = new TemplateInfoVO();
|
||||
template.setTemplateUrl(toolTemplateHandler.getTemplateUrl());
|
||||
template.setParams(toolTemplateHandler.getParms(dto.getParams()));
|
||||
template.setTemplateId(toolTemplateHandler.getTeamplateId());
|
||||
|
||||
return ApiResp.respOK(template);
|
||||
}
|
||||
|
||||
@TokenIgnore
|
||||
@PostMapping("/template/deal")
|
||||
public ApiResp<String> templateDeal(@RequestBody TemplateDealDTO dto) {
|
||||
|
||||
List<ToolTemplateHandler> collect = templateHandlerList.stream().
|
||||
filter(it -> Objects.equals(it.getTeamplateId(), dto.getTemplateId()))
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(collect)) {
|
||||
throw new ApiException("模版ID不存在");
|
||||
}
|
||||
|
||||
return ApiResp.respOK(collect.get(0).handler(dto));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user