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();
}
}
}
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;
}
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;
}
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;
}
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;
}
Aggregations