Search in sources :

Example 26 with ExtraBill

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

the class ExtraBillReceiptController 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());
    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);
    // 电子发票
    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("businessLicense", businessLicense);
    // 税务登记
    TaxRegisterCert taxRegisterCert = taxCertService.getTaxRegisterCertByExtraBillId(id, null);
    uiModel.addAttribute("taxRegisterCert", taxRegisterCert);
    // 组织机构代码
    OrgCode orgCode = orgCodeService.getOrgCodeByExtraBillId(id, null);
    uiModel.addAttribute("orgCode", orgCode);
    // 代理人
    Agent agent = agentService.getAgentByExtraBillId(id, null);
    uiModel.addAttribute("agent", agent);
    // 开户行信息
    OpenBankInfo openBankInfo = openBankInfoService.getOpenBankInfoByExtraBillId(id, null);
    uiModel.addAttribute("openBankInfo", openBankInfo);
    // 法人信息
    IdentityCard identityCard = identityCardService.getIdentityCardByExtraBillId(id, null);
    uiModel.addAttribute("identityCard", identityCard);
    // TODO 还需要补充订单对应的附加信息和第三方回调信息
    return "extrabillreceipt/show";
}
Also used : Ereceipt(com.itrus.portal.db.Ereceipt) Agent(com.itrus.portal.db.Agent) ExtraBill(com.itrus.portal.db.ExtraBill) ExtraProductSpec(com.itrus.portal.db.ExtraProductSpec) UserInfo(com.itrus.portal.db.UserInfo) Einvoice(com.itrus.portal.db.Einvoice) ExtraBillExample(com.itrus.portal.db.ExtraBillExample) Project(com.itrus.portal.db.Project) ExtraProduct(com.itrus.portal.db.ExtraProduct) OrgCode(com.itrus.portal.db.OrgCode) BusinessLicense(com.itrus.portal.db.BusinessLicense) OnPayInfo(com.itrus.portal.db.OnPayInfo) OpenBankInfo(com.itrus.portal.db.OpenBankInfo) ServiceProvider(com.itrus.portal.db.ServiceProvider) Enterprise(com.itrus.portal.db.Enterprise) TaxRegisterCert(com.itrus.portal.db.TaxRegisterCert) IdentityCard(com.itrus.portal.db.IdentityCard) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 27 with ExtraBill

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

the class ExtraBillReviewController 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());
    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);
    // 电子发票
    Einvoice einvoice = sqlSession.selectOne("com.itrus.portal.db.EinvoiceMapper.selectByPrimaryKey", bill.geteInvoice());
    uiModel.addAttribute("einvoice", einvoice);
    // 其他附加信息
    // 营业执照
    BusinessLicense businessLicense = businessService.getBusinessByExtraBillId(id, null);
    uiModel.addAttribute("businessLicense", businessLicense);
    // 税务登记
    TaxRegisterCert taxRegisterCert = taxCertService.getTaxRegisterCertByExtraBillId(id, null);
    uiModel.addAttribute("taxRegisterCert", taxRegisterCert);
    // 组织机构代码
    OrgCode orgCode = orgCodeService.getOrgCodeByExtraBillId(id, null);
    uiModel.addAttribute("orgCode", orgCode);
    // 代理人
    Agent agent = agentService.getAgentByExtraBillId(id, null);
    uiModel.addAttribute("agent", agent);
    // 开户行信息
    OpenBankInfo openBankInfo = openBankInfoService.getOpenBankInfoByExtraBillId(id, null);
    uiModel.addAttribute("openBankInfo", openBankInfo);
    // 法人信息
    IdentityCard identityCard = identityCardService.getIdentityCardByExtraBillId(id, null);
    uiModel.addAttribute("identityCard", identityCard);
    // TODO 还需要补充订单对应的附加信息和第三方回调信息
    return "extrabillreview/show";
}
Also used : Agent(com.itrus.portal.db.Agent) ExtraBill(com.itrus.portal.db.ExtraBill) ExtraProductSpec(com.itrus.portal.db.ExtraProductSpec) UserInfo(com.itrus.portal.db.UserInfo) Einvoice(com.itrus.portal.db.Einvoice) ExtraBillExample(com.itrus.portal.db.ExtraBillExample) Project(com.itrus.portal.db.Project) ExtraProduct(com.itrus.portal.db.ExtraProduct) OrgCode(com.itrus.portal.db.OrgCode) BusinessLicense(com.itrus.portal.db.BusinessLicense) OnPayInfo(com.itrus.portal.db.OnPayInfo) OpenBankInfo(com.itrus.portal.db.OpenBankInfo) ServiceProvider(com.itrus.portal.db.ServiceProvider) Enterprise(com.itrus.portal.db.Enterprise) TaxRegisterCert(com.itrus.portal.db.TaxRegisterCert) IdentityCard(com.itrus.portal.db.IdentityCard) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 28 with ExtraBill

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

the class ExtraBillReviewController method sendSmsBySHJJ.

/**
 * 手动发送审核拒绝短信通知
 *
 * @param billId
 * @return
 */
@RequestMapping("/sendSmsBySHJJ")
@ResponseBody
public synchronized Map<String, Object> sendSmsBySHJJ(@RequestParam(value = "billId", required = true) Long billId) {
    Map<String, Object> retMap = new HashMap<String, Object>();
    retMap.put("retCode", 0);
    // 修改订单
    ExtraBill bill = extraBillService.selectByPrimaryKey(billId);
    if (null == bill) {
        retMap.put("retMsg", "订单不存在");
        return retMap;
    }
    // 查询短信模版
    // 查找对应项目的消息模版:SHJJ
    MessageTemplate messageTemplate = messageTemplateService.getMsgTemp(bill.getProject(), "SHJJ");
    if (null == messageTemplate) {
        retMap.put("retMsg", "审核拒绝短信模版不存在,请联系系统管理员配置");
        return retMap;
    }
    Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
    ExtraProduct product = extraProductService.selectByPrimaryKey(bill.getExtraProduct());
    Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", bill.getProject());
    UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bill.getUniqueId());
    String content = messageTemplate.getMessageContent();
    // 替换特定内容:企业名称:enterpriseName,产品名称:productName,项目名称:projectName,拒绝原因:reason
    if (content.contains("enterpriseName")) {
        content = content.replaceAll("enterpriseName", enterprise.getEnterpriseName());
    }
    if (content.contains("productName")) {
        content = content.replaceAll("productName", product.getAppName());
    }
    if (content.contains("projectName")) {
        content = content.replaceAll("projectName", project.getName());
    }
    if (content.contains("reason")) {
        content = content.replaceAll("reason", bill.getRefuseReason());
    }
    // 发送短信
    try {
        smsSendService.sendRefuseReview(userInfo.getmPhone(), content, "SHJJ", project.getId(), userInfo.getUniqueId(), bill.getBillId());
    } catch (Exception e) {
        e.printStackTrace();
    }
    bill.setIsRefuseSms(true);
    bill.setSendTime(new Date());
    try {
        extraBillService.updateByPrimaryKey(bill);
        retMap.put("retCode", 1);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return retMap;
}
Also used : MessageTemplate(com.itrus.portal.db.MessageTemplate) ExtraProduct(com.itrus.portal.db.ExtraProduct) Project(com.itrus.portal.db.Project) HashMap(java.util.HashMap) ExtraBill(com.itrus.portal.db.ExtraBill) Enterprise(com.itrus.portal.db.Enterprise) UserInfo(com.itrus.portal.db.UserInfo) Date(java.util.Date) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 29 with ExtraBill

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

the class ExtraBillReviewController method audit.

// TODO 单个订单推送到第三方支付平台进行审核.
@RequestMapping("/audit")
@ResponseBody
public synchronized Map<String, Object> audit(@RequestParam(value = "billId", required = true) Long id) {
    Map<String, Object> retMap = new HashMap<>();
    retMap.put("retCode", 0);
    ExtraBill bill = extraBillService.selectByPrimaryKey(id);
    if (null == bill || !bill.getBillStatus().equals(ComNames.EXTRA_BILL_STATUS_3)) {
        retMap.put("retMsg", "订单不存在,或者订单状态不是待审核");
        return retMap;
    }
    ExtraProduct product = extraProductService.selectByPrimaryKey(bill.getExtraProduct());
    // 根据产品所属的服务商,调用不同的服务商推送接口
    Long serviceInterfaceName = product.getServiceInterfaceName();
    if (null == serviceInterfaceName) {
        retMap.put("retMsg", "产品没有配置服务接口");
        return retMap;
    }
    if (bill.getBillStatus().equals(ComNames.EXTRA_BILL_STATUS_4)) {
        retMap.put("retMsg", "该订单服务商已经在审核中");
        return retMap;
    }
    boolean flag = false;
    if (serviceInterfaceName.equals(ComNames.SERVICE_INTERFACE_NAME_BWFPTPT)) {
        flag = baiWangService.submitOrder(bill);
    } else if (serviceInterfaceName.equals(ComNames.SERVICE_INTERFACE_NAME_SZYQQYDB)) {
        flag = SZYQService.submitBill(bill);
    } else {
        retMap.put("retMsg", "产品配置的服务接口类型错误,无法送审");
        return retMap;
    }
    if (flag) {
        retMap.put("retCode", 1);
        retMap.put("retMsg", "订单送审成功");
        return retMap;
    } else {
        retMap.put("retMsg", "推送订单失败,详情请查看管理员日志");
    }
    return retMap;
}
Also used : ExtraProduct(com.itrus.portal.db.ExtraProduct) HashMap(java.util.HashMap) ExtraBill(com.itrus.portal.db.ExtraBill) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 30 with ExtraBill

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

the class ExtraBillReviewController method queryAudit.

// TODO 单个订单查询送审结果
@RequestMapping("/queryAudit")
@ResponseBody
public synchronized Map<String, Object> queryAudit(@RequestParam(value = "billId", required = true) Long id) {
    Map<String, Object> retMap = new HashMap<>();
    retMap.put("retCode", 0);
    ExtraBill bill = extraBillService.selectByPrimaryKey(id);
    if (null == bill || !bill.getBillStatus().equals(ComNames.EXTRA_BILL_STATUS_4)) {
        retMap.put("retMsg", "订单不存在,或者订单状态不是审核中");
        return retMap;
    }
    ExtraProduct product = extraProductService.selectByPrimaryKey(bill.getExtraProduct());
    // 根据产品所属的服务商,调用不同的服务商查询
    Long serviceInterfaceName = product.getServiceInterfaceName();
    if (null == serviceInterfaceName) {
        retMap.put("retMsg", "产品没有配置服务接口");
        return retMap;
    }
    if (serviceInterfaceName.equals(ComNames.SERVICE_INTERFACE_NAME_BWFPTPT)) {
        bill = baiWangService.query(bill);
    } else if (serviceInterfaceName.equals(ComNames.SERVICE_INTERFACE_NAME_SZYQQYDB)) {
        bill = SZYQService.queryBills(bill);
    }
    if (bill.getBillStatus().equals(ComNames.EXTRA_BILL_STATUS_4)) {
        retMap.put("retMsg", "服务商审核中");
    } else if (bill.getBillStatus().equals(ComNames.EXTRA_BILL_STATUS_5)) {
        retMap.put("retMsg", "服务商审核拒绝");
    } else if (bill.getBillStatus().equals(ComNames.EXTRA_BILL_STATUS_6) || bill.getBillStatus().equals(ComNames.EXTRA_BILL_STATUS_7)) {
        retMap.put("retMsg", "服务商审核通过");
    }
    retMap.put("retCode", 1);
    return retMap;
}
Also used : ExtraProduct(com.itrus.portal.db.ExtraProduct) HashMap(java.util.HashMap) ExtraBill(com.itrus.portal.db.ExtraBill) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

ExtraBill (com.itrus.portal.db.ExtraBill)41 ExtraProduct (com.itrus.portal.db.ExtraProduct)25 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)24 HashMap (java.util.HashMap)22 Enterprise (com.itrus.portal.db.Enterprise)21 UserInfo (com.itrus.portal.db.UserInfo)20 HttpSession (javax.servlet.http.HttpSession)12 ExtraProductSpec (com.itrus.portal.db.ExtraProductSpec)11 OpenBankInfo (com.itrus.portal.db.OpenBankInfo)11 Date (java.util.Date)11 Map (java.util.Map)11 TransactionStatus (org.springframework.transaction.TransactionStatus)11 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)11 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)11 BusinessLicense (com.itrus.portal.db.BusinessLicense)10 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)10 ExtraBillExample (com.itrus.portal.db.ExtraBillExample)9 IdentityCard (com.itrus.portal.db.IdentityCard)9 OnPayInfo (com.itrus.portal.db.OnPayInfo)9 ArrayList (java.util.ArrayList)9