|
|
|
|
@ -4,6 +4,7 @@ package org.springblade.modules.business.service.impl; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import org.apache.commons.collections.CollectionUtils; |
|
|
|
|
import org.springblade.common.cache.UserCache; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
|
@ -15,6 +16,8 @@ import org.springblade.modules.business.pojo.entity.maintenance.MaintenancePlanD |
|
|
|
|
import org.springblade.modules.business.pojo.entity.maintenance.MaintenanceTask; |
|
|
|
|
import org.springblade.modules.business.pojo.entity.maintenance.MaintenanceTaskDetail; |
|
|
|
|
import org.springblade.modules.business.service.*; |
|
|
|
|
import org.springblade.modules.business.sms.SmsService; |
|
|
|
|
import org.springblade.modules.resource.pojo.entity.Sms; |
|
|
|
|
import org.springblade.modules.system.pojo.entity.User; |
|
|
|
|
import org.springblade.modules.system.service.IUserService; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
@ -46,6 +49,7 @@ public class MaintenancePlanServiceImpl extends BaseServiceImpl<MaintenancePlanM |
|
|
|
|
private final IMaintenanceTaskDetailService taskDetailService; |
|
|
|
|
private final IDeviceAttachService deviceAttachService; |
|
|
|
|
private final IUserService userService; |
|
|
|
|
private final SmsService smsService; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
@ -239,6 +243,7 @@ public class MaintenancePlanServiceImpl extends BaseServiceImpl<MaintenancePlanM |
|
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); |
|
|
|
|
String todayStr = format.format(new Date()); |
|
|
|
|
int count = 1; |
|
|
|
|
int taskCount = 0; |
|
|
|
|
for (Map.Entry<Long, List<MaintenancePlanDetail>> longListEntry : listMap.entrySet()) { |
|
|
|
|
Long planId = longListEntry.getKey(); |
|
|
|
|
List<MaintenancePlanDetail> details = longListEntry.getValue(); |
|
|
|
|
@ -274,12 +279,24 @@ public class MaintenancePlanServiceImpl extends BaseServiceImpl<MaintenancePlanM |
|
|
|
|
// 修改计划详情
|
|
|
|
|
planDetailService.updateBatchById(newDetails); |
|
|
|
|
count++; |
|
|
|
|
taskCount++; |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error(e.toString()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (taskCount > 0) { |
|
|
|
|
String roleId = "1839537055389515777"; |
|
|
|
|
List<User> maintenanceSupervisorList = userService.list(Wrappers.lambdaQuery(User.class).eq(User::getRoleId, roleId)); |
|
|
|
|
try { |
|
|
|
|
for (User maintenanceSupervisor : maintenanceSupervisorList) { |
|
|
|
|
smsService.sendSms(maintenanceSupervisor.getPhone(), maintenanceSupervisor.getRealName()); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|