Search in sources :

Example 91 with UserInfo

use of com.itrus.portal.db.UserInfo 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 92 with UserInfo

use of com.itrus.portal.db.UserInfo 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 93 with UserInfo

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

the class ExtraBillServiceImpl method getUserInfoMapByEnterpriseId.

/**
 * 根据企业id查询企业的所有代理人Map
 *
 * @param enterprise
 * @return
 */
public Map<Long, UserInfo> getUserInfoMapByEnterpriseId(Long enterprise) {
    Map<Long, UserInfo> enterpriseMap = new HashMap<Long, UserInfo>();
    List<Long> userInfoIds = sqlSession.selectList("com.itrus.portal.db.ExtraBillMapper.selectUserInfosByEnterprise", enterprise);
    if (null != userInfoIds && !userInfoIds.isEmpty()) {
        UserInfoExample example = new UserInfoExample();
        UserInfoExample.Criteria criteria = example.or();
        criteria.andIdIn(userInfoIds);
        enterpriseMap = sqlSession.selectMap("com.itrus.portal.db.UserInfoMapper.selectByExample", example, "id");
    }
    return enterpriseMap;
}
Also used : UserInfoExample(com.itrus.portal.db.UserInfoExample) HashMap(java.util.HashMap) UserInfo(com.itrus.portal.db.UserInfo)

Example 94 with UserInfo

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

the class BillServiceImpl method getUserInfoMapByEnterpriseId.

/**
 * 根据企业id查询企业的所有代理人Map
 *
 * @param enterprise
 * @return
 */
public Map<Long, UserInfo> getUserInfoMapByEnterpriseId(Long enterprise) {
    Map<Long, UserInfo> enterpriseMap = new HashMap<Long, UserInfo>();
    List<Long> userInfoIds = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectUserInfosByEnterprise", enterprise);
    if (null != userInfoIds && !userInfoIds.isEmpty()) {
        UserInfoExample example = new UserInfoExample();
        UserInfoExample.Criteria criteria = example.or();
        criteria.andIdIn(userInfoIds);
        enterpriseMap = sqlSession.selectMap("com.itrus.portal.db.UserInfoMapper.selectByExample", example, "id");
    }
    return enterpriseMap;
}
Also used : UserInfoExample(com.itrus.portal.db.UserInfoExample) HashMap(java.util.HashMap) UserInfo(com.itrus.portal.db.UserInfo)

Example 95 with UserInfo

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

the class SendReNewInfoTask method sendReNewInfo.

/**
 * 心跳更新。启动时执行一次,之后每隔24小时执行一次
 */
@Scheduled(fixedRate = 1000 * 60 * 60 * 24)
public void sendReNewInfo() {
    // 筛选出所有是待更新的,而且未发送短信的订单
    BillExample billExample = new BillExample();
    BillExample.Criteria criteria = billExample.or();
    // 订单状态是12的时候,表示是待更新的订单
    criteria.andBillStatusEqualTo(ComNames.BILL_STATUS_12);
    // 订单的短信发送时间是Null的时候,表示未发送过通知短信
    criteria.andRenewSendTimeIsNull();
    criteria.andIsDeleteEqualTo(false);
    // billExample.setLimit(100);
    List<Bill> bills = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectByExample", billExample);
    if (null == bills || bills.size() < 1) {
        return;
    }
    String billSn = "";
    String mPhone = "";
    try {
        // 向每个订单发送短信通知
        for (int i = 0; i < bills.size(); i++) {
            billSn = bills.get(i).getBillId();
            UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bills.get(i).getUniqueId());
            mPhone = userInfo.getmPhone();
            UserCertExample userCertExample = new UserCertExample();
            UserCertExample.Criteria ucriteria = userCertExample.or();
            ucriteria.andIdEqualTo(bills.get(i).getOldUserCert());
            UserCert userCert = sqlSession.selectOne("com.itrus.portal.db.UserCertMapper.selectByExample", userCertExample);
            Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bills.get(i).getEnterprise());
            Long projectId = bills.get(i).getProject();
            String keySn = "";
            if (null == userCert.getKeySn()) {
                keySn = "该证书未绑定key";
            } else {
                keySn = userCert.getKeySn();
            }
            String enterpriseName = enterprise.getEnterpriseName();
            Date endTime = userCert.getCertEndTime();
            // 获取订单对应的产品信息
            Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bills.get(i).getProduct());
            String productName = product.getName();
            try {
                makeCerServiceImpl.sendReNewInfo(bills.get(i), mPhone, projectId, "ZSGX", keySn, enterpriseName, endTime, productName);
            } catch (UserInfoServiceException e) {
                String type = "发送证书更新通知失败";
                String info = "用户手机号:" + mPhone + ",订单号" + bills.get(i).getBillId() + "错误信息:" + e.getMessage();
                LogUtil.syslog(sqlSession, type, info);
                log.error("ERRORLOG证书更新通知 {}", info);
                return;
            } catch (Exception e) {
                String type = "发送证书更新通知失败";
                String info = "用户手机号:" + mPhone + ",订单号" + bills.get(i).getBillId() + "错误信息:" + e.getMessage();
                LogUtil.syslog(sqlSession, type, info);
                log.error("ERRORLOG证书更新通知 {}", info);
                return;
            }
        }
    } catch (Exception e) {
        String type = "发送证书更新通知失败";
        String info = "用户手机号:" + mPhone + ",订单号" + billSn + "错误信息:" + e.getMessage();
        LogUtil.syslog(sqlSession, type, info);
        log.error("ERRORLOG证书更新通知 {}", info);
        return;
    }
}
Also used : UserCertExample(com.itrus.portal.db.UserCertExample) Product(com.itrus.portal.db.Product) UserInfo(com.itrus.portal.db.UserInfo) Date(java.util.Date) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) BillExample(com.itrus.portal.db.BillExample) Bill(com.itrus.portal.db.Bill) Enterprise(com.itrus.portal.db.Enterprise) UserCert(com.itrus.portal.db.UserCert) Scheduled(org.springframework.scheduling.annotation.Scheduled)

Aggregations

UserInfo (com.itrus.portal.db.UserInfo)99 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)79 Enterprise (com.itrus.portal.db.Enterprise)68 HashMap (java.util.HashMap)52 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)40 IOException (java.io.IOException)39 HttpSession (javax.servlet.http.HttpSession)37 Bill (com.itrus.portal.db.Bill)31 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)31 Product (com.itrus.portal.db.Product)26 ExtraProduct (com.itrus.portal.db.ExtraProduct)24 Project (com.itrus.portal.db.Project)24 UserCert (com.itrus.portal.db.UserCert)24 BusinessLicense (com.itrus.portal.db.BusinessLicense)21 ExtraBill (com.itrus.portal.db.ExtraBill)20 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)20 UserLog (com.itrus.portal.db.UserLog)20 IdentityCard (com.itrus.portal.db.IdentityCard)19 OrgCode (com.itrus.portal.db.OrgCode)19 UserinfoEnterprise (com.itrus.portal.db.UserinfoEnterprise)19