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
e2a8bc75
Commit
e2a8bc75
authored
Apr 08, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
maven修改
parent
f90d4872
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
226 additions
and
184 deletions
+226
-184
pom.xml
pom.xml
+56
-74
OrderManageServiceImpl.java
.../application/order/serve/impl/OrderManageServiceImpl.java
+11
-5
QRCodeServiceImpl.java
...va/com/gogirl/application/xcx/impl/QRCodeServiceImpl.java
+7
-6
Schedule.java
...ain/java/com/gogirl/infrastructure/schedule/Schedule.java
+5
-5
FileService.java
...a/com/gogirl/infrastructure/service/file/FileService.java
+26
-0
QiniuFileServiceImpl.java
...nfrastructure/service/file/impl/QiniuFileServiceImpl.java
+22
-7
SmsService.java
...ava/com/gogirl/infrastructure/service/sms/SmsService.java
+9
-61
QCloudSmsServiceImpl.java
...infrastructure/service/sms/impl/QCloudSmsServiceImpl.java
+41
-0
SmsConstant.java
...m/gogirl/infrastructure/service/sms/impl/SmsConstant.java
+4
-7
PushMsgService.java
...girl/infrastructure/service/subscribe/PushMsgService.java
+5
-3
MiniappPushMsgServiceImpl.java
...ure/service/subscribe/impl/MiniappPushMsgServiceImpl.java
+5
-5
ServeController.java
.../com/gogirl/interfaces/product/serve/ServeController.java
+1
-1
StoreTechnicianController.java
...nterfaces/store/technician/StoreTechnicianController.java
+4
-2
CustomerController.java
...n/java/com/gogirl/interfaces/user/CustomerController.java
+6
-4
application-dev.yml
src/main/resources/application-dev.yml
+0
-1
application-pre.yml
src/main/resources/application-pre.yml
+0
-1
application-prod.yml
src/main/resources/application-prod.yml
+0
-1
application-test.yml
src/main/resources/application-test.yml
+0
-1
logback-spring.xml
src/main/resources/logback-spring.xml
+24
-0
No files found.
pom.xml
View file @
e2a8bc75
...
...
@@ -19,45 +19,45 @@
<properties>
<java.version>
1.8
</java.version>
<weixin-java-mp.version>
3.3.0
</weixin-java-mp.version>
<weixin-java-miniapp.version>
3.3.0
</weixin-java-miniapp.version>
<mybatis-plus-generator.version>
3.0.7
</mybatis-plus-generator.version>
<mybatis-plus-boot-starter.version>
3.0.7
</mybatis-plus-boot-starter.version>
<weixin-java-pay.version>
3.1.0
</weixin-java-pay.version>
<qiniu-java-sdk.version>
[7.2.0, 7.2.99]
</qiniu-java-sdk.version>
<geodesy.version>
1.1.3
</geodesy.version>
<springfox-swagger-ui.version>
2.9.2
</springfox-swagger-ui.version>
<springfox-swagger2.version>
2.9.2
</springfox-swagger2.version>
<bcprov-jdk16.version>
1.46
</bcprov-jdk16.version>
<commons-io.version>
2.4
</commons-io.version>
<commons-dbcp.version>
1.4
</commons-dbcp.version>
<commons-pool2.version>
2.6.2
</commons-pool2.version>
<qcloudsms.version>
1.0.6
</qcloudsms.version>
<commons-lang3.verson>
3.4
</commons-lang3.verson>
<json-lib.version>
2.4
</json-lib.version>
<fastjson.version>
1.2.47
</fastjson.version>
<commons-fileupload.version>
1.3.1
</commons-fileupload.version>
</properties>
<dependencies>
<!--mp 增加Mybatis-->
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus-boot-starter
</artifactId>
<version>
3.0.7
</version>
<version>
${mybatis-plus-generator.version}
</version>
</dependency>
<dependency>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-databind
</artifactId>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid-spring-boot-starter
</artifactId>
<version>
1.1.17
</version>
</dependency>
<!--数据库日志-->
<!--日志输出到数据库-->
<dependency>
<groupId>
commons-dbcp
</groupId>
<artifactId>
commons-dbcp
</artifactId>
<version>
1.4
</version>
<version>
${commons-dbcp.version}
</version>
</dependency>
<!--邮件服务-->
<dependency>
<groupId>
com.google.zxing
</groupId>
<artifactId>
core
</artifactId>
<version>
3.3.0
</version>
</dependency>
<dependency>
<groupId>
com.google.zxing
</groupId>
<artifactId>
javase
</artifactId>
<version>
3.3.0
</version>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-mail
</artifactId>
</dependency>
<!--数据库连接组件-->
...
...
@@ -66,11 +66,11 @@
<artifactId>
mysql-connector-java
</artifactId>
</dependency>
<!--工具包-->
<!--
对象池
工具包-->
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-pool2
</artifactId>
<version>
2.6.2
</version>
<version>
${commons-pool2.version}
</version>
</dependency>
<!--spring aspect 切面-->
...
...
@@ -91,21 +91,16 @@
<dependency>
<groupId>
net.sf.json-lib
</groupId>
<artifactId>
json-lib
</artifactId>
<version>
2.4
</version>
<version>
${json-lib.version}
</version>
<classifier>
jdk15
</classifier>
</dependency>
<!--qcloud短信模块-->
<!--腾讯云qcloud短信模块-->
<dependency>
<groupId>
com.github.qcloudsms
</groupId>
<artifactId>
qcloudsms
</artifactId>
<version>
1.0.6
</version>
</dependency>
<dependency>
<groupId>
com.thoughtworks.xstream
</groupId>
<artifactId>
xstream
</artifactId>
<version>
1.4.10
</version>
<version>
${qcloudsms.version}
</version>
</dependency>
<!--lombok-->
...
...
@@ -121,94 +116,91 @@
<artifactId>
spring-boot-starter-websocket
</artifactId>
</dependency>
<!--fastjson-->
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
<version>
1.2.47
</version>
<version>
${fastjson.version}
</version>
</dependency>
<!--apache 工具包-->
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-lang3
</artifactId>
<version>
3.4
</version>
<version>
${commons-lang3.verson}
</version>
</dependency>
<!--编码工具包-->
<dependency>
<groupId>
commons-codec
</groupId>
<artifactId>
commons-codec
</artifactId>
<version>
${commons-codec.version}
</version>
</dependency>
<!--文件处理工具包 commons-fileupload 通常和 commons-io 一起使用-->
<dependency>
<groupId>
commons-fileupload
</groupId>
<artifactId>
commons-fileupload
</artifactId>
<version>
1.3.1
</version>
<version>
${commons-fileupload.version}
</version>
</dependency>
<!--文件处理工具包 commons-fileupload 通常和 commons-io 一起使用-->
<dependency>
<groupId>
commons-io
</groupId>
<artifactId>
commons-io
</artifactId>
<version>
2.4
</version>
</dependency>
<dependency>
<groupId>
org.json
</groupId>
<artifactId>
json
</artifactId>
<version>
20180813
</version>
<version>
${commons-io.version}
</version>
</dependency>
<!-- 微信小程序加密数据解密算法 -->
<dependency>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcprov-jdk16
</artifactId>
<version>
1.46
</version>
<version>
${bcprov-jdk16.version}
</version>
</dependency>
<!-- 自动生成接口文档 -->
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
<version>
2.9.2
</version>
<version>
${springfox-swagger2.version}
</version>
</dependency>
<!-- 自动生成接口文档 -->
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger-ui
</artifactId>
<version>
2.9.2
</version>
<version>
${springfox-swagger-ui.version}
</version>
</dependency>
<!--地理位置计算工具包-->
<dependency>
<groupId>
org.gavaghan
</groupId>
<artifactId>
geodesy
</artifactId>
<version>
1.1.3
</version>
<version>
${geodesy.version}
</version>
</dependency>
<!--七牛云文档-->
<dependency>
<groupId>
com.qiniu
</groupId>
<artifactId>
qiniu-java-sdk
</artifactId>
<version>
[7.2.0, 7.2.99]
</version>
<version>
${qiniu-java-sdk.version}
</version>
</dependency>
<!--微信小程序二次开发sdk-->
<dependency>
<groupId>
com.github.binarywang
</groupId>
<artifactId>
weixin-java-miniapp
</artifactId>
<version>
${weixin-java-mp.version}
</version>
<version>
${weixin-java-m
iniap
p.version}
</version>
</dependency>
<!--微信支付二次开发sdk-->
<dependency>
<groupId>
com.github.binarywang
</groupId>
<artifactId>
weixin-java-pay
</artifactId>
<version>
3.1.0
</version>
</dependency>
<!-- 数据库连接池 -->
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid
</artifactId>
<version>
1.1.12
</version>
<version>
${weixin-java-pay.version}
</version>
</dependency>
<!--spring web组件-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
...
...
@@ -226,30 +218,22 @@
<artifactId>
spring-boot-starter-undertow
</artifactId>
</dependency>
<!--springboot
自动配置
-->
<!--springboot
redis
-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-redis
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-ooxml
</artifactId>
<version>
3.15
</version>
</dependency>
<!--mp 代码生成工具-->
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus-generator
</artifactId>
<version>
3.0.7
</version>
<version>
${mybatis-plus-generator.version}
</version>
</dependency>
<dependency>
<groupId>
org.freemarker
</groupId>
<artifactId>
freemarker
</artifactId>
<!-- <version>2.3.9</version>-->
</dependency>
...
...
@@ -387,7 +371,6 @@
<!-- </execution>-->
<!-- </executions>-->
</plugin>
</plugins>
<resources>
...
...
@@ -403,5 +386,4 @@
</resource>
</resources>
</build>
</project>
src/main/java/com/gogirl/application/order/serve/impl/OrderManageServiceImpl.java
View file @
e2a8bc75
...
...
@@ -42,7 +42,7 @@ import com.gogirl.infrastructure.mapper.product.serve.ProducePromotionTimeMapper
import
com.gogirl.infrastructure.mapper.store.store.StoreTechnicianMapper
;
import
com.gogirl.infrastructure.mapper.user.customer.CustomerBalanceMapper
;
import
com.gogirl.infrastructure.mapper.user.customer.CustomerMessageMapper
;
import
com.gogirl.infrastructure.service.subscribe.
Subscribe
Service
;
import
com.gogirl.infrastructure.service.subscribe.
PushMsg
Service
;
import
com.gogirl.infrastructure.util.SessionUtils
;
import
com.gogirl.shared.member.order.command.CreateCommentCommand
;
import
com.gogirl.shared.member.order.command.OrderCommentCommand
;
...
...
@@ -108,7 +108,7 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
@Resource
private
CustomerService
customerService
;
@Resource
private
SubscribeService
subscribe
Service
;
private
PushMsgService
pushMsg
Service
;
@Resource
private
GogirlTokenService
gogirlTokenService
;
@Resource
...
...
@@ -451,7 +451,7 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
}
Customer
customer
=
customerService
.
selectByCustomerId
(
orderManage
.
getOrderUser
());
subscribe
Service
.
sendOrderPayNotifyMsg
(
orderId
,
pushMsg
Service
.
sendOrderPayNotifyMsg
(
orderId
,
customer
.
getOpenid1
(),
name
,
orderManage
.
getOrderNo
(),
...
...
@@ -821,7 +821,7 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
//非朋友代付
orderManage
.
setIsFriendPay
(
2
);
//发送订阅消息
subscribe
Service
.
sendPaySuccessMsg
(
orderId
,
customer
.
getOpenid1
(),
payTypeStr
,
new
Date
(),
orderManage
.
getTotalPaymentAmount
(),
new
BigDecimal
(
customerBalance
.
getBalance
()
/
100
));
pushMsg
Service
.
sendPaySuccessMsg
(
orderId
,
customer
.
getOpenid1
(),
payTypeStr
,
new
Date
(),
orderManage
.
getTotalPaymentAmount
(),
new
BigDecimal
(
customerBalance
.
getBalance
()
/
100
));
this
.
updateById
(
orderManage
);
}
...
...
@@ -925,12 +925,18 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
ScheduleManage
scheduleManage
=
scheduleManageMapper
.
selectById
(
orderManage
.
getScheduledId
());
List
<
ScheduleServe
>
scheduleServeList
=
scheduleServeMapper
.
selectList
(
new
LambdaQueryWrapper
<
ScheduleServe
>().
eq
(
ScheduleServe:
:
getSchId
,
scheduleManage
.
getId
()));
List
<
OrderServe
>
orderServeList
=
orderServeMapper
.
selectList
(
new
LambdaQueryWrapper
<
OrderServe
>().
eq
(
OrderServe:
:
getOrderId
,
orderManage
.
getId
()));
//过滤辅助服务
orderServeList
=
orderServeList
.
stream
()
.
filter
(
orderServe
->
scheduleServeList
.
stream
()
.
filter
(
scheduleServe
->
scheduleServe
.
getMainServeId
()
==
null
)
.
map
(
ScheduleServe:
:
getServeId
)
.
collect
(
Collectors
.
toList
())
.
contains
(
orderServe
.
getServeId
()))
.
contains
(
orderServe
.
getServeId
())
||
!
scheduleServeList
.
stream
()
.
map
(
ScheduleServe:
:
getServeId
)
.
collect
(
Collectors
.
toList
())
.
contains
(
orderServe
.
getServeId
()))
.
collect
(
Collectors
.
toList
());
orderServeList
.
forEach
(
orderServe
->
{
...
...
src/main/java/com/gogirl/application/xcx/impl/QRCodeServiceImpl.java
View file @
e2a8bc75
...
...
@@ -3,26 +3,27 @@ package com.gogirl.application.xcx.impl;
import
com.github.binarywang.utils.qrcode.MatrixToImageWriter
;
import
com.gogirl.application.xcx.QRCodeService
;
import
com.gogirl.infrastructure.config.property.GogirlProperties
;
import
com.gogirl.infrastructure.
util.ImageUtils
;
import
com.gogirl.infrastructure.
service.file.FileService
;
import
com.google.zxing.BarcodeFormat
;
import
com.google.zxing.common.BitMatrix
;
import
com.google.zxing.qrcode.QRCodeWriter
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.json.JSONObject
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.io.File
;
import
java.util.UUID
;
@Service
@AllArgsConstructor
@Slf4j
public
class
QRCodeServiceImpl
implements
QRCodeService
{
private
final
GogirlProperties
gogirlProperties
;
@Resource
private
GogirlProperties
gogirlProperties
;
@Resource
FileService
fileService
;
public
String
myQrCode
(
String
customerId
,
String
phone
)
throws
Exception
{
...
...
@@ -41,7 +42,7 @@ public class QRCodeServiceImpl implements QRCodeService {
MatrixToImageWriter
.
writeToFile
(
bitMatrix
,
"PNG"
,
file
);
return
ImageUtils
.
qiniuUpload
(
file
);
return
fileService
.
qiniuUpload
(
file
);
}
}
...
...
src/main/java/com/gogirl/infrastructure/schedule/Schedule.java
View file @
e2a8bc75
...
...
@@ -43,7 +43,7 @@ import com.gogirl.infrastructure.mapper.store.store.StoreManageMapper;
import
com.gogirl.infrastructure.mapper.store.store.StoreTechnicianMapper
;
import
com.gogirl.infrastructure.mapper.user.customer.CustomerBalanceRecordMapper
;
import
com.gogirl.infrastructure.mapper.xcx.WeekConfigMapper
;
import
com.gogirl.infrastructure.service.subscribe.
Subscribe
Service
;
import
com.gogirl.infrastructure.service.subscribe.
PushMsg
Service
;
import
com.google.common.collect.Lists
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -80,7 +80,7 @@ public class Schedule {
private
final
StoreTechnicianService
storeTechnicianService
;
private
final
StoreManageService
storeManageService
;
private
final
ScheduleManageService
scheduleManageService
;
private
final
SubscribeService
subscribe
Service
;
private
final
PushMsgService
pushMsg
Service
;
private
final
CustomerService
customerService
;
private
final
MallOrderService
mallOrderService
;
private
final
ProduceSalesService
produceSalesService
;
...
...
@@ -203,7 +203,7 @@ public class Schedule {
StoreManage
storeManage
=
storeManageService
.
getById
(
scheduleManage
.
getDepartmentId
());
List
<
ScheduleServe
>
scheduleServeList
=
scheduleManageMapper
.
selectByScheduleId
(
scheduleManage
.
getId
());
subscribe
Service
.
sendScheduleMsg
(
customer
.
getOpenid1
(),
scheduleServeList
.
get
(
0
).
getServeName
(),
scheduleManage
.
getArriveTime
(),
storeManage
.
getName
(),
storeManage
.
getAddress
());
pushMsg
Service
.
sendScheduleMsg
(
customer
.
getOpenid1
(),
scheduleServeList
.
get
(
0
).
getServeName
(),
scheduleManage
.
getArriveTime
(),
storeManage
.
getName
(),
storeManage
.
getAddress
());
scheduleManage
.
setIsSend
(
1
);
scheduleManageMapper
.
updateById
(
scheduleManage
);
...
...
@@ -244,7 +244,7 @@ public class Schedule {
StoreManage
storeManage
=
storeManageService
.
getById
(
scheduleManage
.
getDepartmentId
());
if
(
customer
!=
null
)
{
try
{
subscribe
Service
.
sendOverScheduleMsg
(
customer
.
getOpenid1
(),
scheduleServeList
.
get
(
0
).
getServeName
(),
scheduleManage
.
getArriveTime
(),
storeManage
.
getName
(),
storeManage
.
getAddress
());
pushMsg
Service
.
sendOverScheduleMsg
(
customer
.
getOpenid1
(),
scheduleServeList
.
get
(
0
).
getServeName
(),
scheduleManage
.
getArriveTime
(),
storeManage
.
getName
(),
storeManage
.
getAddress
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -615,7 +615,7 @@ public class Schedule {
try
{
Customer
customer
=
customerService
.
getById
(
orderManage
.
getOrderUser
());
subscribeService
.
testPaper
(
customer
.
getOpenid1
(),
orderManage
.
getId
());
pushMsgService
.
sendCommentMsg
(
customer
.
getOpenid1
(),
orderManage
.
getId
());
orderManage
.
setIsSendCommentMsg
(
1
);
orderManageMapper
.
updateById
(
orderManage
);
...
...
src/main/java/com/gogirl/infrastructure/service/file/FileService.java
0 → 100644
View file @
e2a8bc75
package
com
.
gogirl
.
infrastructure
.
service
.
file
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.File
;
import
java.io.IOException
;
public
interface
FileService
{
/**
* 上传mutiPartFile
*
* @param multipartFile
* @return
*/
String
saveImage
(
MultipartFile
multipartFile
)
throws
IOException
;
/**
* 上传本地文件
*
* @param localFile
* @return
*/
String
qiniuUpload
(
File
localFile
);
}
src/main/java/com/gogirl/infrastructure/
util/ImageUtils
.java
→
src/main/java/com/gogirl/infrastructure/
service/file/impl/QiniuFileServiceImpl
.java
View file @
e2a8bc75
package
com
.
gogirl
.
infrastructure
.
uti
l
;
package
com
.
gogirl
.
infrastructure
.
service
.
file
.
imp
l
;
import
com.gogirl.infrastructure.config.property.GogirlProperties
;
import
com.gogirl.infrastructure.service.file.FileService
;
import
com.google.gson.Gson
;
import
com.qiniu.common.QiniuException
;
import
com.qiniu.common.Zone
;
...
...
@@ -8,28 +10,42 @@ import com.qiniu.storage.Configuration;
import
com.qiniu.storage.UploadManager
;
import
com.qiniu.storage.model.DefaultPutRet
;
import
com.qiniu.util.Auth
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
java.io.File
;
import
java.io.IOException
;
public
class
ImageUtils
{
/**
* 文件服务 七牛云实现
*/
@Service
public
class
QiniuFileServiceImpl
implements
FileService
{
public
static
String
saveImage
(
String
picturePath
,
MultipartFile
multipartFile
)
throws
IOException
{
@Resource
GogirlProperties
gogirlProperties
;
@Override
public
String
saveImage
(
MultipartFile
multipartFile
)
throws
IOException
{
//临时文件地址
String
picturePath
=
gogirlProperties
.
getPicturePath
();
//文件名
String
fileName
=
multipartFile
.
getOriginalFilename
();
String
fileSuffix
=
fileName
.
substring
(
fileName
.
lastIndexOf
(
"."
)
,
fileName
.
length
()
);
String
fileSuffix
=
fileName
.
substring
(
fileName
.
lastIndexOf
(
"."
));
String
localFileName
=
System
.
currentTimeMillis
()
+
fileSuffix
;
String
filePath
=
picturePath
+
File
.
separator
+
localFileName
;
File
localFile
=
new
File
(
filePath
);
File
imagePath
=
new
File
(
picturePath
);
if
(!
imagePath
.
exists
())
{
imagePath
.
mkdirs
();
boolean
ignore
=
imagePath
.
mkdirs
();
}
multipartFile
.
transferTo
(
localFile
);
return
qiniuUpload
(
localFile
);
}
public
static
String
qiniuUpload
(
File
localFilePath
)
{
@Override
public
String
qiniuUpload
(
File
localFilePath
)
{
//1、构造一个带指定Zone对象的配置类
Configuration
cfg
=
new
Configuration
(
Zone
.
zone2
());
//2、其他参数参考类注释
...
...
@@ -39,7 +55,6 @@ public class ImageUtils {
String
secretKey
=
"tS2gxsQO26mGoFZJI-x8WSH9X5aPgYMJcyoJdak5"
;
String
bucket
=
"begogirls"
;
//如果是Windows情况下,格式是 D:\\qiniu\\test.png
//默认不指定key的情况下,以文件内容的hash值作为文件名
String
key
=
null
;
Auth
auth
=
Auth
.
create
(
accessKey
,
secretKey
);
...
...
src/main/java/com/gogirl/infrastructure/service/sms/SmsService.java
View file @
e2a8bc75
package
com
.
gogirl
.
infrastructure
.
service
.
sms
;
import
com.github.qcloudsms.SmsSingleSender
;
import
com.github.qcloudsms.SmsSingleSenderResult
;
import
org.json.JSONException
;
import
org.springframework.stereotype.Service
;
import
javax.xml.ws.http.HTTPException
;
import
java.io.IOException
;
public
interface
SmsService
{
@Service
public
class
SmsService
{
int
appid
=
SmsConstant
.
appid
;
String
appkey
=
SmsConstant
.
appkey
;
public
static
String
decodeUnicode
(
String
unicode
)
{
StringBuffer
sb
=
new
StringBuffer
();
String
[]
hex
=
unicode
.
split
(
"\\\\u"
);
for
(
int
i
=
1
;
i
<
hex
.
length
;
i
++)
{
int
data
=
Integer
.
parseInt
(
hex
[
i
],
16
);
sb
.
append
((
char
)
data
);
}
return
sb
.
toString
();
}
public
SmsSingleSenderResult
sendLoginSmsCode
(
String
phoneNumber
,
String
code
)
{
String
smsSign
=
SmsConstant
.
smsSign
;
int
templateId
=
SmsConstant
.
loginTemplateId
;
String
activeTime
=
SmsConstant
.
activeTime
;
String
[]
params
=
{
code
,
activeTime
};
return
sendSmsCode
(
phoneNumber
,
params
,
templateId
,
smsSign
);
}
public
SmsSingleSenderResult
sendBindSmsCode
(
String
phoneNumber
,
String
code
)
{
String
smsSign
=
SmsConstant
.
smsSign
;
int
templateId
=
SmsConstant
.
bindTemplateId
;
String
activeTime
=
SmsConstant
.
activeTime
;
String
[]
params
=
{
code
,
activeTime
};
return
sendSmsCode
(
phoneNumber
,
params
,
templateId
,
smsSign
);
}
private
SmsSingleSenderResult
sendSmsCode
(
String
phoneNumber
,
String
[]
params
,
int
templateId
,
String
smsSign
)
{
SmsSingleSenderResult
result
=
new
SmsSingleSenderResult
();
try
{
SmsSingleSender
ssender
=
new
SmsSingleSender
(
appid
,
appkey
);
result
=
ssender
.
sendWithParam
(
"86"
,
phoneNumber
,
templateId
,
params
,
smsSign
,
""
,
""
);
}
catch
(
HTTPException
e
)
{
// HTTP响应码错误
e
.
printStackTrace
();
return
result
;
}
catch
(
JSONException
e
)
{
// json解析错误
e
.
printStackTrace
();
return
result
;
}
catch
(
IOException
e
)
{
// 网络IO错误
e
.
printStackTrace
();
return
result
;
}
catch
(
com
.
github
.
qcloudsms
.
httpclient
.
HTTPException
e
)
{
e
.
printStackTrace
();
}
return
result
;
}
/**
* 发送短信验证码
*
* @param phoneNumber
* @param code
* @return
*/
SmsSingleSenderResult
sendBindSmsCode
(
String
phoneNumber
,
String
code
);
}
src/main/java/com/gogirl/infrastructure/service/sms/impl/QCloudSmsServiceImpl.java
0 → 100644
View file @
e2a8bc75
package
com
.
gogirl
.
infrastructure
.
service
.
sms
.
impl
;
import
com.github.qcloudsms.SmsSingleSender
;
import
com.github.qcloudsms.SmsSingleSenderResult
;
import
com.gogirl.infrastructure.service.sms.SmsService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.json.JSONException
;
import
org.springframework.stereotype.Service
;
import
javax.xml.ws.http.HTTPException
;
import
java.io.IOException
;
/**
* 短信服务 腾讯云短信实现
*/
@Service
@Slf4j
public
class
QCloudSmsServiceImpl
implements
SmsService
{
@Override
public
SmsSingleSenderResult
sendBindSmsCode
(
String
phoneNumber
,
String
code
)
{
//
String
smsSign
=
SmsConstant
.
smsSign
;
int
templateId
=
SmsConstant
.
bindTemplateId
;
String
[]
params
=
{
code
,
SmsConstant
.
activeTime
};
SmsSingleSenderResult
result
=
new
SmsSingleSenderResult
();
try
{
SmsSingleSender
sender
=
new
SmsSingleSender
(
SmsConstant
.
appid
,
SmsConstant
.
appkey
);
result
=
sender
.
sendWithParam
(
"86"
,
phoneNumber
,
templateId
,
params
,
smsSign
,
""
,
""
);
}
// HTTP响应码错误 json解析错误 网络IO错误
catch
(
HTTPException
|
JSONException
|
IOException
|
com
.
github
.
qcloudsms
.
httpclient
.
HTTPException
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
return
result
;
}
}
src/main/java/com/gogirl/infrastructure/service/sms/SmsConstant.java
→
src/main/java/com/gogirl/infrastructure/service/sms/
impl/
SmsConstant.java
View file @
e2a8bc75
package
com
.
gogirl
.
infrastructure
.
service
.
sms
;
package
com
.
gogirl
.
infrastructure
.
service
.
sms
.
impl
;
public
class
SmsConstant
{
// 短信应用SDK AppID
public
static
final
int
appid
=
1400159337
;
// 1400开头1400144640
public
static
final
int
appid
=
1400159337
;
// 短信应用SDK AppKey
public
static
final
String
appkey
=
"253e42aa6423cfd51ff1eb735cd12d99"
;
//"b839ac7529c10835d38e341ae672bbcb";
// 短信模板ID,需要在短信应用中申请223595
public
static
final
int
loginTemplateId
=
223595
;
public
static
final
String
appkey
=
"253e42aa6423cfd51ff1eb735cd12d99"
;
// 短信模板ID,需要在短信应用中申请
public
static
final
int
bindTemplateId
=
223595
;
// 签名
//
腾讯云短信
签名
public
static
final
String
smsSign
=
"gogirl美甲美睫"
;
//验证码有效时间
...
...
src/main/java/com/gogirl/infrastructure/service/subscribe/
Subscribe
Service.java
→
src/main/java/com/gogirl/infrastructure/service/subscribe/
PushMsg
Service.java
View file @
e2a8bc75
...
...
@@ -3,7 +3,10 @@ package com.gogirl.infrastructure.service.subscribe;
import
java.math.BigDecimal
;
import
java.util.Date
;
public
interface
SubscribeService
{
/**
* 消息推送服务
*/
public
interface
PushMsgService
{
void
sendScheduleMsg
(
String
openId
,
String
scheduleName
,
...
...
@@ -64,6 +67,5 @@ public interface SubscribeService {
* @param openid1
* @param id
*/
void
testPaper
(
String
openid1
,
Integer
id
);
void
sendCommentMsg
(
String
openid1
,
Integer
id
);
}
src/main/java/com/gogirl/infrastructure/service/subscribe/impl/
Subscribe
ServiceImpl.java
→
src/main/java/com/gogirl/infrastructure/service/subscribe/impl/
MiniappPushMsg
ServiceImpl.java
View file @
e2a8bc75
...
...
@@ -4,7 +4,7 @@ import com.gogirl.application.xcx.impl.AccessTokenService;
import
com.gogirl.infrastructure.common.base.JsonResult
;
import
com.gogirl.infrastructure.common.util.JsonUtilByFsJson
;
import
com.gogirl.infrastructure.config.property.WxProperties
;
import
com.gogirl.infrastructure.service.subscribe.
Subscribe
Service
;
import
com.gogirl.infrastructure.service.subscribe.
PushMsg
Service
;
import
com.gogirl.shared.wx.*
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -20,7 +20,7 @@ import java.util.HashMap;
import
java.util.Map
;
/**
* 小程序订阅消息
基础服务类
* 小程序订阅消息
实现消息推送服务
*
* @Author robbendev
* @Description //TODO
...
...
@@ -29,7 +29,7 @@ import java.util.Map;
@Service
@AllArgsConstructor
@Slf4j
public
class
SubscribeServiceImpl
implements
Subscribe
Service
{
public
class
MiniappPushMsgServiceImpl
implements
PushMsg
Service
{
private
final
AccessTokenService
accessTokenService
;
private
final
WxProperties
wxProperties
;
...
...
@@ -165,8 +165,8 @@ public class SubscribeServiceImpl implements SubscribeService {
@Override
public
void
testPaper
(
String
openId
,
Integer
orderId
)
{
public
void
sendCommentMsg
(
String
openId
,
Integer
orderId
)
{
log
.
info
(
"推送提醒评价订阅消息,订单id:{}"
,
orderId
);
this
.
send
(
WxSubscribeMessageRequest
...
...
src/main/java/com/gogirl/interfaces/product/serve/ServeController.java
View file @
e2a8bc75
...
...
@@ -2,13 +2,13 @@ package com.gogirl.interfaces.product.serve;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.beust.jcommander.internal.Lists
;
import
com.gogirl.application.product.serve.BaseServeService
;
import
com.gogirl.domain.product.serve.BaseServe
;
import
com.gogirl.infrastructure.common.base.JsonResult
;
import
com.gogirl.infrastructure.common.util.DateUtils
;
import
com.gogirl.infrastructure.common.util.StringUtils
;
import
com.gogirl.infrastructure.mapper.product.serve.BaseServeMapper
;
import
com.google.common.collect.Lists
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.AllArgsConstructor
;
...
...
src/main/java/com/gogirl/interfaces/store/technician/StoreTechnicianController.java
View file @
e2a8bc75
...
...
@@ -9,7 +9,7 @@ import com.gogirl.domain.xcx.GogirlToken;
import
com.gogirl.infrastructure.common.annotation.GogirlShop
;
import
com.gogirl.infrastructure.common.base.JsonResult
;
import
com.gogirl.infrastructure.config.property.GogirlProperties
;
import
com.gogirl.infrastructure.
util.ImageUtils
;
import
com.gogirl.infrastructure.
service.file.FileService
;
import
com.gogirl.infrastructure.util.SessionUtils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -33,6 +33,8 @@ public class StoreTechnicianController {
StoreTechnicianService
storeTechnicianService
;
@Resource
GogirlProperties
gogirlProperties
;
@Resource
FileService
fileService
;
@ApiOperation
(
"/查询美甲师信息"
)
@GetMapping
(
"/customer/technician/getById"
)
...
...
@@ -88,7 +90,7 @@ public class StoreTechnicianController {
@ApiOperation
(
value
=
"图片上传"
)
@RequestMapping
(
"/technician/xcx/upload"
)
public
JsonResult
<
String
>
techUpload
(
MultipartFile
file
)
throws
Exception
{
String
imgUrl
=
ImageUtils
.
saveImage
(
gogirlProperties
.
getPicturePath
(),
file
);
String
imgUrl
=
fileService
.
saveImage
(
file
);
return
JsonResult
.
success
(
imgUrl
);
}
}
src/main/java/com/gogirl/interfaces/user/CustomerController.java
View file @
e2a8bc75
...
...
@@ -5,8 +5,8 @@ import com.gogirl.domain.user.customer.Customer;
import
com.gogirl.dto.customer.CustomerOrderDetail
;
import
com.gogirl.infrastructure.common.base.JsonResult
;
import
com.gogirl.infrastructure.config.property.GogirlProperties
;
import
com.gogirl.infrastructure.service.file.FileService
;
import
com.gogirl.infrastructure.util.Base64Utils
;
import
com.gogirl.infrastructure.util.ImageUtils
;
import
com.gogirl.shared.user.query.qry.CustomerQuery
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -27,6 +27,8 @@ public class CustomerController {
private
CustomerService
customerService
;
@Resource
private
GogirlProperties
gogirlProperties
;
@Resource
FileService
fileService
;
@ApiOperation
(
"用户授权接街道地址信息"
)
@GetMapping
(
"/customer/xcx/bindAddressInfo"
)
...
...
@@ -86,9 +88,9 @@ public class CustomerController {
@ApiOperation
(
value
=
"图片上传"
)
@PostMapping
(
"/customer/xcx/upload"
)
public
JsonResult
<
String
>
upload
(
MultipartFile
f
ile
)
throws
Exception
{
public
JsonResult
<
String
>
upload
(
MultipartFile
multipartF
ile
)
throws
Exception
{
log
.
info
(
"图片上传"
);
String
imgUrl
=
ImageUtils
.
saveImage
(
gogirlProperties
.
getPicturePath
(),
f
ile
);
String
imgUrl
=
fileService
.
saveImage
(
multipartF
ile
);
return
JsonResult
.
success
(
imgUrl
);
}
...
...
@@ -97,7 +99,7 @@ public class CustomerController {
public
JsonResult
<
String
>
base64Upload
(
@RequestBody
String
base64
)
throws
Exception
{
log
.
info
(
"图片上传"
);
MultipartFile
multipartFile
=
Base64Utils
.
base64ToMultipart
(
base64
);
String
imgUrl
=
ImageUtils
.
saveImage
(
gogirlProperties
.
getPicturePath
(),
multipartFile
);
String
imgUrl
=
fileService
.
saveImage
(
multipartFile
);
return
JsonResult
.
success
(
imgUrl
);
}
...
...
src/main/resources/application-dev.yml
View file @
e2a8bc75
...
...
@@ -40,7 +40,6 @@ spring:
username
:
root
password
:
"
#7kfnymAM$Y9-Ntf"
driver-class-name
:
com.mysql.jdbc.Driver
type
:
com.alibaba.druid.pool.DruidDataSource
#redis配置
redis
:
...
...
src/main/resources/application-pre.yml
View file @
e2a8bc75
...
...
@@ -40,7 +40,6 @@ spring:
username
:
root
password
:
"
#7kfnymAM$Y9-Ntf"
driver-class-name
:
com.mysql.jdbc.Driver
type
:
com.alibaba.druid.pool.DruidDataSource
#redis配置
redis
:
...
...
src/main/resources/application-prod.yml
View file @
e2a8bc75
...
...
@@ -40,7 +40,6 @@ spring:
username
:
root
password
:
"
#7kfnymAM$Y9-Ntf"
driver-class-name
:
com.mysql.jdbc.Driver
type
:
com.alibaba.druid.pool.DruidDataSource
#redis配置
redis
:
...
...
src/main/resources/application-test.yml
View file @
e2a8bc75
...
...
@@ -40,7 +40,6 @@ spring:
username
:
root
password
:
"
#7kfnymAM$Y9-Ntf"
driver-class-name
:
com.mysql.jdbc.Driver
type
:
com.alibaba.druid.pool.DruidDataSource
#redis配置
redis
:
...
...
src/main/resources/logback-spring.xml
View file @
e2a8bc75
...
...
@@ -19,6 +19,30 @@
<contextName>
${contextName}
</contextName>
<property
name=
"smtpHost"
value=
"smtp.exmail.qq.com"
/>
<property
name=
"username"
value=
"name@new4g.cn"
/>
<property
name=
"email_to"
value=
"name@new4g.cn"
/>
<property
name=
"password"
value=
"ykglyxhfwurjbjbi"
/>
<property
name=
"SSL"
value=
"fasle"
/>
<property
name=
"email_subject"
value=
"服务器日志报错"
/>
<!--邮件-->
<appender
name=
"EMAIL"
class=
"ch.qos.logback.classic.net.SMTPAppender"
>
<smtpHost>
${smtpHost}
</smtpHost>
<Username>
${username}
</Username>
<Password>
${password}
</Password>
<SSL>
${SSL}
</SSL>
<to>
${email_to}
</to>
<from>
${username}
</from>
<subject>
${email_subject}
</subject>
<asynchronousSending>
true
</asynchronousSending>
<layout
class=
"ch.qos.logback.classic.PatternLayout"
>
<pattern>
%date %X{ip} %-5level %logger{35} - %message%n
</pattern>
</layout>
</appender>
<!-- info日志 appender -->
<appender
name=
"INFO"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!--日志回滚策略-->
...
...
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