Merge remote-tracking branch 'hs/dev/feat/partner1.4_20231009' into dev/feat/partner1.4_20231009
This commit is contained in:
@@ -99,6 +99,16 @@
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -2,6 +2,8 @@ package com.cool.store.http;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.dto.wx.CodeSessionDTO;
|
||||
import com.cool.store.dto.wx.MiniAppUrlLinkDTO;
|
||||
import com.cool.store.dto.wx.MiniAppUrlLinkReqDTO;
|
||||
import com.cool.store.dto.wx.PhoneInfoDTO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
@@ -41,6 +43,8 @@ public class WechatRest {
|
||||
*/
|
||||
String GET_USERPHONENUMBER = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=%s";
|
||||
|
||||
String GET_MINIAPP_URL_LINK = "https://api.weixin.qq.com/wxa/generate_urllink?access_token=%s";
|
||||
|
||||
|
||||
public CodeSessionDTO miniProgramJsCodeSession(String appId, String secret, String jsCode){
|
||||
log.info("WechatRest#miniProgramJsCodeSession, jsCode:{}", jsCode);
|
||||
@@ -90,4 +94,19 @@ public class WechatRest {
|
||||
return null;
|
||||
}
|
||||
|
||||
public MiniAppUrlLinkDTO getMiniAppUrlLink(String accessToken, MiniAppUrlLinkReqDTO miniAppUrlLinkReqDTO){
|
||||
String reqUrl = String.format(GET_MINIAPP_URL_LINK, accessToken);
|
||||
String responseStr = null;
|
||||
try {
|
||||
responseStr = httpRestTemplateService.postForObject(reqUrl, miniAppUrlLinkReqDTO, String.class);
|
||||
log.info("WechatRest#getUserPhoneNumber, reqUrl:{}, response:{}", reqUrl, responseStr);
|
||||
if(StringUtils.isNotBlank(responseStr)){
|
||||
return JSONObject.parseObject(responseStr, MiniAppUrlLinkDTO.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("获取手机号异常", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.cool.store.job;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.cool.store.dto.mdm.AccessTokenDTO;
|
||||
import com.cool.store.dto.response.DictResultDTO;
|
||||
import com.cool.store.dto.response.MDMResultDTO;
|
||||
import com.cool.store.entity.HyPartnerFraSourceDO;
|
||||
import com.cool.store.exception.ApiException;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.mapper.HyPartnerFraSourceMapper;
|
||||
import com.cool.store.request.RpcGetMdmTokenReq;
|
||||
import com.cool.store.utils.RestTemplateUtil;
|
||||
import com.xxl.job.core.context.XxlJobHelper;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author hxd
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class FraSourceSyncJob {
|
||||
|
||||
|
||||
@Value("${hs.mdm.baseUrl:null}")
|
||||
private String mdmBaseUrl;
|
||||
|
||||
@Value("${hs.mdm.appkey:null}")
|
||||
private String mdmAppKey;
|
||||
|
||||
@Value("${hs.mdm.appsec:null}")
|
||||
private String mdmAppSec;
|
||||
|
||||
@Resource
|
||||
private HyPartnerFraSourceMapper hyPartnerFraSourceMapper;
|
||||
|
||||
@XxlJob("FraSourceSyncJob")
|
||||
public void fraSourceSyncJob() {
|
||||
XxlJobHelper.log("-------------------------------定时同步800请求来源开始-------------------------------");
|
||||
execute();
|
||||
XxlJobHelper.log("-------------------------------定时同步800请求来源结束-------------------------------");
|
||||
XxlJobHelper.handleSuccess();
|
||||
}
|
||||
|
||||
private void execute() {
|
||||
DictResultDTO dictResultDTO = null;
|
||||
try {
|
||||
dictResultDTO = JSON.parseObject(getDictList(), new TypeReference<DictResultDTO>() {
|
||||
});
|
||||
} catch (ApiException e) {
|
||||
log.error("请求800获取字典报错:" + JSONObject.toJSONString(e));
|
||||
}
|
||||
if (ObjectUtil.isNull(dictResultDTO)) {
|
||||
return;
|
||||
}
|
||||
List<DictResultDTO.Dict> configList = dictResultDTO.getConfigList();
|
||||
List<HyPartnerFraSourceDO> collect = configList.stream().map(item -> {
|
||||
HyPartnerFraSourceDO hyPartnerFraSourceDO = new HyPartnerFraSourceDO();
|
||||
BeanUtil.copyProperties(item, hyPartnerFraSourceDO);
|
||||
hyPartnerFraSourceDO.setSourceId(item.getId());
|
||||
return hyPartnerFraSourceDO;
|
||||
}).collect(Collectors.toList());
|
||||
hyPartnerFraSourceMapper.batchInsertSelective(collect);
|
||||
}
|
||||
|
||||
public String getDictList() throws ApiException {
|
||||
String url = mdmBaseUrl + "/api/openapi/dict/api/dictListByCode?code=mdFraSource";
|
||||
ResponseEntity<MDMResultDTO> responseEntity = null;
|
||||
try {
|
||||
RpcGetMdmTokenReq rpcGetMDMTokenReq = new RpcGetMdmTokenReq();
|
||||
rpcGetMDMTokenReq.setAppKey(mdmAppKey);
|
||||
rpcGetMDMTokenReq.setAppSecret(mdmAppSec);
|
||||
Map<String, String> headers = new HashMap<>(1);
|
||||
headers.put("Authorization", getMdmAccessToken(rpcGetMDMTokenReq));
|
||||
responseEntity = RestTemplateUtil.get(url, headers, MDMResultDTO.class);
|
||||
log.info("url:{}, header:{}, response:{}", url, JSONObject.toJSONString(headers), JSONObject.toJSONString(responseEntity));
|
||||
if (Objects.nonNull(responseEntity.getBody()) && responseEntity.getBody().isSuccess()) {
|
||||
return JSONObject.toJSONString(responseEntity.getBody().getData());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info("调用MDM接口出错 url{}, e{}", url, e);
|
||||
throw new ApiException(e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getMdmAccessToken(RpcGetMdmTokenReq rpcGetMDMTokenReq) throws ApiException {
|
||||
String url = mdmBaseUrl + "/api/oauth2/accessToken";
|
||||
ResponseEntity<MDMResultDTO> responseEntity = null;
|
||||
try {
|
||||
responseEntity = RestTemplateUtil.post(url, rpcGetMDMTokenReq, MDMResultDTO.class);
|
||||
log.info("url:{}, response:{}", url, JSONObject.toJSONString(responseEntity));
|
||||
if (Objects.nonNull(responseEntity.getBody()) && responseEntity.getBody().isSuccess()) {
|
||||
AccessTokenDTO accessTokenDTO = JSONObject.parseObject(JSONObject.toJSONString(responseEntity.getBody().getData()), AccessTokenDTO.class);
|
||||
if (accessTokenDTO == null || StringUtils.isBlank(accessTokenDTO.getAccessToken())) {
|
||||
throw new ServiceException("获取Mdm token失败!");
|
||||
}
|
||||
return accessTokenDTO.getAccessToken();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info("获取MDM Token 出错 url:\t{}, e:\t{}", url, e);
|
||||
throw new ApiException(e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.entity.HyPartnerFraSourceDO;
|
||||
import com.cool.store.exception.ApiException;
|
||||
import com.cool.store.request.CreateQualifyVerifyReq;
|
||||
import com.cool.store.request.QualificationCallbackReq;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: young.yu
|
||||
@@ -15,4 +17,7 @@ public interface FlowService {
|
||||
void createQualifyVerify(CreateQualifyVerifyReq request) throws ApiException, IOException;
|
||||
|
||||
void qualificationCallback(QualificationCallbackReq request) throws ApiException;
|
||||
|
||||
List<HyPartnerFraSourceDO> getDictList();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
|
||||
import com.cool.store.enums.SMSMsgEnum;
|
||||
import com.cool.store.exception.ApiException;
|
||||
import com.cool.store.response.SmsSendResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @Author: young.yu
|
||||
@@ -9,5 +13,8 @@ import com.cool.store.exception.ApiException;
|
||||
* @Description:
|
||||
*/
|
||||
public interface SmsService {
|
||||
public SendSmsResponse sendSms(String params, String templateCode, String mobile) throws ApiException;
|
||||
public SmsSendResponse sendSmsNormal(String phone, SMSMsgEnum smsMsgEnum, Object... objects);
|
||||
|
||||
public SmsSendResponse sendSmsVariable(String phone, SMSMsgEnum smsMsgEnum,String... objects);
|
||||
|
||||
}
|
||||
|
||||
@@ -19,4 +19,6 @@ public interface WechatMiniAppService {
|
||||
String updateUserPhoneNumber(MobileUpdateRequest request, PartnerUserInfoVO userInfoVO);
|
||||
|
||||
PartnerUserInfoVO getUserInfo(String mobile, String openId);
|
||||
|
||||
String getMiniAppUrl();
|
||||
}
|
||||
|
||||
@@ -86,8 +86,8 @@ public class EcSyncServiceImpl implements EcSyncService {
|
||||
try {
|
||||
insertSelectiveSync(customerInfoItem);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
sendFeiShuRobotMessage("推送:" + JSONObject.toJSONString(e), "27243d49-97ca-4981-8aec-7c3bf84eb660");
|
||||
log.error("ec同步至招商小程序报错"+JSONObject.toJSONString(e));
|
||||
sendFeiShuRobotMessage("推送:"+JSONObject.toJSONString(e),"27243d49-97ca-4981-8aec-7c3bf84eb660");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -158,8 +158,7 @@ public class EcSyncServiceImpl implements EcSyncService {
|
||||
}
|
||||
String newPartnerId = UUIDUtils.get32UUID();
|
||||
HyPartnerUserInfoDO resultUser = new HyPartnerUserInfoDO();
|
||||
resultUser.setUsername(customerInfoItem.getName()).setMobile(customerInfoItem.getMobile()).setUserChannelId(Convert.toInt(channelId));
|
||||
|
||||
resultUser.setUsername(customerInfoItem.getName()).setMobile(customerInfoItem.getMobile()).setUserChannelId(Convert.toInt(channelId)).setEcWantShopArea(customerInfoItem.getEcWantShopArea());
|
||||
HyPartnerLineInfoDO resultLine = new HyPartnerLineInfoDO();
|
||||
String followUserName = customerInfoItem.getFollowUserName();
|
||||
String followUserMobile = customerInfoItem.getFollowUserMobile();
|
||||
@@ -249,6 +248,9 @@ public class EcSyncServiceImpl implements EcSyncService {
|
||||
setCreateTime(new Date());
|
||||
hyPartnerBaseInfoDAO.insertSelective(resultBase);
|
||||
}
|
||||
newUserInfo.setEcWantShopArea(resultUser.getEcWantShopArea());
|
||||
//添加ec意向区域同步
|
||||
hyPartnerUserInfoDAO.updateByPrimaryKeySelective(newUserInfo);
|
||||
} else {
|
||||
resultUser.setPartnerId(newPartnerId).setCreateTime(new Date());
|
||||
hyPartnerUserInfoDAO.insertSelective(resultUser);
|
||||
|
||||
@@ -16,10 +16,7 @@ import com.cool.store.dto.log.LogBasicDTO;
|
||||
import com.cool.store.dto.mdm.AccessTokenDTO;
|
||||
import com.cool.store.dto.response.MDMResultDTO;
|
||||
import com.cool.store.entity.*;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.enums.InspectionTyeEnum;
|
||||
import com.cool.store.enums.OperateTypeEnum;
|
||||
import com.cool.store.enums.WorkflowStatusEnum;
|
||||
import com.cool.store.enums.*;
|
||||
import com.cool.store.exception.ApiException;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.mapper.*;
|
||||
@@ -27,10 +24,7 @@ import com.cool.store.oss.OSSServer;
|
||||
import com.cool.store.request.*;
|
||||
import com.cool.store.request.data.flow.KeyText;
|
||||
import com.cool.store.request.data.flow.SkrRelshipProve;
|
||||
import com.cool.store.service.FlowService;
|
||||
import com.cool.store.service.HyPartnerLineInfoService;
|
||||
import com.cool.store.service.LogService;
|
||||
import com.cool.store.service.SmsService;
|
||||
import com.cool.store.service.*;
|
||||
import com.cool.store.utils.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -103,9 +97,14 @@ public class FlowServiceImpl implements FlowService {
|
||||
|
||||
@Autowired
|
||||
private HyInspectionMapper inspectionMapper;
|
||||
@Autowired
|
||||
private WechatMiniAppService wechatMiniAppService;
|
||||
|
||||
@Autowired
|
||||
private HyPartnerFraSourceMapper hyPartnerFraSourceMapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createQualifyVerify(CreateQualifyVerifyReq request) throws ApiException, IOException {
|
||||
//根据面试id获取面试信息
|
||||
HyPartnerInterviewDO hyPartnerInterviewDO = hyPartnerInterviewMapper.selectByPrimaryKeySelective(request.getInterviewId());
|
||||
@@ -119,10 +118,7 @@ public class FlowServiceImpl implements FlowService {
|
||||
//1.发起加盟商资质审核
|
||||
RpcCreateQualifyVerifyReq rpcRequest = new RpcCreateQualifyVerifyReq();
|
||||
RpcCreateQualifyVerifyReq.Data dataBody = new RpcCreateQualifyVerifyReq().new Data();
|
||||
KeyText fraSource = new KeyText();
|
||||
fraSource.setKey("HSAYPartner");
|
||||
fraSource.setText("沪上阿姨合伙人");
|
||||
dataBody.setFraSource(fraSource);
|
||||
dataBody.setFraSource(request.getFraSource());
|
||||
//copy properties
|
||||
BeanUtil.copyProperties(request, dataBody);
|
||||
//日期格式问题
|
||||
@@ -223,6 +219,24 @@ public class FlowServiceImpl implements FlowService {
|
||||
hyPartnerLineInfoDO.setDevelopmentDirector(request.getDevtDirectorId());
|
||||
hyPartnerLineInfoMapper.updateByPrimaryKeySelective(hyPartnerLineInfoDO);
|
||||
}
|
||||
//3. 生成通过函并修改数据库相关信息
|
||||
String verifyCity = hyPartnerInterviewMapper.getVerifyCityByInterviewId(request.getInterviewId());
|
||||
String[] split = verifyCity.split("/");
|
||||
//根据长度来取市级行政区域
|
||||
if (split.length == 2) {
|
||||
verifyCity = split[1];
|
||||
} else if (split.length == 3) {
|
||||
verifyCity = split[1];
|
||||
} else if (split.length == 4) {
|
||||
verifyCity = split[2];
|
||||
} else {
|
||||
throw new ServiceException(ErrorCodeEnum.INTENT_INFO_NOT_EXIST);
|
||||
}
|
||||
// TODO pass_reason 暂无
|
||||
//将通过时间修改为本系统处理回调的时间,不以 request 的 modifiedTime 为准(有误)
|
||||
String partnerName = request.getIntentionSignerUsername();
|
||||
//TODO 问题:如果因为 pdf 生成失败或者其他原因导致异常,但是由于 MDM 只是做回调,不对回调是否成功负责,会导致流程信息缺失
|
||||
genPassLetterAndUpdateDB(partnerName, verifyCity, new Date(), request.getInterviewId());
|
||||
//记录日志
|
||||
CreateQualifyVerifyDTO log = CreateQualifyVerifyDTO.builder().mobile(operator.getMobile()).operateUserId(operator.getUserId()).operateUsername(operator.getName()).operateTime(DateUtil.format(new Date(), CoolDateUtils.DATE_FORMAT_SEC))
|
||||
.summary(request.getSummary()).qualiVerifyContent(JSON.toJSONString(partnerCertificationInfoDO)).build();
|
||||
@@ -251,27 +265,10 @@ public class FlowServiceImpl implements FlowService {
|
||||
if ("FINISHED".equals(request.getInstanceStatus())) {
|
||||
//更新面试状态
|
||||
interviewDAO.updateInterviewWorkflowStatus(interviewPlanId, WorkflowStatusEnum.INTERVIEW_6);
|
||||
//2. 准备需要的信息
|
||||
String partnerName = request.getIntendedSigner();
|
||||
String verifyCity = hyPartnerInterviewMapper.getVerifyCityByInterviewId(interviewId);
|
||||
String[] split = verifyCity.split("/");
|
||||
//根据长度来取市级行政区域
|
||||
if (split.length == 2) {
|
||||
verifyCity = split[1];
|
||||
} else if (split.length == 3) {
|
||||
verifyCity = split[1];
|
||||
} else if (split.length == 4) {
|
||||
verifyCity = split[2];
|
||||
} else {
|
||||
throw new ServiceException(ErrorCodeEnum.INTENT_INFO_NOT_EXIST);
|
||||
}
|
||||
// TODO pass_reason 暂无
|
||||
//将通过时间修改为本系统处理回调的时间,不以 request 的 modifiedTime 为准(有误)
|
||||
Date passDate = new Date();
|
||||
//3. 生成通过函并修改数据库相关信息
|
||||
//TODO 问题:如果因为 pdf 生成失败或者其他原因导致异常,但是由于 MDM 只是做回调,不对回调是否成功负责,会导致流程信息缺失
|
||||
genPassLetterAndUpdateDB(partnerName, verifyCity, passDate, interviewId);
|
||||
//4. 向面试稽核表中新增一条信息
|
||||
//4. 向面试稽核表中新增一条信息
|
||||
HyInspectionDO hyInspectionDO = new HyInspectionDO();
|
||||
hyInspectionDO.setInterviewPlanId(Long.parseLong(interviewPlanId));
|
||||
hyInspectionDO.setCreateTime(DateUtil.formatDateTime(passDate));
|
||||
@@ -279,7 +276,7 @@ public class FlowServiceImpl implements FlowService {
|
||||
inspectionMapper.insertSelective(hyInspectionDO);
|
||||
//发送加盟商资质审核通过短信
|
||||
HyPartnerBaseInfoDO hyPartnerBaseInfoDO = hyPartnerBaseInfoDAO.getByPartnerLineId(partnerLineId);
|
||||
smsService.sendSms(null, CommonConstants.SMS_TEMPLATE_CODE_VERIFY, hyPartnerBaseInfoDO.getMobile());
|
||||
smsService.sendSmsVariable(hyPartnerBaseInfoDO.getMobile(), SMSMsgEnum.INTERVIEW_PASS,wechatMiniAppService.getMiniAppUrl());
|
||||
//记录日志
|
||||
//这里记录的日志时间为 passTime,而不是当前时间,否则 getTipsInfo 接口返回的时间是这里记录的当前时间,与 passTime 不符
|
||||
LogBasicDTO log = LogBasicDTO.builder().operateTime(DateUtil.format(passDate, CoolDateUtils.DATE_FORMAT_SEC))
|
||||
@@ -299,6 +296,11 @@ public class FlowServiceImpl implements FlowService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HyPartnerFraSourceDO> getDictList() {
|
||||
return hyPartnerFraSourceMapper.selectAllFraSourceList();
|
||||
}
|
||||
|
||||
public List<SkrRelshipProve> OSSFileToMDMFile(List<String> fileUrlList) throws ApiException, IOException {
|
||||
String url = mdmBaseUrl + "/api/openapi/ext/upload/file";
|
||||
ResponseEntity<MDMResultDTO> responseEntity = null;
|
||||
|
||||
@@ -96,6 +96,8 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
|
||||
@Resource
|
||||
private HyPartnerIntentInfoDAO hyPartnerIntentInfoDAO;
|
||||
|
||||
@Autowired
|
||||
private WechatMiniAppService wechatMiniAppService;
|
||||
@Override
|
||||
public StageCountVO selectStagePendingCount(String userId) {
|
||||
StageCountDTO stageCountDTO = hyPartnerLineInfoDAO.selectStagePendingCount(userId);
|
||||
@@ -476,9 +478,7 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
|
||||
hy.setCertifyFile(JSONObject.toJSONString(closeFollowRequest.getCertifyFile()));
|
||||
}
|
||||
hyPartnerBaseInfoDAO.updateByPrimaryKeySelective(hy);
|
||||
IntentSmsReq intentSmsReq = new IntentSmsReq();
|
||||
intentSmsReq.setDeadLine(DateUtil.formatDateTime(hyPartnerLineInfoDO.getDeadline()));
|
||||
smsService.sendSms(JSON.toJSONString(intentSmsReq),CommonConstants.SMS_TEMPLATE_CODE_INTENT, hy.getMobile());
|
||||
smsService.sendSmsVariable(hy.getMobile(), SMSMsgEnum.INTENTION_APPLY_PASS,DateUtil.formatDateTime(hyPartnerLineInfoDO.getDeadline()),wechatMiniAppService.getMiniAppUrl());
|
||||
}
|
||||
|
||||
//拒绝
|
||||
@@ -595,6 +595,7 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
|
||||
}
|
||||
publicSeaLineListVo.setPhoneAddress(phoneAddress);
|
||||
publicSeaLineListVo.setWantShopArea(x.getWantShopArea());
|
||||
publicSeaLineListVo.setEcWantShopArea(x.getEcWantShopArea());
|
||||
publicSeaLineListVo.setUpdateTime(DateUtil.format(x.getUpdateTime(),CoolDateUtils.DATE_FORMAT_SEC_2));
|
||||
publicSeaLineListVo.setId(x.getLineId());
|
||||
publicSeaLineListVo.setAcceptAdjustType(x.getAcceptAdjustType());
|
||||
|
||||
@@ -24,10 +24,7 @@ import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.http.ISVHttpRequest;
|
||||
import com.cool.store.mapper.*;
|
||||
import com.cool.store.request.*;
|
||||
import com.cool.store.service.EnterpriseUserService;
|
||||
import com.cool.store.service.InterviewService;
|
||||
import com.cool.store.service.LogService;
|
||||
import com.cool.store.service.SmsService;
|
||||
import com.cool.store.service.*;
|
||||
import com.cool.store.utils.CoolDateUtils;
|
||||
import com.cool.store.utils.StringUtil;
|
||||
import com.cool.store.utils.TRTCUtils;
|
||||
@@ -100,6 +97,9 @@ public class InterviewServiceImpl implements InterviewService {
|
||||
|
||||
@Autowired
|
||||
private EnterpriseUserDAO enterpriseUserDAO;
|
||||
|
||||
@Autowired
|
||||
private WechatMiniAppService wechatMiniAppService;
|
||||
@Override
|
||||
public List<InterviewVO> getInterviewList(GetInterviewListReq request) {
|
||||
List<InterviewVO> interviewList = hyPartnerInterviewPlanMapper.getInterviewList(request);
|
||||
@@ -571,10 +571,7 @@ public class InterviewServiceImpl implements InterviewService {
|
||||
hyPartnerLineDO.setUpdateTime(new Date());
|
||||
hyPartnerLineInfoMapper.updateByPrimaryKeySelective(hyPartnerLineDO);
|
||||
//异步发送短信给加盟商
|
||||
InterviewSmsReq interviewSmsReq = new InterviewSmsReq();
|
||||
interviewSmsReq.setInterviewStartTime(DateUtil.format(DateUtil.parse(interviewVO.getStartTime()), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
|
||||
smsService.sendSms(JSON.toJSONString(interviewSmsReq),templateCode, partnerBaseInfo.getMobile());
|
||||
|
||||
smsService.sendSmsVariable(partnerBaseInfo.getMobile(), SMSMsgEnum.INTERVIEW_APPOINTMENT_PASS,DateUtil.format(DateUtil.parse(interviewVO.getStartTime()), DatePattern.NORM_DATETIME_MINUTE_PATTERN),wechatMiniAppService.getMiniAppUrl());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,55 +1,100 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.aliyun.dysmsapi20170525.Client;
|
||||
import com.aliyun.dysmsapi20170525.models.SendSmsRequest;
|
||||
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
|
||||
import com.aliyun.teaopenapi.models.Config;
|
||||
import com.cool.store.enums.SMSMsgEnum;
|
||||
import com.cool.store.exception.ApiException;
|
||||
import com.cool.store.mq.util.HttpRestTemplateService;
|
||||
import com.cool.store.request.SmsSendRequest;
|
||||
import com.cool.store.response.SmsSendResponse;
|
||||
import com.cool.store.service.SmsService;
|
||||
import com.cool.store.utils.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* @Author: young.yu
|
||||
* @Date: 2023-06-21 10:55
|
||||
* @Description:
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SmsServiceImpl implements SmsService {
|
||||
|
||||
@Value("${hs.sms.accessKeyId:null}")
|
||||
private String accessKeyId ;
|
||||
|
||||
@Value("${hs.sms.accessKeySecret:null}")
|
||||
private String accessKeySecret;
|
||||
/**
|
||||
* 普通短信请求url
|
||||
*/
|
||||
private final static String NORMAL_SMS_URL = "https://smssh1.253.com/msg/v1/send/json";
|
||||
|
||||
/**
|
||||
* 发送短信
|
||||
* @param params Json格式的参数
|
||||
* @param mobile
|
||||
* 普通短信请求url
|
||||
*/
|
||||
private final static String VARIABLE_SMS_URL = "https://smssh1.253.com/msg/variable/json";
|
||||
|
||||
/**
|
||||
* 用户平台API账号
|
||||
*/
|
||||
private final static String ACCOUNT = "N7567896";
|
||||
/**
|
||||
* 用户平台API密码
|
||||
*/
|
||||
public final static String PASS_WORD = "MpGD8g15v2cea3";
|
||||
|
||||
@Autowired
|
||||
private HttpRestTemplateService httpRestTemplateService;
|
||||
|
||||
/**
|
||||
* 发送普通短信
|
||||
* @param phone 手机号码
|
||||
* @param smsMsgEnum 短信内容
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@Override
|
||||
@Async
|
||||
public SendSmsResponse sendSms(String params,String templateCode, String mobile) throws ApiException {
|
||||
public SmsSendResponse sendSmsNormal(String phone, SMSMsgEnum smsMsgEnum,Object... objects) {
|
||||
try {
|
||||
Config config = new Config()
|
||||
// 您的AccessKey ID
|
||||
.setAccessKeyId(accessKeyId)
|
||||
// 您的AccessKey Secret
|
||||
.setAccessKeySecret(accessKeySecret);
|
||||
SendSmsRequest sendSmsRequest = new SendSmsRequest()
|
||||
.setPhoneNumbers(mobile)
|
||||
.setSignName("沪上阿姨")
|
||||
.setTemplateCode(templateCode)
|
||||
.setTemplateParam(params);
|
||||
Client client = new Client(config);
|
||||
return client.sendSms(sendSmsRequest);
|
||||
}catch (ApiException e){
|
||||
throw new ApiException(e.getMessage());
|
||||
} catch (Exception exception) {
|
||||
throw new ApiException(exception.getMessage());
|
||||
SmsSendRequest smsSingleRequest = new SmsSendRequest(ACCOUNT, PASS_WORD, MessageFormat.format(smsMsgEnum.getContent(), objects), phone);
|
||||
String requestJson = JSON.toJSONString(smsSingleRequest);
|
||||
String response = httpRestTemplateService.postForObject(NORMAL_SMS_URL, requestJson, String.class);
|
||||
SmsSendResponse smsSingleResponse = JSON.parseObject(response, SmsSendResponse.class);
|
||||
return smsSingleResponse;
|
||||
}catch (Exception e){
|
||||
log.error("短信发送异常:"+e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送变量短信
|
||||
* @param params 手机号,参数 多个使用;隔开 例: 手机号1,参数A,参数B;手机号2,参数C,参数D
|
||||
* @param msg 短信内容,变量使用{$var}标识
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@Override
|
||||
@Async
|
||||
public SmsSendResponse sendSmsVariable(String phone, SMSMsgEnum smsMsgEnum,String... objects){
|
||||
//
|
||||
//params 手机号,参数 多个使用;隔开 例: 手机号1,参数A,参数B;手机号2,参数C,参数D
|
||||
StringBuffer params = new StringBuffer(phone);
|
||||
for (String object : objects) {
|
||||
params.append(",").append(object);
|
||||
}
|
||||
SmsSendRequest smsSingleRequest = new SmsSendRequest(ACCOUNT, PASS_WORD, smsMsgEnum.getContent(), params.toString());
|
||||
String requestJson = JSON.toJSONString(smsSingleRequest);
|
||||
String response = httpRestTemplateService.postForObject(VARIABLE_SMS_URL, requestJson,String.class);
|
||||
SmsSendResponse smsSingleResponse = JSON.parseObject(response, SmsSendResponse.class);
|
||||
return smsSingleResponse;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,9 @@ package com.cool.store.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.dao.*;
|
||||
import com.cool.store.dto.wx.CodeSessionDTO;
|
||||
import com.cool.store.dto.wx.MiniProgramLoginDTO;
|
||||
import com.cool.store.dto.wx.PhoneInfoDTO;
|
||||
import com.cool.store.dto.wx.*;
|
||||
import com.cool.store.entity.HyOpenAreaInfoDO;
|
||||
import com.cool.store.entity.HyPartnerLineInfoDO;
|
||||
import com.cool.store.entity.HyPartnerUserInfoDO;
|
||||
@@ -26,6 +23,7 @@ import com.cool.store.utils.UUIDUtils;
|
||||
import com.cool.store.vo.PartnerUserInfoVO;
|
||||
import com.cool.store.vo.wx.MiniProgramUserVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -71,7 +69,6 @@ public class WechatMiniAppServiceImpl implements WechatMiniAppService {
|
||||
@Value("${recommended.channel.id}")
|
||||
private Integer recommended;
|
||||
|
||||
|
||||
@Override
|
||||
public PartnerUserInfoVO miniProgramLogin(MiniProgramLoginDTO param) {
|
||||
log.info("miniProgramLogin #param {}", JSONObject.toJSONString(param));
|
||||
@@ -217,4 +214,17 @@ public class WechatMiniAppServiceImpl implements WechatMiniAppService {
|
||||
return userInfoVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMiniAppUrl() {
|
||||
// 获取小程序token
|
||||
String accessToken = wechatRest.getAccessToken(wxAppId, wxAppSecret);
|
||||
MiniAppUrlLinkReqDTO miniAppUrlLinkReqDTO = new MiniAppUrlLinkReqDTO();
|
||||
// miniAppUrlLinkReqDTO.setPath(weixinIndexUrl);
|
||||
MiniAppUrlLinkDTO miniAppUrlLink = wechatRest.getMiniAppUrlLink(accessToken, miniAppUrlLinkReqDTO);
|
||||
if (miniAppUrlLink != null){
|
||||
return miniAppUrlLink.getUrlLink();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* @Author: young.yu
|
||||
* @Date: 2023-09-14 15:22
|
||||
* @Description:
|
||||
*/class SmsServiceTest {
|
||||
|
||||
@Test
|
||||
void sendSmsNormal() {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user