|
|
|
@ -1,10 +1,15 @@
|
|
|
|
|
package com.op.device.service.impl;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
|
|
import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A;
|
|
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
|
|
import com.op.common.core.context.SecurityContextHolder;
|
|
|
|
@ -16,7 +21,12 @@ import com.op.common.core.web.domain.AjaxResult;
|
|
|
|
|
import com.op.common.security.utils.SecurityUtils;
|
|
|
|
|
import com.op.device.domain.*;
|
|
|
|
|
import com.op.device.mapper.*;
|
|
|
|
|
import com.op.system.api.RemoteOpenService;
|
|
|
|
|
import com.op.system.api.domain.SysNoticeGroup;
|
|
|
|
|
import com.op.system.api.domain.SysUser;
|
|
|
|
|
import com.op.system.api.domain.dto.WechartDTO;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import com.op.device.service.IEquOrderService;
|
|
|
|
@ -37,6 +47,8 @@ import static com.op.common.core.web.domain.AjaxResult.success;
|
|
|
|
|
*/
|
|
|
|
|
@Service
|
|
|
|
|
public class EquOrderServiceImpl implements IEquOrderService {
|
|
|
|
|
protected Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private EquOrderMapper equOrderMapper;
|
|
|
|
|
@Autowired
|
|
|
|
@ -59,6 +71,10 @@ public class EquOrderServiceImpl implements IEquOrderService {
|
|
|
|
|
private EquSpareApplyMapper equSpareApplyMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private SparePartsLedgerMapper sparePartsLedgerMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private RemoteOpenService remoteOpenService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private EquEquipmentMapper equEquipmentMapper;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询计划工单
|
|
|
|
@ -224,6 +240,7 @@ public class EquOrderServiceImpl implements IEquOrderService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取检查项信息列表
|
|
|
|
|
String orderDesc = "";
|
|
|
|
|
//照片格式
|
|
|
|
|
String imageType = "3";
|
|
|
|
|
List<EquOrderDetail> detailList = equOrder.getDetailList();
|
|
|
|
@ -268,7 +285,10 @@ public class EquOrderServiceImpl implements IEquOrderService {
|
|
|
|
|
hasError = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//不达标
|
|
|
|
|
if(standard.getDetailReach().equals("0")){
|
|
|
|
|
orderDesc = orderDesc + detail.getItemName() + ":" + standard.getStandardName()+"不达标;";
|
|
|
|
|
}
|
|
|
|
|
// 更新标准
|
|
|
|
|
standard.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
equOrderStandardMapper.updateEquOrderStandard(standard);
|
|
|
|
@ -342,6 +362,66 @@ public class EquOrderServiceImpl implements IEquOrderService {
|
|
|
|
|
String key = "#header.poolName";
|
|
|
|
|
equRepairOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_", ""));
|
|
|
|
|
equRepairOrderMapper.insertEquRepairOrder(equRepairOrder);
|
|
|
|
|
|
|
|
|
|
//点检巡检报修后
|
|
|
|
|
//发企业微信--------------------开始(跟班组有关)
|
|
|
|
|
SimpleDateFormat myFmt=new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒"); //规范时间格式
|
|
|
|
|
SysNoticeGroup noticeQo = new SysNoticeGroup();
|
|
|
|
|
//id写死了?
|
|
|
|
|
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}", equRepairOrder.getEquipmentCode()+"\n")
|
|
|
|
|
.replace("${orderCode}", equRepairOrder.getOrderCode()+"\n")
|
|
|
|
|
.replace("${orderDesc}", orderDesc+"\n")
|
|
|
|
|
.replace("${orderBreakdownTime}", myFmt.format(equRepairOrder.getOrderBreakdownTime())+"\n")
|
|
|
|
|
.replace("${orderRepairmanName}", equRepairOrder.getOrderRepairmanName()+"\n")
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
//查询设备相关信息
|
|
|
|
|
//设备名称
|
|
|
|
|
EquEquipment equ = equEquipmentMapper.selectEquEquipmentByEquEquipmentCode(equRepairOrder.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("PC端点检巡检报修企业微信提醒请求:" + JSONObject.toJSONString(wecharts));
|
|
|
|
|
if (!CollectionUtils.isEmpty(wecharts)) {
|
|
|
|
|
|
|
|
|
|
new Thread(() -> {
|
|
|
|
|
AjaxResult wxresult = remoteOpenService.sendWeChartMessage(wecharts);
|
|
|
|
|
logger.info("PC端点检巡检报修企业微信提醒结果:" + JSONObject.toJSONString(wxresult));
|
|
|
|
|
|
|
|
|
|
}).start();
|
|
|
|
|
}
|
|
|
|
|
//发企业微信--------------------结束
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 如果不存在未达标信息
|
|
|
|
|