Search in sources :

Example 6 with BusinessLicense

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

the class MakeCertController method push.

/**
 * 手动推送
 *
 * @param id
 * @param uiModel
 * @return
 */
@RequestMapping(value = "/{id}/{type}", method = RequestMethod.GET, produces = "text/html")
@ResponseBody
public String push(@PathVariable("id") Long id, @PathVariable("type") Long type, Model uiModel) {
    SignatureConfig sc = null;
    JSONObject data = null;
    JSONObject org = null;
    JSONObject result = null;
    Bill bill = null;
    /*if(type==1){
			try {
				bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", id);
				log.error("bill.getMcstatus()="+bill.getMcstatus()+"bill="+bill);
				if(null == bill) {
					//log.error(bill.getMcstatus()+"---------------------------------------------"+bill);
					//System.out.println(bill.getMcstatus()+"=******************************="+bill);
					return "该订单无法推送";
				}
				Product product = productService.getProductById(bill.getProduct());
				sc = sqlSession.selectOne("com.itrus.portal.db.SignatureConfigMapper.selectByPrimaryKey",
						product.getSignature());
				Enterprise enterprise = enterpriseService.getEnterpriseByBillId(id);
				BusinessLicense bl = businessService.getBusinessByBillId((id), null);
				if (org == null) {
					org = new JSONObject();
					
				}
				org.put("userType", 1);
				org.put("fullName", bl.getEnterpriseName());
				if (bl != null && bl.getBusinessType() == 1) {
					org.put("orgCode", bl.getLicenseNo());
				} else {
					TaxRegisterCert tc = taxCertService.getTaxRegisterCertByBillId((id), null);
					org.put("orgCode", tc == null ? "" : tc.getCertNo());
				}
				org.put("papersType", "营业执照");
				UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey",
						bill.getUniqueId());
				org.put("businessNum", userInfo.getTelephone());
				// IdentityCard ic =
				// identityCardService.getIdentityCardByBillId(Long.parseLong(String.valueOf(map.get("id"))),
				// null);
				org.put("legalPersonName", bl == null ? "" : bl.getLegalPerson());
				Agent agent = agentService.getAgentByBillId((id), null);
				org.put("transactorName", agent == null ? enterprise.getEnterpriseName() : agent.getName());
				if (agent != null && agent.getCardType() == 1) {
					org.put("transactorIdCardNum", agent.getIdCode());
				}
				org.put("transactorMobile", userInfo.getmPhone());
				org.put("realInfoOrder", bill.getBillId());
				org.put("realInfoUid", bill.getUniqueId());
				if (data == null) {
					data = new JSONObject();
				}
				data.put("appId", sc.getAppId());
				data.put("timestamp", System.currentTimeMillis());
				data.put("user", org);
				data.put("autoCert", true);
				data.put("autoSeal", true);
				// String content =
				// "{\"autoCert\":true,\"timestamp\":1472105170418,\"apiId\":\"test\",\"autoSeal\":true,\"user\":{\"transactorIdCardNum\":\"120102198904025625\",\"transactorMobile\":\"15822452770\",\"orgCode\":\"120116328553325\",\"papersType\":\"营销执照\",\"businessNum\":\"022-88956296\",\"realInfoUid\":\"151\",\"fullName\":\"天津瑞普生物技术股份有限公司空港经济区分公司\",\"legalPersonName\":\"刘建\",\"transactorName\":\"李洋\",\"realInfoOrder\":\"TWCX20160824170928580820\",\"userType\":1}}";
				// bill =
				// sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey",
				// map.get("id"));
				if (bill.getMcstatus() != null && bill.getMcstatus() == 1) {
					// return "redirect:/makecert";
					return null;
				}
				log.error("打印data="+data.toString());
				
				log.error("----------接口地址**************"+sc.getAddress() + USER_URL+"***********服务密钥**********"+sc.getAddressKey());
				result = JSONObject
						.parseObject(RequestUtils.post(sc.getAddress() + USER_URL, data.toString(), sc.getAddressKey()));
				log.equals("MakeCert_push_result : " + result);
				if (result.getBoolean("isOK") && result.getIntValue("code") == 0) {
					LogUtil.syslog(sqlSession, "手动推送用户", bill.getBillId() + "企业名称:" + bl.getEnterpriseName());
					bill.setMcstatus(1);
					bill.setBillStatus(8);
					sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKey", bill);
					sqlSession.flushStatements();
					// return "redirect:/makecert";
					return null;
				}
				LogUtil.syslog(sqlSession, "手动推送用户",
						bill.getBillId() + "企业名称:" + enterprise.getEnterpriseName() + "错误:" + result.getString("message"));
				// uiModel.addAttribute("error", "错误:" +
				// result.getString("message"));
			} catch (Exception e) {
				// TODO: handle exception
				e.printStackTrace();
				// uiModel.addAttribute("error", "错误:" + e);
				return "错误【" + e + "】";
			}
		}else */
    if (type == 1) {
        try {
            bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", id);
            log.error("bill.getMcstatus()=" + bill.getMcstatus() + "bill=" + bill);
            if (null == bill) {
                // System.out.println(bill.getMcstatus()+"=******************************="+bill);
                return "该订单无法推送";
            }
            Product product = productService.getProductById(bill.getProduct());
            sc = sqlSession.selectOne("com.itrus.portal.db.SignatureConfigMapper.selectByPrimaryKey", product.getSignature());
            Enterprise enterprise = enterpriseService.getEnterpriseByBillId(id);
            BusinessLicense bl = businessService.getBusinessByBillId((id), null);
            if (org == null) {
                org = new JSONObject();
            }
            org.put("userType", 1);
            org.put("fullName", bl.getEnterpriseName());
            if (bl != null && bl.getBusinessType() == 1) {
                org.put("orgCode", bl.getLicenseNo());
            } else {
                TaxRegisterCert tc = taxCertService.getTaxRegisterCertByBillId((id), null);
                org.put("orgCode", tc == null ? "orgCode" : tc.getCertNo());
            }
            org.put("papersType", "营业执照");
            UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bill.getUniqueId());
            org.put("businessNum", userInfo.getTelephone() == null ? "businessNum" : userInfo.getTelephone());
            // null);
            if (bl != null) {
                org.put("legalPersonName", bl.getLegalPerson() == null ? "legalPersonName" : bl.getLegalPerson());
            } else {
                org.put("legalPersonName", "legalPersonName");
            }
            Agent agent = agentService.getAgentByBillId((id), null);
            org.put("transactorName", agent == null ? "transactorName" : agent.getName());
            if (agent != null && agent.getCardType() == 1) {
                org.put("transactorIdCardNum", agent.getIdCode());
            } else {
                org.put("transactorIdCardNum", "transactorIdCardNum");
            }
            org.put("transactorMobile", userInfo.getmPhone());
            org.put("realInfoOrder", bill.getBillId());
            org.put("realInfoUid", bill.getUniqueId());
            if (data == null) {
                data = getJSONRequest(sc.getAppId());
            }
            data.put("autoCert", true);
            data.put("autoSeal", true);
            // data.put("appId", sc.getAppId());
            // data.put("timestamp", System.currentTimeMillis());
            data.put("user", org);
            // String content =
            // "{\"autoCert\":true,\"timestamp\":1472105170418,\"apiId\":\"test\",\"autoSeal\":true,\"user\":{\"transactorIdCardNum\":\"120102198904025625\",\"transactorMobile\":\"15822452770\",\"orgCode\":\"120116328553325\",\"papersType\":\"营销执照\",\"businessNum\":\"022-88956296\",\"realInfoUid\":\"151\",\"fullName\":\"天津瑞普生物技术股份有限公司空港经济区分公司\",\"legalPersonName\":\"刘建\",\"transactorName\":\"李洋\",\"realInfoOrder\":\"TWCX20160824170928580820\",\"userType\":1}}";
            // bill =
            // sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey",
            // map.get("id"));
            /*if (bill.getMcstatus() != null && bill.getMcstatus() == 1) {
					// return "redirect:/makecert";
					return null;
				}*/
            log.error("打印data=" + data.toString());
            log.error("----------接口地址**************" + sc.getAddress() + USER_URL + "***********服务密钥**********" + sc.getAddressKey());
            result = JSONObject.parseObject(RequestUtils.post(sc.getAddress() + USER_URL, data.toString(), sc.getAddressKey()));
            log.equals("MakeCert_push_result : " + result);
            if (result.getBoolean("isOK") && result.getIntValue("code") == 0) {
                LogUtil.syslog(sqlSession, "手动推送用户", bill.getBillId() + "企业名称:" + bl.getEnterpriseName());
                bill.setMcstatus(1);
                bill.setBillStatus(8);
                sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKey", bill);
                sqlSession.flushStatements();
                // return "redirect:/makecert";
                return null;
            }
            LogUtil.syslog(sqlSession, "手动推送用户", bill.getBillId() + "企业名称:" + enterprise.getEnterpriseName() + "错误:" + result.getString("message"));
        // uiModel.addAttribute("error", "错误:" +
        // result.getString("message"));
        } catch (Exception e) {
            // TODO: handle exception
            e.printStackTrace();
            // uiModel.addAttribute("error", "错误:" + e);
            return "错误【" + e + "】";
        }
    } else {
        try {
            bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", id);
            log.error("bill.getMcstatus()=" + bill.getMcstatus() + "bill=" + bill);
            if (null == bill) {
                // System.out.println(bill.getMcstatus()+"=******************************="+bill);
                return "该订单无法推送";
            }
            Product product = productService.getProductById(bill.getProduct());
            sc = sqlSession.selectOne("com.itrus.portal.db.SignatureConfigMapper.selectByPrimaryKey", product.getSignature());
            Enterprise enterprise = enterpriseService.getEnterpriseByBillId(id);
            BusinessLicense bl = businessService.getBusinessByBillId((id), null);
            /*if (org == null) {
					org = new JSONObject();
				}
				org.put("userType", 1);
				org.put("fullName", bl.getEnterpriseName());
				if (bl != null && bl.getBusinessType() == 1) {
					org.put("orgCode", bl.getLicenseNo());
				} else {
					TaxRegisterCert tc = taxCertService.getTaxRegisterCertByBillId((id), null);
					org.put("orgCode", tc == null ? "" : tc.getCertNo());
				}
				org.put("papersType", "营业执照");*/
            UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bill.getUniqueId());
            // org.put("businessNum", userInfo.getTelephone());
            // IdentityCard ic =
            // identityCardService.getIdentityCardByBillId(Long.parseLong(String.valueOf(map.get("id"))),
            // null);
            // org.put("legalPersonName", bl == null ? "" : bl.getLegalPerson());
            Agent agent = agentService.getAgentByBillId((id), null);
            /*org.put("transactorName", agent == null ? "" : agent.getName());
				if (agent != null && agent.getCardType() == 1) {
					org.put("transactorIdCardNum", agent.getIdCode());
				}
				org.put("transactorMobile", userInfo.getmPhone());
				org.put("realInfoOrder", bill.getBillId());
				org.put("realInfoUid", bill.getUniqueId());*/
            if (data == null) {
                data = new JSONObject();
            }
            Map<String, Object> treeMap = Maps.newTreeMap();
            treeMap.put("app_id", sc.getAppId());
            treeMap.put("order_number", bill.getBillId());
            treeMap.put("user_name", enterprise.getEnterpriseName());
            treeMap.put("user_email", userInfo.getEmail());
            treeMap.put("user_phone", userInfo.getmPhone());
            treeMap.put("user_type", "organization");
            /*String cardType = null;
				if(agent!=null && agent.getCardType()!=null){
					if(agent.getCardType()==1){
						cardType = "IdentityCard";
					}else if(agent.getCardType()==2){
						cardType = "NationalPassport";
					}else{
						cardType = "Other";
					}
					treeMap.put("identification_number",agent.getIdCode());
				}
				*/
            String cardType = null;
            String sn = null;
            BusinessLicense businessLicense = businessService.getBusinessByBillId(bill.getId(), null);
            if (businessLicense != null && businessLicense.getBusinessType() == 1) {
                sn = businessLicense.getLicenseNo();
                cardType = "UniformSocialCreditCode";
            }
            if (businessLicense == null || businessLicense.getBusinessType() != 1) {
                // 不是五证合一
                OrgCode oc = orgCodeService.getOrgCodeByBillId(bill.getId(), null);
                if (oc != null) {
                    sn = oc.getOrgCode();
                    cardType = "OrganizationCode";
                }
            }
            treeMap.put("identification_number", sn);
            treeMap.put("identity_type", cardType);
            String jsondata = JSONObject.toJSONString(treeMap);
            String data1 = mapToQueryString(treeMap);
            log.error(data1);
            result = JSONObject.parseObject(RequestUtils.post1(sc.getAddress(), jsondata.toString(), data1, sc.getAddressKey(), "HMAC-SHA256"));
            log.equals("MakeCert_push_result : " + result);
            if (result.getString("code") != null && "SUCCESS".equals(result.getString("code").toString())) {
                LogUtil.syslog(sqlSession, "手动推送用户", bill.getBillId() + "企业名称:" + bl.getEnterpriseName());
                bill.setMcstatus(1);
                bill.setBillStatus(8);
                sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKey", bill);
                sqlSession.flushStatements();
                // return "redirect:/makecert";
                return null;
            }
            LogUtil.syslog(sqlSession, "手动推送用户", bill.getBillId() + "企业名称:" + enterprise.getEnterpriseName() + "错误:" + result.getString("message"));
        // uiModel.addAttribute("error", "错误:" +
        // result.getString("message"));
        } catch (Exception e) {
            // TODO: handle exception
            e.printStackTrace();
            // uiModel.addAttribute("error", "错误:" + e);
            return "错误【" + e + "】";
        }
    }
    return "错误【" + result.getString("message") + "】";
}
Also used : Agent(com.itrus.portal.db.Agent) SignatureConfig(com.itrus.portal.db.SignatureConfig) Product(com.itrus.portal.db.Product) UserInfo(com.itrus.portal.db.UserInfo) EncDecException(com.itrus.portal.exception.EncDecException) IOException(java.io.IOException) RaServiceUnavailable_Exception(cn.topca.tca.ra.service.RaServiceUnavailable_Exception) OrgCode(com.itrus.portal.db.OrgCode) BusinessLicense(com.itrus.portal.db.BusinessLicense) JSONObject(com.alibaba.fastjson.JSONObject) Bill(com.itrus.portal.db.Bill) Enterprise(com.itrus.portal.db.Enterprise) JSONObject(com.alibaba.fastjson.JSONObject) TaxRegisterCert(com.itrus.portal.db.TaxRegisterCert) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 7 with BusinessLicense

use of com.itrus.portal.db.BusinessLicense 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";
}
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) OnlinePay(com.itrus.portal.db.OnlinePay) IdentityCard(com.itrus.portal.db.IdentityCard) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 8 with BusinessLicense

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

the class EnterpriseController method updateEnterprise.

/**
 * 修改企业
 *
 * @param id
 * @return
 */
@RequestMapping(value = "/updateEnterprise/{eid}", method = RequestMethod.POST)
public String updateEnterprise(@PathVariable(value = "eid") Long id, Enterprise enterprise) {
    Enterprise old_enterprise = enterpriseService.getEnterpriseById(id);
    if (null == enterprise) {
        return "uncaughtException";
    }
    String oldEnterpriseSn = old_enterprise.getEnterpriseSn();
    // 修改企业信息
    try {
        enterpriseService.updateEnterprise(enterprise);
        // 修改该企业关联的营业执照信息中的企业名称
        List<BusinessLicense> bus = businessService.getBusinessLicenses(id);
        businessService.updateBus(bus, enterprise);
        // 记录管理员日志
        LogUtil.adminlog(sqlSession, "修改企业", "企业名称由" + old_enterprise.getEnterpriseName() + "修改为" + enterprise.getEnterpriseName() + ",企业唯一标识由" + old_enterprise.getEnterpriseSn() + "修改为" + enterprise.getEnterpriseSn());
    } catch (Exception e) {
        e.printStackTrace();
        return "uncaughtException";
    }
    // 复制修改前的图片到新的文件夹中(旧目录为空不会复制)
    if (!oldEnterpriseSn.equals(enterprise.getEnterpriseSn())) {
        try {
            CopyFile.copyFile(systemConfigService.getTrustDir().getPath() + File.separator + oldEnterpriseSn, systemConfigService.getTrustDir().getPath() + File.separator + enterprise.getEnterpriseSn());
        } catch (Exception e) {
            e.printStackTrace();
            return "uncaughtException";
        }
    }
    return "redirect:/enterpriseinfo/updateEnterpriseUI/" + id;
}
Also used : BusinessLicense(com.itrus.portal.db.BusinessLicense) Enterprise(com.itrus.portal.db.Enterprise) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 9 with BusinessLicense

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

the class EnterpriseController method detail.

@RequestMapping("/detail")
public String detail(@RequestParam(value = "id", required = true) Long id, @RequestParam(value = "item", required = false) Integer item, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
    Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", id);
    if (null == enterprise) {
        return "status403";
    }
    uiModel.addAttribute("enterprise", enterprise);
    if (page == null || page < 1) {
        page = 1;
    }
    if (size == null || size < 1) {
        size = 10;
    }
    // 总记录数
    Integer count = 0;
    // 当前页记录数
    Integer itemcount = 0;
    // ===0认证信息、1关联用户、2订单列表
    if (null == item || 0 == item) {
        item = 0;
        // 认证信息
        BusinessLicense businessLicense = null;
        OrgCode orgCode = null;
        TaxRegisterCert taxRegisterCert = null;
        IdentityCard identityCard = null;
        if (null != enterprise.getAuthenticationLevel()) {
            // 审核通过:
            // 获取企业的认证等级
            Certification certification = sqlSession.selectOne("com.itrus.portal.db.CertificationMapper.selectByPrimaryKey", enterprise.getAuthenticationLevel());
            uiModel.addAttribute("certification", certification);
        }
        if (null != enterprise.getHasBl()) {
            businessLicense = sqlSession.selectOne("com.itrus.portal.db.BusinessLicenseMapper.selectByPrimaryKey", enterprise.getHasBl());
        }
        if (null != enterprise.getHasOrgCode()) {
            orgCode = sqlSession.selectOne("com.itrus.portal.db.OrgCodeMapper.selectByPrimaryKey", enterprise.getHasOrgCode());
        }
        if (null != enterprise.getHasTaxCert()) {
            taxRegisterCert = sqlSession.selectOne("com.itrus.portal.db.TaxRegisterCertMapper.selectByPrimaryKey", enterprise.getHasTaxCert());
        }
        if (null != enterprise.getHasIdCard()) {
            identityCard = sqlSession.selectOne("com.itrus.portal.db.IdentityCardMapper.selectByPrimaryKey", enterprise.getHasIdCard());
        }
        uiModel.addAttribute("businessLicense", businessLicense);
        uiModel.addAttribute("orgCode", orgCode);
        uiModel.addAttribute("taxRegisterCert", taxRegisterCert);
        uiModel.addAttribute("identityCard", identityCard);
        // 查询增值订单中开户行信息
        OpenBankInfoExample obie = new OpenBankInfoExample();
        Criteria obiec = obie.createCriteria();
        obiec.andEnterpriseEqualTo(enterprise.getId());
        obie.setOrderByClause("create_time desc");
        List<OpenBankInfo> openBankInfos = sqlSession.selectList("com.itrus.portal.db.OpenBankInfoMapper.selectByExample", obie);
        if (openBankInfos != null && openBankInfos.size() > 0) {
            uiModel.addAttribute("openBankInfos", openBankInfos);
        }
    } else if (1 == item) {
        item = 1;
        // 关联用户
        List<UserInfo> userInfos = new ArrayList<UserInfo>();
        List<Long> userInfoIds = userInfoEnterpriseService.getUserInfoByEnterprise(enterprise.getId());
        if (null != userInfoIds && !userInfoIds.isEmpty()) {
            count = userInfoIds.size();
            UserInfoExample userInfoExample = new UserInfoExample();
            UserInfoExample.Criteria criteria = userInfoExample.or();
            criteria.andIdIn(userInfoIds);
            if (page > 1 && size * (page - 1) >= count) {
                page = (count + size - 1) / size;
            }
            Integer offset = size * (page - 1);
            userInfoExample.setOffset(offset);
            userInfoExample.setLimit(size);
            userInfoExample.setOrderByClause("create_time desc");
            userInfos = sqlSession.selectList("com.itrus.portal.db.UserInfoMapper.selectByExample", userInfoExample);
        }
        itemcount = userInfos.size();
        uiModel.addAttribute("userInfos", userInfos);
    } else if (2 == item) {
        item = 2;
        // 订单列表
        BillExample billExample = new BillExample();
        BillExample.Criteria criteria = billExample.or();
        criteria.andEnterpriseEqualTo(enterprise.getId());
        criteria.andIsDeleteEqualTo(false);
        count = sqlSession.selectOne("com.itrus.portal.db.BillMapper.countByExample", billExample);
        if (page > 1 && size * (page - 1) >= count) {
            page = (count + size - 1) / size;
        }
        Integer offset = size * (page - 1);
        billExample.setOffset(offset);
        billExample.setLimit(size);
        billExample.setOrderByClause("create_time desc");
        List<Bill> billList = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectByExample", billExample);
        itemcount = billList.size();
        uiModel.addAttribute("billList", billList);
        Map<Long, Project> projectMap = billService.getProjectMapByEnterpriseId(enterprise.getId());
        uiModel.addAttribute("projectMap", projectMap);
        Map<Long, Product> productMap = billService.getProductMapByEnterpriseId(enterprise.getId());
        uiModel.addAttribute("productMap", productMap);
        Map<Long, UserInfo> userInfoMap = billService.getUserInfoMapByEnterpriseId(enterprise.getId());
        uiModel.addAttribute("userInfoMap", userInfoMap);
    } else if (3 == item) {
        item = 3;
        // 增值订单列表
        ExtraBillExample extraBillExample = new ExtraBillExample();
        ExtraBillExample.Criteria criteria = extraBillExample.or();
        criteria.andEnterpriseEqualTo(enterprise.getId());
        criteria.andIsDeleteEqualTo(false);
        count = sqlSession.selectOne("com.itrus.portal.db.ExtraBillMapper.countByExample", extraBillExample);
        if (page > 1 && size * (page - 1) >= count) {
            page = (count + size - 1) / size;
        }
        Integer offset = size * (page - 1);
        extraBillExample.setOffset(offset);
        extraBillExample.setLimit(size);
        extraBillExample.setOrderByClause("create_time desc");
        List<ExtraBill> extraBillList = sqlSession.selectList("com.itrus.portal.db.ExtraBillMapper.selectByExample", extraBillExample);
        itemcount = extraBillList.size();
        uiModel.addAttribute("billList", extraBillList);
        Map<Long, Project> projectMap = extraBillService.getProjectMapByEnterpriseId(enterprise.getId());
        uiModel.addAttribute("projectMap", projectMap);
        Map<Long, ExtraProduct> productMap = extraBillService.getProductMapByEnterpriseId(enterprise.getId());
        uiModel.addAttribute("productMap", productMap);
        Map<Long, UserInfo> userInfoMap = extraBillService.getUserInfoMapByEnterpriseId(enterprise.getId());
        uiModel.addAttribute("userInfoMap", userInfoMap);
    }
    uiModel.addAttribute("count", count);
    uiModel.addAttribute("pages", (count + size - 1) / size);
    uiModel.addAttribute("page", page);
    uiModel.addAttribute("size", size);
    uiModel.addAttribute("itemcount", itemcount);
    uiModel.addAttribute("item", item);
    return "enterprise/detail";
}
Also used : Product(com.itrus.portal.db.Product) ExtraProduct(com.itrus.portal.db.ExtraProduct) UserInfo(com.itrus.portal.db.UserInfo) Criteria(com.itrus.portal.db.OpenBankInfoExample.Criteria) OpenBankInfo(com.itrus.portal.db.OpenBankInfo) BillExample(com.itrus.portal.db.BillExample) ExtraBillExample(com.itrus.portal.db.ExtraBillExample) ArrayList(java.util.ArrayList) List(java.util.List) IdentityCard(com.itrus.portal.db.IdentityCard) UserInfoExample(com.itrus.portal.db.UserInfoExample) Certification(com.itrus.portal.db.Certification) ExtraBillExample(com.itrus.portal.db.ExtraBillExample) OrgCode(com.itrus.portal.db.OrgCode) Project(com.itrus.portal.db.Project) BusinessLicense(com.itrus.portal.db.BusinessLicense) Enterprise(com.itrus.portal.db.Enterprise) ExtraBill(com.itrus.portal.db.ExtraBill) Bill(com.itrus.portal.db.Bill) OpenBankInfoExample(com.itrus.portal.db.OpenBankInfoExample) HashMap(java.util.HashMap) Map(java.util.Map) TaxRegisterCert(com.itrus.portal.db.TaxRegisterCert) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 10 with BusinessLicense

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

the class ExtraBillPayController method show.

// 显示详情
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel, @RequestParam(value = "payStatus", required = false) Integer payStatus) {
    uiModel.addAttribute("payStatus", payStatus);
    // 管理员项目权限
    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);
    if (onPayInfo != null && onPayInfo.getOnlinePay() != 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);
    // 其他附加信息
    // 营业执照
    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 "extrabillpay/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) OnlinePay(com.itrus.portal.db.OnlinePay) IdentityCard(com.itrus.portal.db.IdentityCard) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

BusinessLicense (com.itrus.portal.db.BusinessLicense)43 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)30 Enterprise (com.itrus.portal.db.Enterprise)26 OrgCode (com.itrus.portal.db.OrgCode)25 IdentityCard (com.itrus.portal.db.IdentityCard)24 UserInfo (com.itrus.portal.db.UserInfo)21 Agent (com.itrus.portal.db.Agent)20 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)16 HashMap (java.util.HashMap)14 OpenBankInfo (com.itrus.portal.db.OpenBankInfo)13 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)13 ExtraProduct (com.itrus.portal.db.ExtraProduct)12 Proxy (com.itrus.portal.db.Proxy)11 ExtraBill (com.itrus.portal.db.ExtraBill)10 File (java.io.File)10 Date (java.util.Date)10 ArrayList (java.util.ArrayList)9 TransactionStatus (org.springframework.transaction.TransactionStatus)9 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)9 Product (com.itrus.portal.db.Product)8