use of com.itrus.portal.db.Bill in project portal by ixinportal.
the class SecurityServiceWebController method securityCenter.
// 选出当前用户当前企业的所有证书和证书所绑定的用户信息
@RequestMapping("/securityCenter")
public String securityCenter(HttpSession session, Model uiModel) {
UserInfo userInfos = (UserInfo) session.getAttribute("webuserInfo");
Enterprise enterprise = (Enterprise) session.getAttribute("webenterprise");
if (null == userInfos || null == enterprise) {
// 登录状态失效,跳转到注册页面
return "redirect:/userInfoWeb/denglu.html";
}
Map param = new HashMap();
param.put("userinfoid", userInfos.getId());
param.put("enterpriseid", enterprise.getId());
List<Map<String, Object>> userCertList = sqlSession.selectList("com.itrus.portal.db.UserCertMapper.selectByUserInfoAndEnterprise", param);
if (null != userCertList && !userCertList.isEmpty()) {
for (int i = 0; i < userCertList.size(); i++) {
if (null != userCertList.get(i).get("bill_status") && (userCertList.get(i).get("bill_status").equals(ComNames.BILL_STATUS_8) || userCertList.get(i).get("bill_status").equals(ComNames.BILL_STATUS_7) || userCertList.get(i).get("bill_status").equals(ComNames.BILL_STATUS_6)) && userCertList.get(i).containsKey("renewBillId")) {
// 状态为已完成的订单并且订单包含旧证书id
Bill bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", userCertList.get(i).get("renewBillId"));
if (null != bill.getOldUserCert()) {
UserCert oldUserCert = sqlSession.selectOne("com.itrus.portal.db.UserCertMapper.selectByPrimaryKey", bill.getOldUserCert());
userCertList.get(i).put("oldCertSn", oldUserCert.getCertSn());
}
}
}
}
try {
String usercertsString = jsonTool.writeValueAsString(userCertList);
uiModel.addAttribute("usercerts", usercertsString);
List<String> allIssUerDn = new ArrayList<String>();
allIssUerDn = sqlSession.selectList("com.itrus.portal.db.CrlContextMapper.selectAllIssUerDn");
uiModel.addAttribute("allIssUerDn", jsonTool.writeValueAsString(allIssUerDn));
} catch (JsonGenerationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JsonMappingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "ixinweb/anquanfuwu";
}
use of com.itrus.portal.db.Bill in project portal by ixinportal.
the class PayController method sendsms.
@RequestMapping(value = "/sendsms/{id}/{phone}/{type}", produces = "text/html")
@ResponseBody
public String sendsms(@PathVariable("id") Long id, @PathVariable("phone") String phone, @PathVariable("type") String type) {
Map param = new HashMap();
param.put("id", id);
// 管理员项目权限
Long[] projectsOfAdmin = getProjectLongIdsOfAdmin();
param.put("hasProjects", Arrays.asList(projectsOfAdmin));
Map bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByCondition", param);
Bill b = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", id);
MessageTemplate messageTemplate = messageTemplateService.getMsgTemp(b.getProject(), type);
if (null == messageTemplate) {
return "发送短信失败,未找到对应的消息模版";
}
String content = messageTemplate.getMessageContent();
if (StringUtils.isBlank(content) || content.indexOf("content") == -1) {
return "发送短信失败,消息模版配置错误";
}
content = content.replaceAll("content", bill.get("pname").toString());
smsSendService.sendSms(bill.get("m_phone").toString(), content, type.equals("WZF") ? "支付通知" : "支付异常通知", b.getProject(), null, b.getBillId());
b.setIsSms(true);
b.setSendTime(new Date());
sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKeySelective", b);
return null;
}
use of com.itrus.portal.db.Bill in project portal by ixinportal.
the class PsCourierController method sendMoreSmsFhtz.
/**
* 发送属于快递配送的短信
*/
private Map<String, Object> sendMoreSmsFhtz(Long pcId) {
Map<String, Object> retMap = new HashMap<String, Object>();
// 0标识失败,1标识成功
retMap.put("retCode", 0);
try {
CourierInfo ci = sqlSession.selectOne("com.itrus.portal.db.CourierInfoMapper.selectByPrimaryKey", pcId);
if (null == ci) {
retMap.put("retMsg", "发送短信失败,未找到对应的快递配送记录");
return retMap;
}
Bill bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", ci.getBill());
CourierExample courierex = new CourierExample();
Map<Long, Courier> couriermap = sqlSession.selectMap("com.itrus.portal.db.CourierMapper.selectByExample", courierex, "id");
// 查找对应项目的消息模版:FHTZ
MessageTemplate messageTemplate = messageTemplateService.getMsgTemp(bill.getProject(), "FHTZ");
if (null == messageTemplate) {
retMap.put("retMsg", "发送短信失败,未找到对应的快递配送消息模版");
return retMap;
}
String content = messageTemplate.getMessageContent();
if (StringUtils.isBlank(content) || content.indexOf("cItems") == -1 || content.indexOf("cId") == -1 || content.indexOf("cName") == -1) {
retMap.put("retMsg", "发送短信失败,快递配送消息模版配置错误");
return retMap;
}
String str = null;
if (ci.getCourierItems() == 1) {
str = "电子钥匙";
}
if (ci.getCourierItems() == 2) {
str = "发票";
}
if (ci.getCourierItems() == 3) {
str = "电子钥匙和发票";
}
content = content.replaceAll("cItems", str);
content = content.replaceAll("cId", ci.getCourierId());
content = content.replaceAll("cName", couriermap.get(ci.getCourier()).getCompanyName());
Delivery delivery = sqlSession.selectOne("com.itrus.portal.db.DeliveryMapper.selectByPrimaryKey", bill.getDelivery());
if (smsSendService.sendSms(delivery.getRvPhone(), content, "发货通知", bill.getProject(), bill.getUniqueId(), bill.getBillId())) {
ci.setMessageSms(1);
sqlSession.update("com.itrus.portal.db.CourierInfoMapper.updateByPrimaryKeySelective", ci);
retMap.put("retCode", 1);
retMap.put("retMsg", "发送短信成功");
}
} catch (Exception e) {
e.printStackTrace();
retMap.put("retMsg", "发送短信失败,errmsg:" + e.getMessage());
return retMap;
}
return retMap;
}
use of com.itrus.portal.db.Bill in project portal by ixinportal.
the class DoUnlockKeyController method veryfyCodeZSJS.
/**
* 校验解锁码是否正确,正确则返回订单对应的解锁码
* @param certSn
* @param keySn
* @param enterpriseName
* @param mPhone
* @param code
* @param session
* @return
*/
@RequestMapping("/veryfyCodeZSJS")
@ResponseBody
public Map<String, Object> veryfyCodeZSJS(@RequestParam("billId") Long billId, @RequestParam("certSn") String certSn, @RequestParam("keySn") String keySn, @RequestParam(value = "enterpriseName", required = false) String enterpriseName, @RequestParam(value = "mPhone", required = true) String mPhone, @RequestParam(value = "code", required = true) String code, HttpSession session) {
Map<String, Object> retMap = new HashMap<String, Object>();
retMap.put("retCode", 0);
Bill bill = null;
UserInfo userInfo = null;
try {
// 发送验证码
if (!dynamicCodeService.verifyCode(mPhone, code)) {
retMap.put("retMsg", "动态码验证失败,请重新获取动态码");
return retMap;
}
session.setAttribute("verifyCodeZSJS", true);
bill = billService.getBill(billId);
userInfo = userInfoService.getUserInfoById(bill.getUniqueId());
// 根据key序列号,获取证书
ProjectKeyInfo projectKeyInfo = cacheCustomer.findProjectByKey(keySn);
if (null == projectKeyInfo) {
retMap.put("retMsg", "无法识别该序列号:" + keySn + ", 请联系系统管理进行配置");
return retMap;
}
// TODO 获取订单对应的解锁码,返回给客户端,可能会有解锁码过期 的问题,过期了则进行更新后在返回
session.setAttribute("verifyCodeZSJS", true);
KeyUnlock keyUnlock = keyUnlockService.getKeyUnlockByBillId(billId);
if (!keyUnlockService.isUnlockCodeValid(keyUnlock)) {
keyUnlock = unlockKeyService.generateUnlockCode(null, null, keyUnlock);
// 再次进行解锁校验
if (!keyUnlockService.isUnlockCodeValid(keyUnlock)) {
retMap.put("retMsg", "产生解锁码失败,请联系系统管理员进行处理!");
return retMap;
}
}
retMap.put("reqCode", keyUnlock.getReqCode());
retMap.put("repCode", keyUnlock.getRepCode());
// 若存在,则返回第二个解锁码
if (StringUtils.isNotBlank(keyUnlock.getRepCode2())) {
retMap.put("repCode2", keyUnlock.getRepCode2());
}
retMap.put("retCode", 1);
return retMap;
} catch (Exception e) {
retMap.put("retMsg", "校验解锁动态码出现异常,请联系系统管理员进行处理!");
LogUtil.userlog(sqlSession, bill.getProject(), "校验动态码", "校验出现异常,keySn:" + keySn + "异常信息:" + e.getMessage(), "未知", "", null == userInfo.getUniqueId() ? null : userInfo.getUniqueId());
return retMap;
}
}
use of com.itrus.portal.db.Bill in project portal by ixinportal.
the class DoUnlockKeyController method queryWhetherHasUnlockBill.
/**
* 用户登录首页,根据用户插入的key,判断用户是否有待解锁的订单:
* 如果有,则显示:查询解锁审批结果
* 如果没有,则显示:忘记证书口令
* retcode0,没有订单,1有订单
* @param certSn
* @param keySn
* @param enterpriseName
* @return
*/
@RequestMapping("/queryWhetherHasUnlockBill")
@ResponseBody
public Map<String, Object> queryWhetherHasUnlockBill(@RequestParam("certSn") String certSn, @RequestParam("keySn") String keySn, @RequestParam("enterpriseName") String enterpriseName) {
Map<String, Object> retMap = new HashMap<>();
retMap.put("retCode", 0);
UserCert userCert = userCertService.getUserCertByCertSn(certSn);
if (null == userCert) {
retMap.put("retMsg", "无法识别该证书,请检查您插入的key是否正确,证书序列号:" + certSn);
return retMap;
}
// if (null== userCert.getUserinfo() || null == userCert.getEnterprise()) {
// retMap.put("retMsg", "该证书尚未绑定用户和企业信息");
// return retMap;
// }
// 一个key可能会申请多个解锁订单(之前的订单已经解锁完了)
Bill bill = billService.getBillWaitingForUnlock(userCert.getId());
if (null == bill) {
retMap.put("retMsg", "不存在解锁订单");
return retMap;
}
retMap.put("billId", bill.getId());
retMap.put("retCode", 1);
return retMap;
}
Aggregations