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
189361b7
Commit
189361b7
authored
Jul 15, 2019
by
jiaorz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://113.105.137.151:22280/youjj/cloud-platform
into dev
parents
64668edf
c76fea50
Changes
20
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
2265 additions
and
49 deletions
+2265
-49
XxLogInterceptor.java
.../github/wxiaoqi/security/common/log/XxLogInterceptor.java
+1
-0
UserFeign.java
...va/com/github/wxiaoqi/security/admin/feign/UserFeign.java
+8
-0
PublicController.java
.../github/wxiaoqi/security/admin/rest/PublicController.java
+22
-8
OrderTypeEnum.java
.../xxfc/platform/order/contant/enumerate/OrderTypeEnum.java
+6
-6
RefundTypeEnum.java
...xxfc/platform/order/contant/enumerate/RefundTypeEnum.java
+5
-5
BaseOrderBiz.java
...c/main/java/com/xxfc/platform/order/biz/BaseOrderBiz.java
+59
-9
TourGoodMapper.xml
...-tour-server/src/main/resources/mapper/TourGoodMapper.xml
+2
-2
pom.xml
xx-universal/xx-universal-api/pom.xml
+7
-5
SmsTemplateDTO.java
.../java/com/xxfc/platform/universal/dto/SmsTemplateDTO.java
+4
-0
ThirdFeign.java
...in/java/com/xxfc/platform/universal/feign/ThirdFeign.java
+1
-1
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
Ueditor.java
...src/main/java/com/xxfc/platform/universal/vo/Ueditor.java
+14
-0
pom.xml
xx-universal/xx-universal-server/pom.xml
+6
-0
SmsController.java
...com/xxfc/platform/universal/controller/SmsController.java
+3
-6
UploadController.java
.../xxfc/platform/universal/controller/UploadController.java
+24
-4
No files found.
ace-common/src/main/java/com/github/wxiaoqi/security/common/log/XxLogInterceptor.java
View file @
189361b7
...
...
@@ -68,6 +68,7 @@ public class XxLogInterceptor{
}
}
catch
(
BaseException
e
){
commonLogService
.
initCommonLogLastPart
(
xxLogEntity
,
ObjectRestResponse
.
createFailedResult
(
e
.
getStatus
(),
e
.
getMessage
()));
throw
e
;
}
catch
(
Exception
e
){
commonLogService
.
initCommonLogLastPart
(
xxLogEntity
,
ObjectRestResponse
.
createFailedResult
(
500
,
e
.
getMessage
()));
throw
e
;
...
...
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/feign/UserFeign.java
View file @
189361b7
...
...
@@ -39,6 +39,14 @@ public interface UserFeign {
@RequestMapping
(
value
=
"/public/userinfo-by-uid"
)
public
ObjectRestResponse
<
UserDTO
>
userinfoByUid
(
@RequestParam
(
"uid"
)
Integer
uid
);
/**
* id获取用户信息
* @param id
* @return
*/
@RequestMapping
(
value
=
"/public/app/userinfo-by-id"
)
public
ObjectRestResponse
<
AppUserDTO
>
userDetailById
(
@RequestParam
(
"id"
)
Integer
id
);
/**
*status:0-判断是否认证过,1-认证成功后修改用户认证状态
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/PublicController.java
View file @
189361b7
...
...
@@ -22,10 +22,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.*
;
/**
* ${DESCRIPTION}
...
...
@@ -70,14 +68,30 @@ public class PublicController {
ObjectRestResponse
userDetailByToken
(
String
token
)
throws
Exception
{
String
username
=
userAuthUtil
.
getInfoFromToken
(
token
).
getId
();
if
(
username
==
null
)
{
throw
new
BaseException
(
ResultCode
.
NOTEXIST_CODE
);
throw
new
BaseException
(
ResultCode
.
NOTEXIST_CODE
,
new
HashSet
<
String
>()
{{
add
(
"用户名不存在!"
);}});
}
AppUserDTO
userDTO
=
new
AppUserDTO
();
Integer
userid
=
Integer
.
parseInt
(
username
);
return
ObjectRestResponse
.
succ
(
getAppUserInfoById
(
userid
));
}
@RequestMapping
(
value
=
"/app/userinfo-by-id"
,
method
=
RequestMethod
.
GET
)
public
@ResponseBody
ObjectRestResponse
<
AppUserDTO
>
userDetailById
(
Integer
id
)
throws
Exception
{
if
(
id
==
null
)
{
throw
new
BaseException
(
ResultCode
.
NOTEXIST_CODE
,
new
HashSet
<
String
>()
{{
add
(
"用户名不存在!"
);}});
}
return
ObjectRestResponse
.
succ
(
getAppUserInfoById
(
id
));
}
private
AppUserDTO
getAppUserInfoById
(
Integer
userid
)
throws
IllegalAccessException
,
InvocationTargetException
{
AppUserDTO
userDTO
=
new
AppUserDTO
();
//获取用户基础信息
AppUserVo
userVo
=
detailBiz
.
getUserInfoById
(
userid
);
if
(
userVo
==
null
)
{
throw
new
BaseException
(
ResultCode
.
NOTEXIST_CODE
);
throw
new
BaseException
(
ResultCode
.
NOTEXIST_CODE
,
new
HashSet
<
String
>()
{{
add
(
"用户不存在!"
);}});
}
Integer
id
=
userVo
.
getId
();
Integer
positionId
=
userVo
.
getPositionId
();
...
...
@@ -94,7 +108,7 @@ public class PublicController {
userDTO
.
setPositionName
(
userPosition
.
getName
());
}
userDTO
.
setId
(
id
);
return
new
ObjectRestResponse
<
AppUserDetail
>().
rel
(
true
).
data
(
userDTO
)
;
return
userDTO
;
}
@RequestMapping
(
value
=
"/userinfo-by-uid"
,
method
=
RequestMethod
.
GET
)
...
...
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/contant/enumerate/OrderTypeEnum.java
View file @
189361b7
...
...
@@ -17,14 +17,14 @@ public enum OrderTypeEnum {
*/
private
String
desc
;
p
rivate
static
Map
<
Integer
,
String
>
codeAndDesc
=
new
HashMap
<
Integer
,
String
>();
p
ublic
static
Map
<
Integer
,
OrderTypeEnum
>
codeAndDesc
=
new
HashMap
<
Integer
,
OrderTypeEnum
>();
//Maps.newHashMap();
//
static{
// for(VehicleBookRecordStatus constantType : VehicleBookRecordStatus
.values()){
// codeAndDesc.put(constantType.getCode(),constantType.getDesc()
);
//
}
//
}
static
{
for
(
OrderTypeEnum
enumE
:
OrderTypeEnum
.
values
()){
codeAndDesc
.
put
(
enumE
.
getCode
(),
enumE
);
}
}
OrderTypeEnum
(
Integer
code
,
String
desc
){
this
.
code
=
code
;
...
...
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/contant/enumerate/RefundTypeEnum.java
View file @
189361b7
...
...
@@ -19,11 +19,11 @@ public enum RefundTypeEnum {
private
static
Map
<
Integer
,
String
>
codeAndDesc
=
new
HashMap
<
Integer
,
String
>();
//Maps.newHashMap();
//
static{
// for(VehicleBookRecordStatus constantType : VehicleBookRecordStatus
.values()){
// codeAndDesc.put(constantType.getCode(),constantType
.getDesc());
//
}
//
}
static
{
for
(
RefundTypeEnum
enumE
:
RefundTypeEnum
.
values
()){
codeAndDesc
.
put
(
enumE
.
getCode
(),
enumE
.
getDesc
());
}
}
RefundTypeEnum
(
Integer
code
,
String
desc
){
this
.
code
=
code
;
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/BaseOrderBiz.java
View file @
189361b7
package
com
.
xxfc
.
platform
.
order
.
biz
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.github.wxiaoqi.security.admin.dto.UserMemberDTO
;
import
com.github.wxiaoqi.security.admin.entity.AppUserLogin
;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
...
...
@@ -20,6 +22,7 @@ import com.xxfc.platform.order.pojo.order.OrderListVo;
import
com.xxfc.platform.order.pojo.order.OrderPageVO
;
import
com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto
;
import
com.xxfc.platform.tour.feign.TourFeign
;
import
com.xxfc.platform.universal.dto.SmsTemplateDTO
;
import
com.xxfc.platform.universal.feign.ThirdFeign
;
import
com.xxfc.platform.universal.vo.OrderRefundVo
;
import
com.xxfc.platform.vehicle.common.RestResponse
;
...
...
@@ -382,7 +385,10 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
* @param orderNo
* @param tradeNo
*/
@Transactional
public
void
payNotifyHandle
(
String
orderNo
,
String
tradeNo
,
Integer
type
)
{
OrderRentVehicleDetail
orvd
=
new
OrderRentVehicleDetail
();
OrderMemberDetail
omd
=
new
OrderMemberDetail
();
BaseOrder
baseOrder
=
this
.
selectOne
(
new
BaseOrder
()
{{
setNo
(
orderNo
);
}});
...
...
@@ -401,23 +407,25 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
if
(
OrderTypeEnum
.
MEMBER
.
getCode
().
equals
(
baseOrder
.
getType
()))
{
//直接设置订单完成
updateOrder
.
setStatus
(
OrderStatusEnum
.
ORDER_FINISH
.
getCode
());
OrderMemberDetail
omd
=
orderMemberDetailBiz
.
selectOne
(
new
OrderMemberDetail
(){{
omd
=
orderMemberDetailBiz
.
selectOne
(
new
OrderMemberDetail
(){{
setOrderId
(
baseOrder
.
getId
());
}});
//触发会员效益
ObjectRestResponse
orr
=
userFeign
.
buyMember
(
new
UserMemberDTO
()
{{
UserMemberDTO
userMemberDTO
=
new
UserMemberDTO
()
{{
setUserId
(
baseOrder
.
getUserId
());
setDiscount
(
omd
.
getRebate
());
setIsBind
(
ISBIND_BIND
);
setMemberLevel
(
omd
.
getMemberLevel
());
setRentFreeDays
(
omd
.
getRentFreeNum
());
setTotalNumber
(
omd
.
getRentFreeNum
());
}});
}};
userMemberDTO
.
setMemberLevel
(
omd
.
getMemberLevel
());
userMemberDTO
.
setRentFreeDays
(
omd
.
getRentFreeNum
());
userMemberDTO
.
setTotalNumber
(
omd
.
getRentFreeNum
());
userMemberDTO
.
setDiscount
(
omd
.
getRebate
());
ObjectRestResponse
orr
=
userFeign
.
buyMember
(
userMemberDTO
);
log
.
info
(
"orr.getStatus() : "
+
orr
.
getStatus
()
);
}
else
if
(
OrderTypeEnum
.
RentVehicle
.
getCode
().
equals
(
baseOrder
.
getType
()))
{
updateOrder
.
setStatus
(
OrderStatusEnum
.
ORDER_TOSTART
.
getCode
());
OrderRentVehicleDetail
orvd
=
orderRentVehicleBiz
.
selectOne
(
new
OrderRentVehicleDetail
(){{
orvd
=
orderRentVehicleBiz
.
selectOne
(
new
OrderRentVehicleDetail
(){{
setOrderId
(
baseOrder
.
getId
());
}});
//车辆预定审核通过
...
...
@@ -436,7 +444,49 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
//站点总人数添加
tourFeign
.
updateTourGoodPersonNum
(
otd
.
getVerificationId
(),
TourFeign
.
TOTAL_PERSON
,
otd
.
getTotalNumber
());
}
try
{
this
.
updateSelectiveByIdRe
(
updateOrder
);
}
finally
{
OrderTypeEnum
orderTypeEnum
=
OrderTypeEnum
.
codeAndDesc
.
get
(
baseOrder
.
getType
());
AppUserDTO
appUserDTO
=
userFeign
.
userDetailById
(
baseOrder
.
getUserId
()).
getData
();
Integer
smstype
;
List
<
String
>
smsParams
=
new
ArrayList
<
String
>();
smsParams
.
add
(
baseOrder
.
getRealAmount
().
toString
());
switch
(
orderTypeEnum
)
{
case
RentVehicle:
if
(
orvd
.
getFreeDays
()
>
0
)
{
smstype
=
SmsTemplateDTO
.
RENT_MEMENT
;
smsParams
.
add
(
orvd
.
getFreeDays
().
toString
());
smsParams
.
add
(
appUserDTO
.
getRentFreeDays
().
toString
());
}
else
{
smstype
=
SmsTemplateDTO
.
RENT_NORMAL
;
}
thirdFeign
.
sendTemplate
(
new
SmsTemplateDTO
(){{
setPhoneNumbers
(
appUserDTO
.
getUsername
());
setType
(
smstype
);
setParams
(
smsParams
.
toArray
(
new
String
[
smsParams
.
size
()]));
}});
break
;
case
TOUR:
thirdFeign
.
sendTemplate
(
new
SmsTemplateDTO
(){{
setPhoneNumbers
(
appUserDTO
.
getUsername
());
setType
(
SmsTemplateDTO
.
TOUR
);
setParams
(
smsParams
.
toArray
(
new
String
[
smsParams
.
size
()]));
}});
break
;
case
MEMBER:
smsParams
.
add
(
omd
.
getRentFreeNum
().
toString
());
smsParams
.
add
(
appUserDTO
.
getRentFreeDays
().
toString
());
thirdFeign
.
sendTemplate
(
new
SmsTemplateDTO
(){{
setPhoneNumbers
(
appUserDTO
.
getUsername
());
setType
(
SmsTemplateDTO
.
MEMENT
);
setParams
(
smsParams
.
toArray
(
new
String
[
smsParams
.
size
()]));
}});
break
;
default
:
break
;
}
}
}
else
{
log
.
error
(
" order has payed , orderNo:{}, tradeNo:{} "
,
orderNo
,
tradeNo
);
}
...
...
xx-tour/xx-tour-server/src/main/resources/mapper/TourGoodMapper.xml
View file @
189361b7
...
...
@@ -88,7 +88,7 @@
from tour_good g
LEFT JOIN tour_good_tag tag ON g.id=tag.good_id
LEFT JOIN tour_tag t ON tag.tag_id=t.id
where g.recommend=1 and g.status=1 and g.is_del=0
where g.recommend=1 and g.status=1 and g.is_del=0
and t.is_del=0
GROUP BY g.id
ORDER BY g.rank DESC ,g.id DESC
limit #{start,jdbcType=INTEGER},#{size,jdbcType=INTEGER}
...
...
@@ -104,7 +104,7 @@
LEFT JOIN tour_good_tag tag ON g.id=tag.good_id
LEFT JOIN tour_tag t ON tag.tag_id=t.id
<where>
g.is_del=0
g.is_del=0
and t.is_del=0
<if
test=
"params.name != null and params.name != ''"
>
and (g.`name` like CONCAT('%',#{params.name},'%') or g.introduce like CONCAT('%',#{params.name},'%'))
</if>
...
...
xx-universal/xx-universal-api/pom.xml
View file @
189361b7
...
...
@@ -43,11 +43,13 @@
</dependency>
<!-- 短信机-->
<dependency>
<groupId>
sms
</groupId>
<artifactId>
sms
</artifactId>
<version>
2.6.3
</version>
<scope>
system
</scope>
<systemPath>
D:/hezhen/Program Files/apache-maven-3.5.4/repo/sms/CCP_REST_SMS_SDK_JAVA_v2.6.3r.jar
</systemPath>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
<version>
2.8.5
</version>
</dependency>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
</dependency>
</dependencies>
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/dto/SmsTemplateDTO.java
View file @
189361b7
...
...
@@ -12,6 +12,10 @@ import lombok.Data;
*/
@Data
public
class
SmsTemplateDTO
{
public
static
final
int
RENT_NORMAL
=
1
;
public
static
final
int
RENT_MEMENT
=
2
;
public
static
final
int
TOUR
=
3
;
public
static
final
int
MEMENT
=
4
;
//类型:1-租车订单通知(普通用户),2-租车订单短信(会员权益),3-旅游订单短信,4-加入会员通知
private
Integer
type
;
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/feign/ThirdFeign.java
View file @
189361b7
...
...
@@ -31,7 +31,7 @@ public interface ThirdFeign {
//发送短信模板消息
public
JSONObject
sendCode
(
@RequestParam
(
"phone"
)
String
phone
,
@RequestParam
(
"code"
)
String
code
,
@RequestParam
(
"templateCode"
)
String
templateCode
);
//云通讯短信机
@RequestMapping
(
value
=
"/
app/unauth/sendTemplate"
,
method
=
RequestMethod
.
GE
T
)
@RequestMapping
(
value
=
"/
sms/app/unauth/sendTemplate"
,
method
=
RequestMethod
.
POS
T
)
public
ObjectRestResponse
sendTemplate
(
SmsTemplateDTO
smsTemplateDTO
);
@RequestMapping
(
value
=
"/file/app/unauth/uploadFiles"
,
method
=
RequestMethod
.
POST
)
public
JSONObject
uploadFiles
(
@RequestParam
(
value
=
"files"
)
MultipartFile
[]
files
);
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/utils/CCPRestSDK.java
0 → 100644
View file @
189361b7
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 @
189361b7
package
com
.
xxfc
.
platform
.
universal
.
utils
;
import
com.cloopen.rest.sdk.CCPRestSmsSDK
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Set
;
public
class
CCPRestSmsUtils
{
public
static
CCPRestS
msS
DK
restAPI
;
public
static
CCPRestSDK
restAPI
;
static
{
restAPI
=
new
CCPRestS
msS
DK
();
restAPI
=
new
CCPRestSDK
();
restAPI
.
init
(
"app.cloopen.com"
,
"8883"
);
restAPI
.
setAccount
(
"8aaf070865e6b6eb0165ecd776700559"
,
"3fe5e2f053674f23b029a9a9fc9503f0"
);
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/utils/CcopHttpClient.java
0 → 100644
View file @
189361b7
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 @
189361b7
/*
* 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 @
189361b7
/*
* 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 @
189361b7
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-api/src/main/java/com/xxfc/platform/universal/vo/Ueditor.java
0 → 100644
View file @
189361b7
package
com
.
xxfc
.
platform
.
universal
.
vo
;
import
lombok.Data
;
@Data
public
class
Ueditor
{
private
String
url
;
private
String
original
;
private
String
state
;
private
String
title
;
}
xx-universal/xx-universal-server/pom.xml
View file @
189361b7
...
...
@@ -27,6 +27,12 @@
<dependency>
<groupId>
com.aliyun
</groupId>
<artifactId>
aliyun-java-sdk-core
</artifactId>
<exclusions>
<exclusion>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
</exclusion>
</exclusions>
<version>
4.4.2
</version>
</dependency>
<dependency>
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/SmsController.java
View file @
189361b7
...
...
@@ -11,10 +11,7 @@ import com.xxfc.platform.universal.service.SmsService;
import
com.xxfc.platform.universal.service.UploadService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.RequestMapping
;
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.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.File
;
...
...
@@ -47,8 +44,8 @@ public class SmsController {
return
smsService
.
smsByCode
(
phone
,
code
,
templateCode
);
}
@RequestMapping
(
value
=
"/app/unauth/sendTemplate"
,
method
=
RequestMethod
.
GE
T
)
public
ObjectRestResponse
sendTemplate
(
SmsTemplateDTO
smsTemplateDTO
)
throws
Exception
{
@RequestMapping
(
value
=
"/app/unauth/sendTemplate"
,
method
=
RequestMethod
.
POS
T
)
public
ObjectRestResponse
sendTemplate
(
@RequestBody
SmsTemplateDTO
smsTemplateDTO
)
throws
Exception
{
if
(
smsTemplateDTO
==
null
){
return
ObjectRestResponse
.
createDefaultFail
();
}
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/UploadController.java
View file @
189361b7
...
...
@@ -4,16 +4,17 @@ import com.alibaba.fastjson.JSONObject;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken
;
import
com.github.wxiaoqi.security.common.util.result.JsonResultUtil
;
import
com.xxfc.platform.universal.service.UploadService
;
import
com.xxfc.platform.universal.utils.PublicMsg
;
import
com.xxfc.platform.universal.vo.Ueditor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.RequestMapping
;
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.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
/**
* 图片上传
...
...
@@ -96,5 +97,24 @@ public class UploadController{
return
JsonResultUtil
.
createDefaultFail
();
}
//以下是图片上传的方法
@RequestMapping
(
value
=
"/app/unauth/ueditor"
)
@ResponseBody
public
String
ueditor
(
HttpServletRequest
request
)
{
return
PublicMsg
.
UEDITOR_CONFIG
;
}
@RequestMapping
(
value
=
"/app/unauth/ueditor"
,
method
=
RequestMethod
.
POST
)
public
Ueditor
imgUpload
(
MultipartFile
upfile
)
throws
Exception
{
Ueditor
ueditor
=
new
Ueditor
();
ueditor
.
setUrl
(
uploadService
.
uploadFile
(
upfile
,
"admin"
));
ueditor
.
setOriginal
(
upfile
.
getOriginalFilename
());
ueditor
.
setState
(
"SUCCESS"
);
ueditor
.
setTitle
(
upfile
.
getOriginalFilename
());
return
ueditor
;
}
}
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