|
@@ -5,6 +5,8 @@ import com.aliyuncs.exceptions.ClientException;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -60,6 +62,8 @@ import java.util.Objects;
|
|
|
@Transactional(readOnly = true)
|
|
@Transactional(readOnly = true)
|
|
|
public class CompanyService extends BaseService<Company> {
|
|
public class CompanyService extends BaseService<Company> {
|
|
|
|
|
|
|
|
|
|
+ private static Logger logger = LoggerFactory.getLogger(CompanyService.class);
|
|
|
|
|
+
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private CompanyDao companyDao;
|
|
private CompanyDao companyDao;
|
|
|
|
|
|
|
@@ -479,7 +483,9 @@ public class CompanyService extends BaseService<Company> {
|
|
|
approval1.setOper_type(Constant.OperType.APPROVED);
|
|
approval1.setOper_type(Constant.OperType.APPROVED);
|
|
|
//保存审核记录
|
|
//保存审核记录
|
|
|
approvalService.insertAndGetId(approval1);
|
|
approvalService.insertAndGetId(approval1);
|
|
|
- sendSMSToRegisteredCompanyUser(users.get(0), true, approval1);
|
|
|
|
|
|
|
+ if (CommonUtils.isNotNull(users) && users.size() > 0 ) {
|
|
|
|
|
+ sendSMSToRegisteredCompanyUser(users.get(0), true, approval1);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
} else {//退回
|
|
} else {//退回
|
|
|
//查询最近的一条审核记录
|
|
//查询最近的一条审核记录
|
|
@@ -514,7 +520,9 @@ public class CompanyService extends BaseService<Company> {
|
|
|
user.setIs_register(2);
|
|
user.setIs_register(2);
|
|
|
user.setDel_flag(true);
|
|
user.setDel_flag(true);
|
|
|
userService.updateSelective(user);
|
|
userService.updateSelective(user);
|
|
|
- sendSMSToRegisteredCompanyUser(users.get(0), false, approval1);
|
|
|
|
|
|
|
+ if (CommonUtils.isNotNull(user) && users.size() > 0) {
|
|
|
|
|
+ sendSMSToRegisteredCompanyUser(users.get(0), false, approval1);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
//同步信息给天启
|
|
//同步信息给天启
|
|
|
// SyncUserDto dto = new SyncUserDto();
|
|
// SyncUserDto dto = new SyncUserDto();
|
|
@@ -541,27 +549,42 @@ public class CompanyService extends BaseService<Company> {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//发送短信给企业用户,账号注册成功/失败
|
|
//发送短信给企业用户,账号注册成功/失败
|
|
|
- private void sendSMSToRegisteredCompanyUser(User user, Boolean isPassed, Approval approval) throws ClientException, InterruptedException {
|
|
|
|
|
|
|
+ // 发送短信 错误修改 wangjiang 2020-1-8
|
|
|
|
|
+ private void sendSMSToRegisteredCompanyUser(User user, Boolean isPassed, Approval approval) {
|
|
|
|
|
+ String templateParam;
|
|
|
|
|
+ String phone = user.getPhone();
|
|
|
|
|
+ logger.info("send msg to register company user which phone is : {}", phone);
|
|
|
if (isPassed) {
|
|
if (isPassed) {
|
|
|
//发送短信给企业用户,账号注册成功
|
|
//发送短信给企业用户,账号注册成功
|
|
|
//您的企业${company_name}账号注册,审核通过啦! 账号名为${nick_name}。感谢您的支持。
|
|
//您的企业${company_name}账号注册,审核通过啦! 账号名为${nick_name}。感谢您的支持。
|
|
|
- String phone = user.getPhone();
|
|
|
|
|
|
|
+// String phone = user.getPhone();
|
|
|
String nick_name = user.getNick_name();
|
|
String nick_name = user.getNick_name();
|
|
|
String company_name = user.getCompany_name();
|
|
String company_name = user.getCompany_name();
|
|
|
- String templateParam = "{\"nick_name\":\"" + nick_name + "\",\"company_name\":\"" + company_name + "\"}";
|
|
|
|
|
- AlibabaSMSUtil.sendSMS(phone, Constant.SMS_TemplateCode.COMPANY_USER_REGISTER_PASSED, "企业提升发展服务平台", templateParam);
|
|
|
|
|
|
|
+ templateParam = "{\"nick_name\":\"" + nick_name + "\",\"company_name\":\"" + company_name + "\"}";
|
|
|
|
|
+// AlibabaSMSUtil.sendSMS(phone, Constant.SMS_TemplateCode.COMPANY_USER_REGISTER_PASSED, "企业提升发展服务平台", templateParam);
|
|
|
} else {
|
|
} else {
|
|
|
//发送短信给企业用户,账号注册失败
|
|
//发送短信给企业用户,账号注册失败
|
|
|
//您的企业${company_name}账号注册(账号名为${nick_name}),审核失败。${comment}感谢您的支持。
|
|
//您的企业${company_name}账号注册(账号名为${nick_name}),审核失败。${comment}感谢您的支持。
|
|
|
- String phone = user.getPhone();
|
|
|
|
|
|
|
+// String phone = user.getPhone();
|
|
|
String nick_name = user.getNick_name();
|
|
String nick_name = user.getNick_name();
|
|
|
String company_name = user.getCompany_name();
|
|
String company_name = user.getCompany_name();
|
|
|
String comment = approval.getApproval_comment();
|
|
String comment = approval.getApproval_comment();
|
|
|
if (null != comment && comment.length() > 20) {
|
|
if (null != comment && comment.length() > 20) {
|
|
|
comment = comment.substring(0, 20);
|
|
comment = comment.substring(0, 20);
|
|
|
}
|
|
}
|
|
|
- String templateParam = "{\"nick_name\":\"" + nick_name + "\",\"comment\":\"" + comment + "\",\"company_name\":\"" + company_name + "\"}";
|
|
|
|
|
|
|
+ templateParam = "{\"nick_name\":\"" + nick_name + "\",\"comment\":\"" + comment + "\",\"company_name\":\"" + company_name + "\"}";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
AlibabaSMSUtil.sendSMS(phone, Constant.SMS_TemplateCode.COMPANY_USER_REGISTER_REJECT, "企业提升发展服务平台", templateParam);
|
|
AlibabaSMSUtil.sendSMS(phone, Constant.SMS_TemplateCode.COMPANY_USER_REGISTER_REJECT, "企业提升发展服务平台", templateParam);
|
|
|
|
|
+ } catch (ClientException e) {
|
|
|
|
|
+ logger.error("发送阿里巴巴sms错误(ClientException):{}", e.getMessage());
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ throw new RuntimeException("发送阿里巴巴sms错误(ClientException):" + e.getMessage());
|
|
|
|
|
+ } catch (InterruptedException e) {
|
|
|
|
|
+ logger.error("发送阿里巴巴sms错误(InterruptedException):{}", e.getMessage());
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ throw new RuntimeException("发送阿里巴巴sms错误(InterruptedException):" + e.getMessage());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|