use of com.itrus.portal.db.ExtraProductSpec in project portal by ixinportal.
the class ClientWebController method bugExtraProduct.
// TODO
// 用户选择了产品中的某个规格,确认进行购买,对应于确认订单:根据产品是否需要附加信息,来决定用户提交的资料,判断后台是否有这个用户对应的这些附加信息,如果有就返回给页面
@RequestMapping("/buyExtraProduct")
public String bugExtraProduct(@RequestParam(value = "productId", required = true) Long productId, @RequestParam(value = "productSpecId", required = true) Long productSpecId, @RequestParam(value = "buyNumber", required = true) Long buyNumber, 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) {
uiModel.addAttribute("errorMsg", "登录已经失效,请重新登录");
return "client/errorpage";
}
try {
ExtraProduct product = extraProductService.selectByPrimaryKey(productId);
if (null == product) {
uiModel.addAttribute("errorMsg", "增值产品不存在");
return "client/errorpage";
}
uiModel.addAttribute("extraproduct", product);
// 选择的规格信息
ExtraProductSpec extraProductSpec = extraProductSpecService.selectByPrimaryKey(productSpecId);
if (null == extraProductSpec) {
uiModel.addAttribute("errorMsg", "增值产品规格不存在");
return "client/errorpage";
}
uiModel.addAttribute("extraProductSpec", extraProductSpec);
// 用户购买的数量:选择应该默认都是1
uiModel.addAttribute("buyNumber", buyNumber);
// 产品对应的服务商信息
Long serviceProviderId = product.getServiceProvider();
ServiceProvider serviceProvider = serviceProviderService.selectByPrimaryKey(serviceProviderId);
uiModel.addAttribute("serviceProvider", serviceProvider);
// 电子发票信息,看后台配置该产品是否能开票
String eInvoceStr = product.getEinvoice();
if (StringUtils.isNotBlank(eInvoceStr)) {
// 电子开票服务
Long[] ereceiptIds = StringTools.getLong(product.getEinvoice());
Map<Long, Ereceipt> ereceiptMap = ereceiptService.getEreceiptMap(ereceiptIds);
uiModel.addAttribute("ereceiptMap", ereceiptMap);
}
// 附加信息
if (null != product.getExtraMessage()) {
ExtraMessage extraMessage = extraMessageService.selectByPrimaryKey(product.getExtraMessage());
// 用附加信息项的有无来判断是否需要用户填写附加信息,如果需要,则取附加信息项进行分割处理
uiModel.addAttribute("extraMessage", extraMessage);
// //企业信息 认证项(1.企业名称,2.统一社会信用代码/营业执照,3.组织机构代码,4.税务登记号)
if (StringUtils.isNotBlank(extraMessage.getEnterpriseItems())) {
if (StringUtils.isNotBlank(extraMessage.getEnterpriseItems())) {
if (extraMessage.getEnterpriseItems().contains("1")) {
}
if (extraMessage.getEnterpriseItems().contains("2")) {
List<BusinessLicense> businessLicenses = businessService.getBusinessLicensesNews(enterprise.getId());
if (null != businessLicenses && !businessLicenses.isEmpty()) {
session.setAttribute("webbusinessLicense", businessLicenses.get(0));
}
}
if (extraMessage.getEnterpriseItems().contains("3")) {
List<OrgCode> orgCodes = orgCodeService.getOrgCodesNews(enterprise.getId());
if (null != orgCodes && !orgCodes.isEmpty()) {
session.setAttribute("weborgCode", orgCodes.get(0));
}
}
if (extraMessage.getEnterpriseItems().contains("4")) {
List<TaxRegisterCert> taxRegisterCerts = taxCertService.getTaxRegisterCertsNews(enterprise.getId());
if (null != taxRegisterCerts && !taxRegisterCerts.isEmpty()) {
session.setAttribute("webtaxRegisterCert", taxRegisterCerts.get(0));
}
}
}
}
// field string --fieldName agentItems
if (StringUtils.isNotBlank(extraMessage.getAgentItems())) {
List<Agent> agents = agentService.getAgentsNews(enterprise.getId());
if (null != agents && !agents.isEmpty()) {
session.setAttribute("webagent", agents.get(0));
}
}
// field string --fieldName bankItems
if (StringUtils.isNotBlank(extraMessage.getBankItems())) {
List<OpenBankInfo> openBankInfos = openBankInfoService.getOpenBankInfosNews(enterprise.getId());
if (null != openBankInfos && !openBankInfos.isEmpty()) {
session.setAttribute("webopenBankInfo", openBankInfos.get(0));
}
}
// 法人认证项
if (StringUtils.isNotBlank(extraMessage.getIdentityCardItems())) {
List<IdentityCard> identityCards = identityCardService.getIdentityCardsNews(enterprise.getId());
if (null != identityCards && !identityCards.isEmpty()) {
session.setAttribute("webidentityCard", identityCards.get(0));
}
}
}
// logo和应用介绍信息,通过类似后台的回显方式进行加载
} catch (Exception e) {
// TODO: handle exception
}
return "client/querendingdan";
}
use of com.itrus.portal.db.ExtraProductSpec 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.ExtraProductSpec 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.ExtraProductSpec 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";
}
use of com.itrus.portal.db.ExtraProductSpec 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";
}
Aggregations