搞了半小时才成功
/**
* 在线支付:整理支付单信息
* @param request
* @param response
* @param attr
* @return paymentbill
*/
@RequestMapping(value = "paymentbill")
public ModelAndView paymentbill(HttpServletRequest request,HttpServletResponse response,RedirectAttributes attr) {
if(!chkOfLogin(request,response)){
return null;
}
String groupCode =request.getParameter("groupCode");
String groupId=(new GroupUtil()).getGroupbyCode(groupCode).getId();
Group pro = groupServ.getGroup(groupId);
String bankType = request.getParameter("bankType");
List<BankPayOnlineInfo> bankpayonlineinfo = bankpayonlineinfoServ.getBankPayOnlineInfoByBankType(groupId,bankType);
Member member = getMember(request);
//支付单信息
///收款方信息:
String pk_group = bankpayonlineinfo.get(0).getGroupId();//集团ID
String cpayeeaccname = pro.getName();//收款方户名(集团名字)
String cpayeebanktype = bankpayonlineinfo.get(0).getBankType();//银行简拼
String cpayeeaccnum = bankpayonlineinfo.get(0).getMerchantNo();//收款方账号(商户号)
String cpayeebankaccid = bankpayonlineinfo.get(0).getBankAccount();//收款方银行账户(银行账号)
String cpayeeid = bankpayonlineinfo.get(0).getCorporationId();//收款方(公司ID)
///支付方信息:
String cpayeraccnumid = member.getAccount();//付款方账号(会员账号)
String cpayerid = member.getBusinessName();//付款方(企业名称)
String cpayerbankaccid = member.getACNo();//付款方银行账户(银行账号)
String cpayeraccname = member.getName();//付款方户名(姓名)
///支付单其他信息:
String vpaymentbillcode = cpayeraccnumid+UUIDMake.produceUID();//支付单编号(会员账号+UUID)
String billmaker = cpayeraccnumid;//制单人(会员账号)
String dbilldate = DataTimeUtil.getCurrentTime();//制单时间
String remark = request.getParameter("remark");//备注信息
int fpaymentstatus = 1;//支付状态(1=待支付,2=支付中,3=支付成功,4=支付失败
String payfailreaon = null;//支付失败原因
int corigcurrencyid = 01;//人民币
String dtradedate = DataTimeUtil.getCurrentTime();//交易日期
String modifier = cpayeraccnumid;//最后修改人(会员账号)
String modifiedtime = DataTimeUtil.getCurrentTime();//最后修改时间
BigDecimal money;//充值金额 支付金额 npaymentamount
String moneystr = request.getParameter("topupmoney");
if(StringUtils.isBlank(moneystr)){
throw new BusinessException(ShopExceptionConstant.ERROR, "金额非法");
}
try {
money = new BigDecimal(moneystr);
} catch (Exception e) {
logger.error(e.getMessage());
throw new BusinessException(ShopExceptionConstant.ERROR, "金额非法");
}
PaymentBill paymentbill = new PaymentBill();
//收款方信息:
paymentbill.setPk_group(pk_group);
paymentbill.setCpayeeaccname(cpayeeaccname);
paymentbill.setCpayeebanktype(cpayeebanktype);
paymentbill.setCpayeeaccnum(cpayeeaccnum);
paymentbill.setCpayeebankaccid(cpayeebankaccid);
paymentbill.setCpayeeid(cpayeeid);
//支付方信息:
paymentbill.setCpayeraccname(cpayeraccname);
paymentbill.setCpayeraccnumid(cpayeraccnumid);
paymentbill.setCpayerbankaccid(cpayerbankaccid);
paymentbill.setCpayerid(cpayerid);
//支付单其他信息:
paymentbill.setBillmaker(billmaker);
paymentbill.setCorigcurrencyid(corigcurrencyid);
paymentbill.setDbilldate(dbilldate);
paymentbill.setDtradedate(dtradedate);
paymentbill.setFpaymentstatus(fpaymentstatus);
paymentbill.setModifiedtime(modifiedtime);
paymentbill.setModifier(modifier);
paymentbill.setMoney(money);
paymentbill.setPayfailreaon(payfailreaon);
paymentbill.setRemark(remark);
paymentbill.setVpaymentbillcode(vpaymentbillcode);
//保存支付单信息
paymentbillServ.insertPaymentBill(paymentbill);
//传递的参数
attr.addFlashAttribute("pk_group", pk_group);
attr.addFlashAttribute("cpayeebanktype",cpayeebanktype);
attr.addFlashAttribute("vpaymentbillcode",vpaymentbillcode);
attr.addFlashAttribute("flag", "paymentbill");
//选择支付平台Controller地址
return new ModelAndView("redirect:/paybill/controller/payofbank");
}
/**
* 在线支付:选择支付平台
*/
@RequestMapping(value = "payofbank")
public ModelAndView payofbank(HttpServletRequest request,HttpServletResponse response,RedirectAttributes attr) {
//Map<String, String> map=(Map<String, String>) attr.getFlashAttributes();
//Map<String, Object> maps=RequestContextUtils.getOutputFlashMap(request);
//上面两种方法失败告终
Map<String, String> map=(Map<String, String>)RequestContextUtils.getInputFlashMap(request);
String groupId = (String) map.get("pk_group");
String bankType = (String) map.get("cpayeebanktype");
String vpaymentbillcode = (String) map.get("vpaymentbillcode");
List<BankPayOnlineInfo> bankpayonlineinfo = bankpayonlineinfoServ.getBankPayOnlineInfoByBankType(groupId,bankType);
PaymentBill paymentbill = paymentbillServ.getPaymentBill(vpaymentbillcode);
//下面的地址没写
return new ModelAndView("redirect:");
}
大概就是这个样子