Search in sources :

Example 1 with ExtraMessage

use of com.itrus.portal.db.ExtraMessage 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";
}
Also used : UserInfo(com.itrus.portal.db.UserInfo) OpenBankInfo(com.itrus.portal.db.OpenBankInfo) IdentityCard(com.itrus.portal.db.IdentityCard) Ereceipt(com.itrus.portal.db.Ereceipt) Agent(com.itrus.portal.db.Agent) HttpSession(javax.servlet.http.HttpSession) ExtraProductSpec(com.itrus.portal.db.ExtraProductSpec) IOException(java.io.IOException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) ExtraProduct(com.itrus.portal.db.ExtraProduct) OrgCode(com.itrus.portal.db.OrgCode) BusinessLicense(com.itrus.portal.db.BusinessLicense) ServiceProvider(com.itrus.portal.db.ServiceProvider) Enterprise(com.itrus.portal.db.Enterprise) UserinfoEnterprise(com.itrus.portal.db.UserinfoEnterprise) ExtraMessage(com.itrus.portal.db.ExtraMessage) TaxRegisterCert(com.itrus.portal.db.TaxRegisterCert) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with ExtraMessage

use of com.itrus.portal.db.ExtraMessage 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;
    }
}
Also used : Agent(com.itrus.portal.db.Agent) DefaultTransactionDefinition(org.springframework.transaction.support.DefaultTransactionDefinition) HashMap(java.util.HashMap) HttpSession(javax.servlet.http.HttpSession) ExtraBill(com.itrus.portal.db.ExtraBill) ExtraProductSpec(com.itrus.portal.db.ExtraProductSpec) TransactionStatus(org.springframework.transaction.TransactionStatus) UserInfo(com.itrus.portal.db.UserInfo) UserLog(com.itrus.portal.db.UserLog) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) IOException(java.io.IOException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) ExtraProduct(com.itrus.portal.db.ExtraProduct) OrgCode(com.itrus.portal.db.OrgCode) BusinessLicense(com.itrus.portal.db.BusinessLicense) OpenBankInfo(com.itrus.portal.db.OpenBankInfo) Enterprise(com.itrus.portal.db.Enterprise) UserinfoEnterprise(com.itrus.portal.db.UserinfoEnterprise) ExtraMessage(com.itrus.portal.db.ExtraMessage) TaxRegisterCert(com.itrus.portal.db.TaxRegisterCert) IdentityCard(com.itrus.portal.db.IdentityCard) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 3 with ExtraMessage

use of com.itrus.portal.db.ExtraMessage in project portal by ixinportal.

the class ExtraMessageController method show.

// 显示详情页面
@RequestMapping(value = "/show/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) throws Exception {
    ExtraMessage extraMessage = extraMessageService.selectByPrimaryKey(id);
    uiModel.addAttribute("extraMessage", extraMessage);
    return "extramessage/show";
}
Also used : ExtraMessage(com.itrus.portal.db.ExtraMessage) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with ExtraMessage

use of com.itrus.portal.db.ExtraMessage in project portal by ixinportal.

the class ExtraMessageController method update.

// 修改页面
@RequestMapping(value = "/{id}", params = "form", produces = "text/html")
public String update(@PathVariable("id") Long id, Model uiModel) throws Exception {
    ExtraMessage extraMessage = extraMessageService.selectByPrimaryKey(id);
    uiModel.addAttribute("extraMessage", extraMessage);
    return "extramessage/update";
}
Also used : ExtraMessage(com.itrus.portal.db.ExtraMessage) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with ExtraMessage

use of com.itrus.portal.db.ExtraMessage in project portal by ixinportal.

the class ExtraMessageController method update.

// 修改操作
@RequestMapping(method = RequestMethod.PUT, produces = "text/html")
public String update(@Valid ExtraMessage extraMessage, BindingResult bindingResult, Model uiModel) throws Exception {
    if (bindingResult.hasErrors()) {
        uiModel.addAttribute("extraMessage", extraMessage);
        return "extramessage/update";
    }
    ExtraMessage oldEm = extraMessageService.selectByPrimaryKey(extraMessage.getId());
    extraMessage.setCreateTime(oldEm.getCreateTime());
    extraMessage.setModifyTime(new Date());
    extraMessageService.updateByPrimaryKey(extraMessage);
    LogUtil.adminlog(sqlSession, "修改附加信息", "附加信息名称:" + extraMessage.getName());
    return "redirect:/extramessage/show/" + extraMessage.getId();
}
Also used : ExtraMessage(com.itrus.portal.db.ExtraMessage) Date(java.util.Date) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

ExtraMessage (com.itrus.portal.db.ExtraMessage)12 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)10 ExtraProduct (com.itrus.portal.db.ExtraProduct)6 ExtraProductSpec (com.itrus.portal.db.ExtraProductSpec)5 Agent (com.itrus.portal.db.Agent)4 BusinessLicense (com.itrus.portal.db.BusinessLicense)4 Enterprise (com.itrus.portal.db.Enterprise)4 IdentityCard (com.itrus.portal.db.IdentityCard)4 OpenBankInfo (com.itrus.portal.db.OpenBankInfo)4 OrgCode (com.itrus.portal.db.OrgCode)4 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)4 UserInfo (com.itrus.portal.db.UserInfo)4 HttpSession (javax.servlet.http.HttpSession)4 Ereceipt (com.itrus.portal.db.Ereceipt)3 ExtraBill (com.itrus.portal.db.ExtraBill)3 OnlinePay (com.itrus.portal.db.OnlinePay)3 ServiceProvider (com.itrus.portal.db.ServiceProvider)3 UserLog (com.itrus.portal.db.UserLog)3 UserinfoEnterprise (com.itrus.portal.db.UserinfoEnterprise)3 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)3