diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/regular/TimeChange.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/regular/TimeChange.java index 3f3cb82..adfbb53 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/regular/TimeChange.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/regular/TimeChange.java @@ -19,14 +19,9 @@ import com.ruoyi.jjh.ent.entity.JContacts; import com.ruoyi.jjh.ent.entity.JProject; import com.ruoyi.jjh.ent.entity.JSmartDeclaration; import com.ruoyi.jjh.ent.entity.JSmartReminders; -import com.ruoyi.jjh.ent.service.JContactsService; -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.jjh.ent.service.*; import com.ruoyi.quartz.service.ISysJobService; import com.ruoyi.system.mapper.SysUserMapper; -import liquibase.pro.packaged.S; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; @@ -144,20 +139,17 @@ public class TimeChange { } public void getTime(BmsTemplateRecord items) { - LocalDate currentDate = LocalDate.now(); - LocalDate startDate = LocalDate.of(items.getStartTime().getYear(), items.getStartTime().getMonth(), items.getStartTime().getDayOfMonth()); - LocalDate endDate = LocalDate.of(items.getEndTime().getYear(), items.getEndTime().getMonth(), items.getEndTime().getDayOfMonth()); - if (currentDate.isBefore(startDate)) { - items.setStatus(0); - } - if (currentDate.isAfter(endDate)) { - items.setStatus(1); - } - if (currentDate.equals(startDate) || currentDate.equals(endDate)) { - items.setStatus(2); - } - if (currentDate.isAfter(startDate) && currentDate.isBefore(endDate)) { - items.setStatus(2); + if (items.getIsTime() == 0) { + LocalDate currentDate = LocalDate.now(); + LocalDate startDate = items.getStartTime(); + LocalDate endDate = items.getEndTime(); + if (currentDate.isBefore(startDate)) { + items.setStatus(0); // 未开始 + } else if (currentDate.isAfter(endDate)) { + items.setStatus(1); // 已结束 + } else { + items.setStatus(2); // 进行中(包含在区间内和边界值) + } } } @@ -202,7 +194,7 @@ public class TimeChange { if (total > 0) { // 直接转换第一个元素为BmsEnterpriseBasicInfo对象 BmsEnterpriseBasicInfo res = JSONUtil.toBean(arr.getJSONObject(0).toString(), BmsEnterpriseBasicInfo.class); - if(!"1".equals(items.getType())){ + if (!"1".equals(items.getType())) { res.setQygm("其他"); } res.setId(items.getId()); @@ -247,11 +239,11 @@ public class TimeChange { } List list1 = jContactsService.lambdaQuery().eq(JContacts::getTyshxydm, items.getTyshxydm()).list(); List str = new ArrayList<>(); - list1.forEach(x-> str.add(x.getDwAgencykey())); - if(!list1.isEmpty()){ + list1.forEach(x -> str.add(x.getDwAgencykey())); + if (!list1.isEmpty()) { jContactsService.removeBatchByIds(str); jContactsService.saveBatch(allList); - }else { + } else { jContactsService.saveBatch(allList); } } @@ -297,7 +289,7 @@ public class TimeChange { SysUser user = new SysUser(); user.setUserType("02"); 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(); y.setSmartRemindersId(2L); y.setIsRead(1); @@ -306,8 +298,8 @@ public class TimeChange { y.setZwId(o.getUserId()); bmsDeclarationRecords.add(y); if (isTiming) { - 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()); + 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()); } } }