use of com.itrus.portal.db.ExtraBill in project portal by ixinportal.
the class ClientWebController method reSubmitOrder.
/**
* 审核拒绝,重新提交信息接口
* @param enterprise
* @param userInfo
* @param einvoice
* @param businessLicense
* @param orgCode
* @param taxregisterCert
* @param agent
* @param openBankInfo
* @param identityCard
* @param request
* @return
*/
@RequestMapping("/reSubmitOrder")
@ResponseBody
public Map<String, Object> reSubmitOrder(@RequestParam(value = "extraBillId", required = true) Long id, @ModelAttribute("enterprise") Enterprise enterprise, @ModelAttribute("userInfo") UserInfo userInfo, @ModelAttribute("einvoice") Einvoice einvoice, @ModelAttribute("businessLicense") BusinessLicense businessLicense, @ModelAttribute("orgCode") OrgCode orgCode, @ModelAttribute("taxregisterCert") TaxRegisterCert taxregisterCert, @ModelAttribute("agent") Agent agent, @ModelAttribute("openBankInfo") OpenBankInfo openBankInfo, @ModelAttribute("identityCard") IdentityCard identityCard, HttpServletRequest request) {
Map<String, Object> retMap = new HashMap<String, Object>();
// 0标识失败,1标识成功
retMap.put("retCode", 0);
HttpSession session = request.getSession();
UserInfo webuserInfo = (UserInfo) session.getAttribute("webuserInfo");
Enterprise webenterprise = (Enterprise) session.getAttribute("webenterprise");
if (null == webuserInfo || null == webenterprise) {
retMap.put("retMsg", "用户登录信息已失效,请重新登录");
return retMap;
}
ExtraBill bill = extraBillService.selectByPrimaryKey(id);
if (null == bill) {
retMap.put("retMsg", "订单不存在");
return retMap;
}
if (!bill.getUniqueId().equals(webuserInfo.getId())) {
retMap.put("retMsg", "您无权操作该订单");
return retMap;
}
ExtraProduct product = extraProductService.selectByPrimaryKey(bill.getExtraProduct());
ExtraProductSpec productSpec = extraProductSpecService.selectByPrimaryKey(bill.getExtraProductSpec());
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
TransactionStatus status = transactionManager.getTransaction(def);
try {
// 更新用户信息和企业信息
enterprise.setId(webenterprise.getId());
// ""字符串判断,改为Null,避免覆盖数据库中的信息
if (null != enterprise) {
if (StringUtils.isBlank(enterprise.getProvince())) {
enterprise.setProvince(null);
}
if (StringUtils.isBlank(enterprise.getCity())) {
enterprise.setCity(null);
}
if (StringUtils.isBlank(enterprise.getShortName())) {
enterprise.setShortName(null);
}
if (StringUtils.isBlank(enterprise.getNsrsbh())) {
enterprise.setNsrsbh(null);
}
}
enterprise = enterpriseService.updateByPrimaryKeySelective(enterprise);
userInfo.setId(webuserInfo.getId());
userInfo = userInfoService.updateByPrimaryKeySelective(userInfo);
// 根据订单id,获取该订单的旧认证项:
BusinessLicense oldBl = businessService.getBusinessByExtraBillId(id, null);
OrgCode oldOc = orgCodeService.getOrgCodeByExtraBillId(id, null);
TaxRegisterCert oldTc = taxCertService.getTaxRegisterCertByExtraBillId(id, null);
IdentityCard oldIc = identityCardService.getIdentityCardByBillId(id, null);
Agent oldAgent = agentService.getAgentByExtraBillId(id, null);
OpenBankInfo oldBankInfo = openBankInfoService.getOpenBankInfoByExtraBillId(id, null);
// 新认证项id置null,便于执行新增或者修改处理
businessLicense.setId(null);
orgCode.setId(null);
taxregisterCert.setId(null);
identityCard.setId(null);
agent.setId(null);
openBankInfo.setId(null);
// 获取产品需要的附加信息项
ExtraMessage extraMessage = extraMessageService.selectByPrimaryKey(product.getExtraMessage());
// 是否有营业执照信息,默认false没有
boolean hasBl = false;
if (null != extraMessage) {
// //企业信息 认证项(1.企业名称,2.统一社会信用代码/营业执照,3.组织机构代码,4.税务登记号)
if (StringUtils.isNotBlank(extraMessage.getEnterpriseItems())) {
if (StringUtils.isNotBlank(extraMessage.getEnterpriseItems())) {
if (extraMessage.getEnterpriseItems().contains("2") && !webenterprise.getEnterpriseNature().equals(3)) {
// 事业单位不填写营业执照
hasBl = true;
businessLicense = businessService.saveBusinessExtraBill(webenterprise.getId(), webenterprise.getEnterpriseSn(), bill.getId(), webuserInfo.getId(), businessLicense, ComNames.ITEM_STATUS_2, oldBl);
}
if (extraMessage.getEnterpriseItems().contains("3")) {
// 需要统一组织机构代码认证项,但是页面没有传递过来的时候,用老的
if (!(hasBl && businessLicense.getBusinessType().equals(// 五证合一企业不用提交组织机构代码、税务登记信息
1))) {
orgCode = orgCodeService.saveOrgCodeExtraBill(webenterprise.getId(), webenterprise.getEnterpriseSn(), bill.getId(), webuserInfo.getId(), orgCode, ComNames.ITEM_STATUS_2, oldOc);
}
}
if (extraMessage.getEnterpriseItems().contains("4")) {
if (!(hasBl && businessLicense.getBusinessType().equals(// 五证合一企业不用提交组织机构代码、税务登记信息
1))) {
// 保存税务登记证
if (// 事业单位不填写税务登记信息
!webenterprise.getEnterpriseNature().equals(3)) {
taxregisterCert = taxCertService.saveTaxCertExtraBill(webenterprise.getId(), webenterprise.getEnterpriseSn(), bill.getId(), webuserInfo.getId(), taxregisterCert, ComNames.ITEM_STATUS_2, oldTc);
}
}
}
}
}
// field string --fieldName agentItems
if (StringUtils.isNotBlank(extraMessage.getAgentItems())) {
agent = agentService.saveAgentExtraBill(webenterprise.getId(), webenterprise.getEnterpriseSn(), bill.getId(), webuserInfo.getId(), agent, ComNames.ITEM_STATUS_2, oldAgent);
}
// field string --fieldName bankItems
if (StringUtils.isNotBlank(extraMessage.getBankItems())) {
openBankInfo = openBankInfoService.saveOpenBankInfoExtraBill(webenterprise.getId(), bill.getId(), webuserInfo.getId(), openBankInfo, ComNames.ITEM_STATUS_2, oldBankInfo);
}
// field string --fieldName identityCardItems
if (StringUtils.isNotBlank(extraMessage.getIdentityCardItems())) {
identityCard = identityCardService.saveIdentityCardExtraBill(webenterprise.getId(), webenterprise.getEnterpriseSn(), bill.getId(), webuserInfo.getId(), identityCard, ComNames.ITEM_STATUS_2, oldIc);
}
}
retMap.put("retCode", 1);
retMap.put("billId", bill.getId());
bill.setBillStatus(ComNames.EXTRA_BILL_STATUS_3);
extraBillService.updateByPrimaryKeySelective(bill);
transactionManager.commit(status);
// 更新session用户和企业信息
webenterprise = enterpriseService.getEnterpriseById(webenterprise.getId());
webuserInfo = userInfoService.getUserInfoById(webuserInfo.getId());
session.setAttribute("webenterprise", webenterprise);
session.setAttribute("webuserInfo", webuserInfo);
UserLog userlog = new UserLog();
userlog.setProject(bill.getProject());
userlog.setType("审核拒绝重新提交");
userlog.setInfo("提交成功,订单id:" + bill.getBillId());
userlog.setHostId("未知");
userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
LogUtil.userlog(sqlSession, userlog);
return retMap;
} catch (UserInfoServiceException e) {
if (!status.isCompleted())
transactionManager.rollback(status);
retMap.put("retMsg", e.getMessage());
return retMap;
} catch (Exception e) {
if (!status.isCompleted())
transactionManager.rollback(status);
UserLog userlog = new UserLog();
userlog.setProject(bill.getProject());
userlog.setType("审核拒绝重新提交");
userlog.setInfo("url:reSubmitOrder,详细错误:" + e.getMessage());
userlog.setHostId("未知");
userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
LogUtil.userlog(sqlSession, userlog);
retMap.put("retMsg", "服务端出现未知错误,请联系管理员");
return retMap;
}
}
use of com.itrus.portal.db.ExtraBill in project portal by ixinportal.
the class ClientWebController method downLoadLicenseByBillId.
@RequestMapping("/downLoadLicense")
@ResponseBody
public Map<String, Object> downLoadLicenseByBillId(@RequestParam(value = "billId", required = true) Long Id, HttpServletRequest request, HttpServletResponse response, Model uiModel) {
Map<String, Object> retMap = new HashMap<>();
retMap.put("retCode", 0);
HttpSession session = request.getSession();
Enterprise webenterprise = (Enterprise) session.getAttribute("webenterprise");
UserInfo webuserInfo = (UserInfo) session.getAttribute("webuserInfo");
if (null == webenterprise || null == webuserInfo) {
retMap.put("retMsg", "登录已经失效,请重新登录");
return retMap;
}
ExtraBill bill = extraBillService.selectByPrimaryKey(Id);
if (null == bill) {
retMap.put("retMsg", "登录已经失效,订单不存在");
return retMap;
}
if (!bill.getUniqueId().equals(webuserInfo.getId())) {
retMap.put("retMsg", "您无权操作该订单");
return retMap;
}
if (!(bill.getBillStatus().equals(ComNames.EXTRA_BILL_STATUS_6) || bill.getBillStatus().equals(ComNames.EXTRA_BILL_STATUS_7))) {
retMap.put("retMsg", "订单尚未能下载注册码.请等待服务商审核通过或者订单完成之后才能下载");
return retMap;
}
Bwdjrecord bwdjrecord = BWDJRecordService.getBwdjrecordByExtraBillId(Id);
OutputStream os = null;
try {
String downLoadUrl = bwdjrecord.getDownLoadUrl();
URL url = new URL(downLoadUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
// 设置超时间为3秒
conn.setConnectTimeout(3 * 1000);
// 防止屏蔽程序抓取而返回403错误
conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
// 得到输入流
InputStream inputStream = conn.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
String license = "";
String currentLine = "";
while ((currentLine = reader.readLine()) != null) {
license = license + currentLine.trim();
}
retMap.put("retCode", 1);
retMap.put("license", license);
return retMap;
// 获取自己数组
// byte[] getData = readInputStream(inputStream);
// response.setHeader("Pragma", "no-cache");
// response.setHeader("Cache-Control", "no-cache");
// response.setDateHeader("Expires", 0);
// os = response.getOutputStream();
// os.write(getData);
// os.close();
} catch (Exception e) {
log.error(e.getMessage());
retMap.put("retMsg", "出现异常,请联系系统管理员,异常信息:" + e.getMessage());
return retMap;
} finally {
// 关闭流!
try {
if (null != os) {
os.close();
}
} catch (IOException e) {
}
}
}
use of com.itrus.portal.db.ExtraBill in project portal by ixinportal.
the class ClientWebController method choiceExtraProduct.
/**
* 用户点击购要购买某个产品,返回这个产品对应的信息.购买信息.对应于:应用详情页面
*
* @param productId
* ,增值产品id
* @param old_billId
* @param request
* @param uiModel
* @return
*/
@RequestMapping("/choiceExtraProduct")
public String choiceExtraProduct(@RequestParam(value = "productId", required = true) Long productId, // enterpriseId,
@RequestParam(value = "old_billId", required = false) Long old_billId, HttpServletRequest request, Model uiModel) {
HttpSession session = request.getSession();
// 判断用户和企业信息是否存在了,不存在不能购买
Enterprise enterprise = (Enterprise) session.getAttribute("webenterprise");
UserInfo userInfo = (UserInfo) session.getAttribute("webuserInfo");
if (null == enterprise || null == userInfo) {
return "";
}
ExtraProduct product = null;
try {
product = extraProductService.selectByPrimaryKey(productId);
if (null == product) {
uiModel.addAttribute("errorMsg", "产品不存在");
return "client/errorpage";
}
uiModel.addAttribute("webExtraproduct", product);
// 产品对应的服务商信息
Long serviceProviderId = product.getServiceProvider();
ServiceProvider serviceProvider = serviceProviderService.selectByPrimaryKey(serviceProviderId);
uiModel.addAttribute("webServiceProvider", serviceProvider);
// 服务商对应的网点信息
List<ServiceHall> serviceHalls = new ArrayList<>();
serviceHalls = serviceHallService.getServiceHalls(serviceProviderId);
uiModel.addAttribute("webServiceHalls", serviceHalls);
// 产品对应的规格信息
List<ExtraProductSpec> extraProductSpecs = extraProductSpecService.getSpecByProductIdValid(product.getId());
uiModel.addAttribute("extraProductSpecs", extraProductSpecs);
Set<String> periodSet = new LinkedHashSet<>();
Set<String> specSet = new LinkedHashSet<>();
Map<String, Map<String, Object>> specPeriodMap = new HashMap<>();
for (ExtraProductSpec eps : extraProductSpecs) {
Map<String, Object> map = new HashMap<>();
map.put("id", eps.getId());
map.put("price", eps.getPrice());
specPeriodMap.put(eps.getSpec() + "||" + eps.getCycle1() + ";" + eps.getCycleUnit(), map);
String spec = eps.getSpec();
specSet.add(spec);
periodSet.add(eps.getCycle1() + ";" + eps.getCycleUnit());
}
ObjectMapper objectMapper = new ObjectMapper();
uiModel.addAttribute("specSet", specSet);
uiModel.addAttribute("periodSet", periodSet);
uiModel.addAttribute("specPeriodMapJson", objectMapper.writeValueAsString(specPeriodMap));
} catch (Exception e) {
// TODO: handle exception
}
// 仅用户授权产品.发票校验产品,直接跳转发票校验
if (null != product.getProductOpenType() && product.getProductOpenType().equals(ComNames.PRODUCT_OPEN_TYPE_1)) {
// 查询用户是否曾经买过了该产品对于的订单,如果买了,则提示只能购买一次
List<ExtraBill> bills = extraBillService.getHasByExtraBill(userInfo.getId(), enterprise.getId(), productId);
if (null != bills && bills.size() > 0) {
uiModel.addAttribute("ifHasOpen", 1);
}
return "client/yingyongxiangqing_jyhsq";
}
return "client/yingyongxiangqing";
}
use of com.itrus.portal.db.ExtraBill in project portal by ixinportal.
the class ExtraBillWebController method delete.
// 删除未支付订单
@RequestMapping(value = "/bill/{id}.html", method = RequestMethod.PUT, produces = "text/html")
@ResponseBody
public String delete(@PathVariable("id") Long id, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, HttpServletRequest request, Model uiModel) {
ExtraBill bill = extraBillService.selectByPrimaryKey(id);
HttpSession session = request.getSession();
UserInfo userInfo = (UserInfo) session.getAttribute("webuserInfo");
if (null == userInfo) {
return "登录失效,请重新登录";
}
if (bill == null) {
return "未找到要删除订单";
} else {
if (!bill.getUniqueId().equals(userInfo.getId())) {
return "您无权操作改订单";
}
if (!bill.getBillStatus().equals(ComNames.EXTRA_BILL_STATUS_1)) {
return "该订单不允许删除";
}
bill.setIsDelete(true);
try {
extraBillService.updateByPrimaryKeySelective(bill);
UserLog userlog = new UserLog();
userlog.setProject(userInfo.getProject());
userlog.setType("删除增值订单");
userlog.setInfo(userInfo.getmPhone() + "删除了订单" + bill.getBillId());
userlog.setHostId("未知");
userlog.setSn(null == userInfo.getUniqueId() ? null : userInfo.getUniqueId());
LogUtil.userlog(sqlSession, userlog);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;
}
use of com.itrus.portal.db.ExtraBill in project portal by ixinportal.
the class ExtraBillWebController method showDetail.
/**
* 增值订单详细接口
*
* @param id
* @param processProgress 服务提供商
* 1默认进度,2为内嵌页面
* @param uiModel
* @param request
* @return
*/
@RequestMapping(value = "/bill/{id}.html", produces = "text/html")
public String showDetail(@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");
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);
// 企业
Enterprise billEnterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
if (StringUtils.isNotBlank(billEnterprise.getProvince())) {
String province = sysRegionService.getProvince(billEnterprise.getProvince());
billEnterprise.setProvince(province);
}
if (StringUtils.isNotBlank(billEnterprise.getCity())) {
String city = sysRegionService.getCity(billEnterprise.getCity());
billEnterprise.setCity(city);
}
uiModel.addAttribute("enterprise", billEnterprise);
// 开户行信息
OpenBankInfo openBankInfo = openBankInfoService.getOpenBankInfoByExtraBillId(id, null);
uiModel.addAttribute("openBankInfo", openBankInfo);
// 根据订单所处状态,返回不同的页面,或者先统一用一个页面.
if (processProgress != null && processProgress.intValue() == 2) {
return "client/banlijindu_neiqian";
}
return "client/banlijindu_moren";
}
Aggregations