use of com.itrus.portal.db.Ereceipt in project portal by ixinportal.
the class ExtraProductController method show.
// 显示详情页面
@RequestMapping(value = "/show/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) throws Exception {
ExtraProduct extraProduct = extraProductService.selectByPrimaryKey(id);
uiModel.addAttribute("extraProduct", extraProduct);
List<ExtraProductSpec> extraProductSpecs = extraProductSpecService.getSpecByProductId(id);
uiModel.addAttribute("extraProductSpecs", extraProductSpecs);
// 服务提供商组成的map
Map<Long, ServiceProvider> serviceProviderMap = serviceProviderService.selectMapByExample(null);
uiModel.addAttribute("serviceProviderMap", serviceProviderMap);
// 在线支付的map:微信和支付宝
List<OnlinePay> onlinepays = sqlSession.selectList("com.itrus.portal.db.OnlinePayMapper.selectByExample", null);
uiModel.addAttribute("onlinepays", onlinepays);
// 银行付款的List
List<Transfer> bankPays = sqlSession.selectList("com.itrus.portal.db.TransferMapper.selectByExample", null);
uiModel.addAttribute("bankPays", bankPays);
// 电子发票的list
List<Ereceipt> einvoices = sqlSession.selectList("com.itrus.portal.db.EreceiptMapper.selectByExample", null);
uiModel.addAttribute("einvoices", einvoices);
// 附加项的list
List<ExtraMessage> extraMessages = extraMessageService.selectByExample(null);
uiModel.addAttribute("extraMessages", extraMessages);
return "extraproduct/show";
}
use of com.itrus.portal.db.Ereceipt in project portal by ixinportal.
the class ExtraProductController method updatePage.
// 修改基础信息和产品规格信息页面
@RequestMapping(value = "/update/{id}", produces = "text/html")
public String updatePage(@PathVariable("id") Long id, Model uiModel) throws Exception {
ExtraProduct extraProduct = extraProductService.selectByPrimaryKey(id);
uiModel.addAttribute("extraProduct", extraProduct);
List<ExtraProductSpec> extraProductSpecs = extraProductSpecService.getSpecByProductId(id);
uiModel.addAttribute("extraProductSpecs", extraProductSpecs);
// 服务提供商组成的map
Map<Long, ServiceProvider> serviceProviderMap = serviceProviderService.selectMapByExample(null);
uiModel.addAttribute("serviceProviderMap", serviceProviderMap);
// 在线支付的map:微信和支付宝
List<OnlinePay> onlinepays = sqlSession.selectList("com.itrus.portal.db.OnlinePayMapper.selectByExample", null);
uiModel.addAttribute("onlinepays", onlinepays);
// 银行付款的List
List<Transfer> bankPays = sqlSession.selectList("com.itrus.portal.db.TransferMapper.selectByExample", null);
uiModel.addAttribute("bankPays", bankPays);
// 电子发票的list
List<Ereceipt> einvoices = sqlSession.selectList("com.itrus.portal.db.EreceiptMapper.selectByExample", null);
uiModel.addAttribute("einvoices", einvoices);
return "extraproduct/update";
}
use of com.itrus.portal.db.Ereceipt in project portal by ixinportal.
the class ExtraQueryBillController method show.
// 显示详情
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) {
// 管理员项目权限
Long[] projectsOfAdmin = getProjectLongIdsOfAdmin();
List<Long> projectsOfAdminList = Arrays.asList(projectsOfAdmin);
ExtraBillExample billExample = new ExtraBillExample();
ExtraBillExample.Criteria criteria = billExample.or();
criteria.andIdEqualTo(id);
criteria.andProjectIn(projectsOfAdminList);
ExtraBill bill = sqlSession.selectOne("com.itrus.portal.db.ExtraBillMapper.selectByExample", billExample);
if (null == bill) {
uiModel.addAttribute("errorMsg", "未找到该订单");
return "status403";
}
uiModel.addAttribute("bill", bill);
// 项目
Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", bill.getProject());
uiModel.addAttribute("project", project);
// 企业
Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
if (StringUtils.isNotBlank(enterprise.getProvince())) {
String province = sysRegionService.getProvince(enterprise.getProvince());
enterprise.setProvince(province);
}
if (StringUtils.isNotBlank(enterprise.getCity())) {
String city = sysRegionService.getCity(enterprise.getCity());
enterprise.setCity(city);
}
uiModel.addAttribute("enterprise", enterprise);
// 产品
ExtraProduct product = sqlSession.selectOne("com.itrus.portal.db.ExtraProductMapper.selectByPrimaryKey", bill.getExtraProduct());
uiModel.addAttribute("product", product);
// 规格
ExtraProductSpec productSpec = sqlSession.selectOne("com.itrus.portal.db.ExtraProductSpecMapper.selectByPrimaryKey", bill.getExtraProductSpec());
uiModel.addAttribute("productSpec", productSpec);
// 服务商
ServiceProvider serviceProvider = serviceProviderService.selectByPrimaryKey(product.getServiceProvider());
uiModel.addAttribute("serviceProvider", serviceProvider);
// 用户
UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bill.getUniqueId());
uiModel.addAttribute("userInfo", userInfo);
// 第三方支付信息
OnPayInfo onPayInfo = sqlSession.selectOne("com.itrus.portal.db.OnPayInfoMapper.selectByPrimaryKey", bill.getOnPayInfo());
uiModel.addAttribute("onPayInfo", onPayInfo);
if (onPayInfo != null) {
// 在线支付信息
OnlinePay onlinePay = sqlSession.selectOne("com.itrus.portal.db.OnlinePayMapper.selectByPrimaryKey", onPayInfo.getOnlinePay());
uiModel.addAttribute("onlinePay", onlinePay);
}
// 电子发票
Einvoice einvoice = sqlSession.selectOne("com.itrus.portal.db.EinvoiceMapper.selectByPrimaryKey", bill.geteInvoice());
uiModel.addAttribute("einvoice", einvoice);
// 电子发票类型
if (einvoice != null && einvoice.geteReiceipt() != null) {
Ereceipt ereceipt = sqlSession.selectOne("com.itrus.portal.db.EreceiptMapper.selectByPrimaryKey", einvoice.geteReiceipt());
uiModel.addAttribute("ereceipt", ereceipt);
}
// 其他附加信息
// 营业执照
BusinessLicense businessLicense = businessService.getBusinessByExtraBillId(id, null);
uiModel.addAttribute("bl", businessLicense);
// 税务登记
TaxRegisterCert taxRegisterCert = taxCertService.getTaxRegisterCertByExtraBillId(id, null);
uiModel.addAttribute("trc", taxRegisterCert);
// 组织机构代码
OrgCode orgCode = orgCodeService.getOrgCodeByExtraBillId(id, null);
uiModel.addAttribute("oc", orgCode);
// 代理人
Agent agent = agentService.getAgentByExtraBillId(id, null);
uiModel.addAttribute("agent", agent);
// 开户行信息
OpenBankInfo openBankInfo = openBankInfoService.getOpenBankInfoByExtraBillId(id, null);
uiModel.addAttribute("obi", openBankInfo);
// 法人信息
IdentityCard identityCard = identityCardService.getIdentityCardByExtraBillId(id, null);
uiModel.addAttribute("ic", identityCard);
// TODO 还需要补充订单对应的附加信息和第三方回调信息
return "extrabill/show";
}
use of com.itrus.portal.db.Ereceipt in project portal by ixinportal.
the class MakeInvoiceService method execute.
/**
* 开票推送
*/
@PostMapping(value = "/execute")
@ResponseBody
public Map<String, Object> execute(@RequestHeader("Content-Signature") String authHmac, @RequestParam("appId") String appId, @RequestParam("billId") String billNo, HttpServletRequest request) {
Map<String, Object> result = new HashMap<String, Object>();
result.put("status", -2);
// 验证参数是否完整
if (StringUtils.isEmpty(authHmac) || StringUtils.isEmpty(appId) || StringUtils.isEmpty(billNo)) {
result.put("message", "提交的参数信息不完整");
return result;
}
// 得到应用信息 改成service
Map<String, ApplicationInfo> appInfoMap = CacheCustomer.getAPP_INFO_MAP();
ApplicationInfo applicationInfo = appInfoMap.get(appId);
if (applicationInfo == null) {
ApplicationInfoExample applicationInfoExample = new ApplicationInfoExample();
ApplicationInfoExample.Criteria appInfoExampleCriteria = applicationInfoExample.createCriteria();
appInfoExampleCriteria.andAppIdEqualTo(appId);
applicationInfo = sqlSession.selectOne("com.itrus.portal.db.ApplicationInfoMapper.selectByExample", applicationInfoExample);
}
// 获取配置信息
ReceiptConfig rc = sqlSession.selectOne("com.itrus.portal.db.ReceiptConfigMapper.selectByExample");
log.debug("任务开始");
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
TransactionStatus ts = null;
// 验证hmac有效性
try {
String macVal = Base64.encode(HMACSHA1.getHmacSHA1(appId + billNo, applicationInfo.getSecretKey()), false);
if (!authHmac.equals("HMAC-SHA1 " + macVal)) {
result.put("status", -4);
result.put("message", "服务密钥错误");
return result;
}
} catch (Exception e) {
result.put("status", -3);
result.put("message", "Hmac验证错误");
e.printStackTrace();
return result;
}
try {
String ssl_store = getClass().getClassLoader().getResource("").getPath() + File.separator + // 执行命令后,会生成该testclient.truststore
"fapiao.truststore";
// 证书的存取密码,即执行命令时填写的密码
String ssl_pwd = "ixin21060921";
System.setProperty("javax.net.ssl.trustStore", ssl_store);
System.setProperty("javax.net.ssl.keyStorePassword", ssl_pwd);
// String url =
// "https://218.17.158.39:8999/fpt_dsqz/services/DZFPService?wsdl";
HostnameVerifier hv = new HostnameVerifier() {
public boolean verify(String urlHostName, SSLSession session) {
System.out.println("Warning: URL Host: " + urlHostName + " vs. " + session.getPeerHost());
return true;
}
};
HttpsURLConnection.setDefaultHostnameVerifier(hv);
org.apache.axis.client.Service s = new org.apache.axis.client.Service();
Call call = (Call) s.createCall();
call.setTargetEndpointAddress(new URL(rc.getAddress()));
call.setOperation("doService");
Map param = new HashMap();
param.put("billNo", billNo);
Map<String, Object> data = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByBillEreceipt", param);
// Bill bill =sqlSession.selectOne("", billId);
String xml;
String val;
Bill bill;
Einvoice einvoice = null;
Ereceipt ereceipt;
Map<String, String> temp = null;
String content;
if (null != data && data.size() != 0) {
ereceipt = sqlSession.selectOne("com.itrus.portal.db.EreceiptMapper.selectByPrimaryKey", data.get("eid"));
content = getContent(data, ereceipt);
log.error("[input0]{}", content);
xml = getCommonXml("DFXJ1001", new BASE64Encoder().encodeBuffer(content.getBytes("UTF-8")), rc.getAppId());
log.error("[input1]{}", xml);
Object[] fn01 = { xml };
val = (String) call.invoke(fn01);
log.error("[output]{}", val);
temp = parseXml(val);
if (!temp.get("returnCode").equals("0000")) {
// LogUtil.syslog(sqlSession, "开票推送", data.get("bill_id") + "开票推送失败,错误:" + temp.get("returnMessage"));
log.error("ERRORLOG电子发票 {}", data.get("bill_id") + "开票推送失败,错误:" + temp.get("returnMessage"));
result.put("status", -1);
result.put("message", "开票推送失败");
return result;
}
temp = parseXml(new String(new BASE64Decoder().decodeBuffer(temp.get("content")), "UTF-8"));
einvoice = sqlSession.selectOne("com.itrus.portal.db.EinvoiceMapper.selectByPrimaryKey", data.get("e_invoice"));
einvoice.setInvoiceId(temp.get("FPQQLSH"));
einvoice.setInvoiceCode(temp.get("FP_DM"));
einvoice.setInvoiceNo(temp.get("FP_HM"));
einvoice.setCheckCode(temp.get("JYM"));
einvoice.setConfirmTime(sdf.parse(temp.get("KPRQ")));
einvoice.setDlAddress(temp.get("PDF_URL"));
einvoice.setStatus(1);
einvoice.setInvoiceSum(Double.valueOf(String.valueOf(data.get("bill_sum"))));
ts = transactionManager.getTransaction(def);
sqlSession.update("com.itrus.portal.db.EinvoiceMapper.updateByPrimaryKeySelective", einvoice);
bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", data.get("id"));
bill.setIsInvoiced(1);
bill.setBillTime(new Date());
if (null == bill.getDelivery() && bill.getBillStatus() == 6) {
bill.setBillStatus(ComNames.BILL_STATUS_8);
}
sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKeySelective", bill);
transactionManager.commit(ts);
// count++;
result.put("status", 1);
result.put("address", temp.get("PDF_URL"));
}
// 返回地址
// LogUtil.syslog(sqlSession, "开票推送", "开票推送成功,推送" +
// billexall3.size() + "条,成功" + count + "条。");
log.debug("任务结束");
} catch (Exception e) {
// LogUtil.syslog(sqlSession, "开票推送", "开票推送失败,错误:" + e.toString());
log.error("ERRORLOG电子发票 {}", "开票推送失败,错误:" + e.toString());
e.printStackTrace();
} finally {
if (ts != null && !ts.isCompleted()) {
transactionManager.rollback(ts);
}
}
return result;
}
use of com.itrus.portal.db.Ereceipt 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";
}
Aggregations