use of com.itrus.portal.db.Bill in project portal by ixinportal.
the class DoUnlockKeyController method toUnlockFailPage.
@RequestMapping("/toUnlockFailPage/{billId}")
public String toUnlockFailPage(@PathVariable("billId") Long billId, Model uiModel) {
Bill bill = billService.getBill(billId);
UserInfo userInfo = userInfoService.getUserInfoById(bill.getUniqueId());
Proxy proxy = proxyService.getProxyByBillId(bill.getId());
OnPayInfo onPayInfo = onPayInfoService.selectByPrimaryKey(bill.getOnPayInfo());
UserCert userCert = userCertService.selectByPrimaryKey(bill.getUnlockUserCert());
uiModel.addAttribute("mPhone", userInfo.getmPhone());
uiModel.addAttribute("userCert", userCert);
uiModel.addAttribute("bill", bill);
uiModel.addAttribute("onPayInfo", onPayInfo);
uiModel.addAttribute("proxy", proxy);
uiModel.addAttribute("keySn", userCert.getKeySn());
uiModel.addAttribute("certSn", userCert.getCertSn());
return "clientFW/jiesuoyichang";
}
use of com.itrus.portal.db.Bill in project portal by ixinportal.
the class DoUnlockKeyController method unlockResult.
/**
* 解锁结果.
* @param isUnlockSuccess,是否解锁成功.true解锁成功,false解锁失败
* @param certSn
* @param keySn
* @param enterpriseName
* @param newPassword
* @param uiModel
* @return
*/
@RequestMapping("/unlockResult")
@ResponseBody
public Map<String, Object> unlockResult(@RequestParam("isUnlockSuccess") Boolean isUnlockSuccess, @RequestParam("billId") Long billId, @RequestParam("certSn") String certSn, @RequestParam("keySn") String keySn, @RequestParam(value = "enterpriseName", required = false) String enterpriseName, @RequestParam("newPassword") String newPassword, @RequestParam(value = "errorMsg", required = false) String errorMsg, Model uiModel, HttpSession session) {
Map<String, Object> retMap = new HashMap<String, Object>();
retMap.put("retCode", 0);
boolean verifyCodeZSJS = (boolean) session.getAttribute("verifyCodeZSJS");
if (!verifyCodeZSJS) {
// 查看解锁短信验证是否成功
retMap.put("retMsg", "短信验证失败");
return retMap;
}
session.removeAttribute("verifyCodeZSJS");
DefaultTransactionDefinition dtd = new DefaultTransactionDefinition();
dtd.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
TransactionStatus status = transactionManager.getTransaction(dtd);
UserInfo userInfo = null;
Bill bill = null;
try {
bill = billService.getBill(billId);
if (null == bill) {
retMap.put("retMsg", "订单不存在");
return retMap;
}
userInfo = userInfoService.getUserInfoById(bill.getUniqueId());
KeyUnlock keyUnlock = keyUnlockService.getKeyUnlockByBillId(billId);
if (null == keyUnlock) {
retMap.put("retMsg", "解锁信息不存证");
return retMap;
}
UserCert userCert = userCertService.getUserCertByCertSn(certSn);
if (isUnlockSuccess) {
// 解锁成功,若不需要开票,则直接完成
if (null == bill.geteInvoice() && null == bill.getInvoice()) {
bill.setBillStatus(ComNames.BILL_STATUS_8);
} else {
// 需要开票,校验是否已经开票了
if (null != bill.getIsInvoiced() && bill.getIsInvoiced().equals(1)) {
bill.setBillStatus(ComNames.BILL_STATUS_8);
} else {
bill.setBillStatus(ComNames.BILL_STATUS_18);
}
}
keyUnlock.setUnlockTime(new Date());
keyUnlock.setStatus("UNLOCK");
// 审批解锁成功后,证书和手机号绑定成功,无需登录时再次绑定
if (null == userCert.getUserinfo() || !userCert.getUserinfo().equals(userInfo.getId())) {
userCert.setUserinfo(userInfo.getId());
if (null == userCert.getEnterprise()) {
userCert.setEnterprise(bill.getEnterprise());
}
// 若进行管理员解锁,且订单用户与证书绑定用户不一致,则更换证书所绑定的用户为当前订单用户
if (null != userCert.getUserinfo() && !userCert.getUserinfo().equals(userInfo.getId())) {
userCert.setUserinfo(userInfo.getId());
}
userCertService.updateByPrimaryKeySelective(userCert);
}
} else {
// 解锁异常
bill.setBillStatus(ComNames.BILL_STATUS_17);
}
billService.updateBill(bill);
keyUnlockService.updateByPrimaryKey(keyUnlock);
transactionManager.commit(status);
if (isUnlockSuccess) {
LogUtil.userlog(sqlSession, bill.getProject(), "证书解锁", "解锁成功,keySn:" + keySn, "未知", "", null == userInfo.getUniqueId() ? null : userInfo.getUniqueId());
} else {
LogUtil.userlog(sqlSession, bill.getProject(), "证书解锁", "解锁失败,keySn:" + keySn + ", 错误信息" + errorMsg, "未知", "", null == userInfo.getUniqueId() ? null : userInfo.getUniqueId());
}
retMap.put("retCode", 1);
} catch (Exception e) {
if (!status.isCompleted()) {
transactionManager.rollback(status);
}
LogUtil.userlog(sqlSession, bill.getProject(), "证书解锁", "解锁异常,keySn:" + keySn + "异常信息:" + e.getMessage(), "未知", "", null == userInfo.getUniqueId() ? null : userInfo.getUniqueId());
retMap.put("retMsg", "证书解锁出现异常,请联系系统管理员进行处理!");
} finally {
if (!status.isCompleted()) {
transactionManager.rollback(status);
}
}
return retMap;
}
use of com.itrus.portal.db.Bill in project portal by ixinportal.
the class MakeCertController method makeSeal.
/**
* 获取签章模版
*
* @param billId
* @return
* @throws Exception
* @throws EncDecException
*/
@RequestMapping(value = "/makeSeal", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> makeSeal(@RequestParam(value = "billId", required = true) Long billId, @RequestParam(value = "productId", required = false) Long productId, HttpServletRequest request, HttpServletResponse response) throws EncDecException, Exception {
Map<String, Object> map = new HashMap<String, Object>();
map.put("retCode", 0);
// 获取签章模版
Bill bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", billId);
// 查询项目产品
Product product = null;
// 如为组合产品productId不为空
if (null == productId) {
product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.getProduct());
} else {
product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", productId);
}
if (null == product.getMakeSealServer() || product.getMakeSealServer() <= 0) {
map.put("retMsg", "该产品未配置签章服务");
return map;
}
MakeSealServer makeSealServer = sqlSession.selectOne("com.itrus.portal.db.MakeSealServerMapper.selectByPrimaryKey", product.getMakeSealServer());
// 签章服务配置
List<MakeSealConfig> makeSealConfigs = sqlSession.selectList("com.itrus.portal.db.MakeSealConfigMapper.selectByExample");
if (makeSealConfigs.isEmpty()) {
map.put("retMsg", "没有找到签章服务配置");
return map;
}
/**
* 增加百润和以前的点聚
*/
if (makeSealServer.getFirm().contains("点聚")) {
// 新加if
if (makeSealConfigs.get(0).getName().equals(makeSealServer.getFirm())) {
MakeSealConfig makeSealConfig = makeSealConfigs.get(0);
makeSealConfig.setAddressKey(AESencrp.decrypt(makeSealConfig.getAddressKey(), dbEncKey));
map.put("retCode", 1);
map.put("makeSealConfig", makeSealConfig);
// 替换-印章名称
if (StringUtils.isNotBlank(makeSealServer.getSealName())) {
UIDInfoUtils uidutils = new UIDInfoUtils();
uidutils.initService(businessService, orgCodeService, taxCertService, identityCardService, userInfoService, enterpriseService);
makeSealServer.setSealName(uidutils.getUidInfo(billId, makeSealServer.getSealName()));
}
} else {
MakeSealConfig makeSealConfig = makeSealConfigs.get(1);
makeSealConfig.setAddressKey(AESencrp.decrypt(makeSealConfig.getAddressKey(), dbEncKey));
map.put("retCode", 1);
map.put("makeSealConfig", makeSealConfig);
// 替换-印章名称
if (StringUtils.isNotBlank(makeSealServer.getSealName())) {
UIDInfoUtils uidutils = new UIDInfoUtils();
uidutils.initService(businessService, orgCodeService, taxCertService, identityCardService, userInfoService, enterpriseService);
makeSealServer.setSealName(uidutils.getUidInfo(billId, makeSealServer.getSealName()));
}
}
}
// 新加百润
if (makeSealServer.getFirm().contains("百润")) {
// 第一条是点聚,第二条是百润
if (makeSealConfigs.get(0).getName().equals(makeSealServer.getFirm())) {
MakeSealConfig makeSealConfig = makeSealConfigs.get(0);
makeSealConfig.setAddressKey(AESencrp.decrypt(makeSealConfig.getAddressKey(), dbEncKey));
map.put("retCode", 1);
map.put("makeSealConfig", makeSealConfig);
// 替换-印章名称
if (StringUtils.isNotBlank(makeSealServer.getSealName())) {
UIDInfoUtils uidutils = new UIDInfoUtils();
uidutils.initService(businessService, orgCodeService, taxCertService, identityCardService, userInfoService, enterpriseService);
makeSealServer.setSealName(uidutils.getUidInfo(billId, makeSealServer.getSealName()));
}
} else {
MakeSealConfig makeSealConfig = makeSealConfigs.get(1);
makeSealConfig.setAddressKey(AESencrp.decrypt(makeSealConfig.getAddressKey(), dbEncKey));
map.put("retCode", 1);
map.put("makeSealConfig", makeSealConfig);
// 替换-印章名称
if (StringUtils.isNotBlank(makeSealServer.getSealName())) {
UIDInfoUtils uidutils = new UIDInfoUtils();
uidutils.initService(businessService, orgCodeService, taxCertService, identityCardService, userInfoService, enterpriseService);
makeSealServer.setSealName(uidutils.getUidInfo(billId, makeSealServer.getSealName()));
}
}
}
map.put("makeSealServer", makeSealServer);
return map;
}
use of com.itrus.portal.db.Bill in project portal by ixinportal.
the class MakeCertController method savecertinfo.
// 保存certinfo信息至 uid 字段 ---- 组合产品
@RequestMapping(value = "/save/{id}/{num}", produces = "text/html")
@ResponseBody
public Map<String, Object> savecertinfo(@RequestParam(value = "certinfo", required = false) String certinfo, @PathVariable("id") Long id, @PathVariable("num") Integer num) {
Map<String, Object> ret = new HashMap<String, Object>();
Bill bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", id);
switch(num) {
case 1:
bill.setUid1(certinfo);
log.info("uid1: " + certinfo);
sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKeySelective", bill);
break;
case 2:
bill.setUid2(certinfo);
log.info("uid2: " + certinfo);
sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKeySelective", bill);
break;
case 3:
bill.setUid3(certinfo);
log.info("uid3: " + certinfo);
sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKeySelective", bill);
break;
default:
break;
}
ret.put("status", 0);
return ret;
}
use of com.itrus.portal.db.Bill in project portal by ixinportal.
the class MakeCertController method sendReNewInfo.
/**
* 发送待更新短信通知
*
* @param id
* 订单id
* @return
*/
@RequestMapping("/sendReNewInfo")
@ResponseBody
public Map<String, Object> sendReNewInfo(@RequestParam(value = "billId") Long id) {
Map<String, Object> retMap = new HashMap<String, Object>();
// 0标识发送验证码失败,1标识成功
retMap.put("retCode", 0);
Bill bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", id);
if (null != bill.getRenewSms() && bill.getRenewSms() == true) {
retMap.put("message", "该用户已经发送过短信通知了,不能重复发送");
return retMap;
}
// 获取订单对应的产品信息
Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.getProduct());
String productName = product.getName();
// 发送短信所需要的信息
UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bill.getUniqueId());
UserCertExample userCertExample = new UserCertExample();
UserCertExample.Criteria criteria = userCertExample.or();
criteria.andIdEqualTo(bill.getOldUserCert());
UserCert userCert = sqlSession.selectOne("com.itrus.portal.db.UserCertMapper.selectByExample", userCertExample);
Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
Long projectId = bill.getProject();
String mPhone = userInfo.getmPhone();
String keySn = userCert.getKeySn();
if (null == keySn) {
keySn = "该证书未绑定key";
}
String enterpriseName = enterprise.getEnterpriseName();
Date endTime = userCert.getCertEndTime();
// 执行发送
try {
makeCerServiceImpl.sendReNewInfo(bill, mPhone, projectId, "ZSGX", keySn, enterpriseName, endTime, productName);
retMap.put("retCode", 1);
retMap.put("message", "发送更新通知短信成功");
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
retMap.put("message", "发送短信失败,请联系管理员");
String type = "发送更新证书通知失败";
String info = "用户电话:" + mPhone + "错误信息:" + e.getMessage();
LogUtil.syslog(sqlSession, type, info);
}
return retMap;
}
Aggregations