Commit 9b4f7ca5 by 涂亚平

加密解密加盐工具类

1 parent e7c840d4
Showing with 99 additions and 100 deletions
package com.zhongzhi;
package com.template;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
......@@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RestController;
@RestController
@MapperScan(basePackages = {"com.zhongzhi.dao"})
@MapperScan(basePackages = {"com.template.dao"})
@SpringBootApplication
public class ZhongzhiApplication {
......
package com.zhongzhi.common;
package com.template.common;
import com.auth0.jwt.JWT;
import com.auth0.jwt.JWTVerifier;
......
package com.zhongzhi.common.annotate;
package com.template.common.annotate;
import java.lang.annotation.*;
......
package com.zhongzhi.common.annotate;
package com.template.common.annotate;
import java.lang.annotation.*;
......
package com.zhongzhi.common.annotate;
package com.template.common.annotate;
import java.lang.annotation.*;
......
package com.zhongzhi.common.configure;
package com.template.common.configure;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
......
package com.zhongzhi.common.configure;
package com.template.common.configure;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.zhongzhi.common.handler.MetaHandler;
import com.template.common.handler.MetaHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......
package com.zhongzhi.common.configure;
package com.template.common.configure;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
......
package com.zhongzhi.common.configure;
package com.template.common.configure;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......@@ -26,11 +26,11 @@ public class SwaggerConfig {
return new Docket(DocumentationType.SWAGGER_2)
.pathMapping("/")
.select()
.apis(RequestHandlerSelectors.basePackage("com.zhongzhi.controller"))
.apis(RequestHandlerSelectors.basePackage("com.template.controller"))
.paths(PathSelectors.any())
.build()
.apiInfo(new ApiInfoBuilder()
.title("国泰君安")
.title("模板")
.description("接口文档")
.version("1.0")
.build());
......
package com.zhongzhi.common.configure;
package com.template.common.configure;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
......
package com.zhongzhi.common.configure;
package com.template.common.configure;
import com.zhongzhi.common.interceptor.AuthenticationInterceptor;
import com.template.common.interceptor.AuthenticationInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......
package com.zhongzhi.common.constant;
package com.template.common.constant;
import lombok.Getter;
......
package com.zhongzhi.common.constant;
package com.template.common.constant;
/**
* <p>
......
package com.zhongzhi.common.exception;
package com.template.common.exception;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.zhongzhi.common.configure.RemoteProperties;
import com.zhongzhi.common.constant.Code;
import com.zhongzhi.vo.ResponseData;
import com.zhongzhi.vo.ResponseVO;
import com.template.common.configure.RemoteProperties;
import com.template.common.constant.Code;
import com.template.vo.ResponseData;
import com.template.vo.ResponseVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.http.converter.HttpMessageNotReadableException;
......
package com.zhongzhi.common.exception;
package com.template.common.exception;
import com.zhongzhi.common.configure.RemoteProperties;
import com.template.common.configure.RemoteProperties;
/**
* 异常处理
......
package com.zhongzhi.common.generator;
package com.template.common.generator;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
......@@ -10,7 +10,7 @@ import com.baomidou.mybatisplus.generator.config.*;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
import com.zhongzhi.model.base.BaseModel;
import com.template.model.base.BaseModel;
import java.util.ArrayList;
import java.util.List;
......
package com.zhongzhi.common.handler;
package com.template.common.handler;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
......
package com.zhongzhi.common.interceptor;
package com.template.common.interceptor;
import com.auth0.jwt.interfaces.Claim;
import com.zhongzhi.common.constant.Code;
import com.zhongzhi.common.exception.HttpException;
import com.zhongzhi.common.annotate.LoginRequired;
import com.template.common.constant.Code;
import com.template.common.exception.HttpException;
import com.template.common.annotate.LoginRequired;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import org.springframework.web.method.HandlerMethod;
......@@ -14,7 +14,7 @@ import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Map;
import com.zhongzhi.common.JwtUtil;
import com.template.common.JwtUtil;
/**
* <p>
......
package com.zhongzhi.controller;
package com.template.controller;
import com.aliyun.oss.ClientException;
......@@ -6,10 +6,10 @@ import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.OSSException;
import com.aliyun.oss.model.*;
import com.zhongzhi.vo.ResponseData;
import com.zhongzhi.vo.ResponseVO;
import com.zhongzhi.vo.oss.GetSecretVO;
import com.zhongzhi.vo.oss.UploadFileVO;
import com.template.vo.ResponseData;
import com.template.vo.ResponseVO;
import com.template.vo.oss.GetSecretVO;
import com.template.vo.oss.UploadFileVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -47,40 +47,6 @@ public class OssController {
return ResponseData.generateCreatedResponse(0, getSecretVO);
}
// @PostMapping("uploadFile")
// @ApiOperation("上传文件 file")
// public ResponseVO uploadFile(@RequestParam("file") MultipartFile file) {
// // 创建OSSClient实例。
// OSS ossClient = new OSSClientBuilder().build("http://oss-cn-shanghai.aliyuncs.com", keyId, secret);
// UploadFileVO uploadFileVO = new UploadFileVO();
// try {
////
//// if (env.equals("test")) {
//// env = "ykhl-bigger-test";
//// }
//// if (env.equals("prod")) {
//// env = "ykhl-bigger";
//// }
//
//
// // 创建PutObjectRequest对象。
// PutObjectRequest putObjectRequest = new PutObjectRequest("zhongzhi-cms", System.currentTimeMillis() + "_" + file.getOriginalFilename(), file.getInputStream());
// // 设置该属性可以返回response。如果不设置,则返回的response为空。
// putObjectRequest.setProcess("true");
// // 创建PutObject请求。
// PutObjectResult result = ossClient.putObject(putObjectRequest);
// // 如果上传成功,则返回200。
//// System.out.println(result.getResponse().getUri());
// uploadFileVO.setUrl(result.getResponse().getUri());
// } catch (Exception oe) {
// oe.printStackTrace();
// } finally {
// if (ossClient != null) {
// ossClient.shutdown();
// }
// }
// return ResponseData.generateCreatedResponse(0, uploadFileVO);
// }
@PostMapping("uploadFile")
@ApiOperation("分片上传")
......
package com.zhongzhi.model.base;
package com.template.model.base;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
......
package com.zhongzhi.utils;
package com.template.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
......@@ -6,10 +6,10 @@ import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.zhongzhi.common.configure.AliyunSmsProperties;
import com.template.common.configure.AliyunSmsProperties;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;
import com.zhongzhi.common.exception.HttpException;
import com.template.common.exception.HttpException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
......
package com.zhongzhi.utils;
package com.template.utils;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
......
package com.zhongzhi.utils;
package com.template.utils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
......
package com.template.utils;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.List;
@Slf4j
public class EasyExcelUtil {
/**
* EasyExcel导出
*
* @ExcelProperty("字符串标题")
* private String string;
*/
public void export(List<T> list,Class cls) throws IOException {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletResponse response = servletRequestAttributes.getResponse();
String fileName = System.currentTimeMillis()+".xlsx";
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-disposition", "attachment;filename*=UTF-8''" + URLEncoder.encode(fileName, "UTF-8"));
// EasyExcel.write(response.getOutputStream(), cls).sheet("sheet").doWrite(list);
}
}
package com.zhongzhi.utils;
package com.template.utils;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
......
package com.zhongzhi.utils;
package com.template.utils;
import com.zhongzhi.common.annotate.ExcelColumn;
import com.zhongzhi.common.exception.HttpException;
import com.zhongzhi.vo.ExcelFieldVO;
import com.template.common.annotate.ExcelColumn;
import com.template.common.exception.HttpException;
import com.template.vo.ExcelFieldVO;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
......
package com.zhongzhi.utils;
package com.template.utils;
import javax.servlet.http.HttpServletRequest;
import java.net.InetAddress;
......
package com.zhongzhi.utils;
package com.template.utils;
import org.springframework.web.bind.annotation.RestController;
......
package com.zhongzhi.utils;
package com.template.utils;
import com.itextpdf.text.*;
import com.itextpdf.text.pdf.BaseFont;
......
package com.zhongzhi.utils;
package com.template.utils;
import java.util.Date;
import java.util.Random;
......
package com.zhongzhi.utils;
package com.template.utils;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
......@@ -6,8 +6,8 @@ import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.vod.v20180717.VodClient;
import com.tencentcloudapi.vod.v20180717.models.*;
import com.zhongzhi.common.configure.VODConfig;
import com.zhongzhi.common.exception.HttpException;
import com.template.common.configure.VODConfig;
import com.template.common.exception.HttpException;
import org.springframework.stereotype.Component;
/**
......
package com.zhongzhi.vo;
package com.template.vo;
import com.zhongzhi.common.configure.RemoteProperties;
import com.zhongzhi.vo.ResponseVO;
import com.template.common.configure.RemoteProperties;
import lombok.Data;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
......
package com.zhongzhi.vo;
package com.template.vo;
import lombok.AllArgsConstructor;
import lombok.Builder;
......
package com.zhongzhi.vo.oss;
package com.template.vo.oss;
import lombok.Data;
......
......@@ -47,7 +47,7 @@
</appender>
<springProfile name="dev">
<logger name="com.zhongzhi" level="error"/>
<logger name="com.template" level="error"/>
<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="INFO_FILE"/>
......@@ -56,7 +56,7 @@
</springProfile>
<springProfile name="pre">
<logger name="com.zhongzhi" level="error"/>
<logger name="com.template" level="error"/>
<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="INFO_FILE"/>
......@@ -65,7 +65,7 @@
</springProfile>
<springProfile name="prod">
<logger name="com.zhongzhi" level="error"/>
<logger name="com.template" level="error"/>
<root level="INFO">
<appender-ref ref="ERROR_FILE"/>
</root>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!