use of com.itrus.portal.db.Product 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.Product in project portal by ixinportal.
the class MakeCertController method makeSealBaiRun.
/**
* 百润制章
*
* @param billId
* 订单id
* @param csr
* 证书base64编码
* @param request
* @param response
* @return
* @throws EncDecException
* @throws Exception
*/
@RequestMapping(value = "/makeSealBaiRun", method = RequestMethod.POST)
public void makeSealBaiRun(@RequestParam(value = "billId", required = true) Long billId, @RequestParam(value = "sealpic", required = true) String sealpic, @RequestParam(value = "csr", required = true) String csr, @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; }
*/
Map<String, Object> param = new HashMap<>();
param.put("id", bill.getId());
UserCertExample userc = new UserCertExample();
UserCertExample.Criteria us = userc.createCriteria();
us.andIdNotEqualTo(bill.getId());
userc.setOrderByClause("cert_start_time desc");
userc.setLimit(1);
UserCert usercert = sqlSession.selectOne("com.itrus.portal.db.UserCertMapper.selectByExample", userc);
CertBufExample certbuf = new CertBufExample();
CertBufExample.Criteria cert = certbuf.createCriteria();
cert.andIdEqualTo(usercert.getCertBuf());
CertBuf organ = sqlSession.selectOne("com.itrus.portal.db.CertBufMapper.selectByExample", certbuf);
if (makeSealConfigs.get(1).getName().contains(makeSealServer.getFirm())) {
MakeSealConfig makeSealConfig = makeSealConfigs.get(0);
// 替换-印章名称
if (StringUtils.isNotBlank(makeSealServer.getSealName())) {
UIDInfoUtils uidutils = new UIDInfoUtils();
uidutils.initService(businessService, orgCodeService, taxCertService, identityCardService, userInfoService, enterpriseService);
makeSealServer.setSealName(uidutils.getUidInfo(billId, makeSealServer.getSealName()));
}
try {
log.error("request.getLocalAddr : " + request.getLocalAddr() + ",CSR:" + organ.getCertBuf());
boolean userbool = true;
if (usercert.getIsRegister() == null || !usercert.getIsRegister().equals(1)) {
usercert.setIsRegister(1);
sqlSession.update("com.itrus.portal.db.UserCertMapper.updateByPrimaryKeySelective", usercert);
// 注册用户
userbool = UserSDK.addUser(null, makeSealConfig.getAddressKey(), organ.getCertBuf(), makeSealServer.getAccount(), Constant.APP, Constant.Token);
log.error("makeCertController userbool : " + userbool);
// log.info(makeSealConfig.getAddressKey());
// log.info(String.valueOf(userbool));
}
// 制作印章
Map<String, Object> result = SealSDK.makeSeal(makeSealServer.getSealName(), organ.getCertBuf(), sealpic, "公章", Constant.APP, Constant.Token);
if (userbool && (Boolean) result.get("state")) {
// 制章完成后的印章数据,返回到前台用作导章
log.error("SealSDK : context");
} else {
log.error("SealSDK : ");
// map.put("retMsg", "制章异常");
}
response.setCharacterEncoding("GBK");
response.setContentType("text/html");
OutputStream out = response.getOutputStream();
out.write(result.get("data").toString().getBytes("GBK"));
// map.put("bairun_ret",
// result.get("data").toString().getBytes("GBK"));
out.flush();
out.close();
} catch (Exception e) {
e.printStackTrace();
// map.put("retMsg", e.getMessage());
}
} else {
MakeSealConfig makeSealConfig = makeSealConfigs.get(1);
// 替换-印章名称
if (StringUtils.isNotBlank(makeSealServer.getSealName())) {
UIDInfoUtils uidutils = new UIDInfoUtils();
uidutils.initService(businessService, orgCodeService, taxCertService, identityCardService, userInfoService, enterpriseService);
makeSealServer.setSealName(uidutils.getUidInfo(billId, makeSealServer.getSealName()));
}
try {
log.error("request.getLocalAddr : " + request.getLocalAddr() + ",CSR:" + organ.getCertBuf());
boolean userbool = true;
if (usercert.getIsRegister() != null && !usercert.getIsRegister().equals(1)) {
usercert.setIsRegister(1);
sqlSession.update("com.itrus.portal.db.UserCertMapper.updateByPrimaryKeySelective", usercert);
// 注册用户
userbool = UserSDK.addUser(null, makeSealConfig.getAddressKey(), organ.getCertBuf(), Constant.TianWeiChenXin, Constant.APP, Constant.Token);
}
// 制作印章
Map<String, Object> result = SealSDK.makeSeal(makeSealServer.getSealName(), organ.getCertBuf(), sealpic, "公章", Constant.APP, Constant.Token);
String s = Constant.IP;
if (userbool && (Boolean) result.get("state")) {
// 制章完成后的印章数据,返回到前台用作导章
log.error("SealSDK : " + result.get("data").toString());
} else {
log.error("SealSDK : ");
// map.put("retMsg", "制章异常");
}
response.setCharacterEncoding("GBK");
response.setContentType("text/html");
OutputStream out = response.getOutputStream();
out.write(result.get("data").toString().getBytes("GBK"));
// map.put("bairun_ret",
// result.get("data").toString().getBytes("GBK"));
out.flush();
out.close();
System.out.println(result.get("data").toString().getBytes("GBK").toString() + ":JS");
} catch (Exception e) {
e.printStackTrace();
// map.put("retMsg", e.getMessage());
}
}
// map.put("retCode", 1);
// return map;
}
use of com.itrus.portal.db.Product 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.Product in project portal by ixinportal.
the class MakeCertController method push.
/**
* 手动推送
*
* @param id
* @param uiModel
* @return
*/
@RequestMapping(value = "/{id}/{type}", method = RequestMethod.GET, produces = "text/html")
@ResponseBody
public String push(@PathVariable("id") Long id, @PathVariable("type") Long type, Model uiModel) {
SignatureConfig sc = null;
JSONObject data = null;
JSONObject org = null;
JSONObject result = null;
Bill bill = null;
/*if(type==1){
try {
bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", id);
log.error("bill.getMcstatus()="+bill.getMcstatus()+"bill="+bill);
if(null == bill) {
//log.error(bill.getMcstatus()+"---------------------------------------------"+bill);
//System.out.println(bill.getMcstatus()+"=******************************="+bill);
return "该订单无法推送";
}
Product product = productService.getProductById(bill.getProduct());
sc = sqlSession.selectOne("com.itrus.portal.db.SignatureConfigMapper.selectByPrimaryKey",
product.getSignature());
Enterprise enterprise = enterpriseService.getEnterpriseByBillId(id);
BusinessLicense bl = businessService.getBusinessByBillId((id), null);
if (org == null) {
org = new JSONObject();
}
org.put("userType", 1);
org.put("fullName", bl.getEnterpriseName());
if (bl != null && bl.getBusinessType() == 1) {
org.put("orgCode", bl.getLicenseNo());
} else {
TaxRegisterCert tc = taxCertService.getTaxRegisterCertByBillId((id), null);
org.put("orgCode", tc == null ? "" : tc.getCertNo());
}
org.put("papersType", "营业执照");
UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey",
bill.getUniqueId());
org.put("businessNum", userInfo.getTelephone());
// IdentityCard ic =
// identityCardService.getIdentityCardByBillId(Long.parseLong(String.valueOf(map.get("id"))),
// null);
org.put("legalPersonName", bl == null ? "" : bl.getLegalPerson());
Agent agent = agentService.getAgentByBillId((id), null);
org.put("transactorName", agent == null ? enterprise.getEnterpriseName() : agent.getName());
if (agent != null && agent.getCardType() == 1) {
org.put("transactorIdCardNum", agent.getIdCode());
}
org.put("transactorMobile", userInfo.getmPhone());
org.put("realInfoOrder", bill.getBillId());
org.put("realInfoUid", bill.getUniqueId());
if (data == null) {
data = new JSONObject();
}
data.put("appId", sc.getAppId());
data.put("timestamp", System.currentTimeMillis());
data.put("user", org);
data.put("autoCert", true);
data.put("autoSeal", true);
// String content =
// "{\"autoCert\":true,\"timestamp\":1472105170418,\"apiId\":\"test\",\"autoSeal\":true,\"user\":{\"transactorIdCardNum\":\"120102198904025625\",\"transactorMobile\":\"15822452770\",\"orgCode\":\"120116328553325\",\"papersType\":\"营销执照\",\"businessNum\":\"022-88956296\",\"realInfoUid\":\"151\",\"fullName\":\"天津瑞普生物技术股份有限公司空港经济区分公司\",\"legalPersonName\":\"刘建\",\"transactorName\":\"李洋\",\"realInfoOrder\":\"TWCX20160824170928580820\",\"userType\":1}}";
// bill =
// sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey",
// map.get("id"));
if (bill.getMcstatus() != null && bill.getMcstatus() == 1) {
// return "redirect:/makecert";
return null;
}
log.error("打印data="+data.toString());
log.error("----------接口地址**************"+sc.getAddress() + USER_URL+"***********服务密钥**********"+sc.getAddressKey());
result = JSONObject
.parseObject(RequestUtils.post(sc.getAddress() + USER_URL, data.toString(), sc.getAddressKey()));
log.equals("MakeCert_push_result : " + result);
if (result.getBoolean("isOK") && result.getIntValue("code") == 0) {
LogUtil.syslog(sqlSession, "手动推送用户", bill.getBillId() + "企业名称:" + bl.getEnterpriseName());
bill.setMcstatus(1);
bill.setBillStatus(8);
sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKey", bill);
sqlSession.flushStatements();
// return "redirect:/makecert";
return null;
}
LogUtil.syslog(sqlSession, "手动推送用户",
bill.getBillId() + "企业名称:" + enterprise.getEnterpriseName() + "错误:" + result.getString("message"));
// uiModel.addAttribute("error", "错误:" +
// result.getString("message"));
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
// uiModel.addAttribute("error", "错误:" + e);
return "错误【" + e + "】";
}
}else */
if (type == 1) {
try {
bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", id);
log.error("bill.getMcstatus()=" + bill.getMcstatus() + "bill=" + bill);
if (null == bill) {
// System.out.println(bill.getMcstatus()+"=******************************="+bill);
return "该订单无法推送";
}
Product product = productService.getProductById(bill.getProduct());
sc = sqlSession.selectOne("com.itrus.portal.db.SignatureConfigMapper.selectByPrimaryKey", product.getSignature());
Enterprise enterprise = enterpriseService.getEnterpriseByBillId(id);
BusinessLicense bl = businessService.getBusinessByBillId((id), null);
if (org == null) {
org = new JSONObject();
}
org.put("userType", 1);
org.put("fullName", bl.getEnterpriseName());
if (bl != null && bl.getBusinessType() == 1) {
org.put("orgCode", bl.getLicenseNo());
} else {
TaxRegisterCert tc = taxCertService.getTaxRegisterCertByBillId((id), null);
org.put("orgCode", tc == null ? "orgCode" : tc.getCertNo());
}
org.put("papersType", "营业执照");
UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bill.getUniqueId());
org.put("businessNum", userInfo.getTelephone() == null ? "businessNum" : userInfo.getTelephone());
// null);
if (bl != null) {
org.put("legalPersonName", bl.getLegalPerson() == null ? "legalPersonName" : bl.getLegalPerson());
} else {
org.put("legalPersonName", "legalPersonName");
}
Agent agent = agentService.getAgentByBillId((id), null);
org.put("transactorName", agent == null ? "transactorName" : agent.getName());
if (agent != null && agent.getCardType() == 1) {
org.put("transactorIdCardNum", agent.getIdCode());
} else {
org.put("transactorIdCardNum", "transactorIdCardNum");
}
org.put("transactorMobile", userInfo.getmPhone());
org.put("realInfoOrder", bill.getBillId());
org.put("realInfoUid", bill.getUniqueId());
if (data == null) {
data = getJSONRequest(sc.getAppId());
}
data.put("autoCert", true);
data.put("autoSeal", true);
// data.put("appId", sc.getAppId());
// data.put("timestamp", System.currentTimeMillis());
data.put("user", org);
// String content =
// "{\"autoCert\":true,\"timestamp\":1472105170418,\"apiId\":\"test\",\"autoSeal\":true,\"user\":{\"transactorIdCardNum\":\"120102198904025625\",\"transactorMobile\":\"15822452770\",\"orgCode\":\"120116328553325\",\"papersType\":\"营销执照\",\"businessNum\":\"022-88956296\",\"realInfoUid\":\"151\",\"fullName\":\"天津瑞普生物技术股份有限公司空港经济区分公司\",\"legalPersonName\":\"刘建\",\"transactorName\":\"李洋\",\"realInfoOrder\":\"TWCX20160824170928580820\",\"userType\":1}}";
// bill =
// sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey",
// map.get("id"));
/*if (bill.getMcstatus() != null && bill.getMcstatus() == 1) {
// return "redirect:/makecert";
return null;
}*/
log.error("打印data=" + data.toString());
log.error("----------接口地址**************" + sc.getAddress() + USER_URL + "***********服务密钥**********" + sc.getAddressKey());
result = JSONObject.parseObject(RequestUtils.post(sc.getAddress() + USER_URL, data.toString(), sc.getAddressKey()));
log.equals("MakeCert_push_result : " + result);
if (result.getBoolean("isOK") && result.getIntValue("code") == 0) {
LogUtil.syslog(sqlSession, "手动推送用户", bill.getBillId() + "企业名称:" + bl.getEnterpriseName());
bill.setMcstatus(1);
bill.setBillStatus(8);
sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKey", bill);
sqlSession.flushStatements();
// return "redirect:/makecert";
return null;
}
LogUtil.syslog(sqlSession, "手动推送用户", bill.getBillId() + "企业名称:" + enterprise.getEnterpriseName() + "错误:" + result.getString("message"));
// uiModel.addAttribute("error", "错误:" +
// result.getString("message"));
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
// uiModel.addAttribute("error", "错误:" + e);
return "错误【" + e + "】";
}
} else {
try {
bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", id);
log.error("bill.getMcstatus()=" + bill.getMcstatus() + "bill=" + bill);
if (null == bill) {
// System.out.println(bill.getMcstatus()+"=******************************="+bill);
return "该订单无法推送";
}
Product product = productService.getProductById(bill.getProduct());
sc = sqlSession.selectOne("com.itrus.portal.db.SignatureConfigMapper.selectByPrimaryKey", product.getSignature());
Enterprise enterprise = enterpriseService.getEnterpriseByBillId(id);
BusinessLicense bl = businessService.getBusinessByBillId((id), null);
/*if (org == null) {
org = new JSONObject();
}
org.put("userType", 1);
org.put("fullName", bl.getEnterpriseName());
if (bl != null && bl.getBusinessType() == 1) {
org.put("orgCode", bl.getLicenseNo());
} else {
TaxRegisterCert tc = taxCertService.getTaxRegisterCertByBillId((id), null);
org.put("orgCode", tc == null ? "" : tc.getCertNo());
}
org.put("papersType", "营业执照");*/
UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bill.getUniqueId());
// org.put("businessNum", userInfo.getTelephone());
// IdentityCard ic =
// identityCardService.getIdentityCardByBillId(Long.parseLong(String.valueOf(map.get("id"))),
// null);
// org.put("legalPersonName", bl == null ? "" : bl.getLegalPerson());
Agent agent = agentService.getAgentByBillId((id), null);
/*org.put("transactorName", agent == null ? "" : agent.getName());
if (agent != null && agent.getCardType() == 1) {
org.put("transactorIdCardNum", agent.getIdCode());
}
org.put("transactorMobile", userInfo.getmPhone());
org.put("realInfoOrder", bill.getBillId());
org.put("realInfoUid", bill.getUniqueId());*/
if (data == null) {
data = new JSONObject();
}
Map<String, Object> treeMap = Maps.newTreeMap();
treeMap.put("app_id", sc.getAppId());
treeMap.put("order_number", bill.getBillId());
treeMap.put("user_name", enterprise.getEnterpriseName());
treeMap.put("user_email", userInfo.getEmail());
treeMap.put("user_phone", userInfo.getmPhone());
treeMap.put("user_type", "organization");
/*String cardType = null;
if(agent!=null && agent.getCardType()!=null){
if(agent.getCardType()==1){
cardType = "IdentityCard";
}else if(agent.getCardType()==2){
cardType = "NationalPassport";
}else{
cardType = "Other";
}
treeMap.put("identification_number",agent.getIdCode());
}
*/
String cardType = null;
String sn = null;
BusinessLicense businessLicense = businessService.getBusinessByBillId(bill.getId(), null);
if (businessLicense != null && businessLicense.getBusinessType() == 1) {
sn = businessLicense.getLicenseNo();
cardType = "UniformSocialCreditCode";
}
if (businessLicense == null || businessLicense.getBusinessType() != 1) {
// 不是五证合一
OrgCode oc = orgCodeService.getOrgCodeByBillId(bill.getId(), null);
if (oc != null) {
sn = oc.getOrgCode();
cardType = "OrganizationCode";
}
}
treeMap.put("identification_number", sn);
treeMap.put("identity_type", cardType);
String jsondata = JSONObject.toJSONString(treeMap);
String data1 = mapToQueryString(treeMap);
log.error(data1);
result = JSONObject.parseObject(RequestUtils.post1(sc.getAddress(), jsondata.toString(), data1, sc.getAddressKey(), "HMAC-SHA256"));
log.equals("MakeCert_push_result : " + result);
if (result.getString("code") != null && "SUCCESS".equals(result.getString("code").toString())) {
LogUtil.syslog(sqlSession, "手动推送用户", bill.getBillId() + "企业名称:" + bl.getEnterpriseName());
bill.setMcstatus(1);
bill.setBillStatus(8);
sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKey", bill);
sqlSession.flushStatements();
// return "redirect:/makecert";
return null;
}
LogUtil.syslog(sqlSession, "手动推送用户", bill.getBillId() + "企业名称:" + enterprise.getEnterpriseName() + "错误:" + result.getString("message"));
// uiModel.addAttribute("error", "错误:" +
// result.getString("message"));
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
// uiModel.addAttribute("error", "错误:" + e);
return "错误【" + e + "】";
}
}
return "错误【" + result.getString("message") + "】";
}
use of com.itrus.portal.db.Product 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