修改定时更新

master
杜函宇 2 weeks ago
parent 49794f8c56
commit fee0e42d53

@ -19,14 +19,9 @@ import com.ruoyi.jjh.ent.entity.JContacts;
import com.ruoyi.jjh.ent.entity.JProject; import com.ruoyi.jjh.ent.entity.JProject;
import com.ruoyi.jjh.ent.entity.JSmartDeclaration; import com.ruoyi.jjh.ent.entity.JSmartDeclaration;
import com.ruoyi.jjh.ent.entity.JSmartReminders; import com.ruoyi.jjh.ent.entity.JSmartReminders;
import com.ruoyi.jjh.ent.service.JContactsService; import com.ruoyi.jjh.ent.service.*;
import com.ruoyi.jjh.ent.service.JProjectService;
import com.ruoyi.jjh.ent.service.JSmartDeclarationService;
import com.ruoyi.jjh.ent.service.JSmartRemindersService;
import com.ruoyi.jjh.ent.service.SmsAlertsService;
import com.ruoyi.quartz.service.ISysJobService; import com.ruoyi.quartz.service.ISysJobService;
import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.mapper.SysUserMapper;
import liquibase.pro.packaged.S;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@ -144,20 +139,17 @@ public class TimeChange {
} }
public void getTime(BmsTemplateRecord items) { public void getTime(BmsTemplateRecord items) {
LocalDate currentDate = LocalDate.now(); if (items.getIsTime() == 0) {
LocalDate startDate = LocalDate.of(items.getStartTime().getYear(), items.getStartTime().getMonth(), items.getStartTime().getDayOfMonth()); LocalDate currentDate = LocalDate.now();
LocalDate endDate = LocalDate.of(items.getEndTime().getYear(), items.getEndTime().getMonth(), items.getEndTime().getDayOfMonth()); LocalDate startDate = items.getStartTime();
if (currentDate.isBefore(startDate)) { LocalDate endDate = items.getEndTime();
items.setStatus(0); if (currentDate.isBefore(startDate)) {
} items.setStatus(0); // 未开始
if (currentDate.isAfter(endDate)) { } else if (currentDate.isAfter(endDate)) {
items.setStatus(1); items.setStatus(1); // 已结束
} } else {
if (currentDate.equals(startDate) || currentDate.equals(endDate)) { items.setStatus(2); // 进行中(包含在区间内和边界值)
items.setStatus(2); }
}
if (currentDate.isAfter(startDate) && currentDate.isBefore(endDate)) {
items.setStatus(2);
} }
} }
@ -202,7 +194,7 @@ public class TimeChange {
if (total > 0) { if (total > 0) {
// 直接转换第一个元素为BmsEnterpriseBasicInfo对象 // 直接转换第一个元素为BmsEnterpriseBasicInfo对象
BmsEnterpriseBasicInfo res = JSONUtil.toBean(arr.getJSONObject(0).toString(), BmsEnterpriseBasicInfo.class); BmsEnterpriseBasicInfo res = JSONUtil.toBean(arr.getJSONObject(0).toString(), BmsEnterpriseBasicInfo.class);
if(!"1".equals(items.getType())){ if (!"1".equals(items.getType())) {
res.setQygm("其他"); res.setQygm("其他");
} }
res.setId(items.getId()); res.setId(items.getId());
@ -247,11 +239,11 @@ public class TimeChange {
} }
List<JContacts> list1 = jContactsService.lambdaQuery().eq(JContacts::getTyshxydm, items.getTyshxydm()).list(); List<JContacts> list1 = jContactsService.lambdaQuery().eq(JContacts::getTyshxydm, items.getTyshxydm()).list();
List<String> str = new ArrayList<>(); List<String> str = new ArrayList<>();
list1.forEach(x-> str.add(x.getDwAgencykey())); list1.forEach(x -> str.add(x.getDwAgencykey()));
if(!list1.isEmpty()){ if (!list1.isEmpty()) {
jContactsService.removeBatchByIds(str); jContactsService.removeBatchByIds(str);
jContactsService.saveBatch(allList); jContactsService.saveBatch(allList);
}else { } else {
jContactsService.saveBatch(allList); jContactsService.saveBatch(allList);
} }
} }
@ -297,7 +289,7 @@ public class TimeChange {
SysUser user = new SysUser(); SysUser user = new SysUser();
user.setUserType("02"); user.setUserType("02");
for (SysUser o : sysUserMapper.selectUserList(user)) { for (SysUser o : sysUserMapper.selectUserList(user)) {
if("0".equals(o.getDelFlag()) & "0".equals(o.getStatus())) { if ("0".equals(o.getDelFlag()) & "0".equals(o.getStatus())) {
JSmartDeclaration y = new JSmartDeclaration(); JSmartDeclaration y = new JSmartDeclaration();
y.setSmartRemindersId(2L); y.setSmartRemindersId(2L);
y.setIsRead(1); y.setIsRead(1);
@ -306,8 +298,8 @@ public class TimeChange {
y.setZwId(o.getUserId()); y.setZwId(o.getUserId());
bmsDeclarationRecords.add(y); bmsDeclarationRecords.add(y);
if (isTiming) { if (isTiming) {
emailEnterService.toEnter("政府人员-" + o.getNickName(),"您有1个项目即将建设完成,请前往工作台查看。"+"登录网址为:https://idp.sipac.gov.cn/bms/#/login"+"此邮件为系统自动发送,无需回复!",o.getEmail()); emailEnterService.toEnter("政府人员-" + o.getNickName(), "您有1个项目即将建设完成,请前往工作台查看。" + "登录网址为:https://idp.sipac.gov.cn/bms/#/login" + "此邮件为系统自动发送,无需回复!", o.getEmail());
smsAlertsService.enterSms("政府人员-" + o.getNickName(), "您有1个项目即将建设完成,请前往工作台查看。"+"登录网址为:https://idp.sipac.gov.cn/bms/#/login", o.getPhonenumber()); smsAlertsService.enterSms("政府人员-" + o.getNickName(), "您有1个项目即将建设完成,请前往工作台查看。" + "登录网址为:https://idp.sipac.gov.cn/bms/#/login", o.getPhonenumber());
} }
} }
} }

Loading…
Cancel
Save