Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
youjj
cloud-platform
Commits
e6a4c880
Commit
e6a4c880
authored
Jul 13, 2019
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
短信模板
parent
7fb092c5
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
2123 additions
and
14 deletions
+2123
-14
pom.xml
xx-universal/xx-universal-api/pom.xml
+7
-6
CCPRestSDK.java
...in/java/com/xxfc/platform/universal/utils/CCPRestSDK.java
+1806
-0
CCPRestSmsUtils.java
...va/com/xxfc/platform/universal/utils/CCPRestSmsUtils.java
+3
-3
CcopHttpClient.java
...ava/com/xxfc/platform/universal/utils/CcopHttpClient.java
+67
-0
DateUtil.java
...main/java/com/xxfc/platform/universal/utils/DateUtil.java
+78
-0
EncryptUtil.java
...n/java/com/xxfc/platform/universal/utils/EncryptUtil.java
+59
-0
PublicMsg.java
...ain/java/com/xxfc/platform/universal/utils/PublicMsg.java
+90
-0
SmsController.java
...com/xxfc/platform/universal/controller/SmsController.java
+2
-5
UploadController.java
.../xxfc/platform/universal/controller/UploadController.java
+11
-0
No files found.
xx-universal/xx-universal-api/pom.xml
View file @
e6a4c880
...
@@ -41,13 +41,14 @@
...
@@ -41,13 +41,14 @@
<artifactId>
httpclient
</artifactId>
<artifactId>
httpclient
</artifactId>
<version>
4.5
</version>
<version>
4.5
</version>
</dependency>
</dependency>
<!-- 短信机-->
<dependency>
<dependency>
<groupId>
sms
</groupId>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
sms
</artifactId>
<artifactId>
gson
</artifactId>
<version>
2.6.3
</version>
<version>
2.8.5
</version>
<scope>
system
</scope>
</dependency>
<systemPath>
D:/hezhen/Program Files/apache-maven-3.5.4/repo/sms/CCP_REST_SMS_SDK_JAVA_v2.6.3r.jar
</systemPath>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
</dependency>
</dependency>
</dependencies>
</dependencies>
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/utils/CCPRestSDK.java
0 → 100644
View file @
e6a4c880
This diff is collapsed.
Click to expand it.
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/utils/CCPRestSmsUtils.java
View file @
e6a4c880
package
com
.
xxfc
.
platform
.
universal
.
utils
;
package
com
.
xxfc
.
platform
.
universal
.
utils
;
import
com.cloopen.rest.sdk.CCPRestSmsSDK
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
public
class
CCPRestSmsUtils
{
public
class
CCPRestSmsUtils
{
public
static
CCPRestS
msS
DK
restAPI
;
public
static
CCPRestSDK
restAPI
;
static
{
static
{
restAPI
=
new
CCPRestS
msS
DK
();
restAPI
=
new
CCPRestSDK
();
restAPI
.
init
(
"app.cloopen.com"
,
"8883"
);
restAPI
.
init
(
"app.cloopen.com"
,
"8883"
);
restAPI
.
setAccount
(
"8aaf070865e6b6eb0165ecd776700559"
,
restAPI
.
setAccount
(
"8aaf070865e6b6eb0165ecd776700559"
,
"3fe5e2f053674f23b029a9a9fc9503f0"
);
"3fe5e2f053674f23b029a9a9fc9503f0"
);
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/utils/CcopHttpClient.java
0 → 100644
View file @
e6a4c880
package
com
.
xxfc
.
platform
.
universal
.
utils
;
import
java.security.KeyManagementException
;
import
java.security.NoSuchAlgorithmException
;
import
java.security.Principal
;
import
java.security.SecureRandom
;
import
java.security.cert.CertificateException
;
import
java.security.cert.X509Certificate
;
import
javax.net.ssl.SSLContext
;
import
javax.net.ssl.TrustManager
;
import
javax.net.ssl.X509TrustManager
;
import
org.apache.http.conn.scheme.Scheme
;
import
org.apache.http.conn.ssl.SSLSocketFactory
;
import
org.apache.http.impl.client.DefaultHttpClient
;
public
class
CcopHttpClient
{
public
DefaultHttpClient
registerSSL
(
String
hostname
,
String
protocol
,
int
port
,
String
scheme
)
throws
NoSuchAlgorithmException
,
KeyManagementException
{
DefaultHttpClient
httpclient
=
new
DefaultHttpClient
();
SSLContext
ctx
=
SSLContext
.
getInstance
(
protocol
);
X509TrustManager
tm
=
new
X509TrustManager
()
{
public
void
checkClientTrusted
(
X509Certificate
[]
chain
,
String
authType
)
throws
CertificateException
{
}
public
void
checkServerTrusted
(
X509Certificate
[]
chain
,
String
authType
)
throws
CertificateException
{
if
((
chain
==
null
)
||
(
chain
.
length
==
0
))
throw
new
IllegalArgumentException
(
"null or zero-length certificate chain"
);
if
((
authType
==
null
)
||
(
authType
.
length
()
==
0
))
throw
new
IllegalArgumentException
(
"null or zero-length authentication type"
);
boolean
br
=
false
;
Principal
principal
=
null
;
for
(
X509Certificate
x509Certificate
:
chain
)
{
principal
=
x509Certificate
.
getSubjectX500Principal
();
if
(
principal
!=
null
)
{
br
=
true
;
return
;
}
}
if
(!(
br
))
throw
new
CertificateException
(
"服务端证书验证失败!"
);
}
public
X509Certificate
[]
getAcceptedIssuers
()
{
return
new
X509Certificate
[
0
];
}
};
ctx
.
init
(
null
,
new
TrustManager
[]
{
tm
},
new
SecureRandom
());
SSLSocketFactory
socketFactory
=
new
SSLSocketFactory
(
ctx
,
SSLSocketFactory
.
ALLOW_ALL_HOSTNAME_VERIFIER
);
Scheme
sch
=
new
Scheme
(
scheme
,
port
,
socketFactory
);
httpclient
.
getConnectionManager
().
getSchemeRegistry
().
register
(
sch
);
return
httpclient
;
}
}
\ No newline at end of file
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/utils/DateUtil.java
0 → 100644
View file @
e6a4c880
/*
* Copyright (c) 2014 The CCP project authors. All Rights Reserved.
*
* Use of this source code is governed by a Beijing Speedtong Information Technology Co.,Ltd license
* that can be found in the LICENSE file in the root of the web site.
*
* http://www.yuntongxun.com
*
* An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
package
com
.
xxfc
.
platform
.
universal
.
utils
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
public
class
DateUtil
{
public
static
final
int
DEFAULT
=
0
;
public
static
final
int
YM
=
1
;
public
static
final
int
YMR_SLASH
=
11
;
public
static
final
int
NO_SLASH
=
2
;
public
static
final
int
YM_NO_SLASH
=
3
;
public
static
final
int
DATE_TIME
=
4
;
public
static
final
int
DATE_TIME_NO_SLASH
=
5
;
public
static
final
int
DATE_HM
=
6
;
public
static
final
int
TIME
=
7
;
public
static
final
int
HM
=
8
;
public
static
final
int
LONG_TIME
=
9
;
public
static
final
int
SHORT_TIME
=
10
;
public
static
final
int
DATE_TIME_LINE
=
12
;
public
static
String
dateToStr
(
Date
date
,
String
pattern
)
{
if
((
date
==
null
)
||
(
date
.
equals
(
""
)))
return
null
;
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
pattern
);
return
formatter
.
format
(
date
);
}
public
static
String
dateToStr
(
Date
date
)
{
return
dateToStr
(
date
,
"yyyy/MM/dd"
);
}
public
static
String
dateToStr
(
Date
date
,
int
type
)
{
switch
(
type
)
{
case
0
:
return
dateToStr
(
date
);
case
1
:
return
dateToStr
(
date
,
"yyyy/MM"
);
case
2
:
return
dateToStr
(
date
,
"yyyyMMdd"
);
case
11
:
return
dateToStr
(
date
,
"yyyy-MM-dd"
);
case
3
:
return
dateToStr
(
date
,
"yyyyMM"
);
case
4
:
return
dateToStr
(
date
,
"yyyy/MM/dd HH:mm:ss"
);
case
5
:
return
dateToStr
(
date
,
"yyyyMMddHHmmss"
);
case
6
:
return
dateToStr
(
date
,
"yyyy/MM/dd HH:mm"
);
case
7
:
return
dateToStr
(
date
,
"HH:mm:ss"
);
case
8
:
return
dateToStr
(
date
,
"HH:mm"
);
case
9
:
return
dateToStr
(
date
,
"HHmmss"
);
case
10
:
return
dateToStr
(
date
,
"HHmm"
);
case
12
:
return
dateToStr
(
date
,
"yyyy-MM-dd HH:mm:ss"
);
}
throw
new
IllegalArgumentException
(
"Type undefined : "
+
type
);
}
}
\ No newline at end of file
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/utils/EncryptUtil.java
0 → 100644
View file @
e6a4c880
/*
* Copyright (c) 2014 The CCP project authors. All Rights Reserved.
*
* Use of this source code is governed by a Beijing Speedtong Information Technology Co.,Ltd license
* that can be found in the LICENSE file in the root of the web site.
*
* http://www.yuntongxun.com
*
* An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
package
com
.
xxfc
.
platform
.
universal
.
utils
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
import
cn.hutool.core.codec.Base64
;
public
class
EncryptUtil
{
private
static
final
String
UTF8
=
"utf-8"
;
public
String
md5Digest
(
String
src
)
throws
NoSuchAlgorithmException
,
UnsupportedEncodingException
{
MessageDigest
md
=
MessageDigest
.
getInstance
(
"MD5"
);
byte
[]
b
=
md
.
digest
(
src
.
getBytes
(
"utf-8"
));
return
byte2HexStr
(
b
);
}
public
String
base64Encoder
(
String
src
)
throws
UnsupportedEncodingException
{
// BASE64Encoder encoder = new BASE64Encoder();
return
Base64
.
encode
(
src
.
getBytes
(
"utf-8"
));
}
public
String
base64Decoder
(
String
dest
)
throws
NoSuchAlgorithmException
,
IOException
{
// BASE64Decoder decoder = new BASE64Decoder();
return
new
String
(
Base64
.
decode
(
dest
),
"utf-8"
);
}
private
String
byte2HexStr
(
byte
[]
b
)
{
StringBuilder
sb
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
b
.
length
;
++
i
)
{
String
s
=
Integer
.
toHexString
(
b
[
i
]
&
0xFF
);
if
(
s
.
length
()
==
1
)
{
sb
.
append
(
"0"
);
}
sb
.
append
(
s
.
toUpperCase
());
}
return
sb
.
toString
();
}
}
\ No newline at end of file
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/utils/PublicMsg.java
0 → 100644
View file @
e6a4c880
package
com
.
xxfc
.
platform
.
universal
.
utils
;
public
class
PublicMsg
{
public
final
static
String
UEDITOR_CONFIG
=
"{\n"
+
" \"imageActionName\": \"uploadimage\",\n"
+
" \"imageFieldName\": \"upfile\",\n"
+
" \"imageMaxSize\": 2048000,\n"
+
" \"imageAllowFiles\": [\".png\", \".jpg\", \".jpeg\", \".gif\", \".bmp\"],\n"
+
" \"imageCompressEnable\": true,\n"
+
" \"imageCompressBorder\": 1600,\n"
+
" \"imageInsertAlign\": \"none\",\n"
+
" \"imageUrlPrefix\": \"\",\n"
+
" \"imagePathFormat\": \"/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}\",\n"
+
"\n"
+
" \"scrawlActionName\": \"uploadscrawl\",\n"
+
" \"scrawlFieldName\": \"upfile\",\n"
+
" \"scrawlPathFormat\": \"/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}\",\n"
+
" \"scrawlMaxSize\": 2048000,\n"
+
" \"scrawlUrlPrefix\": \"\",\n"
+
" \"scrawlInsertAlign\": \"none\",\n"
+
"\n"
+
" \"snapscreenActionName\": \"uploadimage\",\n"
+
" \"snapscreenPathFormat\": \"/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}\",\n"
+
" \"snapscreenUrlPrefix\": \"\",\n"
+
" \"snapscreenInsertAlign\": \"none\",\n"
+
"\n"
+
" \"catcherLocalDomain\": [\"127.0.0.1\", \"localhost\", \"img.baidu.com\"],\n"
+
" \"catcherActionName\": \"catchimage\",\n"
+
" \"catcherFieldName\": \"source\",\n"
+
" \"catcherPathFormat\": \"/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}\",\n"
+
" \"catcherUrlPrefix\": \"\",\n"
+
" \"catcherMaxSize\": 2048000,\n"
+
" \"catcherAllowFiles\": [\".png\", \".jpg\", \".jpeg\", \".gif\", \".bmp\"],\n"
+
"\n"
+
" \"videoActionName\": \"uploadvideo\",\n"
+
" \"videoFieldName\": \"upfile\",\n"
+
" \"videoPathFormat\": \"/ueditor/jsp/upload/video/{yyyy}{mm}{dd}/{time}{rand:6}\",\n"
+
" \"videoUrlPrefix\": \"\",\n"
+
" \"videoMaxSize\": 102400000,\n"
+
" \"videoAllowFiles\": [\n"
+
" \".flv\", \".swf\", \".mkv\", \".avi\", \".rm\", \".rmvb\", \".mpeg\", \".mpg\",\n"
+
" \".ogg\", \".ogv\", \".mov\", \".wmv\", \".mp4\", \".webm\", \".mp3\", \".wav\", \".mid\"],\n"
+
"\n"
+
" \"fileActionName\": \"uploadfile\",\n"
+
" \"fileFieldName\": \"upfile\",\n"
+
" \"filePathFormat\": \"/ueditor/jsp/upload/file/{yyyy}{mm}{dd}/{time}{rand:6}\",\n"
+
" \"fileUrlPrefix\": \"\",\n"
+
" \"fileMaxSize\": 51200000,\n"
+
" \"fileAllowFiles\": [\n"
+
" \".png\", \".jpg\", \".jpeg\", \".gif\", \".bmp\",\n"
+
" \".flv\", \".swf\", \".mkv\", \".avi\", \".rm\", \".rmvb\", \".mpeg\", \".mpg\",\n"
+
" \".ogg\", \".ogv\", \".mov\", \".wmv\", \".mp4\", \".webm\", \".mp3\", \".wav\", \".mid\",\n"
+
" \".rar\", \".zip\", \".tar\", \".gz\", \".7z\", \".bz2\", \".cab\", \".iso\",\n"
+
" \".doc\", \".docx\", \".xls\", \".xlsx\", \".ppt\", \".pptx\", \".pdf\", \".txt\", \".md\", \".xml\"\n"
+
" ],\n"
+
"\n"
+
" \"imageManagerActionName\": \"listimage\",\n"
+
" \"imageManagerListPath\": \"/ueditor/jsp/upload/image/\",\n"
+
" \"imageManagerListSize\": 20,\n"
+
" \"imageManagerUrlPrefix\": \"\",\n"
+
" \"imageManagerInsertAlign\": \"none\",\n"
+
" \"imageManagerAllowFiles\": [\".png\", \".jpg\", \".jpeg\", \".gif\", \".bmp\"],\n"
+
"\n"
+
" \"fileManagerActionName\": \"listfile\",\n"
+
" \"fileManagerListPath\": \"/ueditor/jsp/upload/file/\",\n"
+
" \"fileManagerUrlPrefix\": \"\",\n"
+
" \"fileManagerListSize\": 20,\n"
+
" \"fileManagerAllowFiles\": [\n"
+
" \".png\", \".jpg\", \".jpeg\", \".gif\", \".bmp\",\n"
+
" \".flv\", \".swf\", \".mkv\", \".avi\", \".rm\", \".rmvb\", \".mpeg\", \".mpg\",\n"
+
" \".ogg\", \".ogv\", \".mov\", \".wmv\", \".mp4\", \".webm\", \".mp3\", \".wav\", \".mid\",\n"
+
" \".rar\", \".zip\", \".tar\", \".gz\", \".7z\", \".bz2\", \".cab\", \".iso\",\n"
+
" \".doc\", \".docx\", \".xls\", \".xlsx\", \".ppt\", \".pptx\", \".pdf\", \".txt\", \".md\", \".xml\"\n"
+
" ] \n"
+
"\n"
+
"}"
;
/**
* Ueditor的返回状态类型
*/
public
enum
UeditorMsg
{
SUCCESS
(
"SUCCESS"
),
ERROR
(
"上传失败"
);
private
String
v
;
UeditorMsg
(
String
v
){
this
.
v
=
v
;
}
public
String
get
(){
return
this
.
v
;
}
}
}
\ No newline at end of file
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/SmsController.java
View file @
e6a4c880
...
@@ -11,10 +11,7 @@ import com.xxfc.platform.universal.service.SmsService;
...
@@ -11,10 +11,7 @@ import com.xxfc.platform.universal.service.SmsService;
import
com.xxfc.platform.universal.service.UploadService
;
import
com.xxfc.platform.universal.service.UploadService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.File
;
import
java.io.File
;
...
@@ -48,7 +45,7 @@ public class SmsController {
...
@@ -48,7 +45,7 @@ public class SmsController {
}
}
@RequestMapping
(
value
=
"/app/unauth/sendTemplate"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/app/unauth/sendTemplate"
,
method
=
RequestMethod
.
GET
)
public
ObjectRestResponse
sendTemplate
(
SmsTemplateDTO
smsTemplateDTO
)
throws
Exception
{
public
ObjectRestResponse
sendTemplate
(
@RequestBody
SmsTemplateDTO
smsTemplateDTO
)
throws
Exception
{
if
(
smsTemplateDTO
==
null
){
if
(
smsTemplateDTO
==
null
){
return
ObjectRestResponse
.
createDefaultFail
();
return
ObjectRestResponse
.
createDefaultFail
();
}
}
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/UploadController.java
View file @
e6a4c880
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken
;
import
com.github.wxiaoqi.security.common.util.result.JsonResultUtil
;
import
com.github.wxiaoqi.security.common.util.result.JsonResultUtil
;
import
com.xxfc.platform.universal.service.UploadService
;
import
com.xxfc.platform.universal.service.UploadService
;
import
com.xxfc.platform.universal.utils.PublicMsg
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -14,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestParam;
...
@@ -14,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
/**
/**
* 图片上传
* 图片上传
...
@@ -96,5 +99,13 @@ public class UploadController{
...
@@ -96,5 +99,13 @@ public class UploadController{
return
JsonResultUtil
.
createDefaultFail
();
return
JsonResultUtil
.
createDefaultFail
();
}
}
//以下是图片上传的方法
@RequestMapping
(
value
=
"/app/unauth/ueditor"
)
public
String
ueditor
(
HttpServletRequest
request
)
{
return
PublicMsg
.
UEDITOR_CONFIG
;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment