2024-07-17 设备-手持-点检巡检保养提交后微信提醒

master
A0010407 6 months ago
parent 25e7440973
commit 746f963f3c

@ -396,6 +396,78 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
String key = "#header.poolName";
equRepairOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_", ""));
equRepairOrderMapper.insertEquRepairOrder(equRepairOrder);
//微信提醒
//PDA企业微信报修审核提醒
//发企业微信--------------------开始(跟班组有关)
SimpleDateFormat myFmt=new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒"); //规范时间格式
SysNoticeGroup noticeQo = new SysNoticeGroup();
noticeQo.setNoticeId(10L);
List<SysNoticeGroup> notices = equRepairOrderMapper.getNoticesGroup(noticeQo);
if(!CollectionUtils.isEmpty(notices)) {
List<WechartDTO> wecharts = new ArrayList<>();
List<String> userCodes = notices.stream()
.map(SysNoticeGroup::getUserCode)
.collect(Collectors.toList());
for (SysNoticeGroup noticeDto : notices) {
WechartDTO wechart0 = new WechartDTO();
wechart0.setUserId(noticeDto.getWxId());
String contentInfo = noticeDto.getNoticeContent();
//在前端填的时候,需要判空!!!!!!
contentInfo = contentInfo
.replace("${message}", "\n")
.replace("${equipmentCode}", equOrder.getEquipmentCode()+"\n")
.replace("${orderCode}", equOrder.getOrderCode()+"\n")
.replace("${orderDesc}", equRepairOrder.getOrderSource() + "存在不达标检查项"+"\n")
;
//故障开始时间
if(equOrder.getOrderStart() != null){
contentInfo = contentInfo.replace("${orderBreakdownTime}", myFmt.format(equOrder.getOrderStart())+"\n");
}else{
contentInfo = contentInfo.replace("${orderBreakdownTime}", "无"+"\n");
}
//报修人equOrder
if(equOrder.getPlanPersonName() != null){
contentInfo = contentInfo.replace("${orderRepairmanName}", equOrder.getPlanPersonName()+"\n");
}else{
contentInfo = contentInfo.replace("${orderRepairmanName}", "无"+"\n");
}
//查询设备相关信息
//设备名称
EquEquipment equ = equEquipmentMapper.selectEquEquipmentByEquEquipmentCode(equOrder.getEquipmentCode());
if(StringUtils.isNotEmpty(equ.getEquipmentName())){
contentInfo = contentInfo.replace("${equipmentName}", equ.getEquipmentName()+"\n");
}else{
contentInfo = contentInfo.replace("${equipmentName}", "无"+"\n");
}
//设备位置
if(StringUtils.isNotEmpty(equ.getEquipmentLocation())){
contentInfo = contentInfo.replace("${equipmentLocation}", equ.getEquipmentLocation()+"\n");
}else{
contentInfo = contentInfo.replace("${equipmentLocation}", "无"+"\n");
}
Pattern p= Pattern.compile("<[^>]+>");
Matcher m = p.matcher(contentInfo);
contentInfo = m.replaceAll("");
System.out.println(contentInfo);
wechart0.setText(contentInfo);
wecharts.add(wechart0);
}
logger.info("PDA端"+ equRepairOrder.getOrderSource() + "报修企业微信提醒请求:" + JSONObject.toJSONString(wecharts));
if (!CollectionUtils.isEmpty(wecharts)) {
new Thread(() -> {
AjaxResult wxresult = remoteOpenService.sendWeChartMessage(wecharts);
logger.info("PDA端报修企业微信提醒结果" + JSONObject.toJSONString(wxresult));
}).start();
}
//发企业微信--------------------结束
}
}
// 如果不存在未达标信息

Loading…
Cancel
Save