Search in sources :

Example 31 with Project

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

the class SHJJExtraBillSmsTask method run.

@Override
public void run() {
    Map<String, Object> param = new HashMap<String, Object>();
    param.put("reviewStatus", 3);
    param.put("isRefuseSms", 0);
    param.put("limit", 20);
    List<Map<String, Object>> billexall = sqlSession.selectList("com.itrus.portal.db.ExtraBillMapper.selectByCondition", param);
    ExtraBill bill;
    MessageTemplate messageTemplate;
    for (Map<String, Object> billMap : billexall) {
        bill = extraBillService.selectByPrimaryKey(Long.parseLong(billMap.get("id").toString()));
        // 查询短信模版
        // 查找对应项目的消息模版:SHJJ
        messageTemplate = messageTemplateService.getMsgTemp(bill.getProject(), "SHJJ");
        if (null == messageTemplate) {
            continue;
        }
        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);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
Also used : HashMap(java.util.HashMap) ExtraBill(com.itrus.portal.db.ExtraBill) UserInfo(com.itrus.portal.db.UserInfo) Date(java.util.Date) MessageTemplate(com.itrus.portal.db.MessageTemplate) ExtraProduct(com.itrus.portal.db.ExtraProduct) Project(com.itrus.portal.db.Project) Enterprise(com.itrus.portal.db.Enterprise) HashMap(java.util.HashMap) Map(java.util.Map)

Example 32 with Project

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

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

the class BillServiceImpl method getProjectMapByEnterpriseId.

/**
 * 根据企业id查询订单表中对应的projectMap
 *
 * @param enterprise
 * @return
 */
public Map<Long, Project> getProjectMapByEnterpriseId(Long enterprise) {
    Map<Long, Project> projectMap = new HashMap<Long, Project>();
    List<Long> projectIds = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectProjectsByEnterprise", enterprise);
    if (null != projectIds && !projectIds.isEmpty()) {
        ProjectExample projectExample = new ProjectExample();
        ProjectExample.Criteria criteria = projectExample.or();
        criteria.andIdIn(projectIds);
        projectMap = sqlSession.selectMap("com.itrus.portal.db.ProjectMapper.selectByExample", projectExample, "id");
    }
    return projectMap;
}
Also used : Project(com.itrus.portal.db.Project) HashMap(java.util.HashMap) ProjectExample(com.itrus.portal.db.ProjectExample)

Example 34 with Project

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

the class BillServiceImpl method getProjectByBillId.

/**
 * 根据订单ID查找出对应的project
 *
 * @param billId
 * @return
 */
public Project getProjectByBillId(Long billId) {
    Bill bill = getBill(billId);
    Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", bill.getProject());
    return project;
}
Also used : Project(com.itrus.portal.db.Project) Bill(com.itrus.portal.db.Bill)

Example 35 with Project

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

the class PersonalBillServiceImpl method getProjectMapByUserInfoId.

/**
 * 根据用户id查找订单表中对应的projectMap
 *
 * @param userInfo
 * @return
 */
public Map<Long, Project> getProjectMapByUserInfoId(Long userInfo) {
    Map<Long, Project> projectMap = new HashMap<Long, Project>();
    List<Long> projectIds = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectProjectsByUserInfo", userInfo);
    if (null != projectIds && !projectIds.isEmpty()) {
        ProjectExample projectExample = new ProjectExample();
        ProjectExample.Criteria criteria = projectExample.or();
        criteria.andIdIn(projectIds);
        projectMap = sqlSession.selectMap("com.itrus.portal.db.ProjectMapper.selectByExample", projectExample, "id");
    }
    return projectMap;
}
Also used : Project(com.itrus.portal.db.Project) HashMap(java.util.HashMap) ProjectExample(com.itrus.portal.db.ProjectExample)

Aggregations

Project (com.itrus.portal.db.Project)77 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)59 HashMap (java.util.HashMap)32 UserInfo (com.itrus.portal.db.UserInfo)24 Enterprise (com.itrus.portal.db.Enterprise)20 ExtraProduct (com.itrus.portal.db.ExtraProduct)17 ProjectExample (com.itrus.portal.db.ProjectExample)16 ArrayList (java.util.ArrayList)15 ProjectKeyInfo (com.itrus.portal.db.ProjectKeyInfo)12 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)12 Product (com.itrus.portal.db.Product)10 Date (java.util.Date)10 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)9 BusinessLicense (com.itrus.portal.db.BusinessLicense)8 IdentityCard (com.itrus.portal.db.IdentityCard)8 OrgCode (com.itrus.portal.db.OrgCode)8 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)8 UserinfoEnterprise (com.itrus.portal.db.UserinfoEnterprise)8 List (java.util.List)8 Map (java.util.Map)8