Search in sources :

Example 26 with ExtraProduct

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

the class BaiWangEmailServiceImpl method sendEmailToUser.

public Map<String, Object> sendEmailToUser(ExtraBill bill) throws MessagingException, Exception {
    Map<String, Object> retMap = new HashMap<>();
    retMap.put("retCode", 0);
    Project project = projectService.selectByPrimaryKey(bill.getProject());
    ExtraProduct product = extraProductService.selectByPrimaryKey(bill.getExtraProduct());
    UserInfo userInfo = userInfoService.getUserInfoById(bill.getUniqueId());
    if (StringUtils.isBlank(userInfo.getEmail())) {
        retMap.put("retMsg", "尚未登记邮箱,请登记邮箱并验证");
        return retMap;
    }
    if (null == userInfo.getTrustEmail() || userInfo.getTrustEmail().equals(false)) {
        retMap.put("retMsg", "您的邮箱尚未通过验证,请验证通过后再处理");
        return retMap;
    }
    Enterprise enterprise = enterpriseService.getEnterpriseById(bill.getEnterprise());
    MailTemplate mailTemplate = mailTemplateService.getMailTemplatesByProjectIdAndType(bill.getProject(), ComNames.MAIL_TEMPLATE_BWDJTZ);
    if (null == mailTemplate) {
        retMap.put("retMsg", "服务端出现未知错误,请联系系统管理员,错误代码:bwtz001");
        LogUtil.syslog(sqlSession, "邮件模版异常", "项目:" + bill.getProject() + ", 未配置百望单机通知邮件模版");
        return retMap;
    }
    // 给订单对应的用户发送邮件信息
    String[] mailOfUser = new String[] { userInfo.getEmail() };
    Map<String, File> proxyMap = new HashMap<String, File>();
    String instructions = product.getInstructions();
    File filePath = extraProductService.getFilePathById(product.getId());
    if (!filePath.exists()) {
        filePath.mkdir();
    }
    File file = new File(filePath, instructions);
    proxyMap.put("单机版开票软件操作指南.fdf", file);
    String subject = mailTemplate.getName().replace("projectname", project.getName()).replace("productname", product.getAppName());
    Bwdjrecord bwdjrecord = bwdjRecordService.getBwdjrecordByExtraBillId(bill.getId());
    String content = mailTemplate.getContent().replace("downloadurl", bwdjrecord.getDownLoadUrl());
    sendEmailService.sendEmail(content, mailOfUser, subject, false, proxyMap);
    retMap.put("retCode", 1);
    return retMap;
}
Also used : Bwdjrecord(com.itrus.portal.db.Bwdjrecord) HashMap(java.util.HashMap) UserInfo(com.itrus.portal.db.UserInfo) Project(com.itrus.portal.db.Project) ExtraProduct(com.itrus.portal.db.ExtraProduct) Enterprise(com.itrus.portal.db.Enterprise) MailTemplate(com.itrus.portal.db.MailTemplate) File(java.io.File)

Example 27 with ExtraProduct

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

the class ExtraBillServiceImpl method getExtraProductMapByUserInfoId.

/**
 * 根据用户id查询订单表中对应的产品Map
 *
 * @param userInfo
 * @return
 * @throws Exception
 */
public Map<Long, ExtraProduct> getExtraProductMapByUserInfoId(Long userInfo) throws Exception {
    Map<Long, ExtraProduct> productMap = new HashMap<Long, ExtraProduct>();
    List<Long> productIds = sqlSession.selectList("com.itrus.portal.db.ExtraBillMapper.selectExraProductsByUserInfo", userInfo);
    if (null != productIds && !productIds.isEmpty()) {
        ExtraProductExample example = new ExtraProductExample();
        ExtraProductExample.Criteria criteria = example.or();
        criteria.andIdIn(productIds);
        productMap = extraProductService.selectMapByExample(example);
    }
    return productMap;
}
Also used : ExtraProduct(com.itrus.portal.db.ExtraProduct) HashMap(java.util.HashMap) ExtraProductExample(com.itrus.portal.db.ExtraProductExample)

Example 28 with ExtraProduct

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

the class ExtraProductServiceImpl method getProductsByServiceProviderId.

/**
 * 根据服务商id,获取服务商下面的产品
 * @param serviceProviderId
 * @return
 * @throws Exception
 */
public List<ExtraProduct> getProductsByServiceProviderId(Long serviceProviderId) throws Exception {
    List<ExtraProduct> extraProducts = new ArrayList<>();
    ExtraProductExample example = new ExtraProductExample();
    ExtraProductExample.Criteria criteria = example.or();
    criteria.andServiceProviderEqualTo(serviceProviderId);
    extraProducts = selectByExample(example);
    return extraProducts;
}
Also used : ExtraProduct(com.itrus.portal.db.ExtraProduct) ArrayList(java.util.ArrayList) ExtraProductExample(com.itrus.portal.db.ExtraProductExample)

Example 29 with ExtraProduct

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

the class ExtraProductServiceImpl method getExtraProductBySIN.

/**
 * 根据服务商接口标识,返回对应的增值产品
 * @param serviceInterfaceName
 * @return
 * @throws Exception
 */
public List<ExtraProduct> getExtraProductBySIN(Long serviceInterfaceName) throws Exception {
    if (null == serviceInterfaceName) {
        return null;
    }
    List<ExtraProduct> extraProducts = new ArrayList<>();
    ExtraProductExample example = new ExtraProductExample();
    ExtraProductExample.Criteria criteria = example.or();
    criteria.andServiceInterfaceNameEqualTo(serviceInterfaceName);
    extraProducts = selectByExample(example);
    return extraProducts;
}
Also used : ExtraProduct(com.itrus.portal.db.ExtraProduct) ArrayList(java.util.ArrayList) ExtraProductExample(com.itrus.portal.db.ExtraProductExample)

Example 30 with ExtraProduct

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

the class ExtraProductServiceImpl method selectByExample.

public List<ExtraProduct> selectByExample(ExtraProductExample example) throws Exception {
    ExtraProductMapper mapper = sqlSession.getMapper(ExtraProductMapper.class);
    List<ExtraProduct> list = mapper.selectByExample(example);
    return list;
}
Also used : ExtraProduct(com.itrus.portal.db.ExtraProduct) ExtraProductMapper(com.itrus.portal.db.ExtraProductMapper)

Aggregations

ExtraProduct (com.itrus.portal.db.ExtraProduct)62 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)44 HashMap (java.util.HashMap)28 ExtraBill (com.itrus.portal.db.ExtraBill)25 Enterprise (com.itrus.portal.db.Enterprise)24 UserInfo (com.itrus.portal.db.UserInfo)24 IOException (java.io.IOException)20 Project (com.itrus.portal.db.Project)17 ArrayList (java.util.ArrayList)16 ExtraProductSpec (com.itrus.portal.db.ExtraProductSpec)14 HttpSession (javax.servlet.http.HttpSession)14 File (java.io.File)13 BusinessLicense (com.itrus.portal.db.BusinessLicense)12 OpenBankInfo (com.itrus.portal.db.OpenBankInfo)12 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)12 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)12 IdentityCard (com.itrus.portal.db.IdentityCard)11 ServiceProvider (com.itrus.portal.db.ServiceProvider)11 OrgCode (com.itrus.portal.db.OrgCode)10 UserinfoEnterprise (com.itrus.portal.db.UserinfoEnterprise)10