feat:短信

This commit is contained in:
苏竹红
2024-10-12 21:45:30 +08:00
parent beb9db2977
commit beb6ea7b03
13 changed files with 62 additions and 85 deletions

View File

@@ -7,36 +7,11 @@ package com.cool.store.enums;
*/
public enum SMSMsgEnum {
INTERVIEW_APPOINTMENT_SUCCESS("邀约面谈成功", "", "SMS_465930408"),
INTERVIEW_TIME_MODIFY("面谈时间修改", "", "SMS_467410046"),
FIRST_INTERVIEW_APPOINTMENT_SUCCESS("一次面审待预约", "", "SMS_465915456"),
FIRST_INTERVIEW_REMIND("一次面审1小时提醒", "", "SMS_465935440"),
FIRST_INTERVIEW_TIME_MODIFY("一审时间修改", "","SMS_467515078"),
FIRST_INTERVIEW_REAPPOINTMENT("一次面审重新预约", "", "SMS_465935442"),
INTENTION_PAYMENT("意向金待缴费", "", "SMS_465950414"),
INTENTION_PAYMENT_FAIL("意向金缴费失败", "", "SMS_465975442"),
INTENTION_PAYMENT_PASS("签署意向协议OA审核完成后进入门店体验阶段", "", "SMS_467400057"),
INTENTION_PAYMENT_SUCCESS("意向金审核通过", "", "SMS_465885415"),
INTENTION_PROTOCOL_FAIL("意向协议审核未通过", "", "SMS_465910434"),
SECOND_INTERVIEW_APPOINTMENT("二审面审待预约", "", "SMS_465950416"),
SECOND_INTERVIEW_REMIND("二审前1小时提醒", "", "SMS_465925428"),
SECOND_INTERVIEW_REAPPOINTMENT("二审重新预约", "", "SMS_465940421"),
SECOND_INTERVIEW_SUCCESS("二审面审成功", "", "SMS_465980397"),
SECOND_INTERVIEW_TIME_MODIFY("二审时间修改", "", "SMS_467365053"),
SELECT_SUCCESS("选铺成功", "", "SMS_465950846"),
RENT_CONTRACT_AUDIT_FAIL("租赁合同上传未通过", "", "SMS_465955429"),
SHOP_EXPERIENCE("门店体验安排", "", "SMS_465905828"),
SYS_BUILD_STORE_DONE("系统建店已完成", "", "SMS_465916277"),
LICENSE_SUBMITTED("证照待提交", "", "SMS_465981218"),
LICENSE_NOT_PASS("证照未通过", "", "SMS_465971250"),
FRANCHISE_FEE_SUBMITTED("缴纳加盟费待缴纳", "", "SMS_465921311"),
FRANCHISE_FEE_NOT_PASS("缴纳加盟费缴纳失败", "", "SMS_465896262"),
DECORATION_MODEL_PAY("装修款待缴费", "","SMS_465961253"),
THREE_ACCEPTANCE_WAIT("三方验收待验收","","SMS_465961257"),
FIRST_ORDER("首批订货金待缴费","","SMS_467585281"),
TRAINING_REGISTER_SUCCESS("培训登记中", "", "SMS_466035101"),
TRAINING_ASSESSMENT_SUCCESS("员工培训已完成", "", "SMS_465901266"),
PAY_FRANCHISE_FEES("缴纳加盟费/保证金", "", "SMS_474655067"),
SIGN_CONTRACT("合同签署", "", "SMS_474450102"),
DESIGN_STAGE("设计阶段", "", "SMS_474450103"),
CONSTRUCTION_STAGE("施工阶段", "", "SMS_474700023"),
PLATFORM_BUILD_STORE("平台建店", "", "SMS_474560075"),
;
private String title;

View File

@@ -336,7 +336,6 @@ public class ApplyLicenseServiceImpl implements ApplyLicenseService {
shopSubStageStatusEnum = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_43;
ShopInfoDO shopInfoDO = shopInfoMapper.selectByPrimaryKey(shopId);
LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(shopInfoDO.getLineId());
commonService.sendSms(lineInfoDO.getMobile(), SMSMsgEnum.LICENSE_NOT_PASS);
}
applyLicenseMapper.updateByShopId(licenseTransactDO);
//插入操作/意见

View File

@@ -71,7 +71,6 @@ public class BankServiceImpl extends LineFlowService implements BankService {
WorkflowSubStageEnum nextStage = workflowSubStageEnum.getNextStage();
//更新线索阶段
lineInfoDAO.updateWorkflowStage(lineInfo.getId(), nextStage, nextStage.getInitStatus(), userId);
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.INTENTION_PAYMENT_SUCCESS);
return Boolean.TRUE;
}
@@ -82,7 +81,6 @@ public class BankServiceImpl extends LineFlowService implements BankService {
lineInfo.setUpdateUserId(userId);
}
lineInfoDAO.updateLineInfo(lineInfo);
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.INTENTION_PAYMENT_FAIL, null);
return Boolean.TRUE;
}
@@ -104,8 +102,6 @@ public class BankServiceImpl extends LineFlowService implements BankService {
auditInfo.setCertifyFile(JSONObject.toJSONString(request.getCertifyFile()));
Long auditId = lineAuditInfoDAO.addAuditInfo(auditInfo);
linePayMapper.updateByPidAndLid(request.getLineId(),lineInfo.getPartnerId(),auditId);
//发送短信
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.INTENTION_PAYMENT_FAIL, null);
return Boolean.TRUE;
}

View File

@@ -132,43 +132,43 @@ public class CommonService {
public void sendSms(List<String> poneNumbers, SMSMsgEnum templateCode, Map<String, String> templateParamMap){
log.info("templateCode:{}, request:{}, poneNumbers:{}", templateCode.getTitle(), JSONObject.toJSONString(templateParamMap), JSONObject.toJSONString(poneNumbers));
// if(CollectionUtils.isEmpty(poneNumbers)){
// return;
// }
// List<String> signNameList = new ArrayList<>();
// signNameList.add("酷店掌");
// AsyncClient client = null;
// try {
// StaticCredentialProvider provider = StaticCredentialProvider.create(Credential.builder()
// .accessKeyId(smsAccessKeyId)
// .accessKeySecret(smsAccessKeySecret)
// .build());
// client = AsyncClient.builder()
// .region("cn-hangzhou")
// .credentialsProvider(provider)
// .overrideConfiguration(
// ClientOverrideConfiguration.create()
// .setEndpointOverride("dysmsapi.aliyuncs.com")
// )
// .build();
// SendBatchSmsRequest sendBatchSmsRequest = SendBatchSmsRequest.builder()
// .phoneNumberJson(JSONObject.toJSONString(poneNumbers))
// .signNameJson(JSONObject.toJSONString(signNameList))
// .templateCode(templateCode.getTemplateCode())
// .templateParamJson("[" + JSONObject.toJSONString(templateParamMap) + "]")
// .build();
// CompletableFuture<SendBatchSmsResponse> response = client.sendBatchSms(sendBatchSmsRequest);
// SendBatchSmsResponse resp = response.get();
// log.info("短信发送templateCode:{}, response:{}", templateCode.getTemplateCode(), JSONObject.toJSONString(resp));
// } catch (InterruptedException e) {
// e.printStackTrace();
// } catch (ExecutionException e) {
// e.printStackTrace();
// } finally {
// if(Objects.isNull(client)){
// client.close();
// }
// }
if(CollectionUtils.isEmpty(poneNumbers)){
return;
}
List<String> signNameList = new ArrayList<>();
signNameList.add("酷店掌");
AsyncClient client = null;
try {
StaticCredentialProvider provider = StaticCredentialProvider.create(Credential.builder()
.accessKeyId(smsAccessKeyId)
.accessKeySecret(smsAccessKeySecret)
.build());
client = AsyncClient.builder()
.region("cn-hangzhou")
.credentialsProvider(provider)
.overrideConfiguration(
ClientOverrideConfiguration.create()
.setEndpointOverride("dysmsapi.aliyuncs.com")
)
.build();
SendBatchSmsRequest sendBatchSmsRequest = SendBatchSmsRequest.builder()
.phoneNumberJson(JSONObject.toJSONString(poneNumbers))
.signNameJson(JSONObject.toJSONString(signNameList))
.templateCode(templateCode.getTemplateCode())
.templateParamJson("[" + JSONObject.toJSONString(templateParamMap) + "]")
.build();
CompletableFuture<SendBatchSmsResponse> response = client.sendBatchSms(sendBatchSmsRequest);
SendBatchSmsResponse resp = response.get();
log.info("短信发送templateCode:{}, response:{}", templateCode.getTemplateCode(), JSONObject.toJSONString(resp));
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
} finally {
if(Objects.isNull(client)){
client.close();
}
}
log.info("短信发送成功(已过滤)");
}

View File

@@ -536,6 +536,11 @@ public class DecorationServiceImpl implements DecorationService {
}
//更新装修设计状态
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_905);
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
LineInfoDO lineInfo = lineInfoMapper.getByLineId(shopInfo.getLineId());
Map<String, String> templateParam = new HashMap<>();
templateParam.put("shopName", shopInfo.getShopName());
commonService.sendSms(lineInfo.getMobile(),SMSMsgEnum.DESIGN_STAGE,templateParam);
return Boolean.TRUE;
}
@@ -642,6 +647,11 @@ public class DecorationServiceImpl implements DecorationService {
acceptanceInfoDAO.insertSelectiveAcceptanceInfo(acceptanceInfoDO);
}
shopStageInfoDAO.batchUpdateShopStageStatus(shopId, Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_112, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_121));
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
LineInfoDO lineInfo = lineInfoMapper.getByLineId(shopInfo.getLineId());
Map<String, String> templateParam = new HashMap<>();
templateParam.put("shopName", shopInfo.getShopName());
commonService.sendSms(lineInfo.getMobile(),SMSMsgEnum.CONSTRUCTION_STAGE,templateParam);
return Boolean.TRUE;
}

View File

@@ -624,7 +624,6 @@ public class EmployeeTrainingServiceImpl implements EmployeeTrainingService {
Map<String, String> messageMap = new HashMap<>();
messageMap.put("storeName", shopInfoDO.getShopName());
LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(tempUserDetailDO.getLineId());
commonService.sendSms(lineInfoDO.getMobile(), SMSMsgEnum.TRAINING_ASSESSMENT_SUCCESS, messageMap);
}
}

View File

@@ -67,7 +67,7 @@ public class FranchiseFeeServiceImpl implements FranchiseFeeService {
}
ShopInfoDO shopInfoDO = shopInfoMapper.selectByPrimaryKey(request.getShopId());
LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(shopInfoDO.getLineId());
commonService.sendSms(lineInfoDO.getMobile(), SMSMsgEnum.FRANCHISE_FEE_SUBMITTED);
commonService.sendSms(lineInfoDO.getMobile(), SMSMsgEnum.PAY_FRANCHISE_FEES);
return true;
}
@@ -126,7 +126,6 @@ public class FranchiseFeeServiceImpl implements FranchiseFeeService {
shopSubStageStatusEnum = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_74;
ShopInfoDO shopInfoDO = shopInfoMapper.selectByPrimaryKey(request.getShopId());
LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(shopInfoDO.getLineId());
commonService.sendSms(lineInfoDO.getMobile(), SMSMsgEnum.FRANCHISE_FEE_NOT_PASS);
}
//插入audit
shopAuditInfoMapper.insertSelective(shopAuditInfoDO);

View File

@@ -112,7 +112,6 @@ public class JoinIntentionServiceImpl extends LineFlowService implements JoinInt
lineInfoDAO.updateWorkflowStage(lineInfo.getId(), nextStage, nextStage.getInitStatus(), userId);
//更新加盟问卷信息
qualificationsInfoDAO.updateAuditIdByLineId(auditId, lineInfo.getId());
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.INTERVIEW_APPOINTMENT_SUCCESS);
return Boolean.TRUE;
}

View File

@@ -317,7 +317,6 @@ public class PointServiceImpl implements PointService {
shopStageInfoDAO.batchUpdateShopStageStatus(pointInfo.getShopId(), Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_12, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_20));
Map<String, String> templateParam = new HashMap<>();
templateParam.put("pointName", pointInfo.getAddress());
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.SELECT_SUCCESS, templateParam);
}
/**
@@ -756,7 +755,6 @@ public class PointServiceImpl implements PointService {
Map<String, String> templateParam = new HashMap<>();
templateParam.put("pointName", pointInfo.getAddress());
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(request.getLineId());
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.SELECT_SUCCESS, templateParam);
}
updateStatusList.add(selectStatus);
shopStageInfoDAO.batchUpdateShopStageStatus(shopId, updateStatusList);
@@ -903,7 +901,7 @@ public class PointServiceImpl implements PointService {
ShopSubStageStatusEnum subStageStatus = AuditResultTypeEnum.PASS.getCode().equals(request.getResultType()) ? ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_23 : ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_22;
if(AuditResultTypeEnum.REJECT.getCode().equals(request.getResultType())){
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.RENT_CONTRACT_AUDIT_FAIL, null);
//commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.RENT_CONTRACT_AUDIT_FAIL, null);
}
if(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_23.equals(subStageStatus)){
//审核通过铺位变为已签约
@@ -921,8 +919,6 @@ public class PointServiceImpl implements PointService {
}
updateShop.setShopManagerUserId(shopManagerUserId);
shopInfoDAO.updateShopInfo(updateShop);
//发送验证码
commonService.sendSms(lineInfo.getMobile(),SMSMsgEnum.LICENSE_SUBMITTED);
//发送工作通知
Map<String, String> requestMap = new HashMap<>();
requestMap.put("partnerName",lineInfo.getUsername());

View File

@@ -11,6 +11,7 @@ import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
import com.cool.store.entity.*;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.MessageEnum;
import com.cool.store.enums.SMSMsgEnum;
import com.cool.store.enums.point.ShopStageEnum;
import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
@@ -248,6 +249,11 @@ public class PreparationServiceImpl implements PreparationService {
list.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_210);
list.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_220);
shopStageInfoDAO.batchUpdateShopStageStatus(shopId,list);
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(shopInfo.getLineId());
Map<String, String> templateParam = new HashMap<>();
templateParam.put("shopName", shopInfo.getShopName());
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.PLATFORM_BUILD_STORE,templateParam);
}
}
}

View File

@@ -167,8 +167,6 @@ public class ShopServiceImpl implements ShopService {
shopInfoDAO.batchAddShop(addShopList);
List<Long> shopIds = addShopList.stream().map(ShopInfoDO::getId).collect(Collectors.toList());
shopStageInfoDAO.initShopStageInfo(lineInfo.getId(), shopIds);
//发送短信
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.TRAINING_REGISTER_SUCCESS, null);
return 1L;
}

View File

@@ -181,6 +181,7 @@ public class SignFranchiseServiceImpl implements SignFranchiseService, AuditResu
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_84);
//如果加盟合同完成 开始设计阶段与验收阶段
preparationService.contractAndBuildStoreCompletion(request.getShopId());
commonService.sendSms(lineInfoDO.getMobile(),SMSMsgEnum.SIGN_CONTRACT);
return new ResponseResult(200000,"提交成功");
} else {
throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION);

View File

@@ -73,9 +73,8 @@ public class PCTestController {
Map<String, String> templateParam = new HashMap<>();
templateParam.put("pointName", "杭州门店A");
List<SMSMsgEnum> smsMsgList = new ArrayList<>();
smsMsgList.add(SMSMsgEnum.SELECT_SUCCESS);
for (SMSMsgEnum value : smsMsgList) {
commonService.sendSms("17681878615", value, templateParam);
//commonService.sendSms("17681878615", value, templateParam);
}
return ResponseResult.success(Boolean.FALSE);
}