use of com.itrus.portal.db.SmsGate in project portal by ixinportal.
the class SmsGateController method show.
// 显示详情
@RequestMapping(produces = "text/html")
public String show(Model uiModel) {
try {
SmsGate smsGate = smsGateService.getSmsGateByExample(new SmsGateExample());
if (smsGate == null) {
return "redirect:/smsgate?form";
}
uiModel.addAttribute("smsgate", smsGate);
} catch (Exception e) {
e.printStackTrace();
uiModel.addAttribute("errMsg", "解密密码失败");
}
return "smsgate/show";
}
use of com.itrus.portal.db.SmsGate in project portal by ixinportal.
the class SmsGateService method getSmsGateByExample.
public SmsGate getSmsGateByExample(SmsGateExample example) throws Exception {
List<SmsGate> list = sqlSession.selectList("com.itrus.portal.db.SmsGateMapper.selectByExample", example);
if (list == null || list.isEmpty())
return null;
SmsGate smsGate = list.get(0);
// 解密账号密码和MD5key
if (StringUtils.isNotBlank(smsGate.getAccountPass()) && Base64.isBase64(smsGate.getAccountPass().getBytes()))
smsGate.setAccountPass(AESencrp.decrypt(smsGate.getAccountPass(), dbEncKey));
if (StringUtils.isNotBlank(smsGate.getMd5Key()) && Base64.isBase64(smsGate.getMd5Key().getBytes()))
smsGate.setMd5Key(AESencrp.decrypt(smsGate.getMd5Key(), dbEncKey));
if (StringUtils.isNotBlank(smsGate.getEmayPass()) && Base64.isBase64(smsGate.getEmayPass().getBytes()))
smsGate.setEmayPass(AESencrp.decrypt(smsGate.getEmayPass(), dbEncKey));
return smsGate;
}
use of com.itrus.portal.db.SmsGate in project portal by ixinportal.
the class SmsGateService method updateSmsGate.
public void updateSmsGate(SmsGate smsGate) throws ServiceNullException, Exception {
if (smsGate == null || smsGate.getId() == null)
throw new ServiceNullException("要更新短信网关配置为空");
SmsGate smsGate1 = getSmsGateById(smsGate.getId());
if (smsGate1 == null)
throw new ServiceNullException("要更新短信网关配置不存在");
// 加密账号密码和MD5key
if (StringUtils.isNotBlank(smsGate.getAccountPass()))
smsGate.setAccountPass(AESencrp.encrypt(smsGate.getAccountPass(), dbEncKey));
if (StringUtils.isNotBlank(smsGate.getMd5Key()))
smsGate.setMd5Key(AESencrp.encrypt(smsGate.getMd5Key(), dbEncKey));
if (StringUtils.isNotBlank(smsGate.getEmayPass()))
smsGate.setEmayPass(AESencrp.encrypt(smsGate.getEmayPass(), dbEncKey));
smsGate.setLastModify(new Date());
sqlSession.update("com.itrus.portal.db.SmsGateMapper.updateByPrimaryKeySelective", smsGate);
}
use of com.itrus.portal.db.SmsGate in project portal by ixinportal.
the class SmsSendService method sendSms4three.
/**
* 用于第三方短信服务
*
* @param mobile
* @param content
* @return
*/
public boolean sendSms4three(String mobile, String content) throws Exception {
boolean ret = false;
SmsGate smsGate = smsGateService.getSmsGateByExample(new SmsGateExample());
// 判断调用哪个接口发送短信,gateType为0时,调用亿美,否则调用之前配置发送短信
if (smsGate.getGateType() == 0) {
ret = sendSmsByEmay(smsGate, mobile, content, "sendSms4three", null, null, null);
// ret = true;// TODO 暂时屏蔽发送短信
} else {
// ret = sendSms(smsGate, mobile, content, "sendSms4three", null, null, null);
// 调用未来无线接口
ret = wlsendSms(smsGate, mobile, content, "sendSms4three", null, null, null);
}
return ret;
}
use of com.itrus.portal.db.SmsGate in project portal by ixinportal.
the class SmsGateController method create.
// 返回新建页面
@RequestMapping(params = "form", produces = "text/html")
public String create(@RequestParam(value = "id", required = false) Long id, Model uiModel) {
if (id == null) {
return "smsgate/create";
}
try {
SmsGate smsGate = smsGateService.getSmsGateById(id);
uiModel.addAttribute("smsgate", smsGate);
} catch (ServiceNullException e) {
uiModel.addAttribute("errMsg", e.getMessage());
} catch (Exception e) {
e.printStackTrace();
uiModel.addAttribute("errMsg", "解密密码失败");
}
return "smsgate/create";
}
Aggregations