Commit 56752545 by 程裕兵

feat:send message of merchant

parent e0ad7429
...@@ -76,4 +76,7 @@ public class ApplyStudioMerchantRequest { ...@@ -76,4 +76,7 @@ public class ApplyStudioMerchantRequest {
@NotBlank(message = "验证码不能为空") @NotBlank(message = "验证码不能为空")
private String smsCode; private String smsCode;
@ApiModelProperty(value = "操作人ID")
private Long operatorId;
} }
...@@ -128,6 +128,9 @@ public class StudioMerchantApplyVO { ...@@ -128,6 +128,9 @@ public class StudioMerchantApplyVO {
@ApiModelProperty(value = "进件所需资料") @ApiModelProperty(value = "进件所需资料")
private Map<String, BrandResourceInfo> resourceMap; private Map<String, BrandResourceInfo> resourceMap;
@ApiModelProperty(value = "操作人ID")
private Long operatorId;
@ApiModelProperty("完成时间") @ApiModelProperty("完成时间")
private Date finishTime; private Date finishTime;
......
...@@ -186,6 +186,7 @@ public class MerchantConvert { ...@@ -186,6 +186,7 @@ public class MerchantConvert {
.license(encrypt.getLicense()) .license(encrypt.getLicense())
.bankCard(encrypt.getBankCard()) .bankCard(encrypt.getBankCard())
.resourceMap(encrypt.getResourceMap()) .resourceMap(encrypt.getResourceMap())
.operatorId(encrypt.getOperatorId())
.build()); .build());
} }
...@@ -478,6 +479,7 @@ public class MerchantConvert { ...@@ -478,6 +479,7 @@ public class MerchantConvert {
.legal(info.getLegal()) .legal(info.getLegal())
.bankCard(info.getBankCard()) .bankCard(info.getBankCard())
.resourceMap(info.getResourceMap()) .resourceMap(info.getResourceMap())
.operatorId(info.getOperatorId())
.finishTime(apply.getFinishTime()) .finishTime(apply.getFinishTime())
.createTime(apply.getCreateTime()) .createTime(apply.getCreateTime())
.updateTime(apply.getUpdateTime()) .updateTime(apply.getUpdateTime())
......
...@@ -32,6 +32,8 @@ import com.jiejing.fitness.finance.service.rpc.MerchantRpcService; ...@@ -32,6 +32,8 @@ import com.jiejing.fitness.finance.service.rpc.MerchantRpcService;
import com.jiejing.fitness.finance.service.rpc.MessageRpcService; import com.jiejing.fitness.finance.service.rpc.MessageRpcService;
import com.jiejing.fitness.finance.service.rpc.ResourceRpcService; import com.jiejing.fitness.finance.service.rpc.ResourceRpcService;
import com.jiejing.fitness.finance.service.rpc.StudioRpcService; import com.jiejing.fitness.finance.service.rpc.StudioRpcService;
import com.jiejing.message.enums.MsgChannelEnum;
import com.jiejing.message.event.SendCommonMsgEvent;
import com.jiejing.paycenter.api.merchant.request.ApplyMerchantRequest; import com.jiejing.paycenter.api.merchant.request.ApplyMerchantRequest;
import com.jiejing.paycenter.common.enums.merchant.SubChannelOpenTypeEnums; import com.jiejing.paycenter.common.enums.merchant.SubChannelOpenTypeEnums;
import com.jiejing.paycenter.common.model.vo.AuthSubChannelVO; import com.jiejing.paycenter.common.model.vo.AuthSubChannelVO;
...@@ -47,7 +49,9 @@ import com.jiejing.paycenter.common.event.MerchantEvent; ...@@ -47,7 +49,9 @@ import com.jiejing.paycenter.common.event.MerchantEvent;
import com.jiejing.paycenter.common.model.request.ResourceInfo; import com.jiejing.paycenter.common.model.request.ResourceInfo;
import com.jiejing.paycenter.common.model.vo.SubChannelVO; import com.jiejing.paycenter.common.model.vo.SubChannelVO;
import com.jiejing.studio.api.studio.vo.StudioVO; import com.jiejing.studio.api.studio.vo.StudioVO;
import com.xiaomai.event.EventAgent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
...@@ -393,6 +397,10 @@ public class StudioMerchantServiceImpl implements StudioMerchantService { ...@@ -393,6 +397,10 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
private void doAfterMerchantSuccess(MerchantEvent event, Long oldMerchantId) { private void doAfterMerchantSuccess(MerchantEvent event, Long oldMerchantId) {
// 1. 配置场馆小程序appId // 1. 配置场馆小程序appId
this.rebindMiniAppId(oldMerchantId, event.getMerchantId()); this.rebindMiniAppId(oldMerchantId, event.getMerchantId());
// 2. 短信
StudioMerchantApplyVO apply = this.getApply(Long.parseLong(event.getApplyNo()));
this.sendOpenSuccessMessage(apply);
} }
private void rebindMiniAppId(Long oldMerchantId, Long newMerchantId) { private void rebindMiniAppId(Long oldMerchantId, Long newMerchantId) {
...@@ -443,9 +451,53 @@ public class StudioMerchantServiceImpl implements StudioMerchantService { ...@@ -443,9 +451,53 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
} }
private void doOpenMerchantFail(Long id, String failMessage) { private void doOpenMerchantFail(Long id, String failMessage) {
StudioMerchantApplyVO apply = this.getApply(id);
if (null == apply) {
return;
}
if (OpenStateEnums.FAIL.getCode().equals(apply.getOpenState())) {
return;
}
// 1. 更新
studioMerchantApplyRpService.updateById( studioMerchantApplyRpService.updateById(
StudioMerchantApply.builder().id(id).openState(OpenStateEnums.FAIL.getCode()) StudioMerchantApply.builder().id(id).openState(OpenStateEnums.FAIL.getCode())
.openFailMessage(failMessage).build()); .openFailMessage(failMessage).build());
// 2. 短信
this.sendOpenFailMessage(apply);
}
private void sendOpenFailMessage(StudioMerchantApplyVO apply) {
List<Map<String, Object>> paramList = new ArrayList<>(1);
Map<String, Object> paramMap = new HashMap<>(1);
paramMap.put("targetId", apply.getOperatorId());
paramMap.put("studioId", apply.getStudioId());
paramList.add(paramMap);
SendCommonMsgEvent event = new SendCommonMsgEvent();
event.setChannelEnums(Lists.newArrayList(MsgChannelEnum.SMS));
event.setCovertTarget(true);
event.setEventId(IdWorker.getId());
event.setSourceId(apply.getStudioId());
event.setBizType("OPEN_MERCHANT_FAIL");
event.setParams(paramList);
EventAgent.of(SendCommonMsgEvent.class).triggerEvent(event);
}
private void sendOpenSuccessMessage(StudioMerchantApplyVO apply) {
List<Map<String, Object>> paramList = new ArrayList<>(1);
Map<String, Object> paramMap = new HashMap<>(1);
paramMap.put("targetId", apply.getOperatorId());
paramMap.put("studioId", apply.getStudioId());
paramList.add(paramMap);
SendCommonMsgEvent event = new SendCommonMsgEvent();
event.setChannelEnums(Lists.newArrayList(MsgChannelEnum.SMS));
event.setCovertTarget(true);
event.setEventId(IdWorker.getId());
event.setSourceId(apply.getStudioId());
event.setBizType("OPEN_MERCHANT_SUCCESS");
event.setParams(paramList);
EventAgent.of(SendCommonMsgEvent.class).triggerEvent(event);
} }
private void doOpenMerchantProcess(Long id) { private void doOpenMerchantProcess(Long id) {
......
...@@ -78,6 +78,9 @@ public class ApplyStudioMerchantParams { ...@@ -78,6 +78,9 @@ public class ApplyStudioMerchantParams {
@NotBlank(message = "验证码不能为空") @NotBlank(message = "验证码不能为空")
private String smsCode; private String smsCode;
@ApiModelProperty(value = "操作人ID")
private Long operatorId;
public ApplyStudioMerchantParams encrypt(String salt) { public ApplyStudioMerchantParams encrypt(String salt) {
ApplyStudioMerchantParams copy = JSON.parseObject(JSON.toJSONString(this), ApplyStudioMerchantParams copy = JSON.parseObject(JSON.toJSONString(this),
ApplyStudioMerchantParams.class); ApplyStudioMerchantParams.class);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment