|
@@ -18,6 +18,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyContent.SPECIALEQUIPMENT_CONTENT;
|
|
|
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyContent.SPECIALEQUIPMENT_CONTENT_PREFIX;
|
|
|
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyTitle.SPECIALEQUIPMENT_TITLE;
|
|
|
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyType.SPECIALEQUIPMENT;
|
|
|
+
|
|
|
@Service("checkItemsService")
|
|
|
public class CheckItemsServiceImpl extends ServiceImpl<CheckItemsDao, CheckItemsDo> implements CheckItemsService {
|
|
|
|
|
@@ -77,7 +82,23 @@ public class CheckItemsServiceImpl extends ServiceImpl<CheckItemsDao, CheckItems
|
|
|
List<String> userIdList = this.baseMapper.selectUserByTenantId(tenantId);
|
|
|
equManager.put(tenantId, userIdList);
|
|
|
});
|
|
|
-
|
|
|
+ // 多个设备 只给收件人发送一条信息
|
|
|
+// equManager.forEach((k,v)->{
|
|
|
+// String content = list.stream().filter(data->k.equals(data.getTenantid())).map(item ->{
|
|
|
+// String typeName = ObjectUtil.isNotEmpty(item.getTypeName()) ? item.getTypeName() : "";
|
|
|
+// String checkItemCode = ObjectUtil.isNotEmpty(item.getCheckitemcode()) ? item.getCheckitemcode() : "";
|
|
|
+// String checkItemName = ObjectUtil.isNotEmpty(item.getCheckitemname()) ? item.getCheckitemname() : "";
|
|
|
+// String nextCheckDate = ObjectUtil.isNotEmpty(item.getNextcheckdate()) ? DateUtil.format(item.getNextcheckdate(), "yyy-MM-dd") : "";
|
|
|
+// return String.format(SPECIALEQUIPMENT_CONTENT,typeName,checkItemCode,checkItemName,nextCheckDate);
|
|
|
+// }).collect(Collectors.joining("</br>"));
|
|
|
+// //发送消息
|
|
|
+// CXCommonUtils.sendNotify(SPECIALEQUIPMENT_TITLE,
|
|
|
+// SPECIALEQUIPMENT_CONTENT_PREFIX + content,
|
|
|
+// null,
|
|
|
+// equManager.get(k.getTenantid()),
|
|
|
+// item.getId(),
|
|
|
+// SPECIALEQUIPMENT);
|
|
|
+// });
|
|
|
//根据设备的所属工厂给自己工厂的设备管理员发送消息
|
|
|
list.forEach(item -> {
|
|
|
if (ObjectUtil.isNotEmpty(item.getTenantid())) {
|
|
@@ -86,15 +107,13 @@ public class CheckItemsServiceImpl extends ServiceImpl<CheckItemsDao, CheckItems
|
|
|
String checkItemName = ObjectUtil.isNotEmpty(item.getCheckitemname()) ? item.getCheckitemname() : "";
|
|
|
String nextCheckDate = ObjectUtil.isNotEmpty(item.getNextcheckdate()) ? DateUtil.format(item.getNextcheckdate(), "yyy-MM-dd") : "";
|
|
|
|
|
|
-
|
|
|
//发送消息
|
|
|
- CXCommonUtils.sendNotify("特种设备提醒",
|
|
|
- "【设备年检提醒】,您好,有如下设备即将年检到期,请及时处理:" +
|
|
|
- "设备类型:【" + typeName + "】,设备编号:【" + checkItemCode + "】,设备名称:【" + checkItemName + "】,年检日期:【" + nextCheckDate + "】",
|
|
|
+ CXCommonUtils.sendNotify(SPECIALEQUIPMENT_TITLE,
|
|
|
+ SPECIALEQUIPMENT_CONTENT_PREFIX + String.format(SPECIALEQUIPMENT_CONTENT,typeName,checkItemCode,checkItemName,nextCheckDate),
|
|
|
null,
|
|
|
equManager.get(item.getTenantid()),
|
|
|
item.getId(),
|
|
|
- "specialequipment");
|
|
|
+ SPECIALEQUIPMENT);
|
|
|
}
|
|
|
});
|
|
|
|