wwl 4 жил өмнө
parent
commit
641a85ac36

+ 3 - 3
hzgzpt-admin/src/main/java/com/miaxis/app/controller/user/UserInfoController.java

@@ -110,7 +110,7 @@ public class UserInfoController extends BaseController{
     @ApiOperation("上传身份证正反面,及人像图片")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "type",value = "1:身份证正面 2:身份证反面 3:人脸比对模板(采集人像图)" ,dataType = "String",required = true),
-            @ApiImplicitParam(name = "multFile", value = "上传文件", required = true, dataType = "String")
+            @ApiImplicitParam(name = "multFile", value = "上传文件", required = true, dataType = "MultipartFile")
     })
     public Response uploadIdCardAndHeadPicture(String type,MultipartFile multFile) throws IOException {
         String prefix = "";
@@ -123,7 +123,7 @@ public class UserInfoController extends BaseController{
         }else {
             throw new CustomException("类型错误!");
         }
-        String savePath = AliyunConfig.gzpt_user
+        String savePath = AliyunConfig.GZPT_USER
                 + new SimpleDateFormat("yyyyMMdd").format(new Date()) + "/"+ prefix + "/";
         String fileName = System.currentTimeMillis() + ".jpg";//文件名
         String fileUrl = AliyunUpload.uploadForStream(multFile.getInputStream(), savePath, fileName);
@@ -138,7 +138,7 @@ public class UserInfoController extends BaseController{
      * 删除文件
      * uploadIdCardAndHeadPicture
      */
-    @PostMapping(Constants.OPEN_PREFIX + "/deleteCardAndHeadPicture")
+    @DeleteMapping(Constants.OPEN_PREFIX + "/cardAndHeadPicture")
     @ApiOperation("删除文件")
     @ApiImplicitParam(name = "filePath",value = "文件路径(filePath)" ,dataType = "String",required = true)
     public Response deleteCardAndHeadPicture(String filePath) {

+ 7 - 7
hzgzpt-common/src/main/java/com/miaxis/common/aliyunOSS/AliyunConfig.java

@@ -1,15 +1,15 @@
 package com.miaxis.common.aliyunOSS;
 
 public class AliyunConfig {
-	public static String endpoint = "oss-cn-shanghai.aliyuncs.com";
-	public static String accessKeyId = "LTAIijc2Vl913Dha";
-	public static String accessKeySecret = "HbQBG0RQqdfKoYGJmoqdT1FFYO8OTs";
-	public static String bucketName = "xzzfile";
-	public static String visitPath = "http://image.jppt.com.cn";
+	public static String ENDPOINT = "oss-cn-shanghai.aliyuncs.com";
+	public static String ACCESSKEYID = "LTAIijc2Vl913Dha";
+	public static String ACCESSKEYSECRET = "HbQBG0RQqdfKoYGJmoqdT1FFYO8OTs";
+	public static String BUCKETNAME = "xzzfile";
+	public static String VISITPATH = "http://image.jppt.com.cn";
 
-	public static String gzpt_path = "gzpt/";
+	public static String GZPT_PATH = "gzpt/";
 	/** 用户图片文件*/
-	public static String gzpt_user = gzpt_path + "user/";
+	public static String GZPT_USER = GZPT_PATH + "user/";
 
 
 	

+ 7 - 7
hzgzpt-common/src/main/java/com/miaxis/common/aliyunOSS/AliyunDown.java

@@ -15,13 +15,13 @@ public class AliyunDown {
 	 * @param  savePath 保存在本地的地址
 	 * */
 	public static boolean  downAliyunFromUrlTolLocalFile(String url,String savePath){
-		OSSClient ossClient = new OSSClient(AliyunConfig.endpoint, AliyunConfig.accessKeyId,AliyunConfig.accessKeySecret);
+		OSSClient ossClient = new OSSClient(AliyunConfig.ENDPOINT, AliyunConfig.ACCESSKEYID,AliyunConfig.ACCESSKEYSECRET);
 
 		try {
-			String key = url.replaceAll(AliyunConfig.visitPath, "");
+			String key = url.replaceAll(AliyunConfig.VISITPATH, "");
 			key = key.replace("/tms", "tms");
 
-			ossClient.getObject(new GetObjectRequest(AliyunConfig.bucketName, key), new File(savePath));
+			ossClient.getObject(new GetObjectRequest(AliyunConfig.BUCKETNAME, key), new File(savePath));
 			return true;
 		} catch (Exception e) {
 			e.printStackTrace();
@@ -37,13 +37,13 @@ public class AliyunDown {
 	 * @param  savePath 保存在本地的地址
 	 * */
 	public static boolean  downBigFileAliyunFromUrlTolLocalFile(String url,String savePath){
-		OSSClient ossClient = new OSSClient(AliyunConfig.endpoint, AliyunConfig.accessKeyId,AliyunConfig.accessKeySecret);
+		OSSClient ossClient = new OSSClient(AliyunConfig.ENDPOINT, AliyunConfig.ACCESSKEYID,AliyunConfig.ACCESSKEYSECRET);
 		try {
-			String key = url.replaceAll(AliyunConfig.visitPath, "");
+			String key = url.replaceAll(AliyunConfig.VISITPATH, "");
 			System.out.println(key);
-			//ossClient.getObject(new GetObjectRequest(AliyunConfig.bucketName, key), new File(savePath));
+			//ossClient.getObject(new GetObjectRequest(AliyunConfig.BUCKETNAME, key), new File(savePath));
 			// 下载请求,10个任务并发下载,启动断点续传
-			DownloadFileRequest downloadFileRequest = new DownloadFileRequest(AliyunConfig.bucketName, key);
+			DownloadFileRequest downloadFileRequest = new DownloadFileRequest(AliyunConfig.BUCKETNAME, key);
 			downloadFileRequest.setDownloadFile(savePath);
 			downloadFileRequest.setTaskNum(10);
 			downloadFileRequest.setEnableCheckpoint(true);

+ 21 - 21
hzgzpt-common/src/main/java/com/miaxis/common/aliyunOSS/AliyunUpload.java

@@ -37,12 +37,12 @@ public class AliyunUpload {
 	 * */
 	@SuppressWarnings("deprecation")
 	public static String uploadForByte(byte[] content,String savePath,String fileName){
-		OSSClient ossClient = new OSSClient(AliyunConfig.endpoint, AliyunConfig.accessKeyId,AliyunConfig.accessKeySecret);
+		OSSClient ossClient = new OSSClient(AliyunConfig.ENDPOINT, AliyunConfig.ACCESSKEYID,AliyunConfig.ACCESSKEYSECRET);
 		String url = "";
 		try {
 			String key = savePath+fileName;
-			ossClient.putObject(AliyunConfig.bucketName, key, new ByteArrayInputStream(content));
-			url = AliyunConfig.visitPath+"/"+savePath+URLEncoder.encode(fileName);
+			ossClient.putObject(AliyunConfig.BUCKETNAME, key, new ByteArrayInputStream(content));
+			url = AliyunConfig.VISITPATH+"/"+savePath+URLEncoder.encode(fileName);
 		} catch (Exception e) {
 			e.printStackTrace();
 			return null;
@@ -60,12 +60,12 @@ public class AliyunUpload {
 	 * */
 	@SuppressWarnings("deprecation")
 	public static String uploadForLocalFile(File file, String savePath,String fileName){
-		OSSClient ossClient = new OSSClient(AliyunConfig.endpoint, AliyunConfig.accessKeyId,AliyunConfig.accessKeySecret);
+		OSSClient ossClient = new OSSClient(AliyunConfig.ENDPOINT, AliyunConfig.ACCESSKEYID,AliyunConfig.ACCESSKEYSECRET);
 		String url = "";
 		try {
 			String key = savePath+fileName;
-			ossClient.putObject(AliyunConfig.bucketName, key, file);
-			url = AliyunConfig.visitPath+"/"+savePath+URLEncoder.encode(fileName);
+			ossClient.putObject(AliyunConfig.BUCKETNAME, key, file);
+			url = AliyunConfig.VISITPATH+"/"+savePath+URLEncoder.encode(fileName);
 		} catch (Exception e) {
 			//e.printStackTrace();
 			return null;
@@ -83,12 +83,12 @@ public class AliyunUpload {
 	 * */
 	@SuppressWarnings("deprecation")
 	public static String uploadForStream(InputStream  is, String savePath,String fileName){
-		OSSClient ossClient = new OSSClient(AliyunConfig.endpoint, AliyunConfig.accessKeyId,AliyunConfig.accessKeySecret);
+		OSSClient ossClient = new OSSClient(AliyunConfig.ENDPOINT, AliyunConfig.ACCESSKEYID,AliyunConfig.ACCESSKEYSECRET);
 		String url = "";
 		try {
 			String key = savePath+fileName;
-			ossClient.putObject(AliyunConfig.bucketName, key, is);
-			url = AliyunConfig.visitPath+"/"+savePath+URLEncoder.encode(fileName);
+			ossClient.putObject(AliyunConfig.BUCKETNAME, key, is);
+			url = AliyunConfig.VISITPATH+"/"+savePath+URLEncoder.encode(fileName);
 		} catch (Exception e) {
 			e.printStackTrace();
 			return null;
@@ -106,13 +106,13 @@ public class AliyunUpload {
 	 * */
 	@SuppressWarnings("deprecation")
 	public static String uploadForUrl(String url, String savePath,String fileName){
-		OSSClient ossClient = new OSSClient(AliyunConfig.endpoint, AliyunConfig.accessKeyId,AliyunConfig.accessKeySecret);
+		OSSClient ossClient = new OSSClient(AliyunConfig.ENDPOINT, AliyunConfig.ACCESSKEYID,AliyunConfig.ACCESSKEYSECRET);
 		String path = "";
 		try {
 			String key = savePath+fileName;
 			InputStream inputStream = new URL(url).openStream();
-			ossClient.putObject(AliyunConfig.bucketName, key, inputStream);
-			path = AliyunConfig.visitPath+"/"+savePath+URLEncoder.encode(fileName);
+			ossClient.putObject(AliyunConfig.BUCKETNAME, key, inputStream);
+			path = AliyunConfig.VISITPATH+"/"+savePath+URLEncoder.encode(fileName);
 		} catch (Exception e) {
 			e.printStackTrace();
 			return null;
@@ -130,12 +130,12 @@ public class AliyunUpload {
 	 * */
 	@SuppressWarnings("deprecation")
 	public static String uploadForString(String content, String savePath,String fileName){
-		OSSClient ossClient = new OSSClient(AliyunConfig.endpoint, AliyunConfig.accessKeyId,AliyunConfig.accessKeySecret);
+		OSSClient ossClient = new OSSClient(AliyunConfig.ENDPOINT, AliyunConfig.ACCESSKEYID,AliyunConfig.ACCESSKEYSECRET);
 		String path = "";
 		try {
 			String key = savePath+fileName;
-			ossClient.putObject(AliyunConfig.bucketName, key, new ByteArrayInputStream(content.getBytes()));
-			path = AliyunConfig.visitPath+"/"+savePath+URLEncoder.encode(fileName);
+			ossClient.putObject(AliyunConfig.BUCKETNAME, key, new ByteArrayInputStream(content.getBytes()));
+			path = AliyunConfig.VISITPATH+"/"+savePath+URLEncoder.encode(fileName);
 		} catch (Exception e) {
 			e.printStackTrace();
 			return null;
@@ -167,7 +167,7 @@ public class AliyunUpload {
 			//System.out.println(fileName);
 			InputStream inputStream = new URL(url).openStream();
 			ossClient.putObject("lnfile", key, inputStream);
-			path = AliyunConfig.visitPath+key;
+			path = AliyunConfig.VISITPATH+key;
 			System.out.println(path);
 		} catch (Exception e) {
 			e.printStackTrace();
@@ -207,11 +207,11 @@ public class AliyunUpload {
 	 * */
 	@SuppressWarnings("deprecation")
 	public static String uploadForGzptStream(InputStream  is, String savePath,String fileName){
-		OSSClient ossClient = new OSSClient(AliyunConfig.endpoint, AliyunConfig.accessKeyId,AliyunConfig.accessKeySecret);
+		OSSClient ossClient = new OSSClient(AliyunConfig.ENDPOINT, AliyunConfig.ACCESSKEYID,AliyunConfig.ACCESSKEYSECRET);
 		String url = "";
 		try {
 			String key = savePath+fileName;
-			ossClient.putObject(AliyunConfig.bucketName, key, is);
+			ossClient.putObject(AliyunConfig.BUCKETNAME, key, is);
 			url = savePath+URLEncoder.encode(fileName);
 		} catch (Exception e) {
 			e.printStackTrace();
@@ -228,15 +228,15 @@ public class AliyunUpload {
      * @return
      */
     public static boolean deleteObject(String filePath) {
-        OSSClient ossClient = new OSSClient(AliyunConfig.endpoint, AliyunConfig.accessKeyId,AliyunConfig.accessKeySecret);
+        OSSClient ossClient = new OSSClient(AliyunConfig.ENDPOINT, AliyunConfig.ACCESSKEYID,AliyunConfig.ACCESSKEYSECRET);
 
         try {
-            boolean exist = ossClient.doesObjectExist(AliyunConfig.bucketName,filePath);
+            boolean exist = ossClient.doesObjectExist(AliyunConfig.BUCKETNAME,filePath);
             if (!exist) {
                 System.out.println("文件不存在");
                 return false;
             }
-            ossClient.deleteObject(AliyunConfig.bucketName,filePath);
+            ossClient.deleteObject(AliyunConfig.BUCKETNAME,filePath);
 
         }catch (Exception e){
             e.printStackTrace();

+ 4 - 4
hzgzpt-common/src/main/java/com/miaxis/common/constant/SmsTemplateConstants.java

@@ -12,25 +12,25 @@ public class SmsTemplateConstants {
     /**
      * 短信模板类型(可拓展)
      */
-    public static final String[] smsTemplateType = {"login","modify","signUp"};
+    public static final String[] SMS_TEMPLATE_TYPE = {"login","modify","signUp"};
 
     /**
      * 登录短信模板
      */
 //    public static final String login = "登录手机号验证码:code,验证码两分钟内有效";
-    public static final String login = "本次验证码:code,验证码两分钟内有效";
+    public static final String LOGIN = "本次验证码:code,验证码两分钟内有效";
 
     /**
      * 修改手机号短信模板
      */
 //    public static final String modify = "修改手机号验证码:code,验证码两分钟内有效";
-    public static final String modify = "本次验证码:code,验证码两分钟内有效";
+    public static final String MODIFY = "本次验证码:code,验证码两分钟内有效";
 
     /**
      * 注册报名短信模板
      */
 //    public static final String signUp = "报名手机号验证码:code,验证码两分钟内有效";
-    public static final String signUp = "本次验证码:code,验证码两分钟内有效";
+    public static final String SIGNUP = "本次验证码:code,验证码两分钟内有效";
 
 
 }

+ 4 - 4
hzgzpt-service-app/src/main/java/com/miaxis/app/sms/impl/SmsServiceImpl.java

@@ -56,7 +56,7 @@ public class SmsServiceImpl implements ISmsService {
         String charset = "UTF-8";
 
         //type验证
-        List<String> collect = Arrays.stream(SmsTemplateConstants.smsTemplateType)
+        List<String> collect = Arrays.stream(SmsTemplateConstants.SMS_TEMPLATE_TYPE)
                 .parallel()
                 .filter(str -> str.equals(smsParameter.getType()))
                 .collect(Collectors.toList());
@@ -83,13 +83,13 @@ public class SmsServiceImpl implements ISmsService {
             smsParameter.setVerificationCount(smsKeyCountPrefix);
 
             if ("login".equals(smsParameter.getType())){
-                smsParameter.setSmsTemplateConstants(SmsTemplateConstants.login);
+                smsParameter.setSmsTemplateConstants(SmsTemplateConstants.LOGIN);
             }
             if ("signUp".equals(smsParameter.getType())){
-                smsParameter.setSmsTemplateConstants(SmsTemplateConstants.signUp);
+                smsParameter.setSmsTemplateConstants(SmsTemplateConstants.SIGNUP);
             }
             if ("modify".equals(smsParameter.getType())){
-                smsParameter.setSmsTemplateConstants(SmsTemplateConstants.modify);
+                smsParameter.setSmsTemplateConstants(SmsTemplateConstants.MODIFY);
             }
 
             //验证缓存信息