master
parent
96e58427d8
commit
d28ab3322c
12 changed files with 184 additions and 90 deletions
@ -1,47 +0,0 @@ |
||||
package com.daqing.financial.guarantee.controller; |
||||
|
||||
import cn.hutool.core.util.IdUtil; |
||||
import com.daqing.financial.guarantee.util.ImgUtil; |
||||
import com.daqing.financial.guarantee.util.R; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
import java.io.IOException; |
||||
|
||||
/** |
||||
* @Author chen |
||||
* @DATE 2021/1/15 9:43 |
||||
* @Version 1.0 |
||||
* 抄送控制器 |
||||
*/ |
||||
@Api(tags = {"抄送API"}) |
||||
@RestController |
||||
@RequestMapping("/copy-send") |
||||
public class CopySendController { |
||||
|
||||
|
||||
@ApiOperation("base转换图片") |
||||
@GetMapping("/conversionImg") |
||||
public R conversionImg(String imgData){ |
||||
//获取随机值
|
||||
String snowflakeId = IdUtil.getSnowflake(6, 4).nextIdStr(); |
||||
//文件扩展名
|
||||
String ext = ".png"; |
||||
//新文件名:雪花算法.文件扩展名
|
||||
String newName = snowflakeId + ext; |
||||
//指定存放目录
|
||||
String directory = "D:/img/"; |
||||
//图片完整路径
|
||||
String imgPath = directory+newName; |
||||
try { |
||||
ImgUtil.generateImage(imgData,imgPath); |
||||
} catch (IOException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
return R.ok(); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue