增加大屏后端;增加图片管理
This commit is contained in:
@ -0,0 +1,100 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.page.VisualRespData;
|
||||
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.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.system.domain.BladeVisualCategory;
|
||||
import com.ruoyi.system.service.IBladeVisualCategoryService;
|
||||
|
||||
/**
|
||||
* 可视化分类Controller
|
||||
*
|
||||
* @author yangsj
|
||||
* @date 2021-10-25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/avue/api/category")
|
||||
public class BladeVisualCategoryController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IBladeVisualCategoryService bladeVisualCategoryService;
|
||||
|
||||
/**
|
||||
* 查询可视化分类列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:visual_category:list')")
|
||||
@GetMapping("/list")
|
||||
public VisualRespData list(BladeVisualCategory bladeVisualCategory)
|
||||
{
|
||||
startPage();
|
||||
List<BladeVisualCategory> list = bladeVisualCategoryService.selectBladeVisualCategoryList(bladeVisualCategory);
|
||||
return getVisualData(list);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 导出可视化分类列表
|
||||
// */
|
||||
// @PreAuthorize("@ss.hasPermi('system:visual_category:export')")
|
||||
// @Log(title = "可视化分类", businessType = BusinessType.EXPORT)
|
||||
// @GetMapping("/export")
|
||||
// public AjaxResult export(BladeVisualCategory bladeVisualCategory)
|
||||
// {
|
||||
// List<BladeVisualCategory> list = bladeVisualCategoryService.selectBladeVisualCategoryList(bladeVisualCategory);
|
||||
// ExcelUtil<BladeVisualCategory> util = new ExcelUtil<BladeVisualCategory>(BladeVisualCategory.class);
|
||||
// return util.exportExcel(list, "可视化分类数据");
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取可视化分类详细信息
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:visual_category:query')")
|
||||
@GetMapping(value = "/detail")
|
||||
public AjaxResult getInfo(Long id)
|
||||
{
|
||||
return AjaxResult.success(bladeVisualCategoryService.selectBladeVisualCategoryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增可视化分类
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:visual_category:add')")
|
||||
@Log(title = "可视化分类", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/save")
|
||||
public AjaxResult add(@RequestBody BladeVisualCategory bladeVisualCategory)
|
||||
{
|
||||
return toAjax(bladeVisualCategoryService.insertBladeVisualCategory(bladeVisualCategory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改可视化分类
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:visual_category:edit')")
|
||||
@Log(title = "可视化分类", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
public AjaxResult edit(@RequestBody BladeVisualCategory bladeVisualCategory)
|
||||
{
|
||||
return toAjax(bladeVisualCategoryService.updateBladeVisualCategory(bladeVisualCategory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除可视化分类
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:visual_category:remove')")
|
||||
@Log(title = "可视化分类", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
public AjaxResult remove(Long[] ids)
|
||||
{
|
||||
return toAjax(bladeVisualCategoryService.deleteBladeVisualCategoryByIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
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.system.domain.BladeVisualConfig;
|
||||
import com.ruoyi.system.service.IBladeVisualConfigService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 可视化配置Controller
|
||||
*
|
||||
* @author yangsj
|
||||
* @date 2021-10-25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/avue/config")
|
||||
public class BladeVisualConfigController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IBladeVisualConfigService bladeVisualConfigService;
|
||||
|
||||
/**
|
||||
* 查询可视化配置列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:visual_config:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BladeVisualConfig bladeVisualConfig)
|
||||
{
|
||||
startPage();
|
||||
List<BladeVisualConfig> list = bladeVisualConfigService.selectBladeVisualConfigList(bladeVisualConfig);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出可视化配置列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:visual_config:export')")
|
||||
@Log(title = "可视化配置", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(BladeVisualConfig bladeVisualConfig)
|
||||
{
|
||||
List<BladeVisualConfig> list = bladeVisualConfigService.selectBladeVisualConfigList(bladeVisualConfig);
|
||||
ExcelUtil<BladeVisualConfig> util = new ExcelUtil<BladeVisualConfig>(BladeVisualConfig.class);
|
||||
return util.exportExcel(list, "可视化配置数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取可视化配置详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:visual_config:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(bladeVisualConfigService.selectBladeVisualConfigById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增可视化配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:visual_config:add')")
|
||||
@Log(title = "可视化配置", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BladeVisualConfig bladeVisualConfig)
|
||||
{
|
||||
return toAjax(bladeVisualConfigService.insertBladeVisualConfig(bladeVisualConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改可视化配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:visual_config:edit')")
|
||||
@Log(title = "可视化配置", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BladeVisualConfig bladeVisualConfig)
|
||||
{
|
||||
return toAjax(bladeVisualConfigService.updateBladeVisualConfig(bladeVisualConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除可视化配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:visual_config:remove')")
|
||||
@Log(title = "可视化配置", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(bladeVisualConfigService.deleteBladeVisualConfigByIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.page.VisualRespEmbData;
|
||||
import com.ruoyi.system.service.impl.BladeVisualConfigServiceImpl;
|
||||
import com.ruoyi.web.param.BladeVisualParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
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.system.domain.BladeVisual;
|
||||
import com.ruoyi.system.service.IBladeVisualService;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 可视化Controller
|
||||
*
|
||||
* @author yangsj
|
||||
* @date 2021-10-25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/avue/api/visual")
|
||||
public class BladeVisualController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IBladeVisualService bladeVisualService;
|
||||
|
||||
/**
|
||||
* 查询可视化列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:visual:list')")
|
||||
@GetMapping("/list")
|
||||
public VisualRespEmbData list(Long category)
|
||||
{
|
||||
startPage();
|
||||
// List<BladeVisual> list = bladeVisualService.selectBladeVisualList(bladeVisual);
|
||||
List<BladeVisual> list = bladeVisualService.selectVisualListByCategory(category);
|
||||
return getVisualEmbData(list);
|
||||
// return getVisualData(list);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 导出可视化列表
|
||||
// */
|
||||
// @PreAuthorize("@ss.hasPermi('system:visual:export')")
|
||||
// @Log(title = "可视化", businessType = BusinessType.EXPORT)
|
||||
// @GetMapping("/export")
|
||||
// public AjaxResult export(BladeVisual bladeVisual)
|
||||
// {
|
||||
// List<BladeVisual> list = bladeVisualService.selectBladeVisualList(bladeVisual);
|
||||
// ExcelUtil<BladeVisual> util = new ExcelUtil<BladeVisual>(BladeVisual.class);
|
||||
// return util.exportExcel(list, "可视化数据");
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取可视化详细信息
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:visual:query')")
|
||||
@GetMapping(value = "/detail")
|
||||
public AjaxResult getInfo(Long id)
|
||||
{
|
||||
return AjaxResult.success(bladeVisualService.selectBladeVisualById(id));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
BladeVisualConfigServiceImpl configService;
|
||||
|
||||
/**
|
||||
* 新增可视化
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:visual:add')")
|
||||
@Log(title = "可视化", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/save")
|
||||
public AjaxResult add(@RequestBody BladeVisualParam param)
|
||||
{
|
||||
Long id = bladeVisualService.insertBladeVisual(param.getVisual());
|
||||
// 两个表id相同,方便检索
|
||||
param.getConfig().setId(id);
|
||||
param.getConfig().setVisualId(id);
|
||||
configService.insertBladeVisualConfig(param.getConfig());
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("id",String.valueOf(id));
|
||||
return new AjaxResult(200,"操作成功",map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改可视化
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:visual:edit')")
|
||||
@Log(title = "可视化", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
public AjaxResult edit(@RequestBody BladeVisualParam param)
|
||||
{
|
||||
int i = bladeVisualService.updateBladeVisual(param.getVisual());
|
||||
int j = configService.updateBladeVisualConfig(param.getConfig());
|
||||
return toAjax(i > 0 && j > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除可视化
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:visual:remove')")
|
||||
@Log(title = "可视化", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
public AjaxResult remove(Long[] ids)
|
||||
{
|
||||
return toAjax(bladeVisualService.deleteBladeVisualByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 处理大屏预览图片上传
|
||||
* @param file 图片
|
||||
* @return VisualRespEmbData
|
||||
*/
|
||||
@PostMapping("/put-file")
|
||||
public @ResponseBody VisualRespEmbData uploadImg(@RequestParam("file") MultipartFile file) {
|
||||
|
||||
//todo 前端每次更改了同一个大屏后,都重新上传一张新图片,文件名和原来不同,导致预览图片堆积。
|
||||
// 应更改前端,将大屏ID作为预览图片的文件名
|
||||
return bladeVisualService.uploadFile(file);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,106 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.page.VisualRespEmbData;
|
||||
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.system.domain.BladeVisualMap;
|
||||
import com.ruoyi.system.service.IBladeVisualMapService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 可视化地图配置Controller
|
||||
*
|
||||
* @author yangsj
|
||||
* @date 2021-10-25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/avue/api/map")
|
||||
public class BladeVisualMapController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IBladeVisualMapService bladeVisualMapService;
|
||||
|
||||
/**
|
||||
* 查询可视化地图配置列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:visual_map:list')")
|
||||
@GetMapping("/list")
|
||||
public VisualRespEmbData list(BladeVisualMap bladeVisualMap)
|
||||
{
|
||||
startPage();
|
||||
List<BladeVisualMap> list = bladeVisualMapService.selectBladeVisualMapList(bladeVisualMap);
|
||||
return getVisualEmbData(list);
|
||||
// return getDataTable(list);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 导出可视化地图配置列表
|
||||
// */
|
||||
//// @PreAuthorize("@ss.hasPermi('system:visual_map:export')")
|
||||
// @Log(title = "可视化地图配置", businessType = BusinessType.EXPORT)
|
||||
// @GetMapping("/export")
|
||||
// public AjaxResult export(BladeVisualMap bladeVisualMap)
|
||||
// {
|
||||
// List<BladeVisualMap> list = bladeVisualMapService.selectBladeVisualMapList(bladeVisualMap);
|
||||
// ExcelUtil<BladeVisualMap> util = new ExcelUtil<BladeVisualMap>(BladeVisualMap.class);
|
||||
// return util.exportExcel(list, "可视化地图配置数据");
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取可视化地图配置详细信息
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:visual_map:query')")
|
||||
@GetMapping(value = "/detail")
|
||||
public AjaxResult getInfo(Long id)
|
||||
{
|
||||
return AjaxResult.success(bladeVisualMapService.selectBladeVisualMapById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增可视化地图配置
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:visual_map:add')")
|
||||
@Log(title = "可视化地图配置", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/save")
|
||||
public AjaxResult add(@RequestBody BladeVisualMap bladeVisualMap)
|
||||
{
|
||||
return toAjax(bladeVisualMapService.insertBladeVisualMap(bladeVisualMap));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改可视化地图配置
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:visual_map:edit')")
|
||||
@Log(title = "可视化地图配置", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
public AjaxResult edit(@RequestBody BladeVisualMap bladeVisualMap)
|
||||
{
|
||||
return toAjax(bladeVisualMapService.updateBladeVisualMap(bladeVisualMap));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除可视化地图配置
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:visual_map:remove')")
|
||||
@Log(title = "可视化地图配置", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
public AjaxResult remove(Long[] ids)
|
||||
{
|
||||
return toAjax(bladeVisualMapService.deleteBladeVisualMapByIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,148 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.utils.uuid.UUID;
|
||||
import com.ruoyi.web.param.VisualImageAddParam;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
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.system.domain.VisualImage;
|
||||
import com.ruoyi.system.service.IVisualImageService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 图片管理。管理上传的图片Controller
|
||||
*
|
||||
* @author yangsj
|
||||
* @date 2021-10-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/visualImage")
|
||||
public class VisualImageController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IVisualImageService visualImageService;
|
||||
|
||||
/**
|
||||
* 查询图片管理。管理上传的图片列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:image:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(VisualImage visualImage)
|
||||
{
|
||||
startPage();
|
||||
List<VisualImage> list = visualImageService.selectVisualImageList(visualImage);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出图片
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:image:export')")
|
||||
@Log(title = "图片管理。管理上传的图片", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(VisualImage visualImage)
|
||||
{
|
||||
List<VisualImage> list = visualImageService.selectVisualImageList(visualImage);
|
||||
ExcelUtil<VisualImage> util = new ExcelUtil<VisualImage>(VisualImage.class);
|
||||
return util.exportExcel(list, "图片管理。管理上传的图片数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取图片
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:image:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(visualImageService.selectVisualImageById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增图片
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:image:add')")
|
||||
@Log(title = "图片管理。管理上传的图片", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody VisualImage visualImage)
|
||||
{
|
||||
String name = SecurityContextHolder.getContext().getAuthentication().getName();
|
||||
visualImage.setCreateBy(name);
|
||||
visualImageService.divideImage(visualImage);
|
||||
return toAjax(visualImageService.insertVisualImage(visualImage));
|
||||
}
|
||||
|
||||
// @Value("${imageDir.visualImage}")
|
||||
// private String imageDir;
|
||||
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('system:image:add')")
|
||||
// @Log(title = "图片管理。管理上传的图片", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/upload")
|
||||
private AjaxResult uploadImage(@RequestParam MultipartFile file){
|
||||
//todo BUG这里自动注入失败,调用服务会报空指针异常
|
||||
// String newFileName = visualImageService.saveImageToLocal(file);
|
||||
String imageDir = "/images";
|
||||
String filePath = RuoYiConfig.getProfile() + imageDir;
|
||||
File targetFile = new File(filePath);
|
||||
if (!targetFile.exists()) {
|
||||
targetFile.mkdirs();
|
||||
}
|
||||
String[] fileNameSplit = file.getOriginalFilename().split("\\.");
|
||||
String fileType = fileNameSplit[fileNameSplit.length - 1];
|
||||
|
||||
String newFileName = UUID.fastUUID().toString(true) + "." + fileType;
|
||||
String fullFileName = filePath + "/" + newFileName;
|
||||
try {
|
||||
FileOutputStream out = new FileOutputStream(fullFileName);
|
||||
out.write(file.getBytes());
|
||||
out.flush();
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("name",newFileName);
|
||||
return AjaxResult.success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:image:edit')")
|
||||
@Log(title = "图片管理。管理上传的图片", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody VisualImage visualImage)
|
||||
{
|
||||
String name = SecurityContextHolder.getContext().getAuthentication().getName();
|
||||
visualImage.setUpdateBy(name);
|
||||
return toAjax(visualImageService.updateVisualImage(visualImage));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除图片
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:image:remove')")
|
||||
@Log(title = "图片管理。管理上传的图片", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(visualImageService.deleteVisualImageByIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.ruoyi.web.param;
|
||||
|
||||
import com.ruoyi.system.domain.BladeVisual;
|
||||
import com.ruoyi.system.domain.BladeVisualConfig;
|
||||
|
||||
public class BladeVisualParam {
|
||||
private BladeVisualConfig config;
|
||||
|
||||
private BladeVisual visual;
|
||||
|
||||
public BladeVisualParam() {
|
||||
}
|
||||
|
||||
public BladeVisualConfig getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
public void setConfig(BladeVisualConfig config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public BladeVisual getVisual() {
|
||||
return visual;
|
||||
}
|
||||
|
||||
public void setVisual(BladeVisual visual) {
|
||||
this.visual = visual;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VisualAddParam{" +
|
||||
"config=" + config +
|
||||
", visual=" + visual +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.ruoyi.web.param;
|
||||
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
public class VisualImageAddParam {
|
||||
private MultipartFile file;
|
||||
|
||||
private Integer width;
|
||||
|
||||
private Integer heigth;
|
||||
|
||||
public VisualImageAddParam() {
|
||||
}
|
||||
|
||||
public MultipartFile getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
public void setFile(MultipartFile file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public Integer getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public void setWidth(Integer width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public Integer getHeigth() {
|
||||
return heigth;
|
||||
}
|
||||
|
||||
public void setHeigth(Integer heigth) {
|
||||
this.heigth = heigth;
|
||||
}
|
||||
}
|
@ -6,16 +6,16 @@ spring:
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://172.17.172.240:3306/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: password
|
||||
password: 123456
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
@ -35,7 +35,7 @@ spring:
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
@ -54,4 +54,4 @@ spring:
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
multi-statement-allow: true
|
||||
|
@ -9,12 +9,20 @@ ruoyi:
|
||||
# 实例演示开关
|
||||
demoEnabled: true
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: D:/ruoyi/uploadPath
|
||||
# profile: F:/ruoyi/uploadPath
|
||||
profile: /home/yangsj/bigScreen
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数组计算 char 字符验证
|
||||
captchaType: math
|
||||
|
||||
imageDir:
|
||||
# 大屏的预览图片存放文件夹名
|
||||
bigScreen: /overview
|
||||
# 其他图片存放文件夹名
|
||||
visualImage: /images
|
||||
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
@ -42,7 +50,7 @@ spring:
|
||||
messages:
|
||||
# 国际化资源文件路径
|
||||
basename: i18n/messages
|
||||
profiles:
|
||||
profiles:
|
||||
active: druid
|
||||
# 文件上传
|
||||
servlet:
|
||||
@ -59,13 +67,13 @@ spring:
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: localhost
|
||||
host: 172.17.172.240
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
database: 4
|
||||
# 密码
|
||||
password:
|
||||
password: ydd123456
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
@ -87,7 +95,7 @@ token:
|
||||
secret: abcdefghijklmnopqrstuvwxyz
|
||||
# 令牌有效期(默认30分钟)
|
||||
expireTime: 30
|
||||
|
||||
|
||||
# MyBatis配置
|
||||
mybatis:
|
||||
# 搜索指定包别名
|
||||
@ -98,10 +106,10 @@ mybatis:
|
||||
configLocation: classpath:mybatis/mybatis-config.xml
|
||||
|
||||
# PageHelper分页插件
|
||||
pagehelper:
|
||||
pagehelper:
|
||||
helperDialect: mysql
|
||||
supportMethodsArguments: true
|
||||
params: count=countSql
|
||||
params: count=countSql
|
||||
|
||||
# Swagger配置
|
||||
swagger:
|
||||
@ -111,10 +119,16 @@ swagger:
|
||||
pathMapping: /dev-api
|
||||
|
||||
# 防止XSS攻击
|
||||
xss:
|
||||
xss:
|
||||
# 过滤开关
|
||||
enabled: true
|
||||
# 排除链接(多个用逗号分隔)
|
||||
excludes: /system/notice
|
||||
# 匹配链接
|
||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||
|
||||
|
||||
#bigScreen:
|
||||
# prefix: /overview
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="/home/ruoyi/logs" />
|
||||
<property name="log.path" value="/home/yangsj/logs" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-info.log</file>
|
||||
@ -34,7 +34,7 @@
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
@ -56,7 +56,7 @@
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
|
||||
<!-- 用户访问日志输出 -->
|
||||
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-user.log</file>
|
||||
@ -70,7 +70,7 @@
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.ruoyi" level="info" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
@ -79,15 +79,15 @@
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
</root>
|
||||
|
||||
|
||||
<!--系统用户操作日志-->
|
||||
<logger name="sys-user" level="info">
|
||||
<appender-ref ref="sys-user"/>
|
||||
</logger>
|
||||
</configuration>
|
||||
</configuration>
|
||||
|
Reference in New Issue
Block a user