|
|
|
@ -1,7 +1,9 @@
|
|
|
|
|
package com.ruoyi.jjh.declaration.component;
|
|
|
|
|
|
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
|
|
import com.ruoyi.jjh.declaration.service.IBmsEnterpriseBasicInfoService;
|
|
|
|
|
import com.ruoyi.jjh.declaration.service.IBmsEnterpriseDirectoryService;
|
|
|
|
|
import com.ruoyi.jjh.ent.entity.JContacts;
|
|
|
|
|
import com.ruoyi.jjh.ent.entity.JEnterpriseContact;
|
|
|
|
|
import com.ruoyi.jjh.ent.entity.JSmartDeclaration;
|
|
|
|
@ -14,7 +16,8 @@ import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
@ -28,7 +31,7 @@ import java.util.Objects;
|
|
|
|
|
* @author du
|
|
|
|
|
* @since 2024/7/18 9:55
|
|
|
|
|
*/
|
|
|
|
|
@Component("TimingRemind")
|
|
|
|
|
@Service
|
|
|
|
|
public class TimingRemindImpl implements TimingRemindService {
|
|
|
|
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(TimingRemindImpl.class);
|
|
|
|
@ -75,6 +78,9 @@ public class TimingRemindImpl implements TimingRemindService {
|
|
|
|
|
@Resource
|
|
|
|
|
private SysUserMapper sysUserMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IBmsEnterpriseDirectoryService enterpriseDirectoryService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 企业端要定时新增数据,并且还要发短信
|
|
|
|
|
*/
|
|
|
|
@ -97,32 +103,37 @@ public class TimingRemindImpl implements TimingRemindService {
|
|
|
|
|
/**
|
|
|
|
|
* 根据企业名称和企业信用代码获取该企业的常用联系人并且发送短信
|
|
|
|
|
*/
|
|
|
|
|
@Async("chrisThreadPool")
|
|
|
|
|
public void getContact(String code, String s) {
|
|
|
|
|
if (isTiming) {
|
|
|
|
|
List<JEnterpriseContact> list1 = jEnterpriseContactService.lambdaQuery().eq(JEnterpriseContact::getEnterpriseCode, code).list();
|
|
|
|
|
if (list1 != null && !list1.isEmpty()) {
|
|
|
|
|
list1.forEach(y -> {
|
|
|
|
|
//先添加工单再发送短信
|
|
|
|
|
//可在导入或者新增的时候将该常用联系人的手机号添加进工单
|
|
|
|
|
smsAlertsService.enterSms(y.getEnterpriseName(), s, y.getContactPhone());
|
|
|
|
|
log.info(y.getEnterpriseName() + "发送短信成功!");
|
|
|
|
|
//发送邮件
|
|
|
|
|
emailEnterService.toEnter(y.getEnterpriseName(), s + "此邮件为系统自动发送,无需回复!", y.getContactEmail());
|
|
|
|
|
log.info(y.getEnterpriseName() + "发送邮件成功!");
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
List<JContacts> list = jContactsService.lambdaQuery().eq(JContacts::getTyshxydm, code)
|
|
|
|
|
.eq(JContacts::getDefaultcontact, "1").list();
|
|
|
|
|
list.forEach(y -> {
|
|
|
|
|
//先添加工单再发送短信
|
|
|
|
|
smsAlertsService.addSsmPhone(y.getYddh());
|
|
|
|
|
//可在导入或者新增的时候将该常用联系人的手机号添加进工单
|
|
|
|
|
smsAlertsService.enterSms(y.getQymc(), s, y.getYddh());
|
|
|
|
|
log.info(y.getQymc() + "发送短信成功!");
|
|
|
|
|
//发送邮件
|
|
|
|
|
emailEnterService.toEnter(y.getQymc(), s + "此邮件为系统自动发送,无需回复!", y.getDzyx());
|
|
|
|
|
log.info(y.getQymc() + "发送邮件成功!");
|
|
|
|
|
});
|
|
|
|
|
try {
|
|
|
|
|
List<JEnterpriseContact> list1 = jEnterpriseContactService.lambdaQuery().eq(JEnterpriseContact::getEnterpriseCode, code).list();
|
|
|
|
|
if (list1 != null && !list1.isEmpty()) {
|
|
|
|
|
list1.forEach(y -> {
|
|
|
|
|
//先添加工单再发送短信
|
|
|
|
|
//可在导入或者新增的时候将该常用联系人的手机号添加进工单
|
|
|
|
|
smsAlertsService.enterSms(y.getEnterpriseName(), s, y.getContactPhone());
|
|
|
|
|
log.info(y.getEnterpriseName() + "发送短信成功!");
|
|
|
|
|
//发送邮件
|
|
|
|
|
emailEnterService.toEnter(y.getEnterpriseName(), s + "此邮件为系统自动发送,无需回复!", y.getContactEmail());
|
|
|
|
|
log.info(y.getEnterpriseName() + "发送邮件成功!");
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
List<JContacts> list = jContactsService.lambdaQuery().eq(JContacts::getTyshxydm, code)
|
|
|
|
|
.eq(JContacts::getDefaultcontact, "1").list();
|
|
|
|
|
list.forEach(y -> {
|
|
|
|
|
//先添加工单再发送短信
|
|
|
|
|
smsAlertsService.addSsmPhone(y.getYddh());
|
|
|
|
|
//可在导入或者新增的时候将该常用联系人的手机号添加进工单
|
|
|
|
|
smsAlertsService.enterSms(y.getQymc(), s, y.getYddh());
|
|
|
|
|
log.info(y.getQymc() + "发送短信成功!");
|
|
|
|
|
//发送邮件
|
|
|
|
|
emailEnterService.toEnter(y.getQymc(), s + "此邮件为系统自动发送,无需回复!", y.getDzyx());
|
|
|
|
|
log.info(y.getQymc() + "发送邮件成功!");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new ServiceException(code + "发送邮件失败!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -151,14 +162,14 @@ public class TimingRemindImpl implements TimingRemindService {
|
|
|
|
|
if (isTiming) {
|
|
|
|
|
if (sd.getProjectId() != null && x.getPhonenumber() != null) {
|
|
|
|
|
smsAlertsService.enterSms("政府人员-" + x.getNickName(), "您有1个项目自定义通知,请前往工作台查看," + "登录网址为:https://idp.sipac.gov.cn/bms/#/login", x.getPhonenumber());
|
|
|
|
|
if(!Objects.equals(x.getEmail(), "") &&x.getEmail()!=null){
|
|
|
|
|
if (!Objects.equals(x.getEmail(), "") && x.getEmail() != null) {
|
|
|
|
|
//发送邮件
|
|
|
|
|
emailEnterService.toEnter("政府人员-" + x.getNickName(), "您有1个项目自定义通知,请前往工作台查看," + "登录网址为:https://idp.sipac.gov.cn/bms/#/login" + "此邮件为系统自动发送,无需回复!", x.getEmail());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (x.getPhonenumber() != null && sd.getProjectId() == null) {
|
|
|
|
|
smsAlertsService.enterSms("政府人员-" + x.getNickName(), "您有1个全局自定义通知,请前往工作台查看," + "登录网址为:https://idp.sipac.gov.cn/bms/#/login", x.getPhonenumber());
|
|
|
|
|
if(!Objects.equals(x.getEmail(), "") &&x.getEmail()!=null) {
|
|
|
|
|
if (!Objects.equals(x.getEmail(), "") && x.getEmail() != null) {
|
|
|
|
|
//发送邮件
|
|
|
|
|
emailEnterService.toEnter("政府人员-" + x.getNickName(), "您有1个全局自定义通知,请前往工作台查看," + "登录网址为:https://idp.sipac.gov.cn/bms/#/login" + "此邮件为系统自动发送,无需回复!", x.getEmail());
|
|
|
|
|
}
|
|
|
|
|