|
|
@@ -99,156 +99,187 @@ public class SendMsgServiceImpl implements ISendMsgService {
|
|
|
log.info(uBuilder.build().toString());
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
+ log.error("sendCustomerInfo failed,error message: "+e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void sendMsg(byte[] byteArray, String topic, Integer funcode) {
|
|
|
- byte[] body = ProtoHelper.getNTAS(byteArray, funcode);
|
|
|
- rabbitTemplate.send(topic, new Message(body, new MessageProperties()));
|
|
|
+ try {
|
|
|
+ byte[] body = ProtoHelper.getNTAS(byteArray, funcode);
|
|
|
+ rabbitTemplate.send(topic, new Message(body, new MessageProperties()));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error("sendMsg failed,error message: "+e);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void sendSMSConnetion(Integer templateId, String recPhone, List<String> params) {
|
|
|
- ShortMessageMtp1.ShortMsgSendReq.Builder smsbuilder = ShortMessageMtp1.ShortMsgSendReq.newBuilder();
|
|
|
- smsbuilder.setMsgType(2);
|
|
|
- smsbuilder.setPriority(2);
|
|
|
- smsbuilder.setScheduledTime("");
|
|
|
- smsbuilder.addRecvPhone(recPhone);
|
|
|
- smsbuilder.setTemplateID(templateId);
|
|
|
+ try {
|
|
|
+ ShortMessageMtp1.ShortMsgSendReq.Builder smsbuilder = ShortMessageMtp1.ShortMsgSendReq.newBuilder();
|
|
|
+ smsbuilder.setMsgType(2);
|
|
|
+ smsbuilder.setPriority(2);
|
|
|
+ smsbuilder.setScheduledTime("");
|
|
|
+ smsbuilder.addRecvPhone(recPhone);
|
|
|
+ smsbuilder.setTemplateID(templateId);
|
|
|
|
|
|
- if (params != null && !params.isEmpty()) {
|
|
|
- params.forEach(p -> smsbuilder.addParamValues(p.replaceAll("\\*", "-")));
|
|
|
+ if (params != null && !params.isEmpty()) {
|
|
|
+ params.forEach(p -> smsbuilder.addParamValues(p.replaceAll("\\*", "-")));
|
|
|
+ }
|
|
|
+ // 添加消息头
|
|
|
+ Common.MessageHead.Builder headBuil = Common.MessageHead.newBuilder();
|
|
|
+ headBuil.setFunCode(FunCodeConstants.FunCode_Trade_ShortMsgSendReq);
|
|
|
+ smsbuilder.setHeader(headBuil.build());
|
|
|
+ byte[] body = ProtoHelper.getNTAS(smsbuilder.build().toByteArray(),
|
|
|
+ FunCodeConstants.FunCode_Trade_ShortMsgSendReq);
|
|
|
+ MessageProperties msgProperties = new MessageProperties();
|
|
|
+ msgProperties.setHeader("messageType", "protoBuf");
|
|
|
+ rabbitTemplate.send(SysConstants.RabbitShortMessage, new Message(body, msgProperties));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error("sendSMSConnetion failed,error message: "+e);
|
|
|
}
|
|
|
- // 添加消息头
|
|
|
- Common.MessageHead.Builder headBuil = Common.MessageHead.newBuilder();
|
|
|
- headBuil.setFunCode(FunCodeConstants.FunCode_Trade_ShortMsgSendReq);
|
|
|
- smsbuilder.setHeader(headBuil.build());
|
|
|
- byte[] body = ProtoHelper.getNTAS(smsbuilder.build().toByteArray(),
|
|
|
- FunCodeConstants.FunCode_Trade_ShortMsgSendReq);
|
|
|
- MessageProperties msgProperties = new MessageProperties();
|
|
|
- msgProperties.setHeader("messageType", "protoBuf");
|
|
|
- rabbitTemplate.send(SysConstants.RabbitShortMessage, new Message(body, msgProperties));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void sendLoginMsg(Set<Long> set_msg, Integer type, Integer ntfmode) {
|
|
|
- if (set_msg == null || set_msg.size() == 0)
|
|
|
- return;
|
|
|
- // 0 新增帐号 1 删除帐号 2 修改帐号 3 修改帐号个性化 4 修改账户权限 5 删除三方登陆信息
|
|
|
- NotifyMI1.LoginAccChangeNtf.Builder builder = NotifyMI1.LoginAccChangeNtf.newBuilder();
|
|
|
- Common.MessageHead.Builder hd = Common.MessageHead.newBuilder();
|
|
|
- hd.setFunCode(FunCodeConstants.FunCode_Trade_LoginAccChangeNtf);
|
|
|
- hd.setClientTime(System.currentTimeMillis());
|
|
|
- builder.setHeader(hd);
|
|
|
- PublicMI1.NotifyHead.Builder nhd = PublicMI1.NotifyHead.newBuilder();
|
|
|
- nhd.setNtfMode(ntfmode);
|
|
|
- builder.setNtfHeader(nhd);
|
|
|
- set_msg.forEach(p -> {
|
|
|
- NotifyMI1.LoginAccChange.Builder lab = NotifyMI1.LoginAccChange.newBuilder();
|
|
|
- lab.setChangeType(type);
|
|
|
- lab.setLoginId(p);
|
|
|
- builder.addLoginAccChange(lab);
|
|
|
- });
|
|
|
+ try {
|
|
|
+ if (set_msg == null || set_msg.size() == 0)
|
|
|
+ return;
|
|
|
+ // 0 新增帐号 1 删除帐号 2 修改帐号 3 修改帐号个性化 4 修改账户权限 5 删除三方登陆信息
|
|
|
+ NotifyMI1.LoginAccChangeNtf.Builder builder = NotifyMI1.LoginAccChangeNtf.newBuilder();
|
|
|
+ Common.MessageHead.Builder hd = Common.MessageHead.newBuilder();
|
|
|
+ hd.setFunCode(FunCodeConstants.FunCode_Trade_LoginAccChangeNtf);
|
|
|
+ hd.setClientTime(System.currentTimeMillis());
|
|
|
+ builder.setHeader(hd);
|
|
|
+ PublicMI1.NotifyHead.Builder nhd = PublicMI1.NotifyHead.newBuilder();
|
|
|
+ nhd.setNtfMode(ntfmode);
|
|
|
+ builder.setNtfHeader(nhd);
|
|
|
+ set_msg.forEach(p -> {
|
|
|
+ NotifyMI1.LoginAccChange.Builder lab = NotifyMI1.LoginAccChange.newBuilder();
|
|
|
+ lab.setChangeType(type);
|
|
|
+ lab.setLoginId(p);
|
|
|
+ builder.addLoginAccChange(lab);
|
|
|
+ });
|
|
|
|
|
|
- sendMsg(builder.build().toByteArray(), SysConstants.RabbitNtfKey, FunCodeConstants.FunCode_Trade_LoginAccChangeNtf);
|
|
|
- log.info(builder.build().toString());
|
|
|
+ sendMsg(builder.build().toByteArray(), SysConstants.RabbitNtfKey, FunCodeConstants.FunCode_Trade_LoginAccChangeNtf);
|
|
|
+ log.info(builder.build().toString());
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error("sendLoginMsg failed,error message: "+e);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void sendM2BUnregistCustomerInfo(List<Taaccount> tas) {
|
|
|
- // 发送用户注销消息给中心\银行接口
|
|
|
- if (tas == null) return;
|
|
|
+ try {
|
|
|
+ // 发送用户注销消息给中心\银行接口
|
|
|
+ if (tas == null) return;
|
|
|
|
|
|
- if (tas != null && !tas.isEmpty()) {
|
|
|
- Long time = System.currentTimeMillis();
|
|
|
- for (int i = 0; i < tas.size(); i++) {
|
|
|
- // Object[] ob = (Object[])sign.get(i);
|
|
|
- String accountCode = tas.get(i).getAccountid().toString();
|
|
|
- BankMI1.m2bUnregistCustomerInfoReq.Builder builder = BankMI1.m2bUnregistCustomerInfoReq.newBuilder();
|
|
|
- Common.MessageHead.Builder hd = Common.MessageHead.newBuilder();
|
|
|
- hd.setClientTime(time);
|
|
|
- hd.setFunCode(FunCodeConstants.FunCode_Trade_m2bUnregistCustomerInfoReq);
|
|
|
- builder.setHeader(hd);
|
|
|
- builder.setExtOperatorID(time + i);
|
|
|
- // builder.setCusBankID(ob[1].toString());
|
|
|
- builder.setTradeDate(DateTimeUtils.format(new Date(), DateTimeUtils.DATE_CHAR_PATTERN));
|
|
|
- builder.setAccountCode(accountCode);
|
|
|
+ if (tas != null && !tas.isEmpty()) {
|
|
|
+ Long time = System.currentTimeMillis();
|
|
|
+ for (int i = 0; i < tas.size(); i++) {
|
|
|
+ // Object[] ob = (Object[])sign.get(i);
|
|
|
+ String accountCode = tas.get(i).getAccountid().toString();
|
|
|
+ BankMI1.m2bUnregistCustomerInfoReq.Builder builder = BankMI1.m2bUnregistCustomerInfoReq.newBuilder();
|
|
|
+ Common.MessageHead.Builder hd = Common.MessageHead.newBuilder();
|
|
|
+ hd.setClientTime(time);
|
|
|
+ hd.setFunCode(FunCodeConstants.FunCode_Trade_m2bUnregistCustomerInfoReq);
|
|
|
+ builder.setHeader(hd);
|
|
|
+ builder.setExtOperatorID(time + i);
|
|
|
+ // builder.setCusBankID(ob[1].toString());
|
|
|
+ builder.setTradeDate(DateTimeUtils.format(new Date(), DateTimeUtils.DATE_CHAR_PATTERN));
|
|
|
+ builder.setAccountCode(accountCode);
|
|
|
|
|
|
- byte[] body = ProtoHelper.getNTAS(builder.build().toByteArray(), FunCodeConstants.FunCode_Trade_m2bUnregistCustomerInfoReq);
|
|
|
- rabbitTemplate.send(SysConstants.RabbitBankNtfKey, new Message(body, new MessageProperties()));
|
|
|
+ byte[] body = ProtoHelper.getNTAS(builder.build().toByteArray(), FunCodeConstants.FunCode_Trade_m2bUnregistCustomerInfoReq);
|
|
|
+ rabbitTemplate.send(SysConstants.RabbitBankNtfKey, new Message(body, new MessageProperties()));
|
|
|
|
|
|
- log.info("用户注销发送注销消息 589835(10801)给中心\\银行接口:" + accountCode);
|
|
|
+ log.info("用户注销发送注销消息 589835(10801)给中心\\银行接口:" + accountCode);
|
|
|
+ }
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error("sendM2BUnregistCustomerInfo failed,error message: "+e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void sendUserChangeMsg(Long accountid, Long userid, Integer usertype, Integer accounttype, Integer ntfmode) {
|
|
|
- NotifyMI1.UserChangeNtf.Builder builder = NotifyMI1.UserChangeNtf.newBuilder();
|
|
|
+ try {
|
|
|
+ NotifyMI1.UserChangeNtf.Builder builder = NotifyMI1.UserChangeNtf.newBuilder();
|
|
|
|
|
|
- Common.MessageHead.Builder hd = Common.MessageHead.newBuilder();
|
|
|
- if (accountid != 0) {
|
|
|
- hd.setAccountID(accountid);
|
|
|
- }
|
|
|
- hd.setFunCode(FunCodeConstants.FunCode_Trade_UserChangeNtf);
|
|
|
- hd.setClientTime(System.currentTimeMillis());
|
|
|
- builder.setHeader(hd);
|
|
|
+ Common.MessageHead.Builder hd = Common.MessageHead.newBuilder();
|
|
|
+ if (accountid != 0) {
|
|
|
+ hd.setAccountID(accountid);
|
|
|
+ }
|
|
|
+ hd.setFunCode(FunCodeConstants.FunCode_Trade_UserChangeNtf);
|
|
|
+ hd.setClientTime(System.currentTimeMillis());
|
|
|
+ builder.setHeader(hd);
|
|
|
|
|
|
- PublicMI1.NotifyHead.Builder nhd = PublicMI1.NotifyHead.newBuilder();
|
|
|
- if (accountid != 0) {
|
|
|
- nhd.addAccountIDs(accountid);
|
|
|
- }
|
|
|
- nhd.setNtfMode(ntfmode);
|
|
|
- builder.setNtfHeader(nhd);
|
|
|
+ PublicMI1.NotifyHead.Builder nhd = PublicMI1.NotifyHead.newBuilder();
|
|
|
+ if (accountid != 0) {
|
|
|
+ nhd.addAccountIDs(accountid);
|
|
|
+ }
|
|
|
+ nhd.setNtfMode(ntfmode);
|
|
|
+ builder.setNtfHeader(nhd);
|
|
|
|
|
|
- if (accountid != 0) {
|
|
|
- NotifyMI1.AccountDataChange.Builder ac = NotifyMI1.AccountDataChange.newBuilder();
|
|
|
- ac.setAccountId(accountid);
|
|
|
- ac.setChangeType(accounttype);
|
|
|
- builder.addAccountChange(ac);
|
|
|
- }
|
|
|
- builder.setChangeType(usertype);
|
|
|
- builder.setUserId(userid);
|
|
|
- sendMsg(builder.build().toByteArray(), SysConstants.RabbitNtfKey, FunCodeConstants.FunCode_Trade_UserChangeNtf);
|
|
|
+ if (accountid != 0) {
|
|
|
+ NotifyMI1.AccountDataChange.Builder ac = NotifyMI1.AccountDataChange.newBuilder();
|
|
|
+ ac.setAccountId(accountid);
|
|
|
+ ac.setChangeType(accounttype);
|
|
|
+ builder.addAccountChange(ac);
|
|
|
+ }
|
|
|
+ builder.setChangeType(usertype);
|
|
|
+ builder.setUserId(userid);
|
|
|
+ sendMsg(builder.build().toByteArray(), SysConstants.RabbitNtfKey, FunCodeConstants.FunCode_Trade_UserChangeNtf);
|
|
|
|
|
|
- log.info(builder.build().toString());
|
|
|
+ log.info(builder.build().toString());
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error("sendUserChangeMsg failed,error message: "+e);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void sendUserChangeMsg(Long accountid, Long userid, Integer type, Integer ntfmode) {
|
|
|
- NotifyMI1.UserChangeNtf.Builder builder = NotifyMI1.UserChangeNtf.newBuilder();
|
|
|
+ try {
|
|
|
+ NotifyMI1.UserChangeNtf.Builder builder = NotifyMI1.UserChangeNtf.newBuilder();
|
|
|
|
|
|
- Common.MessageHead.Builder hd = Common.MessageHead.newBuilder();
|
|
|
- if (accountid != 0) {
|
|
|
- hd.setAccountID(accountid);
|
|
|
- }
|
|
|
- hd.setFunCode(FunCodeConstants.FunCode_Trade_UserChangeNtf);
|
|
|
- hd.setClientTime(System.currentTimeMillis());
|
|
|
- builder.setHeader(hd);
|
|
|
+ Common.MessageHead.Builder hd = Common.MessageHead.newBuilder();
|
|
|
+ if (accountid != 0) {
|
|
|
+ hd.setAccountID(accountid);
|
|
|
+ }
|
|
|
+ hd.setFunCode(FunCodeConstants.FunCode_Trade_UserChangeNtf);
|
|
|
+ hd.setClientTime(System.currentTimeMillis());
|
|
|
+ builder.setHeader(hd);
|
|
|
|
|
|
- PublicMI1.NotifyHead.Builder nhd = PublicMI1.NotifyHead.newBuilder();
|
|
|
- if (accountid != 0) {
|
|
|
- nhd.addAccountIDs(accountid);
|
|
|
- }
|
|
|
- nhd.setNtfMode(ntfmode);
|
|
|
- builder.setNtfHeader(nhd);
|
|
|
+ PublicMI1.NotifyHead.Builder nhd = PublicMI1.NotifyHead.newBuilder();
|
|
|
+ if (accountid != 0) {
|
|
|
+ nhd.addAccountIDs(accountid);
|
|
|
+ }
|
|
|
+ nhd.setNtfMode(ntfmode);
|
|
|
+ builder.setNtfHeader(nhd);
|
|
|
|
|
|
- if (accountid != 0) {
|
|
|
- NotifyMI1.AccountDataChange.Builder ac = NotifyMI1.AccountDataChange.newBuilder();
|
|
|
- ac.setAccountId(accountid);
|
|
|
- ac.setChangeType(type);
|
|
|
- builder.addAccountChange(ac);
|
|
|
- }
|
|
|
- if (type == 1) {
|
|
|
- builder.setChangeType(2);
|
|
|
- } else {
|
|
|
- builder.setChangeType(type);
|
|
|
- }
|
|
|
- builder.setUserId(userid);
|
|
|
- sendMsg(builder.build().toByteArray(), SysConstants.RabbitNtfKey, FunCodeConstants.FunCode_Trade_UserChangeNtf);
|
|
|
+ if (accountid != 0) {
|
|
|
+ NotifyMI1.AccountDataChange.Builder ac = NotifyMI1.AccountDataChange.newBuilder();
|
|
|
+ ac.setAccountId(accountid);
|
|
|
+ ac.setChangeType(type);
|
|
|
+ builder.addAccountChange(ac);
|
|
|
+ }
|
|
|
+ if (type == 1) {
|
|
|
+ builder.setChangeType(2);
|
|
|
+ } else {
|
|
|
+ builder.setChangeType(type);
|
|
|
+ }
|
|
|
+ builder.setUserId(userid);
|
|
|
+ sendMsg(builder.build().toByteArray(), SysConstants.RabbitNtfKey, FunCodeConstants.FunCode_Trade_UserChangeNtf);
|
|
|
|
|
|
- log.info(builder.build().toString());
|
|
|
+ log.info(builder.build().toString());
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error("sendUserChangeMsg failed,error message: "+e);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -257,37 +288,42 @@ public class SendMsgServiceImpl implements ISendMsgService {
|
|
|
@Override
|
|
|
public void sendAccountConfigChangeNtf(Integer nt, Integer ct, Long userid, Long accountid,
|
|
|
Long goodsid, Long groupid, Integer rt) {
|
|
|
- NotifyMI1.AccountConfigChangeNtf.Builder builder = NotifyMI1.AccountConfigChangeNtf.newBuilder();
|
|
|
- Common.MessageHead.Builder mh = Common.MessageHead.newBuilder();
|
|
|
- mh.setFunCode(FunCodeConstants.FunCode_Trade_AccountConfigChangeNtf);
|
|
|
- builder.setHeader(mh);
|
|
|
- PublicMI1.NotifyHead.Builder nf = PublicMI1.NotifyHead.newBuilder();
|
|
|
- nf.setNtfMode(0);
|
|
|
- builder.setNtfHeader(nf);
|
|
|
- builder.setNtfType(nt);
|
|
|
- builder.setChangType(ct);
|
|
|
- if (userid != null) {
|
|
|
- builder.setUserid(userid);
|
|
|
- }
|
|
|
- if (accountid != null) {
|
|
|
- builder.setAccountid(accountid);
|
|
|
- }
|
|
|
- if (goodsid != null) {
|
|
|
- builder.setGoodsid(goodsid);
|
|
|
- }
|
|
|
- if (rt != null) {
|
|
|
- if (rt == 2) {
|
|
|
- builder.setRoletype(2);
|
|
|
- } else if (userid <= 9999) {
|
|
|
- builder.setRoletype(1);
|
|
|
+ try {
|
|
|
+ NotifyMI1.AccountConfigChangeNtf.Builder builder = NotifyMI1.AccountConfigChangeNtf.newBuilder();
|
|
|
+ Common.MessageHead.Builder mh = Common.MessageHead.newBuilder();
|
|
|
+ mh.setFunCode(FunCodeConstants.FunCode_Trade_AccountConfigChangeNtf);
|
|
|
+ builder.setHeader(mh);
|
|
|
+ PublicMI1.NotifyHead.Builder nf = PublicMI1.NotifyHead.newBuilder();
|
|
|
+ nf.setNtfMode(0);
|
|
|
+ builder.setNtfHeader(nf);
|
|
|
+ builder.setNtfType(nt);
|
|
|
+ builder.setChangType(ct);
|
|
|
+ if (userid != null) {
|
|
|
+ builder.setUserid(userid);
|
|
|
+ }
|
|
|
+ if (accountid != null) {
|
|
|
+ builder.setAccountid(accountid);
|
|
|
+ }
|
|
|
+ if (goodsid != null) {
|
|
|
+ builder.setGoodsid(goodsid);
|
|
|
+ }
|
|
|
+ if (rt != null) {
|
|
|
+ if (rt == 2) {
|
|
|
+ builder.setRoletype(2);
|
|
|
+ } else if (userid <= 9999) {
|
|
|
+ builder.setRoletype(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (groupid != null) {
|
|
|
+ builder.setGroupid(groupid);
|
|
|
}
|
|
|
- }
|
|
|
- if (groupid != null) {
|
|
|
- builder.setGroupid(groupid);
|
|
|
- }
|
|
|
|
|
|
- log.info(builder.build().toString());
|
|
|
- byte[] body = ProtoHelper.getNTAS(builder.build().toByteArray(), FunCodeConstants.FunCode_Trade_AccountConfigChangeNtf, 0);
|
|
|
- rabbitTemplate.send(SysConstants.RabbitNtfKey, new Message(body, new MessageProperties()));
|
|
|
+ log.info(builder.build().toString());
|
|
|
+ byte[] body = ProtoHelper.getNTAS(builder.build().toByteArray(), FunCodeConstants.FunCode_Trade_AccountConfigChangeNtf, 0);
|
|
|
+ rabbitTemplate.send(SysConstants.RabbitNtfKey, new Message(body, new MessageProperties()));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error("sendAccountConfigChangeNtf failed,error message: "+e);
|
|
|
+ }
|
|
|
}
|
|
|
}
|