Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
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
pseer
gxpt_ht
Commits
dce6e4f3
Commit
dce6e4f3
authored
Nov 14, 2023
by
YG8999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
生成保洁记录发送短信提示
parent
1156ca14
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
7 deletions
+47
-7
logback.xml
share-admin/src/main/resources/logback.xml
+1
-1
SmsConstants.java
...mon/src/main/java/share/common/constant/SmsConstants.java
+4
-0
SmsConts.java
...-common/src/main/java/share/common/constant/SmsConts.java
+5
-0
SmsService.java
...system/src/main/java/share/system/service/SmsService.java
+10
-0
SCleanRecordsServiceImpl.java
...a/share/system/service/impl/SCleanRecordsServiceImpl.java
+9
-3
SmsServiceImpl.java
...c/main/java/share/system/service/impl/SmsServiceImpl.java
+18
-3
No files found.
share-admin/src/main/resources/logback.xml
View file @
dce6e4f3
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志存放路径 -->
<property
name=
"log.path"
value=
"
/home/gxpt/logs
"
/>
<property
name=
"log.path"
value=
"
/Users/liwenjun/logs/share
"
/>
<!-- 日志输出格式 -->
<property
name=
"log.pattern"
value=
"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"
/>
...
...
share-common/src/main/java/share/common/constant/SmsConstants.java
View file @
dce6e4f3
...
...
@@ -111,4 +111,8 @@ public class SmsConstants {
public
static
final
int
SMS_CONFIG_TYPE_BIND_SUCCESS_DOWN
=
13
;
/** 发送短信参数模板 */
public
static
final
String
SMS_COMMON_PARAM_FORMAT
=
"param[{}]"
;
/** 保洁短信提醒 */
public
static
final
int
SMS_CONFIG_TYPE_CLEAN_RECORDS_SWITCH
=
20
;
}
share-common/src/main/java/share/common/constant/SmsConts.java
View file @
dce6e4f3
...
...
@@ -33,5 +33,10 @@ public class SmsConts {
*/
public
final
static
String
smsCodeTemp
=
"您的验证码是:{0},有效期为{1}分钟。如非本人操作,可不予理会。"
;
/**
* 保洁打扫提示短信内容
*/
public
final
static
String
smsCleanRecordsTemp
=
"门店:{0},房间:{1},已经结束订单,请前往小程序领取保洁任务并进行保洁工作,门店地址:{2}。"
;
}
share-system/src/main/java/share/system/service/SmsService.java
View file @
dce6e4f3
...
...
@@ -2,6 +2,8 @@ package share.system.service;
import
cn.hutool.json.JSONArray
;
import
share.system.domain.SRoom
;
import
share.system.domain.SStore
;
/**
* @author wuwenlong
...
...
@@ -21,4 +23,12 @@ public interface SmsService {
* @return
*/
boolean
sendSmsCode
(
String
phone
);
/**
* 发送保洁打扫提示短信
* @param phone
* @return
*/
boolean
sendSmsCleanRecords
(
String
phone
,
SStore
store
,
SRoom
room
);
}
share-system/src/main/java/share/system/service/impl/SCleanRecordsServiceImpl.java
View file @
dce6e4f3
...
...
@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SRoom
;
import
share.system.domain.SStore
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.mapper.SCleanRecordsMapper
;
import
share.system.domain.SCleanRecords
;
...
...
@@ -18,6 +19,7 @@ import share.system.mapper.SConsumerMapper;
import
share.system.mapper.SRoomMapper
;
import
share.system.mapper.SStoreMapper
;
import
share.system.service.ISCleanRecordsService
;
import
share.system.service.SmsService
;
/**
* 保洁记录Service业务层处理
...
...
@@ -36,6 +38,8 @@ public class SCleanRecordsServiceImpl implements ISCleanRecordsService
private
SRoomMapper
sRoomMapper
;
@Autowired
private
SStoreMapper
sStoreMapper
;
@Autowired
private
SmsService
smsService
;
/**
* 查询保洁记录
...
...
@@ -126,7 +130,9 @@ public class SCleanRecordsServiceImpl implements ISCleanRecordsService
sCleanRecords
.
setCreateTime
(
DateUtils
.
getNowDate
());
boolean
b
=
0
<
sCleanRecordsMapper
.
insertSCleanRecords
(
sCleanRecords
);
if
(
b
)
{
sendSms
(
storeId
);
SStore
store
=
sStoreMapper
.
selectSStoreById
(
storeId
);
SRoom
room
=
sRoomMapper
.
selectSRoomById
(
roomId
);
sendSms
(
storeId
,
store
,
room
);
}
return
b
;
}
...
...
@@ -181,11 +187,11 @@ public class SCleanRecordsServiceImpl implements ISCleanRecordsService
return
0
<
sCleanRecordsMapper
.
updateBatch
(
list
);
}
private
void
sendSms
(
Long
storeId
)
{
private
void
sendSms
(
Long
storeId
,
SStore
store
,
SRoom
room
)
{
List
<
SConsumer
>
list
=
sConsumerMapper
.
selectListByStoreId
(
storeId
);
for
(
SConsumer
consumer
:
list
)
{
// 循环发送短信提示门店保洁打扫卫生
// todo
smsService
.
sendSmsCleanRecords
(
consumer
.
getPhone
(),
store
,
room
);
}
}
...
...
share-system/src/main/java/share/system/service/impl/SmsServiceImpl.java
View file @
dce6e4f3
...
...
@@ -16,6 +16,8 @@ import share.common.constant.SmsConts;
import
share.common.core.redis.RedisUtil
;
import
share.common.utils.BaseUtil
;
import
share.common.utils.SmsUtil
;
import
share.system.domain.SRoom
;
import
share.system.domain.SStore
;
import
share.system.service.SConsumerService
;
import
share.system.service.SmsService
;
...
...
@@ -76,17 +78,23 @@ public class SmsServiceImpl implements SmsService {
* @param phone
* @return
*/
private
boolean
sendSms
(
String
phone
,
Integer
tag
)
{
private
boolean
sendSms
(
String
phone
,
Integer
tag
,
String
content
)
{
try
{
if
(
tag
.
equals
(
SmsConstants
.
SMS_CONFIG_TYPE_VERIFICATION_CODE
))
{
//TODO 发送短信
JSONObject
jsonObject
=
sendOneSms
(
phone
,
getSmsContent
(
phone
,
tag
)
);
JSONObject
jsonObject
=
sendOneSms
(
phone
,
content
);
Boolean
isSendCode
=
Objects
.
nonNull
(
jsonObject
);
//TODO 发送成功判断??
if
(
isSendCode
)
{
return
isSendCode
;
}
// 发送失败删除缓存
redisUtil
.
delete
(
sConsumerService
.
getValidateCodeRedisKey
(
phone
));
}
else
if
(
tag
.
equals
(
SmsConstants
.
SMS_CONFIG_TYPE_CLEAN_RECORDS_SWITCH
)){
JSONObject
jsonObject
=
sendOneSms
(
phone
,
content
);
Boolean
isSendCode
=
Objects
.
nonNull
(
jsonObject
);
if
(
isSendCode
)
{
return
isSendCode
;
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"短信登录验证发送失败:"
,
e
);
...
...
@@ -98,7 +106,14 @@ public class SmsServiceImpl implements SmsService {
@Override
public
boolean
sendSmsCode
(
String
phone
)
{
// redisUtil.set(sConsumerService.getValidateCodeRedisKey(phone), "123456", Long.valueOf(Constants.CONFIG_KEY_SMS_CODE_EXPIRE), TimeUnit.MINUTES);
return
sendSms
(
phone
,
SmsConstants
.
SMS_CONFIG_TYPE_VERIFICATION_CODE
);
//TODO 手机验证吗待对接短信平台 sendSms(phone, SmsConstants.SMS_CONFIG_TYPE_VERIFICATION_CODE);
String
content
=
getSmsContent
(
phone
,
SmsConstants
.
SMS_CONFIG_TYPE_VERIFICATION_CODE
);
return
sendSms
(
phone
,
SmsConstants
.
SMS_CONFIG_TYPE_VERIFICATION_CODE
,
content
);
//TODO 手机验证吗待对接短信平台 sendSms(phone, SmsConstants.SMS_CONFIG_TYPE_VERIFICATION_CODE);
}
@Override
public
boolean
sendSmsCleanRecords
(
String
phone
,
SStore
store
,
SRoom
room
)
{
String
content
=
MessageFormat
.
format
(
SmsConts
.
smsCleanRecordsTemp
,
store
.
getName
(),
room
.
getName
(),
store
.
getAddress
());
return
sendSms
(
phone
,
SmsConstants
.
SMS_CONFIG_TYPE_CLEAN_RECORDS_SWITCH
,
content
);
}
private
String
getSmsContent
(
String
phone
,
Integer
tag
)
{
...
...
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