use of com.itrus.portal.db.DigitalCert in project portal by ixinportal.
the class PayController 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.selectByCondition", param);
if (null == bill || bill.isEmpty()) {
uiModel.addAttribute("errorMsg", "未找到该订单");
return "status403";
}
uiModel.addAttribute("bill", bill);
Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.get("product"));
DigitalCert cert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", product.getCert());
uiModel.addAttribute("cert", cert);
ProductSpec productSpec = null;
// 判断是否属于组合产品
if (product.getIsCombined() != null && product.getIsCombined().equals(1)) {
Product productSub = null;
// 得到三条组合产品的产品信息
for (int i = 1; i < 4; i++) {
if (bill.get("product" + i) == null) {
continue;
}
productSub = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.get("product" + i));
uiModel.addAttribute("product" + i, productSub);
cert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", productSub.getCert());
uiModel.addAttribute("cert" + i, cert);
// 获取产品规格
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);
}
if (bill.get("bill_status").toString().equals("11")) {
PayInfo pi = sqlSession.selectOne("com.itrus.portal.db.PayInfoMapper.selectByPrimaryKey", bill.get("pay_info"));
uiModel.addAttribute("pi", pi);
}
return "pay/show";
}
// 获取产品规格
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("bill_status").toString().equals("11")) {
PayInfo pi = sqlSession.selectOne("com.itrus.portal.db.PayInfoMapper.selectByPrimaryKey", bill.get("pay_info"));
uiModel.addAttribute("pi", pi);
}
return "pay/show";
}
use of com.itrus.portal.db.DigitalCert in project portal by ixinportal.
the class PayController method confirm.
// 显示详情
@RequestMapping(value = "/confirm/{id}", produces = "text/html")
public String confirm(@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.selectByCondition", 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 (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);
}
if (bill.get("price") != null && bill.get("product_num") != null) {
uiModel.addAttribute("sum", Double.parseDouble(bill.get("price").toString()) * Integer.parseInt(bill.get("product_num").toString()));
} else {
uiModel.addAttribute("sum", 0);
}
ProductSpec productSpec = null;
Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.get("product"));
DigitalCert cert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", product.getCert());
uiModel.addAttribute("cert", cert);
// 判断是否属于组合产品
if (product.getIsCombined() != null && product.getIsCombined().equals(1)) {
Product productSub = null;
PreferentialRecord pr = null;
// 得到三条组合产品的产品信息
for (int i = 1; i < 4; i++) {
if (bill.get("product" + i) == null) {
continue;
}
productSub = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.get("product" + i));
uiModel.addAttribute("product" + i, productSub);
cert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", productSub.getCert());
uiModel.addAttribute("cert" + i, cert);
// 获取产品规格
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);
// 该订单是否有价格优惠记录
pr = preferentialRecordService.selectPreferentialRecordSByBillIdAndProductId(id, (Long) (bill.get("product" + i)));
if (null != pr) {
uiModel.addAttribute("preferentialrecord" + i, pr);
}
}
PayInfo pi = sqlSession.selectOne("com.itrus.portal.db.PayInfoMapper.selectByPrimaryKey", bill.get("pay_info"));
uiModel.addAttribute("pi", pi);
return "pay/update";
}
// 获取产品规格
if (bill.containsKey("product_spec") && !"0".equals(bill.get("product_spec"))) {
productSpec = productSpecService.getProductSpec((Long) bill.get("product_spec"));
}
uiModel.addAttribute("productSpec", productSpec);
PayInfo pi = sqlSession.selectOne("com.itrus.portal.db.PayInfoMapper.selectByPrimaryKey", bill.get("pay_info"));
uiModel.addAttribute("pi", pi);
// 该订单是否有价格优惠记录
PreferentialRecord pr = preferentialRecordService.selectPreferentialRecordSByBillId(id);
if (null != pr) {
uiModel.addAttribute("preferentialrecord", pr);
}
return "pay/update";
}
use of com.itrus.portal.db.DigitalCert in project portal by ixinportal.
the class MakeCertController method show.
// 显示查看详细
@RequestMapping(value = "show/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) {
List<Map> makecerts = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectBillByMakecert", id);
uiModel.addAttribute("makecerts", makecerts);
List makecertexall = sqlSession.selectList("com.itrus.portal.db.UserCertMapper.selectByPrimaryBillKey", id);
uiModel.addAttribute("makecertexall", makecertexall);
DigitalCert digitalcert = null;
ProductSpec productSpec = null;
if (makecerts.get(0).get("is_combined") != null && makecerts.get(0).get("is_combined").equals(1)) {
Product productSub = null;
// 得到三条组合产品的产品信息
for (int i = 1; i < 4; i++) {
if (makecerts.get(0).get("product" + i) == null) {
continue;
}
productSub = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", makecerts.get(0).get("product" + i));
uiModel.addAttribute("product" + i, productSub);
digitalcert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", productSub.getCert());
uiModel.addAttribute("digitalcert" + i, digitalcert);
// 获取产品规格
if (makecerts.get(0).containsKey("product_spec" + i) && !"0".equals(makecerts.get(0).get("product_spec" + i))) {
productSpec = productSpecService.getProductSpec((Long) makecerts.get(0).get("product_spec" + i));
}
uiModel.addAttribute("productSpec" + i, productSpec);
}
return "makecert/show";
}
digitalcert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", makecerts.get(0).get("cert"));
uiModel.addAttribute("digitalcert", digitalcert);
if (makecerts.get(0).containsKey("product_spec") && !"0".equals(makecerts.get(0).get("product_spec"))) {
productSpec = productSpecService.getProductSpec((Long) makecerts.get(0).get("product_spec"));
}
uiModel.addAttribute("productSpec", productSpec);
return "makecert/show";
}
use of com.itrus.portal.db.DigitalCert in project portal by ixinportal.
the class MakeCertController method showReNew.
// 显示待更新订单详细
@RequestMapping(value = "showrenew/{id}", produces = "text/html")
public String showReNew(@PathVariable("id") Long id, Model uiModel) {
List<Map> makecerts = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectBillByMakecert", id);
uiModel.addAttribute("makecerts", makecerts);
List makecertexall = sqlSession.selectList("com.itrus.portal.db.UserCertMapper.selectOldUserCertByBillId", id);
uiModel.addAttribute("makecertexall", makecertexall);
DigitalCert digitalcert = null;
digitalcert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", makecerts.get(0).get("cert"));
uiModel.addAttribute("digitalcert", digitalcert);
ProductSpec productSpec = null;
if (makecerts.get(0).get("is_combined") != null && makecerts.get(0).get("is_combined").equals(1)) {
Product productSub = null;
// 得到三条组合产品的产品信息
for (int i = 1; i < 4; i++) {
if (makecerts.get(0).get("product" + i) == null) {
continue;
}
productSub = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", makecerts.get(0).get("product" + i));
uiModel.addAttribute("product" + i, productSub);
digitalcert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", productSub.getCert());
uiModel.addAttribute("digitalcert" + i, digitalcert);
// 获取产品规格
if (makecerts.get(0).containsKey("product_spec" + i) && !"0".equals(makecerts.get(0).get("product_spec" + i))) {
productSpec = productSpecService.getProductSpec((Long) makecerts.get(0).get("product_spec" + i));
}
uiModel.addAttribute("productSpec" + i, productSpec);
}
return "makecert/show2";
}
digitalcert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", makecerts.get(0).get("cert"));
uiModel.addAttribute("digitalcert", digitalcert);
if (makecerts.get(0).containsKey("product_spec") && !"0".equals(makecerts.get(0).get("product_spec"))) {
productSpec = productSpecService.getProductSpec((Long) makecerts.get(0).get("product_spec"));
}
uiModel.addAttribute("productSpec", productSpec);
return "makecert/show2";
}
use of com.itrus.portal.db.DigitalCert in project portal by ixinportal.
the class MakeCertController method reMakeCert.
/**
* 已制证的订单修改状态为待制证
*
* @param certId
* 证书id
* @return
*/
@ResponseBody
@RequestMapping("/reMakeCert")
public Map<String, Object> reMakeCert(@RequestParam(value = "certId", required = true) Long certId) {
Map<String, Object> retMap = new HashMap<String, Object>();
retMap.put("retCode", 0);
UserCert userCert = sqlSession.selectOne("com.itrus.portal.db.UserCertMapper.selectByPrimaryKey", certId);
if (null == userCert) {
retMap.put("msg", "该证书不存在");
return retMap;
}
// 设置证书id状态为0,标识制证异常
userCert.setCertStatus("0");
// 设置注册用户状态(百润)为 0 未注册
userCert.setIsRegister(0);
// 修改对应订单状态为待制证状态5
Bill bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", userCert.getBill());
if (null == bill) {
retMap.put("msg", "对应的订单不存在");
return retMap;
}
bill.setBillStatus(ComNames.BILL_STATUS_5);
// 判断证书是否为用户下载方式
Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.getProduct());
// 判断是否为组合产品
if (product.getIsCombined() != null && product.getIsCombined().equals(1)) {
product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.getProduct1());
}
DigitalCert cert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", product.getCert());
// 数字证书操作方式为用户下载(2)的,订单状态设置为待下载
if (null != cert && null != cert.getInitBuy() && "2".equals(cert.getInitBuy())) {
bill.setBillStatus(ComNames.BILL_STATUS_13);
}
// 待更新
if (ComNames.TYPE_RENEW.equals(product.getType())) {
bill.setBillStatus(ComNames.BILL_STATUS_12);
}
// 更新数据库
sqlSession.update("com.itrus.portal.db.UserCertMapper.updateByPrimaryKey", userCert);
sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKey", bill);
retMap.put("retCode", 1);
return retMap;
}
Aggregations