use of com.itrus.portal.exception.EncDecException in project portal by ixinportal.
the class BillWebController method reNewCertConfirm.
// 订单详情,待更新确认
@RequestMapping(value = "/reNewCertConfirm/{id}", produces = "text/html")
public String reNewCertConfirm(@PathVariable("id") Long id, HttpServletRequest request, Model uiModel) {
HttpSession session = request.getSession();
UserInfo userInfo = (UserInfo) session.getAttribute("webuserInfo");
Enterprise enterprise = (Enterprise) session.getAttribute("webenterprise");
if (null == userInfo || null == enterprise) {
return "redirect:/userInfoWeb/denglu.html";
}
// 审核记录
ReviewLog reviewLog = reviewLogService.getReviewLog(id);
if (reviewLog != null) {
uiModel.addAttribute("reviewLog", reviewLog);
}
Map param = new HashMap();
// 设置查询条件,选择属于当前用户,当前企业的订单
param.put("id", id);
// param.put("userinfoid", userInfo.getId());
// param.put("enterpriseid", enterprise.getId());
List<Map> billAll = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectProductBillCertById", param);
log.error("--------获取订单数量-------" + billAll.size() + "*****获取订单信息***" + billAll);
log.error("------获取订单id--------" + billAll.get(0).get("id"));
log.error("========获取订单编号=========" + billAll.get(0).get("bill_id"));
if (0 == billAll.size()) {
return "redirect:/userInfoWeb/denglu.html";
}
uiModel.addAttribute("bills", billAll.get(0));
// 获取数字证书
Product product = productService.getProduct((Long) billAll.get(0).get("product"));
log.error("****获取产品id*****" + product.getId());
DigitalCert digitalCert = digitalCertService.getDigitalCert(product.getCert());
// 获取订单在线支付方式
if (billAll.get(0).get("on_pay_info") != null) {
Map<Long, OnPayInfo> opiMap = sqlSession.selectMap("com.itrus.portal.db.OnPayInfoMapper.selectByExample", "id");
uiModel.addAttribute("opiMap", opiMap);
Map<Long, OnlinePay> opMap = sqlSession.selectMap("com.itrus.portal.db.OnlinePayMapper.selectByExample", "id");
uiModel.addAttribute("opMap", opMap);
}
PayInfoExample payInfoex = new PayInfoExample();
Map<Long, PayInfo> payinfoMap = sqlSession.selectMap("com.itrus.portal.db.PayInfoMapper.selectByExample", payInfoex, "id");
uiModel.addAttribute("payinfomap", payinfoMap);
// 获取产品规格
ProductSpec productSpec = null;
if (null != billAll.get(0).get("product_spec") && !"0".equals(billAll.get(0).get("product_spec"))) {
productSpec = productSpecService.getProductSpec((Long) billAll.get(0).get("product_spec"));
}
uiModel.addAttribute("productSpec", productSpec);
uiModel.addAttribute("digitalCert", digitalCert);
// 返回订单对应的老证书的base64
CertBuf certBuf = sqlSession.selectOne("com.itrus.portal.db.CertBufMapper.selectCertBufByBillId", id);
if (null != certBuf) {
uiModel.addAttribute("oldCertB64", certBuf.getCertBuf().replaceAll("\n", ""));
}
log.error("*********签章服务******" + product.getMakeSealServer());
// 判断是否有签章服务,有则显示授权
if (null != product.getMakeSealServer()) {
uiModel.addAttribute("makesealserver", product.getMakeSealServer());
uiModel.addAttribute("billId", billAll.get(0).get("id"));
// 签章服务配置
List<MakeSealConfig> makeSealConfigs = sqlSession.selectList("com.itrus.portal.db.MakeSealConfigMapper.selectByExample");
if (!makeSealConfigs.isEmpty()) {
MakeSealConfig makeSealConfig = makeSealConfigs.get(0);
try {
makeSealConfig.setAddressKey(AESencrp.decrypt(makeSealConfig.getAddressKey(), dbEncKey));
} catch (EncDecException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
uiModel.addAttribute("makeSealConfig", makeSealConfig);
}
}
return "ixinweb/dingdanxiangqing_gengxinqueren";
}
use of com.itrus.portal.exception.EncDecException in project portal by ixinportal.
the class BillController method show.
// 显示详情
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) {
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.selectByCondition2", param);
if (null == bill || bill.isEmpty()) {
uiModel.addAttribute("errorMsg", "未找到该订单");
return "status403";
}
uiModel.addAttribute("bill", bill);
// 得到纳税人识别号
if (bill.get("id") != null) {
String taxesCode = getTaxesCode(Long.valueOf(bill.get("id").toString()));
uiModel.addAttribute("taxesCode", taxesCode);
}
// 获取十环证书编号
if (null != bill.get("uid") && !"{}".equals(bill.get("uid"))) {
List<String> uidList = new ArrayList<String>();
JSONObject uid = JSONObject.parseObject(bill.get("uid").toString());
int countUid = StringUtils.countMatches(bill.get("uid").toString(), "ADDTIONAL_FIELD4");
for (int i = 0; i < countUid; i++) {
uidList.add(uid.get("ADDTIONAL_FIELD4_" + (i + 1)).toString());
}
uiModel.addAttribute("uidList", uidList);
}
Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.get("product"));
uiModel.addAttribute("product", product);
Certification certification = sqlSession.selectOne("com.itrus.portal.db.CertificationMapper.selectByPrimaryKey", product.getAuthentication());
if (certification != null) {
uiModel.addAttribute("rank", certification.getRank());
}
PayInfo payinfo = sqlSession.selectOne("com.itrus.portal.db.PayInfoMapper.selectByPrimaryKey", bill.get("pay_info"));
uiModel.addAttribute("pi", payinfo);
if (product.getIsCombined() != null && product.getIsCombined().equals(1)) {
for (int i = 1; i < 4; i++) {
if (bill.get("product" + i) != null) {
Product product1 = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.get("product" + i));
uiModel.addAttribute("product" + i, product1);
if (null != product1.getCert()) {
DigitalCert cert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", product1.getCert());
uiModel.addAttribute("cert" + i, cert);
}
ProductSpec productSpec = null;
if (bill.containsKey("product_spec" + i) && !"0".equals(bill.get("product_spec" + i))) {
productSpec = productSpecService.getProductSpec((Long) bill.get("product_spec" + i));
}
uiModel.addAttribute("productSpec" + i, productSpec);
}
}
}
DigitalCert cert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", product.getCert());
uiModel.addAttribute("cert", cert);
// 获取产品规格
ProductSpec productSpec = null;
if (bill.containsKey("product_spec") && !"0".equals(bill.get("product_spec"))) {
productSpec = productSpecService.getProductSpec((Long) bill.get("product_spec"));
}
uiModel.addAttribute("productSpec", productSpec);
if (bill.get("on_pay_info") != null) {
OnPayInfo onpayinfo = sqlSession.selectOne("com.itrus.portal.db.OnPayInfoMapper.selectByPrimaryKey", bill.get("on_pay_info"));
uiModel.addAttribute("onpayinfo", onpayinfo);
OnlinePay onlinepay = sqlSession.selectOne("com.itrus.portal.db.OnlinePayMapper.selectByPrimaryKey", bill.get("online_pay"));
uiModel.addAttribute("onlinepay", onlinepay);
}
// 证书信息
UserCertExample uce = new UserCertExample();
UserCertExample.Criteria ucc = uce.createCriteria();
ucc.andBillEqualTo(id);
List certs = sqlSession.selectList("com.itrus.portal.db.UserCertMapper.selectByExample", uce);
uiModel.addAttribute("certs", certs);
Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.get("enterprise"));
uiModel.addAttribute("ent", enterprise);
BusinessLicenseExample ble = new BusinessLicenseExample();
BusinessLicenseExample.Criteria blc = ble.createCriteria();
blc.andEnterpriseEqualTo(enterprise.getId());
blc.andBillEqualTo(id);
BusinessLicense bl = sqlSession.selectOne("com.itrus.portal.db.BusinessLicenseMapper.selectByExample", ble);
uiModel.addAttribute("bl", bl);
OrgCodeExample oce = new OrgCodeExample();
OrgCodeExample.Criteria occ = oce.createCriteria();
occ.andEnterpriseEqualTo(enterprise.getId());
occ.andBillEqualTo(id);
OrgCode oc = sqlSession.selectOne("com.itrus.portal.db.OrgCodeMapper.selectByExample", oce);
uiModel.addAttribute("oc", oc);
TaxRegisterCertExample trce = new TaxRegisterCertExample();
TaxRegisterCertExample.Criteria trcc = trce.createCriteria();
trcc.andEnterpriseEqualTo(enterprise.getId());
trcc.andBillEqualTo(id);
TaxRegisterCert trc = sqlSession.selectOne("com.itrus.portal.db.TaxRegisterCertMapper.selectByExample", trce);
uiModel.addAttribute("trc", trc);
IdentityCardExample ice = new IdentityCardExample();
IdentityCardExample.Criteria icc = ice.createCriteria();
icc.andEnterpriseEqualTo(enterprise.getId());
icc.andBillEqualTo(id);
IdentityCard ic = sqlSession.selectOne("com.itrus.portal.db.IdentityCardMapper.selectByExample", ice);
uiModel.addAttribute("ic", ic);
AgentExample ate = new AgentExample();
AgentExample.Criteria aec = ate.createCriteria();
aec.andEnterpriseEqualTo(enterprise.getId());
aec.andBillEqualTo(id);
Agent at = sqlSession.selectOne("com.itrus.portal.db.AgentMapper.selectByExample", ate);
uiModel.addAttribute("at", at);
ProxyExample pe = new ProxyExample();
ProxyExample.Criteria pc = pe.createCriteria();
pc.andEnterpriseEqualTo(enterprise.getId());
pc.andBillEqualTo(id);
Proxy p = sqlSession.selectOne("com.itrus.portal.db.ProxyMapper.selectByExample", pe);
uiModel.addAttribute("p", p);
PayInfo pi = sqlSession.selectOne("com.itrus.portal.db.PayInfoMapper.selectByPrimaryKey", bill.get("pay_info"));
uiModel.addAttribute("pi", pi);
Invoice invoice = sqlSession.selectOne("com.itrus.portal.db.InvoiceMapper.selectByPrimaryKey", bill.get("invoice"));
uiModel.addAttribute("invoice", invoice);
if (invoice != null && invoice.getReceipt() != null) {
Receipt receipt = sqlSession.selectOne("com.itrus.portal.db.ReceiptMapper.selectByPrimaryKey", invoice.getReceipt());
uiModel.addAttribute("receipt", receipt);
}
// 判断是否选择电子发票
if (bill.get("e_invoice") != null && bill.get("e_invoice") != "") {
Einvoice einvoice = sqlSession.selectOne("com.itrus.portal.db.EinvoiceMapper.selectByPrimaryKey", bill.get("e_invoice"));
uiModel.addAttribute("einvoice", einvoice);
Ereceipt ereceipt = sqlSession.selectOne("com.itrus.portal.db.EreceiptMapper.selectByPrimaryKey", einvoice.geteReiceipt());
uiModel.addAttribute("ereceipt", ereceipt);
}
Delivery d = sqlSession.selectOne("com.itrus.portal.db.DeliveryMapper.selectByPrimaryKey", bill.get("delivery"));
uiModel.addAttribute("d", d);
if (d != null) {
String regionCodes = d.getRegionCodes();
String adds = d.getDetailAdds();
if (StringUtils.isNotBlank(regionCodes) && regionCodes.indexOf("@") >= 0) {
String[] codes = regionCodes.split("@");
String regionName = sysRegionService.getAllName(codes[1], codes[2], codes[3]);
adds = regionName + adds;
d.setDetailAdds(adds);
}
// Courier delivery =
// sqlSession.selectOne("com.itrus.portal.db.CourierMapper.selectByPrimaryKey",
// d.getCourier());
uiModel.addAttribute("delivery", d.getCourier());
}
CourierInfoExample cie = new CourierInfoExample();
CourierInfoExample.Criteria cic = cie.createCriteria();
cic.andBillEqualTo(id);
List couriers = sqlSession.selectList("com.itrus.portal.db.CourierInfoMapper.selectByExample", cie);
uiModel.addAttribute("couriers", couriers);
Map<Long, Courier> deliverys = sqlSession.selectMap("com.itrus.portal.db.CourierMapper.selectByExample", null, "id");
uiModel.addAttribute("deliverys", deliverys);
try {
makeSeal((Long) bill.get("id"), uiModel);
} catch (EncDecException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
// 该订单是否有价格优惠记录
PreferentialRecord pr = preferentialRecordService.selectPreferentialRecordSByBillId(id);
if (null != pr) {
uiModel.addAttribute("preferentialrecord", pr);
}
return "bill/show";
}
Aggregations