|
@@ -1,10 +1,14 @@
|
|
|
package com.rongwei.bscommon.sys.service.impl;
|
|
|
|
|
|
+import com.rongwei.bscommon.sys.dao.CommonDao;
|
|
|
+import com.rongwei.bscommon.sys.service.AspCheckItemsService;
|
|
|
import com.rongwei.bscommon.sys.service.EquLubricationTaskManagementService;
|
|
|
import com.rongwei.bscommon.sys.service.EquMaintenanceTaskService;
|
|
|
import com.rongwei.bscommon.sys.service.EquipmentSendNotifyService;
|
|
|
+import com.rongwei.bsentity.domain.AspCheckItems;
|
|
|
import com.rongwei.bsentity.domain.EquLubricationTaskManagementDo;
|
|
|
import com.rongwei.bsentity.domain.EquMaintenanceTaskDo;
|
|
|
+import com.rongwei.bsentity.dto.EquipmentDisposeDTO;
|
|
|
import com.rongwei.rwadmincommon.system.domain.SysDictDo;
|
|
|
import com.rongwei.rwadmincommon.system.service.SysDictService;
|
|
|
import com.rongwei.rwcommon.base.R;
|
|
@@ -16,11 +20,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
import static com.rongwei.safecommon.utils.SaveConstans.NotifyContent.*;
|
|
|
import static com.rongwei.safecommon.utils.SaveConstans.NotifyTitle.*;
|
|
@@ -48,6 +50,12 @@ public class EquipmentSendNotifyServiceImpl implements EquipmentSendNotifyServic
|
|
|
@Autowired
|
|
|
private EquLubricationTaskManagementService equLubricationTaskManagementService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private AspCheckItemsService aspCheckItemsService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CommonDao commonDao;
|
|
|
+
|
|
|
/**
|
|
|
* 根据任务ID发送 提醒
|
|
|
*
|
|
@@ -89,7 +97,7 @@ public class EquipmentSendNotifyServiceImpl implements EquipmentSendNotifyServic
|
|
|
maintenanceTaskDo.getWorkshop(), maintenanceTaskDo.getEquipmentname(), maintenanceTaskDo.getEquipmentnumber(),
|
|
|
maintenanceTaskDo.getMaintenancesite(), maintenanceTaskDo.getPrincipal(), maintenanceTaskDo.getOtherengineers());
|
|
|
//删除提醒
|
|
|
- CXCommonUtils.deleteSendNotify("maintain",id);
|
|
|
+ CXCommonUtils.deleteSendNotify("maintain", id);
|
|
|
|
|
|
//发送提醒
|
|
|
CXCommonUtils.sendNotify(title, context, null, userId.stream().distinct().collect(Collectors.toList()),
|
|
@@ -127,7 +135,7 @@ public class EquipmentSendNotifyServiceImpl implements EquipmentSendNotifyServic
|
|
|
maintenanceTaskDo.getOtherengineers());
|
|
|
|
|
|
//删除提醒
|
|
|
- CXCommonUtils.deleteSendNotify("maintain",id);
|
|
|
+ CXCommonUtils.deleteSendNotify("maintain", id);
|
|
|
|
|
|
CXCommonUtils.sendNotify(ACCEPTANCE_SYSTEM_TITLE, context, null, userId.stream().distinct().collect(Collectors.toList()),
|
|
|
maintenanceTaskDo.getId(), ACCEPTMAINTAINTASK, false);
|
|
@@ -157,7 +165,7 @@ public class EquipmentSendNotifyServiceImpl implements EquipmentSendNotifyServic
|
|
|
// 发送消息提醒
|
|
|
CXCommonUtils.sendNotify(LUBRICATION_TASK_TITLE,
|
|
|
String.format(LUBRICATION_TASK_CONTENT, info.getYear(), info.getMonth(), taskfrequency,
|
|
|
- info.getEquipmentworkshop(),info.getEquipment(), info.getEquipmentnumber(), info.getLubricator()),
|
|
|
+ info.getEquipmentworkshop(), info.getEquipment(), info.getEquipmentnumber(), info.getLubricator()),
|
|
|
null, Arrays.asList(info.getLubricatorid().split(",")), info.getId(), LUBRICATION_TASK, false);
|
|
|
});
|
|
|
// 发送消息提醒
|
|
@@ -167,7 +175,7 @@ public class EquipmentSendNotifyServiceImpl implements EquipmentSendNotifyServic
|
|
|
@Override
|
|
|
public R sendLubricationTaskNotifyByIds(Map<String, Object> parameter) {
|
|
|
String taskIds = parameter.get("taskIds").toString();
|
|
|
- if(StringUtils.isNotBlank(taskIds)){
|
|
|
+ if (StringUtils.isNotBlank(taskIds)) {
|
|
|
String[] idArray = taskIds.split(",");
|
|
|
List<EquLubricationTaskManagementDo> equLubricationTaskManagementDos = new ArrayList<>(equLubricationTaskManagementService.listByIds(Arrays.asList(idArray)));
|
|
|
sendLubricationTaskNotify(equLubricationTaskManagementDos);
|
|
@@ -177,11 +185,39 @@ public class EquipmentSendNotifyServiceImpl implements EquipmentSendNotifyServic
|
|
|
|
|
|
@Override
|
|
|
public void sendPlanningTasksNotify(String planyear, String belongfactory, Integer taskquantity, String fileItemId) {
|
|
|
- CXCommonUtils.deleteSendNotify("mobilePlanningTask",fileItemId);
|
|
|
+ CXCommonUtils.deleteSendNotify("mobilePlanningTask", fileItemId);
|
|
|
// 发送消息提醒
|
|
|
CXCommonUtils.sendNotify(PLANNING_TASK_TITLE,
|
|
|
String.format(PLANNING_TASK_CONTENT, planyear, belongfactory, taskquantity),
|
|
|
null, Arrays.asList("7144ec7b69484007a07f2542cc1d90c7".split(",")), fileItemId, MOBILE_PLANNING_TASK, true);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void equScrapAuditNotify(EquipmentDisposeDTO equipmentDisposeDTO) {
|
|
|
+ String equid = equipmentDisposeDTO.getEquipmentId();
|
|
|
+ AspCheckItems aspCheckItems = aspCheckItemsService.getById(equid);
|
|
|
+
|
|
|
+ if (null == aspCheckItems) {
|
|
|
+ log.info("无法通过id:{}获取到设备信息", equid);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 发送人
|
|
|
+ List<String> userId = new ArrayList<>();
|
|
|
+ List<String> useDeptRoleUserIds = commonDao.getRoleUserIds("'车间主任','车间维修主管','车间保养主管'", "so.ID='" + aspCheckItems.getUsedeptid() + "'");
|
|
|
+ List<String> factoryRoleUserIds = commonDao.getRoleUserIds("'设备部部门长'", "(so.FULLPID like '," + aspCheckItems.getTenantid() + "%' or so.ID='" + aspCheckItems.getTenantid() + "')");
|
|
|
+ if (useDeptRoleUserIds.size() > 0 && factoryRoleUserIds.size() > 0) {
|
|
|
+ userId = Stream.of(useDeptRoleUserIds, factoryRoleUserIds).flatMap(Collection::stream).distinct().collect(Collectors.toList());
|
|
|
+ } else if (useDeptRoleUserIds.size() == 0) {
|
|
|
+ userId = factoryRoleUserIds;
|
|
|
+ } else {
|
|
|
+ userId = useDeptRoleUserIds;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (userId.isEmpty()) {
|
|
|
+ log.info("id为{}的任务无提醒人", equipmentDisposeDTO.getId());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|