diff --git a/lib/minio-7.0.2-all.jar b/lib/minio-7.0.2-all.jar
new file mode 100644
index 0000000..74d1664
Binary files /dev/null and b/lib/minio-7.0.2-all.jar differ
diff --git a/pom.xml b/pom.xml
index 134163c..0484aed 100644
--- a/pom.xml
+++ b/pom.xml
@@ -163,7 +163,13 @@
-
+
+ io.minio
+ minio
+ 7.0.2-all
+ system
+ ${project.basedir}/lib/minio-7.0.2-all.jar
+
io.netty
diff --git a/src/main/java/com/fxzy/warn/common/conf/MinioConfig.java b/src/main/java/com/fxzy/warn/common/conf/MinioConfig.java
new file mode 100644
index 0000000..5366b74
--- /dev/null
+++ b/src/main/java/com/fxzy/warn/common/conf/MinioConfig.java
@@ -0,0 +1,295 @@
+package com.fxzy.warn.common.conf;
+
+import com.fxzy.warn.common.util.TimeUtil;
+import io.minio.MinioClient;
+import io.minio.ObjectStat;
+import io.minio.PutObjectOptions;
+import io.minio.Result;
+import io.minio.messages.Bucket;
+import io.minio.messages.Item;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.tomcat.util.http.fileupload.IOUtils;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.springframework.util.Assert;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.util.UriUtils;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.InputStream;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+
+@Component
+public class MinioConfig implements InitializingBean {
+
+ @Value(value = "${minio.bucket}")
+ private String bucket;
+
+ @Value(value = "${minio.host}")
+ private String host;
+
+ @Value(value = "${minio.url}")
+ private String url;
+
+ @Value(value = "${minio.access-key}")
+ private String accessKey;
+
+ @Value(value = "${minio.secret-key}")
+ private String secretKey;
+
+ private MinioClient minioClient;
+
+ @Override
+ public void afterPropertiesSet() throws Exception {
+ Assert.hasText(url, "Minio url 为空");
+ Assert.hasText(accessKey, "Minio accessKey为空");
+ Assert.hasText(secretKey, "Minio secretKey为空");
+ this.minioClient = new MinioClient(this.host, this.accessKey, this.secretKey);
+ }
+
+
+ /**
+ * 上传
+ */
+ public String putObject(MultipartFile multipartFile) throws Exception {
+ // bucket 不存在,创建
+ if (!minioClient.bucketExists(this.bucket)) {
+ minioClient.makeBucket(this.bucket);
+ }
+ try (InputStream inputStream = multipartFile.getInputStream()) {
+ // 上传文件的名称
+ String multipartFileName = StringUtils.isNotBlank(multipartFile.getOriginalFilename()) ? multipartFile.getOriginalFilename() : multipartFile.getName();
+ String suffix = multipartFileName
+ .substring(multipartFileName.lastIndexOf("."));//文件后缀
+ //获取附件上传路径
+ String fileName = UUID.randomUUID().toString().replace("-", "") + TimeUtil
+ .formatTimeyyyyMMdd() + suffix;//文件名重新命名,避免重复
+
+ // PutObjectOptions,上传配置(文件大小,内存中文件分片大小)
+ PutObjectOptions putObjectOptions = new PutObjectOptions(multipartFile.getSize(), PutObjectOptions.MIN_MULTIPART_SIZE);
+ // 文件的ContentType
+ putObjectOptions.setContentType(multipartFile.getContentType());
+ minioClient.putObject(this.bucket, fileName, inputStream, putObjectOptions);
+ // 返回访问路径
+ return UriUtils.encode(fileName, String.valueOf(StandardCharsets.UTF_8));
+ }
+ }
+
+
+ /**
+ * 上传
+ */
+ public String putObject(MultipartFile multipartFile,String fileName) throws Exception {
+ // bucket 不存在,创建
+ if (!minioClient.bucketExists(this.bucket)) {
+ minioClient.makeBucket(this.bucket);
+ }
+ try (InputStream inputStream = multipartFile.getInputStream()) {
+ // 上传文件的名称
+ String multipartFileName = StringUtils.isNotBlank(multipartFile.getOriginalFilename()) ? multipartFile.getOriginalFilename() : multipartFile.getName();
+ String suffix = multipartFileName
+ .substring(multipartFileName.lastIndexOf("."));//文件后缀
+ //获取附件上传路径
+
+
+ // PutObjectOptions,上传配置(文件大小,内存中文件分片大小)
+ PutObjectOptions putObjectOptions = new PutObjectOptions(multipartFile.getSize(), PutObjectOptions.MIN_MULTIPART_SIZE);
+ // 文件的ContentType
+ putObjectOptions.setContentType(multipartFile.getContentType());
+ minioClient.putObject(this.bucket, fileName, inputStream, putObjectOptions);
+ // 返回访问路径
+ return UriUtils.encode(fileName, String.valueOf(StandardCharsets.UTF_8));
+ }
+ }
+
+ /**
+ * 文件下载
+ */
+ public void download(String fileName, HttpServletResponse response) {
+ // 从链接中得到文件名
+ InputStream inputStream;
+ try {
+ MinioClient minioClient = new MinioClient(host, accessKey, secretKey);
+ ObjectStat stat = minioClient.statObject(bucket, fileName);
+ inputStream = minioClient.getObject(bucket, fileName);
+ response.setContentType(stat.contentType());
+ response.setCharacterEncoding("UTF-8");
+ response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
+ IOUtils.copy(inputStream, response.getOutputStream());
+ inputStream.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.out.println("有异常:" + e);
+ }
+ }
+
+ /**
+ * 列出所有存储桶名称
+ *
+ * @return
+ * @throws Exception
+ */
+ public List listBucketNames()
+ throws Exception {
+ List bucketList = listBuckets();
+ List bucketListName = new ArrayList<>();
+ for (Bucket bucket : bucketList) {
+ bucketListName.add(bucket.name());
+ }
+ return bucketListName;
+ }
+
+ /**
+ * 查看所有桶
+ *
+ * @return
+ * @throws Exception
+ */
+ public List listBuckets()
+ throws Exception {
+ return minioClient.listBuckets();
+ }
+
+ /**
+ * 检查存储桶是否存在
+ *
+ * @param bucketName
+ * @return
+ * @throws Exception
+ */
+ public boolean bucketExists(String bucketName) throws Exception {
+ boolean flag = minioClient.bucketExists(bucketName);
+ if (flag) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * 创建存储桶
+ *
+ * @param bucketName
+ * @return
+ * @throws Exception
+ */
+ public boolean makeBucket(String bucketName)
+ throws Exception {
+ boolean flag = bucketExists(bucketName);
+ if (!flag) {
+ minioClient.makeBucket(bucketName);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * 删除桶
+ *
+ * @param bucketName
+ * @return
+ * @throws Exception
+ */
+ public boolean removeBucket(String bucketName)
+ throws Exception {
+ boolean flag = bucketExists(bucketName);
+ if (flag) {
+ Iterable> myObjects = listObjects(bucketName);
+ for (Result- result : myObjects) {
+ Item item = result.get();
+ // 有对象文件,则删除失败
+ if (item.size() > 0) {
+ return false;
+ }
+ }
+ // 删除存储桶,注意,只有存储桶为空时才能删除成功。
+ minioClient.removeBucket(bucketName);
+ flag = bucketExists(bucketName);
+ if (!flag) {
+ return true;
+ }
+
+ }
+ return false;
+ }
+
+ /**
+ * 列出存储桶中的所有对象
+ *
+ * @param bucketName 存储桶名称
+ * @return
+ * @throws Exception
+ */
+ public Iterable> listObjects(String bucketName) throws Exception {
+ boolean flag = bucketExists(bucketName);
+ if (flag) {
+ return minioClient.listObjects(bucketName);
+ }
+ return null;
+ }
+
+ /**
+ * 列出存储桶中的所有对象名称
+ *
+ * @param bucketName 存储桶名称
+ * @return
+ * @throws Exception
+ */
+ public List listObjectNames(String bucketName) throws Exception {
+ List listObjectNames = new ArrayList<>();
+ boolean flag = bucketExists(bucketName);
+ if (flag) {
+ Iterable> myObjects = listObjects(bucketName);
+ for (Result
- result : myObjects) {
+ Item item = result.get();
+ listObjectNames.add(item.objectName());
+ }
+ }
+ return listObjectNames;
+ }
+
+ /**
+ * 删除一个对象
+ *
+ * @param bucketName 存储桶名称
+ * @param objectName 存储桶里的对象名称
+ * @throws Exception
+ */
+ public boolean removeObject(String bucketName, String objectName) throws Exception {
+ boolean flag = bucketExists(bucketName);
+ if (flag) {
+ List objectList = listObjectNames(bucketName);
+ for (String s : objectList) {
+ if (s.equals(objectName)) {
+ minioClient.removeObject(bucketName, objectName);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * 文件访问路径
+ *
+ * @param bucketName 存储桶名称
+ * @param objectName 存储桶里的对象名称
+ * @return
+ * @throws Exception
+ */
+ public String getObjectUrl(String bucketName, String objectName) throws Exception {
+ boolean flag = bucketExists(bucketName);
+ String url = "";
+ if (flag) {
+ url = minioClient.getObjectUrl(bucketName, objectName);
+ }
+ return url;
+ }
+
+}
diff --git a/src/main/java/com/fxzy/warn/common/constants/AuthorizationConstants.java b/src/main/java/com/fxzy/warn/common/constants/AuthorizationConstants.java
new file mode 100644
index 0000000..7a3ad95
--- /dev/null
+++ b/src/main/java/com/fxzy/warn/common/constants/AuthorizationConstants.java
@@ -0,0 +1,30 @@
+package com.fxzy.warn.common.constants;
+
+/**
+ * @author zhangjing
+ * @date 2024/12/05 17:35
+ * @description
+ */
+public class AuthorizationConstants {
+ /**
+ * 用户授权状态常量
+ */
+ // 待申请
+ public static final int STATUS_PENDING_APPLICATION = 0;
+ // 待审批
+ public static final int STATUS_PENDING_APPROVAL = 1;
+ // 授权有效
+ public static final int STATUS_AUTHORIZED_VALID = 2;
+ // 授权过期
+ public static final int STATUS_AUTHORIZED_EXPIRED = 3;
+
+ /**
+ * 审核状态常量
+ */
+ // 待审核
+ public static final int AUDIT_STATUS_PENDING = 0;
+ // 通过
+ public static final int AUDIT_STATUS_APPROVED = 1;
+ // 拒绝
+ public static final int AUDIT_STATUS_REJECTED = 2;
+}
diff --git a/src/main/java/com/fxzy/warn/common/constants/EntityConstants.java b/src/main/java/com/fxzy/warn/common/constants/EntityConstants.java
index 034625c..68d33c7 100644
--- a/src/main/java/com/fxzy/warn/common/constants/EntityConstants.java
+++ b/src/main/java/com/fxzy/warn/common/constants/EntityConstants.java
@@ -17,21 +17,10 @@ public class EntityConstants {
public final static Integer DEL = 1;
/**
- * 此处为冯海磊设置的常量
- * 为状态量时 (0-正常,1-停用)
- * 为is开头的是否值时 (0-是,1-否)
+ * 是否上架
*/
- public final static Integer HL_YES = 0;
- public final static Integer HL_NO = 1;
+ public final static Integer IS_ONLINE = 1;
- /**
- * 用户类型:0:默认 1:市级;2:区县;3:企业,4:群众
- */
- public final static Integer USER_TYPE_DEFAULT = 0;
- public final static Integer USER_TYPE_CITY = 1;
- public final static Integer USER_TYPE_AREA = 2;
- public final static Integer USER_TYPE_UNIT = 3;
- public final static Integer USER_TYPE_PUBLIC = 4;
}
diff --git a/src/main/java/com/fxzy/warn/common/constants/RedisKeyConstants.java b/src/main/java/com/fxzy/warn/common/constants/RedisKeyConstants.java
index 9640bfc..18c6cd3 100644
--- a/src/main/java/com/fxzy/warn/common/constants/RedisKeyConstants.java
+++ b/src/main/java/com/fxzy/warn/common/constants/RedisKeyConstants.java
@@ -9,15 +9,15 @@ package com.fxzy.warn.common.constants;
public class RedisKeyConstants {
/**用户是否锁定key*/
- public final static String USER_LOCK_KEY = "gas_apportal:user:lock:";
+ public final static String USER_LOCK_KEY = "fxzy_warn:user:lock:";
/**登录ST*/
- public final static String LOGIN_ST = "gas_wx:login:st:";
+ public final static String LOGIN_ST = "fxzy_warn:login:st:";
public final static String LOGIN_ST_HEADER = "ST-";
/**登录随机数验证码*/
- public final static String LOGIN_RANDOM_CAPTCHA = "gas_apportal:login:random:captcha-";
+ public final static String LOGIN_RANDOM_CAPTCHA = "fxzy_warn:login:random:captcha-";
/**登录随机数验证码图片类型*/
public final static String LOGIN_RANDOM_CAPTCHA_IMG_TYPE = ".jpg";
diff --git a/src/main/java/com/fxzy/warn/common/constants/ResponseMsgConstants.java b/src/main/java/com/fxzy/warn/common/constants/ResponseMsgConstants.java
index a85c2a3..2bfb39e 100644
--- a/src/main/java/com/fxzy/warn/common/constants/ResponseMsgConstants.java
+++ b/src/main/java/com/fxzy/warn/common/constants/ResponseMsgConstants.java
@@ -30,7 +30,8 @@ public class ResponseMsgConstants {
public final static String OPERATE_FAIL = "操作失败";
public final static String CODE_SENT_SUCCESSFULLY = "验证码已发送";
- public final static String CODE_EXPIRED_PLEASE_RESEND = "验证码已失效,请重新发送";
+ public final static String CODE_EXPIRED_PLEASE_RESEND = "验证码已过期,请重新发送";
+ public final static String CODE_ERROR = "验证码错误";
public final static String USER_PHONE_EXIST = "该手机号已存在";
public final static String OPERATE_SYS_ERROR = "系统异常";
diff --git a/src/main/java/com/fxzy/warn/common/response/ApiResponse.java b/src/main/java/com/fxzy/warn/common/response/ApiResponse.java
index d94bef5..9e2c701 100644
--- a/src/main/java/com/fxzy/warn/common/response/ApiResponse.java
+++ b/src/main/java/com/fxzy/warn/common/response/ApiResponse.java
@@ -51,10 +51,13 @@ public class ApiResponse implements Serializable {
}
public void recordError(String error) {
+ this.code = 500;
+ this.message = error;
+ }
+ public void recordMsgError(String error) {
this.code = 999;
this.message = error;
}
-
public int getCode() {
return code;
}
diff --git a/src/main/java/com/fxzy/warn/common/util/JWTUtil.java b/src/main/java/com/fxzy/warn/common/util/JWTUtil.java
index f6effe9..9daa9ed 100644
--- a/src/main/java/com/fxzy/warn/common/util/JWTUtil.java
+++ b/src/main/java/com/fxzy/warn/common/util/JWTUtil.java
@@ -5,6 +5,7 @@ package com.fxzy.warn.common.util;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.fxzy.warn.model.User;
import com.nimbusds.jose.*;
import com.nimbusds.jose.crypto.MACSigner;
import com.nimbusds.jose.crypto.MACVerifier;
@@ -66,38 +67,38 @@ public class JWTUtil {
}
-// public String creatToken(WxUserVO user, String publicKey) throws JOSEException {
-// if (null == user || StringUtils.isBlank(publicKey)) {
-// return null;
-// }
-// //3.先建立一个头部Header
-// /**
-// * JWSHeader参数:1.加密算法法则,2.类型,3.。。。。。。。
-// * 一般只需要传入加密算法法则就可以。
-// * 这里则采用HS256
-// *
-// * JWSAlgorithm类里面有所有的加密算法法则,直接调用。
-// */
-// JWSHeader jwsHeader = new JWSHeader(JWSAlgorithm.HS256);
-//
-// Map payloadMap = createPayloadMap(user);
-//
-// //建立一个载荷Payload
-// Payload payload = new Payload(new JSONObject(payloadMap));
-//
-// //将头部和载荷结合在一起
-// JWSObject jwsObject = new JWSObject(jwsHeader, payload);
-//
-// //建立一个密匙
-//
-// JWSSigner jwsSigner = new MACSigner(publicKey.getBytes());
-//
-// //签名
-// jwsObject.sign(jwsSigner);
-//
-// //生成token
-// return jwsObject.serialize();
-// }
+ public String creatToken(User user, String publicKey) throws JOSEException {
+ if (null == user || StringUtils.isBlank(publicKey)) {
+ return null;
+ }
+ //3.先建立一个头部Header
+ /**
+ * JWSHeader参数:1.加密算法法则,2.类型,3.。。。。。。。
+ * 一般只需要传入加密算法法则就可以。
+ * 这里则采用HS256
+ *
+ * JWSAlgorithm类里面有所有的加密算法法则,直接调用。
+ */
+ JWSHeader jwsHeader = new JWSHeader(JWSAlgorithm.HS256);
+
+ Map payloadMap = createPayloadMap(user);
+
+ //建立一个载荷Payload
+ Payload payload = new Payload(new JSONObject(payloadMap));
+
+ //将头部和载荷结合在一起
+ JWSObject jwsObject = new JWSObject(jwsHeader, payload);
+
+ //建立一个密匙
+
+ JWSSigner jwsSigner = new MACSigner(publicKey.getBytes());
+
+ //签名
+ jwsObject.sign(jwsSigner);
+
+ //生成token
+ return jwsObject.serialize();
+ }
/**
* 根据token解析当前登陆者信息
@@ -105,28 +106,25 @@ public class JWTUtil {
/**
* 根据token解析当前登陆者信息
*/
-// public WxUserVO getUserByToken(String token) {
-//
-// if (StringUtils.isBlank(token)) {
-// return null;
-// }
-// WxUserVO user = null;
-// try {
-// JWSObject jwsObject = JWSObject.parse(token);
-// //获取到载荷
-// Payload payload = jwsObject.getPayload();
-// JSONObject jsonObject = payload.toJSONObject();
-// String result = jsonObject.toString();
-// user = com.alibaba.fastjson.JSONObject.parseObject(result, WxUserVO.class);
-// if (StringUtils.isNotBlank(user.getId())) {
-// String userId = user.getId();
-// user.setId(userId.substring(0, userId.length() - 14));
-// }
-// } catch (ParseException e) {
-// e.printStackTrace();
-// }
-// return user;
-// }
+ public User getUserByToken(String token) {
+
+ if (StringUtils.isBlank(token)) {
+ return null;
+ }
+ User user = null;
+ try {
+ JWSObject jwsObject = JWSObject.parse(token);
+ //获取到载荷
+ Payload payload = jwsObject.getPayload();
+ JSONObject jsonObject = payload.toJSONObject();
+ String result = jsonObject.toString();
+ user = com.alibaba.fastjson.JSONObject.parseObject(result, User.class);
+
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ return user;
+ }
/**
@@ -157,31 +155,55 @@ public class JWTUtil {
return success;
}
-// public Map createPayloadMap(WxUserVO user) {
-// Map payloadMap = new HashMap<>(16);
-// if (StringUtils.isNotBlank(user.getId())) {
-// payloadMap.put("id", user.getId() + TimeUtil.formatDateToTime(new Date()));
-// }
-// if (StringUtils.isNotBlank(user.getNodeCode())) {
-// payloadMap.put("nodeCode", user.getNodeCode());
-// }
-// if (StringUtils.isNotBlank(user.getUserName())) {
-// payloadMap.put("username", user.getUserName());
-// }
-// if (StringUtils.isNotBlank(user.getMobilePhone())) {
-// payloadMap.put("mobilePhone", user.getMobilePhone());
-// }
-// if (null!=user.getEnterpriseId()) {
-// payloadMap.put("enterpriseId", user.getEnterpriseId());
-// }
-// if (null!=user.getUserIdentity()) {
-// payloadMap.put("userIdentity", user.getUserIdentity());
-// }
-// if (StringUtils.isNotBlank(user.getOpenId())) {
-// payloadMap.put("openId", user.getOpenId());
-// }
-// return payloadMap;
-// }
+ public Map createPayloadMap(User user) {
+ Map payloadMap = new HashMap<>(16);
+ if (user.getId()!=null) {
+ payloadMap.put("id", user.getId());
+ }
+ if (StringUtils.isNotBlank(user.getCompanyName())) {
+ payloadMap.put("companyName", user.getCompanyName());
+ }
+ if (StringUtils.isNotBlank(user.getCreditCode())) {
+ payloadMap.put("creditCode", user.getCreditCode());
+ }
+ if (StringUtils.isNotBlank(user.getLegalPerson())) {
+ payloadMap.put("legalPerson", user.getLegalPerson());
+ }
+ if (StringUtils.isNotBlank(user.getPhoneNumber())) {
+ payloadMap.put("phoneNumber", user.getPhoneNumber());
+ }
+ if (StringUtils.isNotBlank(user.getEmail())) {
+ payloadMap.put("email", user.getEmail());
+ }
+ if (StringUtils.isNotBlank(user.getProvince())) {
+ payloadMap.put("province", user.getProvince());
+ }
+ if (StringUtils.isNotBlank(user.getCity())) {
+ payloadMap.put("city", user.getCity());
+ }
+ if (StringUtils.isNotBlank(user.getDistrict())) {
+ payloadMap.put("district", user.getDistrict());
+ }
+ if (StringUtils.isNotBlank(user.getDetailedAddress())) {
+ payloadMap.put("detailedAddress", user.getDetailedAddress());
+ }
+ if (StringUtils.isNotBlank(user.getBusinessPerson())) {
+ payloadMap.put("businessPerson", user.getBusinessPerson());
+ }
+ if (StringUtils.isNotBlank(user.getRemarks())) {
+ payloadMap.put("remarks", user.getRemarks());
+ }
+ if (user.getAuthorizationId()!=null) {
+ payloadMap.put("authorizationId", user.getAuthorizationId());
+ }
+ if (user.getIsOfficialAccount()!=null) {
+ payloadMap.put("isOfficialAccount", user.getIsOfficialAccount());
+ }
+ if (user.getAuthorizationStatus()!=null) {
+ payloadMap.put("authorizationStatus", user.getAuthorizationStatus());
+ }
+ return payloadMap;
+ }
diff --git a/src/main/java/com/fxzy/warn/controller/AuthorizationController.java b/src/main/java/com/fxzy/warn/controller/AuthorizationController.java
new file mode 100644
index 0000000..5ee2ecb
--- /dev/null
+++ b/src/main/java/com/fxzy/warn/controller/AuthorizationController.java
@@ -0,0 +1,97 @@
+package com.fxzy.warn.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fxzy.warn.common.constants.ResponseMsgConstants;
+import com.fxzy.warn.common.request.RequestParameter;
+import com.fxzy.warn.common.response.ApiResponse;
+import com.fxzy.warn.model.Authorization;
+import com.fxzy.warn.model.User;
+import com.fxzy.warn.service.AuthorizationService;
+import com.fxzy.warn.service.UserService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.Objects;
+
+/**
+ * @author zhangjing
+ * @date 2024/05/21 11:22
+ * @description
+ */
+@Api(tags = "用户授权")
+@RestController
+@RequestMapping("authorization/")
+@Slf4j
+public class AuthorizationController {
+ @Resource
+ private AuthorizationService authorizationService ;
+
+
+ @RequestMapping(value = "save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+ @ApiOperation(value = "创建授权信息")
+ public ApiResponse save(@ApiParam("{\n" +
+ "\"startDate\":\"授权开始日期\",\n" +
+ "\"endDate\":\"授权截止日期\",\n" +
+ "\"fileId\":\"授权书id\",\n" +
+ "\"email\":\"邮箱\"\n" +
+ "\"queryCount\":\"风险查询次数\"\n" +
+ "}") @RequestBody Authorization entity, String ticket) {
+ ApiResponse response = new ApiResponse();
+ try {
+ return authorizationService.saveModel(entity,ticket);
+ } catch (Exception e) {
+ response.recordError(ResponseMsgConstants.OPERATE_FAIL);
+ }
+ return response;
+ }
+ @RequestMapping(value = "applyFor", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+ @ApiOperation(value = "申请")
+ public ApiResponse applyFor(@ApiParam("{\n" +
+ "\"authorizationId\":\"授权信息id\",\n" +
+ "\"id\":\"申请的id\",\n" +
+ "}") @RequestBody JSONObject jsonObject, String ticket) {
+ ApiResponse response = new ApiResponse();
+ try {
+ return authorizationService.applyFor(jsonObject,ticket);
+ } catch (Exception e) {
+ response.recordError(ResponseMsgConstants.OPERATE_FAIL);
+ }
+ return response;
+ }
+ @RequestMapping(value = "approve", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+ @ApiOperation(value = "审批")
+ public ApiResponse approve(@ApiParam("{\n" +
+ "\"content\":\"审批内容\",\n" +
+ "\"statusCode\":\"1通过2拒绝\",\n" +
+ "}") @RequestBody JSONObject jsonObject, String ticket) {
+ ApiResponse response = new ApiResponse();
+ try {
+ return authorizationService.approve(jsonObject,ticket);
+ } catch (Exception e) {
+ response.recordError(ResponseMsgConstants.OPERATE_FAIL);
+ }
+ return response;
+ }
+
+ @RequestMapping(value = "queryPage", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
+ @ApiOperation(value = "授权审批分页查询")
+ public ApiResponse queryPage(@ApiParam() @RequestBody RequestParameter parameter) {
+ ApiResponse apiResponse = new ApiResponse();
+ try {
+ apiResponse.setData(authorizationService.queryPage(parameter));
+ apiResponse.setMessage(ResponseMsgConstants.OPERATE_SUCCESS);
+ } catch (Exception e) {
+ apiResponse.recordError(ResponseMsgConstants.OPERATE_FAIL);
+ }
+ return apiResponse;
+ }
+
+}
diff --git a/src/main/java/com/fxzy/warn/controller/FileController.java b/src/main/java/com/fxzy/warn/controller/FileController.java
new file mode 100644
index 0000000..b569d02
--- /dev/null
+++ b/src/main/java/com/fxzy/warn/controller/FileController.java
@@ -0,0 +1,99 @@
+package com.fxzy.warn.controller;
+
+
+import com.fxzy.warn.common.conf.MinioConfig;
+import com.fxzy.warn.common.response.ApiResponse;
+import com.fxzy.warn.service.FileService;
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+@Api(tags = "文件上传")
+@RestController
+@Slf4j
+@RequestMapping("/file")
+public class FileController {
+
+ @Autowired
+ MinioConfig minioConfig;
+
+ @Autowired
+ FileService fileService;
+
+ /**
+ * 上传
+ * @param file
+ * @return
+ * @throws Exception
+ */
+ @PostMapping("/upload")
+ public Object upload(@RequestParam("file") MultipartFile file) throws Exception {
+ log.info("附件,上传 ==== 参数{" + file + "}");
+ ApiResponse apiResponse = new ApiResponse();
+ if (!file.isEmpty()) {
+ try {
+ apiResponse = fileService.uploadFile(file);
+
+ } catch (Exception e) {
+ log.error("附件上传失败,errMsg==={" + e.getMessage() + "}");
+ e.printStackTrace();
+ }
+ } else {
+ apiResponse.recordError("请至少上传一个文件!");
+ }
+ return apiResponse;
+
+ }
+
+
+
+// // 文件访问路径
+// @PostMapping("/getObjectUrl")
+// public String getObjectUrl(String bucketName, String objectName) throws Exception {
+// return this.minioConfig.getObjectUrl(bucketName, objectName);
+// }
+//
+//
+// // 下载文件
+// @GetMapping("/download")
+// public void download(@RequestParam("fileName") String fileName, HttpServletResponse response) {
+// this.minioConfig.download(fileName, response);
+// }
+//
+// // 列出所有存储桶名称
+// @PostMapping("/list")
+// public List list() throws Exception {
+// return this.minioConfig.listBucketNames();
+// }
+//
+// // 创建存储桶
+// @PostMapping("/createBucket")
+// public boolean createBucket(String bucketName) throws Exception {
+// return this.minioConfig.makeBucket(bucketName);
+// }
+//
+// // 删除存储桶
+// @PostMapping("/deleteBucket")
+// public boolean deleteBucket(String bucketName) throws Exception {
+// return this.minioConfig.removeBucket(bucketName);
+// }
+//
+// // 列出存储桶中的所有对象名称
+// @PostMapping("/listObjectNames")
+// public List listObjectNames(String bucketName) throws Exception {
+// return this.minioConfig.listObjectNames(bucketName);
+// }
+//
+// // 删除一个对象
+// @PostMapping("/removeObject")
+// public boolean removeObject(String bucketName, String objectName) throws Exception {
+// return this.minioConfig.removeObject(bucketName, objectName);
+// }
+
+}
+
+
diff --git a/src/main/java/com/fxzy/warn/controller/MonitorUsersController.java b/src/main/java/com/fxzy/warn/controller/MonitorUsersController.java
new file mode 100644
index 0000000..7b19503
--- /dev/null
+++ b/src/main/java/com/fxzy/warn/controller/MonitorUsersController.java
@@ -0,0 +1,101 @@
+package com.fxzy.warn.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fxzy.warn.common.constants.ResponseMsgConstants;
+import com.fxzy.warn.common.request.RequestParameter;
+import com.fxzy.warn.common.response.ApiResponse;
+import com.fxzy.warn.model.MonitorUsers;
+import com.fxzy.warn.service.MonitorUsersService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * @author zhangjing
+ * @date 2024/05/21 11:22
+ * @description
+ */
+@Api(tags = "监控用户")
+@RestController
+@RequestMapping("monitorUsers/")
+@Slf4j
+public class MonitorUsersController {
+ @Resource
+ private MonitorUsersService monitorUsersService ;
+
+ @RequestMapping(value = "save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+ @ApiOperation(value = "创建用户")
+ public ApiResponse save(@ApiParam("{\n" +
+ "\"companyName\":\"企业名称\",\n" +
+ "\"creditCode\":\"统一社会信用代码\",\n" +
+ "\"legalPerson\":\"企业法人\",\n" +
+ "\"address\":\"地址\"\n" +
+ "\"authorizationId\":\"授权书id\"\n" +
+ "}") @RequestBody MonitorUsers entity, @RequestHeader String ticket) {
+ ApiResponse response = new ApiResponse();
+ try {
+ return monitorUsersService.saveModel(entity,ticket);
+ } catch (Exception e) {
+ response.recordError(ResponseMsgConstants.OPERATE_FAIL);
+ }
+ return response;
+ }
+
+ /**
+ * 修改
+ *
+ * @param
+ * @return
+ */
+ @ResponseBody
+ @ApiOperation(value = "修改")
+ @RequestMapping(value = "edit", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+ public ApiResponse edit(@ApiParam() @RequestBody MonitorUsers entity,@RequestHeader String ticket) {
+ log.info("修改==== 参数{" + entity != null ? entity.toString() : "null" + "}");
+ ApiResponse response = new ApiResponse();
+ try {
+ return monitorUsersService.updateModel(entity,ticket);
+ } catch (Exception e) {
+ response.recordError(ResponseMsgConstants.OPERATE_FAIL);
+ }
+ return response;
+ }
+ /**
+ * 通过ids删除
+ *
+ * @param
+ * @return
+ */
+ @ResponseBody
+ @ApiOperation(value = "删除")
+ @RequestMapping(value = "remove", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+ public ApiResponse remove(@ApiParam("{\"ids\":[\"1\",\"2\"]}") @RequestBody JSONObject jsonObject) {
+ ApiResponse apiResponse = new ApiResponse();
+ try {
+ return monitorUsersService.deleteModel(jsonObject.getJSONArray("ids").toJavaList(String.class));
+ } catch (Exception e) {
+ apiResponse.recordError(ResponseMsgConstants.OPERATE_FAIL);
+ }
+ return apiResponse;
+ }
+ @RequestMapping(value = "queryPage", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
+ @ApiOperation(value = "分页查询")
+ public ApiResponse queryPage(@ApiParam() @RequestBody RequestParameter parameter) {
+ ApiResponse apiResponse = new ApiResponse();
+ try {
+ apiResponse.setData(monitorUsersService.queryPage(parameter));
+ apiResponse.setMessage(ResponseMsgConstants.OPERATE_SUCCESS);
+ } catch (Exception e) {
+ apiResponse.recordError(ResponseMsgConstants.OPERATE_FAIL);
+ }
+ return apiResponse;
+ }
+
+}
diff --git a/src/main/java/com/fxzy/warn/controller/PolicyManagementController.java b/src/main/java/com/fxzy/warn/controller/PolicyManagementController.java
new file mode 100644
index 0000000..a5d6caf
--- /dev/null
+++ b/src/main/java/com/fxzy/warn/controller/PolicyManagementController.java
@@ -0,0 +1,126 @@
+package com.fxzy.warn.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fxzy.warn.common.constants.ResponseMsgConstants;
+import com.fxzy.warn.common.request.RequestParameter;
+import com.fxzy.warn.common.response.ApiResponse;
+import com.fxzy.warn.model.PolicyManagement;
+import com.fxzy.warn.service.PolicyManagementService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+/**
+ * @author zhangjing
+ * @date 2024/05/21 11:22
+ * @description
+ */
+@Api(tags = "政策管理:用户协议,隐私,关于我们")
+@RestController
+@RequestMapping("policyManagement/")
+@Slf4j
+public class PolicyManagementController {
+ @Resource
+ private PolicyManagementService policyManagementService ;
+
+ @RequestMapping(value = "save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+ @ApiOperation(value = "创建用户")
+ public ApiResponse save(@ApiParam("{\n" +
+ "\"version\":\"政策版本\",\n" +
+ "\"content\":\"政策内容(富文本)\",\n" +
+ "\"contentType\":\"政策类型 0用户协议管理1隐私政策管理2关于我们管理\",\n" +
+ "}") @RequestBody PolicyManagement entity, @RequestHeader String ticket) {
+ ApiResponse response = new ApiResponse();
+ try {
+ return policyManagementService.saveModel(entity,ticket);
+ } catch (Exception e) {
+ response.recordError(ResponseMsgConstants.OPERATE_FAIL);
+ }
+ return response;
+ }
+
+ /**
+ * 修改
+ *
+ * @param
+ * @return
+ */
+ @ResponseBody
+ @ApiOperation(value = "修改")
+ @RequestMapping(value = "edit", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+ public ApiResponse edit(@ApiParam() @RequestBody PolicyManagement entity,@RequestHeader String ticket) {
+ log.info("修改==== 参数{" + entity != null ? entity.toString() : "null" + "}");
+ ApiResponse response = new ApiResponse();
+ try {
+ return policyManagementService.updateModel(entity,ticket);
+ } catch (Exception e) {
+ response.recordError(ResponseMsgConstants.OPERATE_FAIL);
+ }
+ return response;
+ }
+ /**
+ * 通过ids删除
+ *
+ * @param
+ * @return
+ */
+ @ResponseBody
+ @ApiOperation(value = "删除")
+ @RequestMapping(value = "remove", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+ public ApiResponse remove(@ApiParam("{\"ids\":[\"1\",\"2\"]}") @RequestBody JSONObject jsonObject) {
+ ApiResponse apiResponse = new ApiResponse();
+ try {
+ return policyManagementService.deleteModel(jsonObject.getJSONArray("ids").toJavaList(String.class));
+ } catch (Exception e) {
+ apiResponse.recordError(ResponseMsgConstants.OPERATE_FAIL);
+ }
+ return apiResponse;
+ }
+
+ /**
+ * 通过ids删除
+ *
+ * @param
+ * @return
+ */
+ @RequestMapping(value = "getPolicy", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+ @ApiOperation(value = "获取当前政策")
+ public ApiResponse getPolicy(String contentType) {
+ ApiResponse apiResponse = new ApiResponse();
+ try {
+ return policyManagementService.getPolicy(contentType);
+ } catch (Exception e) {
+ log.error("查询错误,errMsg==={}", e.getMessage());
+ e.printStackTrace();
+ apiResponse.recordError(ResponseMsgConstants.OPERATE_FAIL);
+ }
+
+ return apiResponse;
+ }
+ /**
+ * 分页查询
+ *
+ * @param
+ * @return
+ */
+ @RequestMapping(value = "queryPage", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
+ @ApiOperation(value = "分页查询")
+ public ApiResponse queryPage(@ApiParam("{\n" +
+ "\"contentType\":\"政策类型 0用户协议管理1隐私政策管理2关于我们管理\",\n" +
+ "}") @RequestBody RequestParameter parameter) {
+ ApiResponse apiResponse = new ApiResponse();
+ try {
+ apiResponse.setData(policyManagementService.queryPage(parameter));
+ apiResponse.setMessage(ResponseMsgConstants.OPERATE_SUCCESS);
+ } catch (Exception e) {
+ apiResponse.recordError(ResponseMsgConstants.OPERATE_FAIL);
+ }
+ return apiResponse;
+ }
+
+}
diff --git a/src/main/java/com/fxzy/warn/mapper/AuditRecordsMapper.java b/src/main/java/com/fxzy/warn/mapper/AuditRecordsMapper.java
new file mode 100644
index 0000000..17afb1c
--- /dev/null
+++ b/src/main/java/com/fxzy/warn/mapper/AuditRecordsMapper.java
@@ -0,0 +1,14 @@
+package com.fxzy.warn.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fxzy.warn.model.AuditRecords;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @author zhangjing
+ * @date 2024/12/04 14:48
+ * @description
+ */
+@Mapper
+public interface AuditRecordsMapper extends BaseMapper {
+}
diff --git a/src/main/java/com/fxzy/warn/mapper/AuthorizationMapper.java b/src/main/java/com/fxzy/warn/mapper/AuthorizationMapper.java
new file mode 100644
index 0000000..635cf8a
--- /dev/null
+++ b/src/main/java/com/fxzy/warn/mapper/AuthorizationMapper.java
@@ -0,0 +1,14 @@
+package com.fxzy.warn.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fxzy.warn.model.Authorization;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @author zhangjing
+ * @date 2024/12/04 14:48
+ * @description
+ */
+@Mapper
+public interface AuthorizationMapper extends BaseMapper {
+}
diff --git a/src/main/java/com/fxzy/warn/mapper/FileMapper.java b/src/main/java/com/fxzy/warn/mapper/FileMapper.java
new file mode 100644
index 0000000..b9674ff
--- /dev/null
+++ b/src/main/java/com/fxzy/warn/mapper/FileMapper.java
@@ -0,0 +1,28 @@
+package com.fxzy.warn.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+import com.fxzy.warn.model.File;
+import com.fxzy.warn.model.vo.FileVO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author yuyantian
+ * @Date 2021/09/09 14:00
+ */
+@Mapper
+public interface FileMapper extends BaseMapper {
+
+
+ File findFileList(@Param("id") Long appLogoId);
+
+ /**
+ * 查询附件
+ * @param fileIds
+ * @return
+ */
+ List selectByFileIds(@Param("fileIds") List