use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class ExtraBillWebController method refuse.
// 审核拒绝重新提交页面
@RequestMapping(value = "/resubmit/{id}", produces = "text/html")
public String refuse(@PathVariable("id") Long id, Model uiModel, HttpServletRequest request) {
HttpSession session = request.getSession();
Enterprise webenterprise = (Enterprise) session.getAttribute("webenterprise");
UserInfo webuserInfo = (UserInfo) session.getAttribute("webuserInfo");
if (null == webenterprise || null == webuserInfo) {
uiModel.addAttribute("errorMsg", "登录失效");
return "client/errorpage";
}
ExtraBill bill = extraBillService.selectByPrimaryKey(id);
if (null == bill) {
uiModel.addAttribute("errorMsg", "未找到该订单");
return "client/errorpage";
}
if (!bill.getUniqueId().equals(webuserInfo.getId())) {
uiModel.addAttribute("errorMsg", "您无权操作该订单");
return "client/errorpage";
}
// 获取订单在线支付方式
if (null != bill.getOnPayInfo()) {
// 第三方在线支付记录信息
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);
}
// 订单
uiModel.addAttribute("bill", bill);
// 产品
ExtraProduct product = sqlSession.selectOne("com.itrus.portal.db.ExtraProductMapper.selectByPrimaryKey", bill.getExtraProduct());
uiModel.addAttribute("product", product);
// 用户
UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bill.getUniqueId());
uiModel.addAttribute("userInfo", userInfo);
// 企业
Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
uiModel.addAttribute("enterprise", enterprise);
FileInputStream fis = null;
try {
if (null != product.getExtraMessage()) {
ExtraMessage extraMessage = extraMessageService.selectByPrimaryKey(product.getExtraMessage());
// 用附加信息项的有无来判断是否需要用户填写附加信息,如果需要,则取附加信息项进行分割处理
uiModel.addAttribute("extraMessage", extraMessage);
File file = new File(systemConfigService.getTrustDir().getPath() + File.separator + enterprise.getEnterpriseSn());
if (!file.exists()) {
file.mkdir();
}
// //企业信息 认证项(1.企业名称,2.统一社会信用代码/营业执照,3.组织机构代码,4.税务登记号)
if (StringUtils.isNotBlank(extraMessage.getEnterpriseItems())) {
if (extraMessage.getEnterpriseItems().contains("2")) {
// 营业执照
BusinessLicense businessLicense = businessService.getBusinessByExtraBillId(id, null);
if (null != businessLicense) {
File imgFile = new File(file, businessLicense.getImgFile());
fis = new FileInputStream(imgFile);
businessLicense.setImgFile(ImageToBase64Utils.GetFileBase64(fis));
fis.close();
uiModel.addAttribute("businessLicense", businessLicense);
}
}
if (extraMessage.getEnterpriseItems().contains("3")) {
// 组织机构代码
OrgCode orgCode = orgCodeService.getOrgCodeByExtraBillId(id, null);
if (null != orgCode) {
File imgFile = new File(file, orgCode.getImgFile());
fis = new FileInputStream(imgFile);
orgCode.setImgFile(ImageToBase64Utils.GetFileBase64(fis));
fis.close();
uiModel.addAttribute("orgCode", orgCode);
}
}
if (extraMessage.getEnterpriseItems().contains("4")) {
// 税务登记
TaxRegisterCert taxRegisterCert = taxCertService.getTaxRegisterCertByExtraBillId(id, null);
if (null != taxRegisterCert) {
File imgFile = new File(file, taxRegisterCert.getImgFile());
fis = new FileInputStream(imgFile);
taxRegisterCert.setImgFile(ImageToBase64Utils.GetFileBase64(fis));
fis.close();
uiModel.addAttribute("taxRegisterCert", taxRegisterCert);
}
}
}
// field string --fieldName agentItems
if (StringUtils.isNotBlank(extraMessage.getAgentItems())) {
Agent agent = agentService.getAgentByExtraBillId(id, null);
if (null != agent) {
File imgFile = new File(file, agent.getFrontImg());
fis = new FileInputStream(imgFile);
agent.setFrontImg(ImageToBase64Utils.GetFileBase64(fis));
if (StringUtils.isNotBlank(agent.getBackImg())) {
File backImgFile = new File(file, agent.getBackImg());
fis = new FileInputStream(backImgFile);
agent.setBackImg(ImageToBase64Utils.GetFileBase64(fis));
fis.close();
}
uiModel.addAttribute("agent", agent);
}
}
// field string --fieldName bankItems
if (StringUtils.isNotBlank(extraMessage.getBankItems())) {
OpenBankInfo openBankInfo = openBankInfoService.getOpenBankInfoByExtraBillId(id, null);
if (null != openBankInfo) {
uiModel.addAttribute("openBankInfo", openBankInfo);
}
}
// 法人认证项
if (StringUtils.isNotBlank(extraMessage.getIdentityCardItems())) {
IdentityCard identityCard = identityCardService.getIdentityCardByExtraBillId(id, null);
if (null != identityCard) {
File imgFile = new File(file, identityCard.getFrontImg());
fis = new FileInputStream(imgFile);
identityCard.setFrontImg(ImageToBase64Utils.GetFileBase64(fis));
if (StringUtils.isNotBlank(identityCard.getBackImg())) {
File backImgFile = new File(file, identityCard.getBackImg());
fis = new FileInputStream(backImgFile);
identityCard.setBackImg(ImageToBase64Utils.GetFileBase64(fis));
fis.close();
}
uiModel.addAttribute("identityCard", identityCard);
}
}
}
} catch (Exception e) {
// TODO: handle exception
UserLog userlog = new UserLog();
userlog.setProject(bill.getProject());
userlog.setType("审核拒绝重新提交");
userlog.setInfo("url:resubmit,详细错误:" + e.getMessage());
userlog.setHostId("未知");
userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
LogUtil.userlog(sqlSession, userlog);
} finally {
if (null != fis) {
try {
fis.close();
} catch (Exception e2) {
// TODO: handle exception
}
}
}
return "client/shenhejujue_chongxintijiao";
}
use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class ExtraBillWebController method refusePage.
// 审核拒绝页面
@RequestMapping(value = "/refusebill/{id}.html", produces = "text/html")
public String refusePage(@PathVariable("id") Long id, @RequestParam(value = "processProgress", required = false) Long processProgress, Model uiModel, HttpServletRequest request) {
HttpSession session = request.getSession();
Enterprise enterprise = (Enterprise) session.getAttribute("webenterprise");
UserInfo userInfo = (UserInfo) session.getAttribute("webuserInfo");
if (null == enterprise || null == userInfo) {
uiModel.addAttribute("errorMsg", "登录失效");
return "client/errorpage";
}
ExtraBill bill = extraBillService.selectByPrimaryKey(id);
if (null == bill) {
uiModel.addAttribute("errorMsg", "订单不存在");
return "client/errorpage";
}
uiModel.addAttribute("bill", bill);
if (!bill.getUniqueId().equals(userInfo.getId())) {
uiModel.addAttribute("errorMsg", "您无权操作该订单");
return "client/errorpage";
}
// 订单对应的产品信息
ExtraProduct product = extraProductService.selectByPrimaryKey(bill.getExtraProduct());
uiModel.addAttribute("product", product);
// 订单对应的规格信息
ExtraProductSpec productSpec = extraProductSpecService.selectByPrimaryKey(bill.getExtraProductSpec());
uiModel.addAttribute("productSpec", productSpec);
// 银行卡支付记录信息
PayInfoExample payInfoex = new PayInfoExample();
Map<Long, PayInfo> payinfoMap = sqlSession.selectMap("com.itrus.portal.db.PayInfoMapper.selectByExample", payInfoex, "id");
uiModel.addAttribute("payinfomap", payinfoMap);
// 获取订单在线支付方式
if (null != bill.getOnPayInfo()) {
// 第三方在线支付记录信息
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);
}
// 电子发票信息
if (null != bill.geteInvoice()) {
Einvoice einvoice = sqlSession.selectOne("com.itrus.portal.db.EinvoiceMapper.selectByPrimaryKey", bill.geteInvoice());
uiModel.addAttribute("einvoice", einvoice);
}
// 纸票模版
Map<Long, Receipt> receiptmap = sqlSession.selectMap("com.itrus.portal.db.ReceiptMapper.selectByExample", null, "id");
uiModel.addAttribute("receiptmap", receiptmap);
// 电票开票模版
Map<Long, Ereceipt> ereceiptmap = sqlSession.selectMap("com.itrus.portal.db.EreceiptMapper.selectByExample", null, "id");
uiModel.addAttribute("ereceiptmap", ereceiptmap);
return "client/shenhejujue";
}
use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class PayExtraBillWebController method pay.
/**
* 测试的接口 String notifyStr =
* request.getContextPath()+"/web/pay/notifyUrl";//回调url String returnStr =
* request.getContextPath()+"/web/pay/returnUrl";//跳转url
*
* @param request
* @param response
*/
@RequestMapping(produces = "text/html")
public String pay(HttpServletRequest request, HttpServletResponse response, String url, String payid, String pay_type, String appid, String appSecretKey, String orderNo, String money, String body) {
try {
HttpSession session = request.getSession();
UserInfo userInfo = (UserInfo) session.getAttribute("webuserInfo");
SortedMap<String, String> map = new TreeMap();
// 0:支付宝支付
// 3:微信支付
map.put("payType", (Integer.parseInt(pay_type) == 1 ? "0" : "3"));
// 用户唯一标识
map.put("userId", userInfo.getId().toString());
// 支付平台提供的appId
map.put("appId", appid);
// 请求支付系统的订单号
map.put("orderId", orderNo);
// 订单总金额
map.put("totalFee", money);
// 订单描述,暂时为产品名称
map.put("description", body);
// 附加描述
map.put("attach", body);
// 签名结果
String mySign = SignUtil.createSign(map, appSecretKey);
request.setAttribute("payType", (Integer.parseInt(pay_type) == 1 ? "0" : "3"));
request.setAttribute("userId", userInfo.getId());
request.setAttribute("appId", appid);
request.setAttribute("orderId", orderNo);
request.setAttribute("totalFee", money);
request.setAttribute("description", body);
request.setAttribute("attach", body);
request.setAttribute("sign", mySign);
request.setAttribute("requestUrl", url);
generatePayInfo(userInfo.getId(), orderNo, payid, money);
// response.setContentType("text/html;charset=utf-8");
// response.getOutputStream().write(result.getBytes("UTF-8"));
} catch (Exception e) {
LogUtil.syslog(sqlSession, "在线支付_增值订单", orderNo + "在线支付错误:" + url + e.toString());
e.printStackTrace();
}
// TODO 跳转支付页面.可以参考原来的.ixinweb/payResult这个页面主要是在页面加载完成之后,吧页面的表单提交到一个地方
return "client/payResult";
}
use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class PayWebController method pay.
/**
* 测试的接口
* @param request
* @param response
*/
@RequestMapping(produces = "text/html")
public void pay(HttpServletRequest request, HttpServletResponse response) {
URL = request.getParameter("url");
// 应用appid
String appid = request.getParameter("appid");
// 应用秘钥
APP_SECRET_KEY = request.getParameter("appSecretKey");
String payid = request.getParameter("payid");
// 订单号
String orderNo = request.getParameter("orderNo");
// 订单号
String money = request.getParameter("money");
String spbill_create_ip = request.getParameter("spbill_create_ip");
String attach = request.getParameter("attach");
String requestURI = request.getRequestURI();
String requestURL = request.getRequestURL().toString();
int indexOfURI = requestURL.indexOf(requestURI);
StringBuffer notifySB = new StringBuffer();
StringBuffer returnSB = new StringBuffer();
// 回调url
String notifyStr = request.getContextPath() + "/web/pay/notifyUrl";
// 页面跳转url
String returnStr = request.getContextPath() + "/web/pay/returnUrl";
notifySB.append(requestURL.substring(0, indexOfURI)).append(notifyStr);
returnSB.append(requestURL.substring(0, indexOfURI)).append(returnStr);
// 异步回调url
String notify_url = notifySB.toString();
// 页面跳转url
String return_url = returnSB.toString();
// 交易类型 all 获取在平台开通的支付方式 , alipay:支付宝 ,wechat:微信,unionPay 银联,thirdPay 第三方付款
String pay_type = request.getParameter("pay_type");
// 描述 商品的标题/交易标题/订单标题/订单关键字等。该参数最长为128个汉字。
String describe = request.getParameter("body");
// 随机字符串
String nonce_str = PayUtil.getNonceStr();
SortedMap<String, String> packageParams = new TreeMap<String, String>();
packageParams.put("appid", appid);
packageParams.put("nonce_str", nonce_str);
packageParams.put("body", describe);
packageParams.put("out_trade_no", orderNo);
packageParams.put("total_fee", money.toString());
packageParams.put("spbill_create_ip", spbill_create_ip);
packageParams.put("notify_url", notify_url);
packageParams.put("return_url", return_url);
packageParams.put("pay_type", pay_type);
packageParams.put("attach", attach);
RequestHandler reqHandler = new RequestHandler(null, null);
reqHandler.init(null, null, APP_SECRET_KEY);
String sign = reqHandler.createSign(packageParams);
String xmlParam = "<xml><appid>" + appid + "</appid>" + "<nonce_str>" + nonce_str + "</nonce_str><sign>" + sign + "</sign>" + "<body><![CDATA[" + describe.trim() + "]]></body>" + "<out_trade_no>" + orderNo + "</out_trade_no><total_fee>" + money + "</total_fee>" + "<spbill_create_ip>" + spbill_create_ip + "</spbill_create_ip><notify_url>" + notify_url + "</notify_url><return_url>" + return_url + "</return_url><pay_type>" + pay_type + "</pay_type><attach>" + attach + "</attach></xml>";
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(URL);
// DefaultTransactionDefinition def = new DefaultTransactionDefinition();
// def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
// TransactionStatus s = transactionManager.getTransaction(def);
String jsonStr = null;
try {
httppost.setEntity(new StringEntity(xmlParam, "UTF-8"));
HttpResponse respon = httpclient.execute(httppost);
jsonStr = EntityUtils.toString(respon.getEntity(), "UTF-8");
if (jsonStr.indexOf("FAIL") != -1) {
PayUtil.showJsp(response, SytemUtil.getContextUrl(request) + "/web/pay/returnUrl1");
return;
} else if (jsonStr.indexOf("SUCCESS") != -1) {
Map m = PayUtil.parseXmlToList2(jsonStr);
String contextUrl = (String) m.get("redirect_url");
String sign01 = (String) m.get("sign");
// 必须进行验签,否则存在支付风险
boolean result01 = PayUtil.validate(sign01, m, APP_SECRET_KEY);
if (result01) {
SortedMap<String, String> pk = new TreeMap<String, String>();
pk.put("redirect_url", contextUrl);
String encryString = PayUtil.getEncryString(pk, APP_SECRET_KEY);
BillExample be = new BillExample();
BillExample.Criteria bc = be.createCriteria();
bc.andBillIdEqualTo(orderNo);
Bill bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByExample", be);
OnPayInfo payInfo;
HttpSession session = request.getSession();
UserInfo userInfo = (UserInfo) session.getAttribute("webuserInfo");
if (bill.getOnPayInfo() == null) {
payInfo = new OnPayInfo();
payInfo.setOnlinePay(Long.parseLong(payid));
payInfo.setPaySum(Double.parseDouble(money));
payInfo.setPayStatus(0);
payInfo.setDyTime(new Date());
payInfo.setName(String.valueOf(userInfo.getId()));
sqlSession.insert("com.itrus.portal.db.OnPayInfoMapper.insert", payInfo);
sqlSession.flushStatements();
bill.setOnPayInfo(payInfo.getId());
sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKeySelective", bill);
} else {
payInfo = sqlSession.selectOne("com.itrus.portal.db.OnPayInfoMapper.selectByPrimaryKey", bill.getOnPayInfo());
payInfo.setOnlinePay(Long.parseLong(payid));
payInfo.setPaySum(Double.parseDouble(money));
payInfo.setDyTime(new Date());
payInfo.setName(String.valueOf(userInfo.getId()));
sqlSession.update("com.itrus.portal.db.OnPayInfoMapper.updateByPrimaryKeySelective", payInfo);
}
// transactionManager.commit(s);
response.sendRedirect(contextUrl + "&sign=" + encryString);
}
return;
}
} catch (Exception e) {
LogUtil.syslog(sqlSession, "在线支付", orderNo + "在线支付错误:" + e.toString() + xmlParam + jsonStr);
e.printStackTrace();
}
// finally{
// if (!s.isCompleted()) {
// transactionManager.rollback(s);
// }
// }
}
use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class PayWebController method returnUrl1.
@RequestMapping(value = "/returnUrl1")
public String returnUrl1(HttpServletRequest request, Model uiModel, HttpServletResponse response) {
// 动态qq在线咨询
HttpSession session = request.getSession();
UserInfo userInfo = (UserInfo) session.getAttribute("webuserInfo");
if (null != userInfo) {
userInfo = userInfoService.getUserInfoById(userInfo.getId());
session.setAttribute("webuserInfo", userInfo);
if (null != userInfo.getProject()) {
EnterpriseQqExample enterprise = new EnterpriseQqExample();
EnterpriseQqExample.Criteria qqEx = enterprise.createCriteria();
qqEx.andProjectIdEqualTo(userInfo.getProject());
EnterpriseQq enterpriseqq = sqlSession.selectOne("com.itrus.portal.db.EnterpriseQqMapper.selectByExample", enterprise);
if (enterpriseqq != null && enterpriseqq.getEnterpriseQqLinks() != null) {
uiModel.addAttribute("enterpriseqq", enterpriseqq.getEnterpriseQqLinks());
session.setAttribute("enterpriseqqE", enterpriseqq.getEnterpriseQqLinks());
}
}
}
return "ixinweb/chongfuzhifu";
}
Aggregations