Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gogirl-miniapp-backend
Overview
Overview
Details
Activity
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
huluobin
gogirl-miniapp-backend
Commits
e2c68839
Commit
e2c68839
authored
Apr 08, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
工具类整理 日志fix
parent
06013377
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
91 additions
and
189 deletions
+91
-189
QRCodeServiceImpl.java
...va/com/gogirl/application/xcx/impl/QRCodeServiceImpl.java
+2
-2
WxPayControllerFeign.java
.../gogirl/infrastructure/feign/wx/WxPayControllerFeign.java
+0
-4
LogAspect.java
...java/com/gogirl/infrastructure/interceptor/LogAspect.java
+7
-4
AesUtils.java
src/main/java/com/gogirl/infrastructure/util/AesUtils.java
+1
-1
Base64Utils.java
...main/java/com/gogirl/infrastructure/util/Base64Utils.java
+1
-1
ImageUtils.java
src/main/java/com/gogirl/infrastructure/util/ImageUtils.java
+1
-1
PrefixUtils.java
...main/java/com/gogirl/infrastructure/util/PrefixUtils.java
+1
-1
QRCodeUtil.java
src/main/java/com/gogirl/infrastructure/util/QRCodeUtil.java
+0
-145
RandomUtils.java
...main/java/com/gogirl/infrastructure/util/RandomUtils.java
+0
-19
SessionUtils.java
...ain/java/com/gogirl/infrastructure/util/SessionUtils.java
+71
-4
WXCore.java
src/main/java/com/gogirl/infrastructure/util/WXCore.java
+1
-1
XcxController.java
src/main/java/com/gogirl/interfaces/xcx/XcxController.java
+6
-6
No files found.
src/main/java/com/gogirl/application/xcx/impl/QRCodeServiceImpl.java
View file @
e2c68839
...
@@ -3,7 +3,7 @@ package com.gogirl.application.xcx.impl;
...
@@ -3,7 +3,7 @@ package com.gogirl.application.xcx.impl;
import
com.github.binarywang.utils.qrcode.MatrixToImageWriter
;
import
com.github.binarywang.utils.qrcode.MatrixToImageWriter
;
import
com.gogirl.application.xcx.QRCodeService
;
import
com.gogirl.application.xcx.QRCodeService
;
import
com.gogirl.infrastructure.config.property.GogirlProperties
;
import
com.gogirl.infrastructure.config.property.GogirlProperties
;
import
com.gogirl.infrastructure.util.ImageUtil
;
import
com.gogirl.infrastructure.util.ImageUtil
s
;
import
com.google.zxing.BarcodeFormat
;
import
com.google.zxing.BarcodeFormat
;
import
com.google.zxing.common.BitMatrix
;
import
com.google.zxing.common.BitMatrix
;
import
com.google.zxing.qrcode.QRCodeWriter
;
import
com.google.zxing.qrcode.QRCodeWriter
;
...
@@ -41,7 +41,7 @@ public class QRCodeServiceImpl implements QRCodeService {
...
@@ -41,7 +41,7 @@ public class QRCodeServiceImpl implements QRCodeService {
MatrixToImageWriter
.
writeToFile
(
bitMatrix
,
"PNG"
,
file
);
MatrixToImageWriter
.
writeToFile
(
bitMatrix
,
"PNG"
,
file
);
return
ImageUtil
.
qiniuUpload
(
file
);
return
ImageUtil
s
.
qiniuUpload
(
file
);
}
}
}
}
...
...
src/main/java/com/gogirl/infrastructure/feign/wx/WxPayControllerFeign.java
View file @
e2c68839
...
@@ -5,7 +5,6 @@ import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
...
@@ -5,7 +5,6 @@ import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
import
com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest
;
import
com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest
;
import
com.github.binarywang.wxpay.bean.result.WxPayRefundResult
;
import
com.github.binarywang.wxpay.bean.result.WxPayRefundResult
;
import
com.github.binarywang.wxpay.exception.WxPayException
;
import
com.github.binarywang.wxpay.exception.WxPayException
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
@@ -18,11 +17,8 @@ public interface WxPayControllerFeign {
...
@@ -18,11 +17,8 @@ public interface WxPayControllerFeign {
* @param <T> 请使用{@link com.github.binarywang.wxpay.bean.order}包下的类
* @param <T> 请使用{@link com.github.binarywang.wxpay.bean.order}包下的类
* @return 返回 {@link com.github.binarywang.wxpay.bean.order}包下的类对象
* @return 返回 {@link com.github.binarywang.wxpay.bean.order}包下的类对象
*/
*/
//@ApiOperation(value = "统一下单,并组装所需支付参数")
@PostMapping
(
"/pay/createOrder"
)
WxPayMpOrderResult
createJsapiOrder
(
@RequestBody
WxPayUnifiedOrderRequest
request
)
throws
WxPayException
;
WxPayMpOrderResult
createJsapiOrder
(
@RequestBody
WxPayUnifiedOrderRequest
request
)
throws
WxPayException
;
@PostMapping
(
"/pay/refund"
)
WxPayRefundResult
refund
(
@RequestBody
WxPayRefundRequest
request
)
throws
WxPayException
;
WxPayRefundResult
refund
(
@RequestBody
WxPayRefundRequest
request
)
throws
WxPayException
;
}
}
...
...
src/main/java/com/gogirl/infrastructure/interceptor/LogAspect.java
View file @
e2c68839
...
@@ -76,10 +76,13 @@ public class LogAspect {
...
@@ -76,10 +76,13 @@ public class LogAspect {
HttpServletRequest
request
=
attributes
.
getRequest
();
HttpServletRequest
request
=
attributes
.
getRequest
();
// 会打印出一个对象,想打印出具体内容需要在定义模型处加上toString()
// 会打印出一个对象,想打印出具体内容需要在定义模型处加上toString()
//logger.info( "result:{}", object.toString() );
//logger.info( "result:{}", object.toString() );
JsonResult
jsonResult
=
JsonUtilByJackson
.
readValue
(
JsonUtilByJackson
.
writeValueAsString
(
object
),
JsonResult
.
class
);
try
{
jsonResult
.
setData
(
"hidden data"
);
JsonResult
jsonResult
=
JsonUtilByJackson
.
readValue
(
JsonUtilByJackson
.
writeValueAsString
(
object
),
JsonResult
.
class
);
logger
.
info
(
"result:{}"
,
JsonUtilByJackson
.
writeValueAsString
(
jsonResult
));
jsonResult
.
setData
(
"hidden data"
);
;
logger
.
info
(
"result:{}"
,
JsonUtilByJackson
.
writeValueAsString
(
jsonResult
));
}
catch
(
Exception
ignore
)
{
}
}
}
/**
/**
...
...
src/main/java/com/gogirl/infrastructure/util/A
ESUtil
.java
→
src/main/java/com/gogirl/infrastructure/util/A
esUtils
.java
View file @
e2c68839
...
@@ -16,7 +16,7 @@ import java.security.spec.InvalidParameterSpecException;
...
@@ -16,7 +16,7 @@ import java.security.spec.InvalidParameterSpecException;
*
*
* @author robbendev
* @author robbendev
*/
*/
public
final
class
A
ESUtil
{
public
final
class
A
esUtils
{
public
static
boolean
initialized
=
false
;
public
static
boolean
initialized
=
false
;
...
...
src/main/java/com/gogirl/infrastructure/util/Base64Util.java
→
src/main/java/com/gogirl/infrastructure/util/Base64Util
s
.java
View file @
e2c68839
...
@@ -9,7 +9,7 @@ import java.io.*;
...
@@ -9,7 +9,7 @@ import java.io.*;
* Base64工具类
* Base64工具类
* BASE64DecodedMultipartFileUtil
* BASE64DecodedMultipartFileUtil
*/
*/
public
final
class
Base64Util
{
public
final
class
Base64Util
s
{
/**
/**
...
...
src/main/java/com/gogirl/infrastructure/util/ImageUtil.java
→
src/main/java/com/gogirl/infrastructure/util/ImageUtil
s
.java
View file @
e2c68839
...
@@ -13,7 +13,7 @@ import org.springframework.web.multipart.MultipartFile;
...
@@ -13,7 +13,7 @@ import org.springframework.web.multipart.MultipartFile;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
public
class
ImageUtil
{
public
class
ImageUtil
s
{
public
static
String
saveImage
(
String
picturePath
,
MultipartFile
multipartFile
)
throws
IOException
{
public
static
String
saveImage
(
String
picturePath
,
MultipartFile
multipartFile
)
throws
IOException
{
String
fileName
=
multipartFile
.
getOriginalFilename
();
String
fileName
=
multipartFile
.
getOriginalFilename
();
...
...
src/main/java/com/gogirl/infrastructure/util/PrefixUtil.java
→
src/main/java/com/gogirl/infrastructure/util/PrefixUtil
s
.java
View file @
e2c68839
...
@@ -9,7 +9,7 @@ import java.util.stream.Stream;
...
@@ -9,7 +9,7 @@ import java.util.stream.Stream;
/**
/**
* Java8求笛卡尔积
* Java8求笛卡尔积
*/
*/
public
class
PrefixUtil
{
public
class
PrefixUtil
s
{
/**
/**
* 求笛卡尔积
* 求笛卡尔积
...
...
src/main/java/com/gogirl/infrastructure/util/QRCodeUtil.java
deleted
100644 → 0
View file @
06013377
package
com
.
gogirl
.
infrastructure
.
util
;
import
com.github.binarywang.utils.qrcode.BufferedImageLuminanceSource
;
import
com.google.zxing.*
;
import
com.google.zxing.common.BitMatrix
;
import
com.google.zxing.common.HybridBinarizer
;
import
com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
;
import
javax.imageio.ImageIO
;
import
java.awt.*
;
import
java.awt.geom.RoundRectangle2D
;
import
java.awt.image.BufferedImage
;
import
java.io.File
;
import
java.io.OutputStream
;
import
java.util.Hashtable
;
public
class
QRCodeUtil
{
private
static
final
String
CHARSET
=
"utf-8"
;
private
static
final
String
FORMAT_NAME
=
"JPG"
;
// 二维码尺寸
private
static
final
int
QRCODE_SIZE
=
300
;
// LOGO宽度
private
static
final
int
WIDTH
=
60
;
// LOGO高度
private
static
final
int
HEIGHT
=
60
;
private
static
BufferedImage
createImage
(
String
content
,
String
imgPath
,
boolean
needCompress
)
throws
Exception
{
Hashtable
hints
=
new
Hashtable
();
hints
.
put
(
EncodeHintType
.
ERROR_CORRECTION
,
ErrorCorrectionLevel
.
H
);
hints
.
put
(
EncodeHintType
.
CHARACTER_SET
,
CHARSET
);
hints
.
put
(
EncodeHintType
.
MARGIN
,
1
);
BitMatrix
bitMatrix
=
new
MultiFormatWriter
().
encode
(
content
,
BarcodeFormat
.
QR_CODE
,
QRCODE_SIZE
,
QRCODE_SIZE
,
hints
);
int
width
=
bitMatrix
.
getWidth
();
int
height
=
bitMatrix
.
getHeight
();
BufferedImage
image
=
new
BufferedImage
(
width
,
height
,
BufferedImage
.
TYPE_INT_RGB
);
for
(
int
x
=
0
;
x
<
width
;
x
++)
{
for
(
int
y
=
0
;
y
<
height
;
y
++)
{
image
.
setRGB
(
x
,
y
,
bitMatrix
.
get
(
x
,
y
)
?
0xFF000000
:
0xFFFFFFFF
);
}
}
if
(
imgPath
==
null
||
""
.
equals
(
imgPath
))
{
return
image
;
}
// 插入图片
QRCodeUtil
.
insertImage
(
image
,
imgPath
,
needCompress
);
return
image
;
}
private
static
void
insertImage
(
BufferedImage
source
,
String
imgPath
,
boolean
needCompress
)
throws
Exception
{
File
file
=
new
File
(
imgPath
);
if
(!
file
.
exists
())
{
System
.
err
.
println
(
""
+
imgPath
+
" 该文件不存在!"
);
return
;
}
Image
src
=
ImageIO
.
read
(
new
File
(
imgPath
));
int
width
=
src
.
getWidth
(
null
);
int
height
=
src
.
getHeight
(
null
);
if
(
needCompress
)
{
// 压缩LOGO
if
(
width
>
WIDTH
)
{
width
=
WIDTH
;
}
if
(
height
>
HEIGHT
)
{
height
=
HEIGHT
;
}
Image
image
=
src
.
getScaledInstance
(
width
,
height
,
Image
.
SCALE_SMOOTH
);
BufferedImage
tag
=
new
BufferedImage
(
width
,
height
,
BufferedImage
.
TYPE_INT_RGB
);
Graphics
g
=
tag
.
getGraphics
();
g
.
drawImage
(
image
,
0
,
0
,
null
);
// 绘制缩小后的图
g
.
dispose
();
src
=
image
;
}
// 插入LOGO
Graphics2D
graph
=
source
.
createGraphics
();
int
x
=
(
QRCODE_SIZE
-
width
)
/
2
;
int
y
=
(
QRCODE_SIZE
-
height
)
/
2
;
graph
.
drawImage
(
src
,
x
,
y
,
width
,
height
,
null
);
Shape
shape
=
new
RoundRectangle2D
.
Float
(
x
,
y
,
width
,
width
,
6
,
6
);
graph
.
setStroke
(
new
BasicStroke
(
3
f
));
graph
.
draw
(
shape
);
graph
.
dispose
();
}
public
static
void
encode
(
String
content
,
String
imgPath
,
String
destPath
,
boolean
needCompress
)
throws
Exception
{
BufferedImage
image
=
QRCodeUtil
.
createImage
(
content
,
imgPath
,
needCompress
);
mkdirs
(
destPath
);
// String file = new Random().nextInt(99999999)+".jpg";
// ImageIO.write(image, FORMAT_NAME, new File(destPath+"/"+file));
ImageIO
.
write
(
image
,
FORMAT_NAME
,
new
File
(
destPath
));
}
public
static
BufferedImage
encode
(
String
content
,
String
imgPath
,
boolean
needCompress
)
throws
Exception
{
BufferedImage
image
=
QRCodeUtil
.
createImage
(
content
,
imgPath
,
needCompress
);
return
image
;
}
public
static
void
mkdirs
(
String
destPath
)
{
File
file
=
new
File
(
destPath
);
// 当文件夹不存在时,mkdirs会自动创建多层目录,区别于mkdir.(mkdir如果父目录不存在则会抛出异常)
if
(!
file
.
exists
()
&&
!
file
.
isDirectory
())
{
file
.
mkdirs
();
}
}
public
static
void
encode
(
String
content
,
String
imgPath
,
String
destPath
)
throws
Exception
{
QRCodeUtil
.
encode
(
content
,
imgPath
,
destPath
,
false
);
}
public
static
void
encode
(
String
content
,
String
destPath
)
throws
Exception
{
QRCodeUtil
.
encode
(
content
,
null
,
destPath
,
false
);
}
public
static
void
encode
(
String
content
,
String
imgPath
,
OutputStream
output
,
boolean
needCompress
)
throws
Exception
{
BufferedImage
image
=
QRCodeUtil
.
createImage
(
content
,
imgPath
,
needCompress
);
ImageIO
.
write
(
image
,
FORMAT_NAME
,
output
);
}
public
static
void
encode
(
String
content
,
OutputStream
output
)
throws
Exception
{
QRCodeUtil
.
encode
(
content
,
null
,
output
,
false
);
}
public
static
String
decode
(
File
file
)
throws
Exception
{
BufferedImage
image
;
image
=
ImageIO
.
read
(
file
);
if
(
image
==
null
)
{
return
null
;
}
BufferedImageLuminanceSource
source
=
new
BufferedImageLuminanceSource
(
image
);
BinaryBitmap
bitmap
=
new
BinaryBitmap
(
new
HybridBinarizer
(
source
));
Result
result
;
Hashtable
hints
=
new
Hashtable
();
hints
.
put
(
DecodeHintType
.
CHARACTER_SET
,
CHARSET
);
result
=
new
MultiFormatReader
().
decode
(
bitmap
,
hints
);
String
resultStr
=
result
.
getText
();
return
resultStr
;
}
public
static
String
decode
(
String
path
)
throws
Exception
{
return
QRCodeUtil
.
decode
(
new
File
(
path
));
}
}
src/main/java/com/gogirl/infrastructure/util/RandomUtils.java
deleted
100644 → 0
View file @
06013377
package
com
.
gogirl
.
infrastructure
.
util
;
import
java.util.Random
;
/**
* Created by yinyong on 2018/9/28.
*/
public
class
RandomUtils
{
public
static
String
random
(
String
prefix
)
{
StringBuffer
buffer
=
new
StringBuffer
();
/*SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");*/
Random
random
=
new
Random
();
for
(
int
i
=
0
;
i
<
8
;
i
++)
{
buffer
.
append
(
random
.
nextInt
(
10
));
}
return
prefix
+
buffer
.
toString
();
}
}
src/main/java/com/gogirl/infrastructure/util/SessionUtils.java
View file @
e2c68839
...
@@ -3,39 +3,74 @@ package com.gogirl.infrastructure.util;
...
@@ -3,39 +3,74 @@ package com.gogirl.infrastructure.util;
import
com.gogirl.domain.xcx.GogirlToken
;
import
com.gogirl.domain.xcx.GogirlToken
;
import
com.gogirl.infrastructure.common.exception.RRException
;
import
com.gogirl.infrastructure.common.exception.RRException
;
/**
* 应用会话管理工具类
*/
public
class
SessionUtils
{
public
class
SessionUtils
{
/*美甲师会话线程变量*/
private
static
final
ThreadLocal
<
GogirlToken
>
technicianTokenThreadLocal
=
new
ThreadLocal
<>();
private
static
final
ThreadLocal
<
GogirlToken
>
technicianTokenThreadLocal
=
new
ThreadLocal
<>();
/*用户会员线程变量*/
private
static
final
ThreadLocal
<
GogirlToken
>
customerTokenThreadLocal
=
new
ThreadLocal
<>();
private
static
final
ThreadLocal
<
GogirlToken
>
customerTokenThreadLocal
=
new
ThreadLocal
<>();
/*请求来源线程变量*/
private
static
final
ThreadLocal
<
String
>
sourceFromThreadLocal
=
new
ThreadLocal
<>();
private
static
final
ThreadLocal
<
String
>
sourceFromThreadLocal
=
new
ThreadLocal
<>();
/**
* 保存美甲师登录信息到本地线程变量
*
* @param gogirlToken 美甲师登录信息
*/
public
static
void
putTechnicianToken
(
GogirlToken
gogirlToken
)
{
public
static
void
putTechnicianToken
(
GogirlToken
gogirlToken
)
{
technicianTokenThreadLocal
.
set
(
gogirlToken
);
technicianTokenThreadLocal
.
set
(
gogirlToken
);
}
}
/**
* 获取美甲师登录信息
*
* @return 美甲师登录信息
*/
public
static
GogirlToken
getTechnicianToken
()
{
public
static
GogirlToken
getTechnicianToken
()
{
return
technicianTokenThreadLocal
.
get
();
return
technicianTokenThreadLocal
.
get
();
}
}
/**
* 清除美甲师登录信息
*/
public
static
void
removeTechnicianToken
()
{
public
static
void
removeTechnicianToken
()
{
technicianTokenThreadLocal
.
remove
();
technicianTokenThreadLocal
.
remove
();
}
}
/**
* 保存用户登录信息到本地线程变量
*
* @param gogirlToken 用户登录信息
*/
public
static
void
putCustomerToken
(
GogirlToken
gogirlToken
)
{
public
static
void
putCustomerToken
(
GogirlToken
gogirlToken
)
{
customerTokenThreadLocal
.
set
(
gogirlToken
);
customerTokenThreadLocal
.
set
(
gogirlToken
);
}
}
/**
* 获取用户登录信息
*
* @return 用户登录信息
*/
public
static
GogirlToken
getCustomerToken
()
{
public
static
GogirlToken
getCustomerToken
()
{
return
customerTokenThreadLocal
.
get
();
return
customerTokenThreadLocal
.
get
();
}
}
/**
* 清除用户登录信息
*/
public
static
void
removeCustomerToken
()
{
public
static
void
removeCustomerToken
()
{
customerTokenThreadLocal
.
remove
();
customerTokenThreadLocal
.
remove
();
}
}
/**
* 获取当前登录美甲师id
*
* @return 美甲师id
*/
public
static
Integer
getTechnicianId
()
{
public
static
Integer
getTechnicianId
()
{
GogirlToken
gogirlToken
=
technicianTokenThreadLocal
.
get
();
GogirlToken
gogirlToken
=
technicianTokenThreadLocal
.
get
();
if
(
gogirlToken
==
null
)
{
if
(
gogirlToken
==
null
)
{
...
@@ -44,26 +79,58 @@ public class SessionUtils {
...
@@ -44,26 +79,58 @@ public class SessionUtils {
return
gogirlToken
.
getTechnicianId
();
return
gogirlToken
.
getTechnicianId
();
}
}
/**
* 获取当前登录用户id
*
* @return 客户id
*/
public
static
Integer
getCustomerId
()
{
public
static
Integer
getCustomerId
()
{
return
customerTokenThreadLocal
.
get
().
getCustomerId
();
GogirlToken
gogirlToken
=
customerTokenThreadLocal
.
get
();
if
(
gogirlToken
==
null
)
{
throw
new
RRException
(
2000
,
"token已经失效,请重新登陆"
);
}
return
gogirlToken
.
getCustomerId
();
}
}
/**
* 设置当前请求来源到线程变量
*
* @param sourceFrom 来源:客户:customer ;美甲师:technician ;H5:h5。
*/
public
static
void
putSourceFrom
(
String
sourceFrom
)
{
public
static
void
putSourceFrom
(
String
sourceFrom
)
{
sourceFromThreadLocal
.
set
(
sourceFrom
);
sourceFromThreadLocal
.
set
(
sourceFrom
);
}
}
public
static
String
getSourceFrom
(
String
sourceFrom
)
{
/**
* 获取当前请求来源
*
* @return 请求来源
*/
public
static
String
getSourceFrom
()
{
return
sourceFromThreadLocal
.
get
();
return
sourceFromThreadLocal
.
get
();
}
}
/**
* 清空请求来源
*/
public
static
void
removeSourceFrom
()
{
public
static
void
removeSourceFrom
()
{
sourceFromThreadLocal
.
remove
();
sourceFromThreadLocal
.
remove
();
}
}
/**
* 当前请求是否来自客户
*
* @return bool
*/
public
static
boolean
isSourceFromCustomer
()
{
public
static
boolean
isSourceFromCustomer
()
{
return
sourceFromThreadLocal
.
get
().
equals
(
"customer"
);
return
sourceFromThreadLocal
.
get
().
equals
(
"customer"
);
}
}
/**
* 当前请求是否来自美甲师
*
* @return bool
*/
public
static
boolean
isSourceFromTechnician
()
{
public
static
boolean
isSourceFromTechnician
()
{
return
sourceFromThreadLocal
.
get
().
equals
(
"technician"
);
return
sourceFromThreadLocal
.
get
().
equals
(
"technician"
);
}
}
...
...
src/main/java/com/gogirl/infrastructure/util/WXCore.java
View file @
e2c68839
...
@@ -23,7 +23,7 @@ public class WXCore {
...
@@ -23,7 +23,7 @@ public class WXCore {
String
sessionKey
,
String
sessionKey
,
String
iv
)
throws
InvalidAlgorithmParameterException
{
String
iv
)
throws
InvalidAlgorithmParameterException
{
String
result
;
String
result
;
A
ESUtil
aes
=
new
AESUtil
();
A
esUtils
aes
=
new
AesUtils
();
byte
[]
resultByte
=
aes
.
decrypt
(
Base64
.
decodeBase64
(
encryptedData
),
byte
[]
resultByte
=
aes
.
decrypt
(
Base64
.
decodeBase64
(
encryptedData
),
Base64
.
decodeBase64
(
sessionKey
),
Base64
.
decodeBase64
(
iv
));
Base64
.
decodeBase64
(
sessionKey
),
Base64
.
decodeBase64
(
iv
));
if
(
null
!=
resultByte
&&
resultByte
.
length
>
0
)
{
if
(
null
!=
resultByte
&&
resultByte
.
length
>
0
)
{
...
...
src/main/java/com/gogirl/interfaces/xcx/XcxController.java
View file @
e2c68839
...
@@ -9,8 +9,8 @@ import com.gogirl.domain.user.customer.Customer;
...
@@ -9,8 +9,8 @@ import com.gogirl.domain.user.customer.Customer;
import
com.gogirl.infrastructure.common.base.JsonResult
;
import
com.gogirl.infrastructure.common.base.JsonResult
;
import
com.gogirl.infrastructure.config.property.GogirlProperties
;
import
com.gogirl.infrastructure.config.property.GogirlProperties
;
import
com.gogirl.infrastructure.mapper.user.customer.CustomerMapper
;
import
com.gogirl.infrastructure.mapper.user.customer.CustomerMapper
;
import
com.gogirl.infrastructure.util.Base64Util
;
import
com.gogirl.infrastructure.util.Base64Util
s
;
import
com.gogirl.infrastructure.util.ImageUtil
;
import
com.gogirl.infrastructure.util.ImageUtil
s
;
import
com.gogirl.shared.user.query.qry.CustomerQuery
;
import
com.gogirl.shared.user.query.qry.CustomerQuery
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -95,7 +95,7 @@ public class XcxController {
...
@@ -95,7 +95,7 @@ public class XcxController {
@PostMapping
(
"/customer/xcx/upload"
)
@PostMapping
(
"/customer/xcx/upload"
)
public
JsonResult
<
String
>
upload
(
MultipartFile
file
)
throws
Exception
{
public
JsonResult
<
String
>
upload
(
MultipartFile
file
)
throws
Exception
{
log
.
info
(
"图片上传"
);
log
.
info
(
"图片上传"
);
String
imgUrl
=
ImageUtil
.
saveImage
(
gogirlProperties
.
getPicturePath
(),
file
);
String
imgUrl
=
ImageUtil
s
.
saveImage
(
gogirlProperties
.
getPicturePath
(),
file
);
return
JsonResult
.
success
(
imgUrl
);
return
JsonResult
.
success
(
imgUrl
);
}
}
...
@@ -103,8 +103,8 @@ public class XcxController {
...
@@ -103,8 +103,8 @@ public class XcxController {
@PostMapping
(
"/customer/xcx/no_base64Upload"
)
@PostMapping
(
"/customer/xcx/no_base64Upload"
)
public
JsonResult
<
String
>
base64Upload
(
@RequestBody
String
base64
)
throws
Exception
{
public
JsonResult
<
String
>
base64Upload
(
@RequestBody
String
base64
)
throws
Exception
{
log
.
info
(
"图片上传"
);
log
.
info
(
"图片上传"
);
MultipartFile
multipartFile
=
Base64Util
.
base64ToMultipart
(
base64
);
MultipartFile
multipartFile
=
Base64Util
s
.
base64ToMultipart
(
base64
);
String
imgUrl
=
ImageUtil
.
saveImage
(
gogirlProperties
.
getPicturePath
(),
multipartFile
);
String
imgUrl
=
ImageUtil
s
.
saveImage
(
gogirlProperties
.
getPicturePath
(),
multipartFile
);
return
JsonResult
.
success
(
imgUrl
);
return
JsonResult
.
success
(
imgUrl
);
}
}
...
@@ -146,7 +146,7 @@ public class XcxController {
...
@@ -146,7 +146,7 @@ public class XcxController {
@ApiOperation
(
value
=
"图片上传"
)
@ApiOperation
(
value
=
"图片上传"
)
@RequestMapping
(
"/technician/xcx/upload"
)
@RequestMapping
(
"/technician/xcx/upload"
)
public
JsonResult
<
String
>
techUpload
(
MultipartFile
file
)
throws
Exception
{
public
JsonResult
<
String
>
techUpload
(
MultipartFile
file
)
throws
Exception
{
String
imgUrl
=
ImageUtil
.
saveImage
(
gogirlProperties
.
getPicturePath
(),
file
);
String
imgUrl
=
ImageUtil
s
.
saveImage
(
gogirlProperties
.
getPicturePath
(),
file
);
return
JsonResult
.
success
(
imgUrl
);
return
JsonResult
.
success
(
imgUrl
);
}
}
...
...
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