();
+ hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
+ hints.put(EncodeHintType.CHARACTER_SET, CHARSET);
+ hints.put(EncodeHintType.MARGIN, 1);
+ BitMatrix bitMatrix = new MultiFormatWriter().encode(content,
+ BarcodeFormat.QR_CODE, size, size, hints);
+ int width = bitMatrix.getWidth();
+ int height = bitMatrix.getHeight();
+ BufferedImage image = new BufferedImage(width, height,
+ BufferedImage.TYPE_INT_RGB);
+ for (int x = 0; x < width; x++) {
+ for (int y = 0; y < height; y++) {
+ image.setRGB(x, y, bitMatrix.get(x, y) ? BLUE_FOREGROUND_COLOR
+ : 0xFFFFFFFF);
+ }
+ }
+ // 从classpath读取LOGO图片并插入二维码中间
+ InputStream logoStream = QRCodeUtil.class.getClassLoader().getResourceAsStream(EMBEDDED_LOGO_PATH);
+ if (logoStream != null) {
+ Image logo = ImageIO.read(logoStream);
+ logoStream.close();
+ int logoWidth = Math.min(logo.getWidth(null), 100);
+ int logoHeight = Math.min(logo.getHeight(null), 100);
+ Image scaledLogo = logo.getScaledInstance(logoWidth, logoHeight, Image.SCALE_SMOOTH);
+ Graphics2D graph = image.createGraphics();
+ int x = (size - logoWidth) / 2;
+ int y = (size - logoHeight) / 2;
+ graph.drawImage(scaledLogo, x, y, logoWidth, logoHeight, null);
+ Shape shape = new RoundRectangle2D.Float(x, y, logoWidth, logoHeight, 6, 6);
+ graph.setStroke(new BasicStroke(3f));
+ graph.draw(shape);
+ graph.dispose();
+ }
+ return image;
+ }
+
+ public static MultipartFile getMultipartFile(File file) {
+ try (InputStream input = new FileInputStream(file)) {
+ return new MockMultipartFile(
+ "file", // 字段名
+ file.getName(), // 原始文件名
+ MediaType.IMAGE_JPEG_VALUE, // 文件类型
+ input.readAllBytes() // 文件内容
+ );
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Invalid file: " + e, e);
+ }
+ }
+
+
+ public static void main(String[] args) throws Exception {
+ String text = "https://www.baidu.com/s?ie=UTF-8&wd=%E7%99%BE%E5%BA%A6";
+ //这里设置自定义网站url
+ String logoPath =null;
+ String destPath = "d:\\pic\\";
+// String url=QRCodeUtil.encode(text, logoPath, destPath, true);
+// System.out.println(url);
+
+
+ /* String file="D:\\11.jpg";
+ String info=QRCodeUtil.decode(file);
+ System.out.println(info);*/
+ // 将地址转换为二维码图片 base64编码返回给页面
+ String base64 = getBase64(text);
+ System.out.println("data:image/jpeg;base64," + base64);
+ }
+
+}
diff --git a/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/common/util/file/FileTypeUtils.java b/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/common/util/file/FileTypeUtils.java
new file mode 100644
index 00000000..51028ce5
--- /dev/null
+++ b/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/common/util/file/FileTypeUtils.java
@@ -0,0 +1,51 @@
+package com.zdxt.enforcementcode.common.util.file;
+
+
+
+import org.dromara.common.core.utils.StringUtils;
+
+import java.io.File;
+
+/**
+ * Created with IntelliJ IDEA.
+ * Description:
+ * User: ouyunhui
+ * Date: 2020-12-08
+ * Time: 15:59
+ */
+public class FileTypeUtils {
+ /**
+ * 获取文件类型
+ *
+ * 例如: ruoyi.txt, 返回: txt
+ *
+ * @param file 文件名
+ * @return 后缀(不含".")
+ */
+ public static String getFileType(File file)
+ {
+ if (null == file)
+ {
+ return StringUtils.EMPTY;
+ }
+ return getFileType(file.getName());
+ }
+
+ /**
+ * 获取文件类型
+ *
+ * 例如: ruoyi.txt, 返回: txt
+ *
+ * @param fileName 文件名
+ * @return 后缀(不含".")
+ */
+ public static String getFileType(String fileName)
+ {
+ int separatorIndex = fileName.lastIndexOf(".");
+ if (separatorIndex < 0)
+ {
+ return "";
+ }
+ return fileName.substring(separatorIndex + 1).toLowerCase();
+ }
+}
diff --git a/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/common/util/file/FileUploadUtils.java b/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/common/util/file/FileUploadUtils.java
new file mode 100644
index 00000000..413bd0e0
--- /dev/null
+++ b/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/common/util/file/FileUploadUtils.java
@@ -0,0 +1,252 @@
+package com.zdxt.enforcementcode.common.util.file;
+
+
+import com.zdxt.enforcementcode.common.Constants;
+import com.zdxt.enforcementcode.common.config.RuoYiConfig;
+import com.zdxt.enforcementcode.common.util.Md5Utils;
+import com.zdxt.enforcementcode.exception.FileSizeLimitExceededException;
+import com.zdxt.enforcementcode.exception.InvalidExtensionException;
+import org.apache.commons.io.FilenameUtils;
+import org.dromara.common.core.exception.base.BaseException;
+import org.dromara.common.core.utils.DateUtils;
+import org.dromara.common.core.utils.StringUtils;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * 文件上传工具类
+ *
+ * @author ruoyi
+ */
+public class FileUploadUtils
+{
+ /**
+ * 默认大小 50M
+ */
+ public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024;
+
+ /**
+ * 默认的文件名最大长度 100
+ */
+ public static final int DEFAULT_FILE_NAME_LENGTH = 100;
+
+ /**
+ * 常见的视频类型
+ */
+ public static final String VIDEO_TYPE = "rm|rmvb|wmv|avi|mp4|3gp|mkvrm|rmvb|avi|mp4|3gp|mkv";
+
+ /**
+ * 默认上传的地址
+ */
+ private static String defaultBaseDir = RuoYiConfig.getProfile();
+
+ private static int counter = 0;
+
+ public static void setDefaultBaseDir(String defaultBaseDir)
+ {
+ FileUploadUtils.defaultBaseDir = defaultBaseDir;
+ }
+
+ public static String getDefaultBaseDir()
+ {
+ return defaultBaseDir;
+ }
+
+ /**
+ * 以默认配置进行文件上传
+ *
+ * @param file 上传的文件
+ * @return 文件名称
+ * @throws Exception
+ */
+ public static final String upload(MultipartFile file) throws IOException
+ {
+ try
+ {
+ return upload(getDefaultBaseDir(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
+ }
+ catch (Exception e)
+ {
+ throw new IOException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * 根据文件路径上传
+ *
+ * @param baseDir 相对应用的基目录
+ * @param file 上传的文件
+ * @return 文件名称
+ * @throws IOException`
+ */
+ public static final String upload(String baseDir, MultipartFile file) throws IOException
+ {
+ try
+ {
+ return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
+ }
+ catch (Exception e)
+ {
+ throw new IOException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * 文件上传
+ *
+ * @param baseDir 相对应用的基目录
+ * @param file 上传的文件
+ * @return 返回上传成功的文件名
+ * @throws FileSizeLimitExceededException 如果超出最大大小
+ * @throws IOException 比如读写文件出错时
+ * @throws InvalidExtensionException 文件校验异常
+ */
+ public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension)
+ throws Exception
+ {
+ int fileNamelength = file.getOriginalFilename().length();
+ if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH)
+ {
+ throw new Exception("文件名称过长");
+ }
+
+ assertAllowed(file, allowedExtension);
+
+ String fileName = extractFilename(file);
+
+ File desc = getAbsoluteFile(baseDir, fileName);
+ file.transferTo(desc);
+ String pathFileName = getPathFileName(baseDir, fileName);
+ return pathFileName;
+ }
+
+ /**
+ * 编码文件名
+ */
+ public static final String extractFilename(MultipartFile file)
+ {
+ String fileName = file.getOriginalFilename();
+ String extension = getExtension(file);
+ fileName = DateUtils.datePath() + "/" + encodingFilename(fileName) + "." + extension;
+ return fileName;
+ }
+
+ private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException
+ {
+ File desc = new File(uploadDir + File.separator + fileName);
+
+ if (!desc.getParentFile().exists())
+ {
+ desc.getParentFile().mkdirs();
+ }
+ if (!desc.exists())
+ {
+ desc.createNewFile();
+ }
+ return desc;
+ }
+
+ private static final String getPathFileName(String uploadDir, String fileName) throws IOException
+ {
+ int dirLastIndex = RuoYiConfig.getProfile().length() + 1;
+ String currentDir = StringUtils.substring(uploadDir, dirLastIndex);
+ String pathFileName = Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName;
+ return pathFileName;
+ }
+
+ /**
+ * 编码文件名
+ */
+ private static final String encodingFilename(String fileName)
+ {
+ fileName = fileName.replace("_", " ");
+ fileName = Md5Utils.hash(fileName + System.nanoTime() + counter++);
+ return fileName;
+ }
+
+ /**
+ * 文件大小校验
+ *
+ * @param file 上传的文件
+ * @return
+ */
+ public static final void assertAllowed(MultipartFile file, String[] allowedExtension)
+ throws Exception
+ {
+ long size = file.getSize();
+
+ int begin = file.getOriginalFilename().lastIndexOf(".");
+ int last = file.getOriginalFilename().length();
+ //获得文件后缀名
+ String a = file.getOriginalFilename().substring(begin+1, last);
+ if(VIDEO_TYPE.indexOf(a) == -1){ //判断是否是视频
+ if (DEFAULT_MAX_SIZE != -1 && size > DEFAULT_MAX_SIZE)
+ {
+ throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024);
+ }
+ }
+
+ String fileName = file.getOriginalFilename();
+ String extension = getExtension(file);
+ if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension))
+ {
+ if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION)
+ {
+ throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension,
+ fileName);
+ }
+ else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION)
+ {
+ throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension,
+ fileName);
+ }
+ else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION)
+ {
+ throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension,
+ fileName);
+ }
+ else
+ {
+ throw new InvalidExtensionException(allowedExtension, extension, fileName);
+ }
+ }
+
+ }
+
+ /**
+ * 判断MIME类型是否是允许的MIME类型
+ *
+ * @param extension
+ * @param allowedExtension
+ * @return
+ */
+ public static final boolean isAllowedExtension(String extension, String[] allowedExtension)
+ {
+ for (String str : allowedExtension)
+ {
+ if (str.equalsIgnoreCase(extension))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * 获取文件名的后缀
+ *
+ * @param file 表单文件
+ * @return 后缀名
+ */
+ public static final String getExtension(MultipartFile file)
+ {
+ String extension = FilenameUtils.getExtension(file.getOriginalFilename());
+ if (StringUtils.isEmpty(extension))
+ {
+ extension = MimeTypeUtils.getExtension(file.getContentType());
+ }
+ return extension;
+ }
+}
diff --git a/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/common/util/file/FileUtils.java b/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/common/util/file/FileUtils.java
new file mode 100644
index 00000000..4b588ece
--- /dev/null
+++ b/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/common/util/file/FileUtils.java
@@ -0,0 +1,138 @@
+package com.zdxt.enforcementcode.common.util.file;
+
+
+import jakarta.servlet.http.HttpServletRequest;
+
+import java.io.*;
+import java.net.URLEncoder;
+
+/**
+ * 文件处理工具类
+ *
+ * @author ruoyi
+ */
+public class FileUtils
+{
+ public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+";
+
+ /**
+ * 输出指定文件的byte数组
+ *
+ * @param filePath 文件路径
+ * @param os 输出流
+ * @return
+ */
+ public static void writeBytes(String filePath, OutputStream os) throws IOException
+ {
+ FileInputStream fis = null;
+ try
+ {
+ File file = new File(filePath);
+ if (!file.exists())
+ {
+ throw new FileNotFoundException(filePath);
+ }
+ fis = new FileInputStream(file);
+ byte[] b = new byte[1024];
+ int length;
+ while ((length = fis.read(b)) > 0)
+ {
+ os.write(b, 0, length);
+ }
+ }
+ catch (IOException e)
+ {
+ throw e;
+ }
+ finally
+ {
+ if (os != null)
+ {
+ try
+ {
+ os.close();
+ }
+ catch (IOException e1)
+ {
+ e1.printStackTrace();
+ }
+ }
+ if (fis != null)
+ {
+ try
+ {
+ fis.close();
+ }
+ catch (IOException e1)
+ {
+ e1.printStackTrace();
+ }
+ }
+ }
+ }
+
+ /**
+ * 删除文件
+ *
+ * @param filePath 文件
+ * @return
+ */
+ public static boolean deleteFile(String filePath)
+ {
+ boolean flag = false;
+ File file = new File(filePath);
+ // 路径为文件且不为空则进行删除
+ if (file.isFile() && file.exists())
+ {
+ file.delete();
+ flag = true;
+ }
+ return flag;
+ }
+
+ /**
+ * 文件名称验证
+ *
+ * @param filename 文件名称
+ * @return true 正常 false 非法
+ */
+ public static boolean isValidFilename(String filename)
+ {
+ return filename.matches(FILENAME_PATTERN);
+ }
+
+ /**
+ * 下载文件名重新编码
+ *
+ * @param request 请求对象
+ * @param fileName 文件名
+ * @return 编码后的文件名
+ */
+ public static String setFileDownloadHeader(HttpServletRequest request, String fileName) throws UnsupportedEncodingException
+ {
+ final String agent = request.getHeader("USER-AGENT");
+ String filename = fileName;
+ if (agent.contains("MSIE"))
+ {
+ // IE浏览器
+ filename = URLEncoder.encode(filename, "utf-8");
+ filename = filename.replace("+", " ");
+ }
+ else if (agent.contains("Firefox"))
+ {
+ // 火狐浏览器
+ filename = new String(fileName.getBytes(), "ISO8859-1");
+ }
+ else if (agent.contains("Chrome"))
+ {
+ // google浏览器
+ filename = URLEncoder.encode(filename, "utf-8");
+ }
+ else
+ {
+ // 其它浏览器
+ filename = URLEncoder.encode(filename, "utf-8");
+ }
+ return filename;
+ }
+}
diff --git a/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/common/util/file/MimeTypeUtils.java b/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/common/util/file/MimeTypeUtils.java
new file mode 100644
index 00000000..ce41ead2
--- /dev/null
+++ b/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/common/util/file/MimeTypeUtils.java
@@ -0,0 +1,55 @@
+package com.zdxt.enforcementcode.common.util.file;
+
+/**
+ * 媒体类型工具类
+ *
+ * @author ruoyi
+ */
+public class MimeTypeUtils
+{
+ public static final String IMAGE_PNG = "image/png";
+
+ public static final String IMAGE_JPG = "image/jpg";
+
+ public static final String IMAGE_JPEG = "image/jpeg";
+
+ public static final String IMAGE_BMP = "image/bmp";
+
+ public static final String IMAGE_GIF = "image/gif";
+
+ public static final String[] IMAGE_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png" };
+
+ public static final String[] FLASH_EXTENSION = { "swf", "flv" };
+
+ public static final String[] MEDIA_EXTENSION = { "swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg",
+ "asf", "rm", "rmvb" };
+
+ public static final String[] DEFAULT_ALLOWED_EXTENSION = {
+ // 图片
+ "bmp", "gif", "jpg", "jpeg", "png",
+ // word excel powerpoint
+ "doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt",
+ // 压缩文件
+ "rar", "zip", "gz", "bz2",
+ // pdf
+ "pdf","apk", "mp4" , "mkv"};
+
+ public static String getExtension(String prefix)
+ {
+ switch (prefix)
+ {
+ case IMAGE_PNG:
+ return "png";
+ case IMAGE_JPG:
+ return "jpg";
+ case IMAGE_JPEG:
+ return "jpeg";
+ case IMAGE_BMP:
+ return "bmp";
+ case IMAGE_GIF:
+ return "gif";
+ default:
+ return "";
+ }
+ }
+}
diff --git a/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/controller/app/enterprise/AppEnterpriseLoginController.java b/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/controller/app/enterprise/AppEnterpriseLoginController.java
index 9c61ca5f..c5abf117 100644
--- a/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/controller/app/enterprise/AppEnterpriseLoginController.java
+++ b/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/controller/app/enterprise/AppEnterpriseLoginController.java
@@ -1,18 +1,22 @@
package com.zdxt.enforcementcode.controller.app.enterprise;
+import cn.dev33.satoken.annotation.SaIgnore;
import com.zdxt.enforcementcode.domain.bo.enterprise.AppEnterpriseLoginBo;
import com.zdxt.enforcementcode.service.enterprise.IAppEnterpriseLoginService;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
+import org.dromara.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
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.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
+import java.util.Map;
+
/**
* 企业端-用户登录
*/
@@ -20,24 +24,20 @@ import org.springframework.web.bind.annotation.RestController;
@Validated
@RequiredArgsConstructor
@RestController
-@RequestMapping("/app-ent/login")
+@RequestMapping("/enterprise/login")
public class AppEnterpriseLoginController {
-
-
@Autowired
private IAppEnterpriseLoginService appEnterpriseLoginService;
/**
- * 企业端用户登录
+ * 企业端用户登录(深i企)
*/
+ @SaIgnore
@ApiResponse(description = "企业端-用户登录")
- @PostMapping("siqLogin")
- @ResponseBody
- public Boolean siqLogin(AppEnterpriseLoginBo bo){
-
- Boolean flag = appEnterpriseLoginService.addSiqUser(bo);
-
- return flag;
+ @PostMapping("/siqLogin")
+ public R