|
|
@ -2,6 +2,7 @@ package com.win.module.eam.service.moldspotinspectionrecord; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.date.LocalDateTimeUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
@ -40,10 +41,11 @@ import com.win.module.eam.dal.mysql.planMasterDtbl.PlanMasterDtblMapper; |
|
|
|
import com.win.module.eam.dal.mysql.repairrelation.RepairRelationMapper; |
|
|
|
import com.win.module.eam.enums.basic.BasicStatusEnum; |
|
|
|
import com.win.module.eam.enums.order.OrderStatusEnum; |
|
|
|
import com.win.module.eam.job.vo.DeleteFileVO; |
|
|
|
import com.win.module.eam.service.attachmentfile.AttachmentFileService; |
|
|
|
import com.win.module.eam.service.common.DeleteFileService; |
|
|
|
import com.win.module.eam.service.deviceaccounts.DeviceAccountsService; |
|
|
|
import com.win.module.eam.service.devicemolditems.DeviceMoldItemsService; |
|
|
|
import com.win.module.eam.service.devicemoldmaintenanceconfig.DeviceMoldMaintenanceConfigService; |
|
|
|
import com.win.module.eam.service.devicerepairrequest.DeviceRepairRequestService; |
|
|
|
import com.win.module.eam.service.moldaccounts.MoldAccountsService; |
|
|
|
import com.win.module.eam.service.moldmaintenancejob.MoldMaintenanceJobMainService; |
|
|
@ -86,7 +88,7 @@ import static com.win.module.eam.enums.ErrorCodeConstants.XUN_JIAN_ORDER_NOT_EXI |
|
|
|
@Slf4j |
|
|
|
@Service |
|
|
|
@Validated |
|
|
|
public class MoldSpotInspectionRecordMainServiceImpl implements MoldSpotInspectionRecordMainService { |
|
|
|
public class MoldSpotInspectionRecordMainServiceImpl implements MoldSpotInspectionRecordMainService, DeleteFileService { |
|
|
|
|
|
|
|
@Resource |
|
|
|
private DeviceSpotInspectionRecordMainMapper deviceSpotInspectionRecordMainMapper; |
|
|
@ -161,12 +163,12 @@ public class MoldSpotInspectionRecordMainServiceImpl implements MoldSpotInspecti |
|
|
|
deviceSpotInspectionRecordMain.setMaintenance(getLoginUserId()); |
|
|
|
deviceSpotInspectionRecordMain.setStatus(OrderStatusEnum.JX_COMPLETED_STATUS.getCode());//完成
|
|
|
|
deviceSpotInspectionRecordMain.setCompletionTime(LocalDateTime.now()); |
|
|
|
if("MOLD".equals(createReqVO.getType())){//模具
|
|
|
|
if ("MOLD".equals(createReqVO.getType())) {//模具
|
|
|
|
QueryWrapper<MoldAccountsDO> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.eq("number", createReqVO.getDeviceNumber()); |
|
|
|
MoldAccountsDO deviceAccountsDO = moldAccountsMapper.selectOne(queryWrapper); |
|
|
|
deviceSpotInspectionRecordMain.setDeptId(Long.parseLong(deviceAccountsDO.getFactoryAreaNumber())); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
QueryWrapper<DeviceAccountsDO> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.eq("number", createReqVO.getDeviceNumber()); |
|
|
|
DeviceAccountsDO deviceAccountsDO = deviceAccountsMapper.selectOne(queryWrapper); |
|
|
@ -177,28 +179,28 @@ public class MoldSpotInspectionRecordMainServiceImpl implements MoldSpotInspecti |
|
|
|
//子巡检项信息录入
|
|
|
|
DeviceMoldMaintenanceConfigDO deviceMoldMaintenanceConfigDO = |
|
|
|
moldMaintenanceConfigMapper.selectOne(new LambdaQueryWrapperX<DeviceMoldMaintenanceConfigDO>() |
|
|
|
.eq(DeviceMoldMaintenanceConfigDO::getDeviceNumber,createReqVO.getDeviceNumber()) |
|
|
|
.eq(DeviceMoldMaintenanceConfigDO::getStatus,createReqVO.getStatus())); |
|
|
|
if(deviceMoldMaintenanceConfigDO == null || StringUtils.isEmpty(deviceMoldMaintenanceConfigDO.getMaintenanceItemId())){ |
|
|
|
.eq(DeviceMoldMaintenanceConfigDO::getDeviceNumber, createReqVO.getDeviceNumber()) |
|
|
|
.eq(DeviceMoldMaintenanceConfigDO::getStatus, createReqVO.getStatus())); |
|
|
|
if (deviceMoldMaintenanceConfigDO == null || StringUtils.isEmpty(deviceMoldMaintenanceConfigDO.getMaintenanceItemId())) { |
|
|
|
return 1L; |
|
|
|
} |
|
|
|
List<Long> maintenanceItemIds = Arrays.stream( deviceMoldMaintenanceConfigDO.getMaintenanceItemId().split(",")) |
|
|
|
List<Long> maintenanceItemIds = Arrays.stream(deviceMoldMaintenanceConfigDO.getMaintenanceItemId().split(",")) |
|
|
|
.map(Long::valueOf).collect(Collectors.toList()); |
|
|
|
List<DeviceMoldItemsDO> deviceMoldItemsDOS = deviceMoldItemsService.getDeviceMoldItemsList(maintenanceItemIds); |
|
|
|
List<DeviceMoldItemsDO> moldItemslist = new ArrayList<>(); |
|
|
|
for(DeviceMoldItemsDO en:deviceMoldItemsDOS){ |
|
|
|
for (DeviceMoldItemsDO en : deviceMoldItemsDOS) { |
|
|
|
DeviceSpotInspectionRecordDetailDO inspectionRecordDetailDO = new DeviceSpotInspectionRecordDetailDO(); |
|
|
|
List<Map<String, Object>> subList = createReqVO.getSubList(); |
|
|
|
Map<String, Object> mapMatch = new HashMap<>(); |
|
|
|
if(!subList.isEmpty()){ |
|
|
|
for(Map<String, Object> map:subList){ |
|
|
|
if (!subList.isEmpty()) { |
|
|
|
for (Map<String, Object> map : subList) { |
|
|
|
mapMatch = map; |
|
|
|
long id = Long.parseLong(map.get("id").toString()); |
|
|
|
if(id==en.getId()){ |
|
|
|
inspectionRecordDetailDO.setIsConform(map.get("isConform")==null?"FALSE":map.get("isConform").toString()); |
|
|
|
inspectionRecordDetailDO.setRecords(map.get("records")==null?null:map.get("records").toString()); |
|
|
|
en.setSpotDescription(map.get("records")==null?null:map.get("records").toString()); |
|
|
|
if("FALSE".equals(inspectionRecordDetailDO.getIsConform())){ |
|
|
|
if (id == en.getId()) { |
|
|
|
inspectionRecordDetailDO.setIsConform(map.get("isConform") == null ? "FALSE" : map.get("isConform").toString()); |
|
|
|
inspectionRecordDetailDO.setRecords(map.get("records") == null ? null : map.get("records").toString()); |
|
|
|
en.setSpotDescription(map.get("records") == null ? null : map.get("records").toString()); |
|
|
|
if ("FALSE".equals(inspectionRecordDetailDO.getIsConform())) { |
|
|
|
moldItemslist.add(en); |
|
|
|
} |
|
|
|
inspectionRecordDetailDO.setMasterId(deviceSpotInspectionRecordMain.getId()); |
|
|
@ -207,24 +209,23 @@ public class MoldSpotInspectionRecordMainServiceImpl implements MoldSpotInspecti |
|
|
|
inspectionRecordDetailDO.setEquipmentPosition(en.getEquipmentParts()); |
|
|
|
deviceSpotInspectionRecordDetailMapper.insert(inspectionRecordDetailDO); |
|
|
|
//维护上传的文件
|
|
|
|
createSpotInspectionUploadFile(number, mapMatch,inspectionRecordDetailDO); |
|
|
|
createSpotInspectionUploadFile(number, mapMatch, inspectionRecordDetailDO); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
dealApplyRepired(deviceSpotInspectionRecordMain,moldItemslist); |
|
|
|
dealApplyRepired(deviceSpotInspectionRecordMain, moldItemslist); |
|
|
|
Long id = deviceSpotInspectionRecordMain.getId(); |
|
|
|
//发送邮件
|
|
|
|
try { |
|
|
|
sendEmails(deviceSpotInspectionRecordMain); |
|
|
|
} catch (Exception e) { |
|
|
|
info("发送邮件异常:{}",e); |
|
|
|
info("发送邮件异常:{}", e); |
|
|
|
} |
|
|
|
return id; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void createSpotInspectionUploadFile(String number, Map<String, Object> map, DeviceSpotInspectionRecordDetailDO inspectionRecordDetailDO) { |
|
|
|
// 文件入库处理
|
|
|
|
UploadFileRequest fileUploadRequest = new UploadFileRequest(); |
|
|
@ -262,34 +263,33 @@ public class MoldSpotInspectionRecordMainServiceImpl implements MoldSpotInspecti |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
private MoldMaintenanceJobMainService moldMaintenanceJobMainService; |
|
|
|
|
|
|
|
private void dealApplyRepired(DeviceSpotInspectionRecordMainDO mainDO, List<DeviceMoldItemsDO> moldItemslist){ |
|
|
|
if(moldItemslist.size()>0){ |
|
|
|
private void dealApplyRepired(DeviceSpotInspectionRecordMainDO mainDO, List<DeviceMoldItemsDO> moldItemslist) { |
|
|
|
if (moldItemslist.size() > 0) { |
|
|
|
//校验设备是否已经维修中,是:则不再创建报修工单,否:则创建
|
|
|
|
Boolean isRepair = false; |
|
|
|
//创建报修工单
|
|
|
|
if(BasicStatusEnum.BASIC_DEVICE.getCode().equals( mainDO.getType())){ |
|
|
|
if (BasicStatusEnum.BASIC_DEVICE.getCode().equals(mainDO.getType())) { |
|
|
|
DeviceAccountsExportReqVO deviceAccountsExportReqVO = new DeviceAccountsExportReqVO(); |
|
|
|
deviceAccountsExportReqVO.setNumber(mainDO.getDeviceNumber()); |
|
|
|
deviceAccountsExportReqVO.setStatus(BasicStatusEnum.BASIC_STATUS_1.getCode()); |
|
|
|
List<DeviceAccountsDO> list = deviceAccountsService.getDeviceAccountsList(deviceAccountsExportReqVO); |
|
|
|
if(list.size()>0){ |
|
|
|
if (list.size() > 0) { |
|
|
|
isRepair = true; |
|
|
|
} |
|
|
|
}else if(BasicStatusEnum.BASIC_MOLD.getCode().equals( mainDO.getType())){ |
|
|
|
} else if (BasicStatusEnum.BASIC_MOLD.getCode().equals(mainDO.getType())) { |
|
|
|
MoldAccountsExportReqVO moldAccountsExportReqVO = new MoldAccountsExportReqVO(); |
|
|
|
moldAccountsExportReqVO.setNumber(mainDO.getDeviceNumber()); |
|
|
|
moldAccountsExportReqVO.setStatus(BasicStatusEnum.BASIC_STATUS_1.getCode()); |
|
|
|
List<MoldAccountsDO> list = moldAccountsService.getMoldAccountsList(moldAccountsExportReqVO); |
|
|
|
if(list.size()>0){ |
|
|
|
if (list.size() > 0) { |
|
|
|
isRepair = true; |
|
|
|
} |
|
|
|
} |
|
|
|
//已经有维修工单则不再创建
|
|
|
|
if(isRepair){ |
|
|
|
if (isRepair) { |
|
|
|
return; |
|
|
|
} |
|
|
|
// 拼接 moldItemslist 中每项的 name
|
|
|
@ -297,7 +297,7 @@ public class MoldSpotInspectionRecordMainServiceImpl implements MoldSpotInspecti |
|
|
|
describesBuilder.append("点检问题报修:"); |
|
|
|
for (int i = 0; i < moldItemslist.size(); i++) { |
|
|
|
DeviceMoldItemsDO item = moldItemslist.get(i); |
|
|
|
describesBuilder.append(i + 1).append("、").append(item.getName()+":【"+item.getSpotDescription()+"】"); |
|
|
|
describesBuilder.append(i + 1).append("、").append(item.getName() + ":【" + item.getSpotDescription() + "】"); |
|
|
|
if (i < moldItemslist.size() - 1) { |
|
|
|
describesBuilder.append("; "); |
|
|
|
} |
|
|
@ -312,7 +312,7 @@ public class MoldSpotInspectionRecordMainServiceImpl implements MoldSpotInspecti |
|
|
|
Long repairRequestId = deviceRepairRequestService.createDeviceRepair(createReqVO); |
|
|
|
DeviceMaintenanceJobMainDO deviceMaintenanceJobMainDO = moldMaintenanceJobMainService.getDeviceMaintenanceMain(repairRequestId); |
|
|
|
List<RepairRelationDO> repairRelationList = new ArrayList<>(); |
|
|
|
moldItemslist.stream().forEach(en->{ |
|
|
|
moldItemslist.stream().forEach(en -> { |
|
|
|
RepairRelationDO repairRelationDO = new RepairRelationDO(); |
|
|
|
repairRelationDO.setSpotInspectionId(en.getId()); |
|
|
|
repairRelationDO.setSpotInspectionName(en.getName()); |
|
|
@ -326,12 +326,10 @@ public class MoldSpotInspectionRecordMainServiceImpl implements MoldSpotInspecti |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public Integer updateDeviceSpotInspectionRecordMain(DeviceSpotInspectionRecordMainUpdateReqVO updateReqVO) { |
|
|
|
// 校验存在
|
|
|
|
validateDeviceSpotInspectionRecordMainExists(updateReqVO.getId()); |
|
|
|
validateDeviceSpotInspectionRecordMainExists(updateReqVO.getId()); |
|
|
|
// 更新
|
|
|
|
DeviceSpotInspectionRecordMainDO updateObj = DeviceSpotInspectionRecordMainConvert.INSTANCE.convert(updateReqVO); |
|
|
|
return deviceSpotInspectionRecordMainMapper.updateById(updateObj); |
|
|
@ -448,19 +446,19 @@ public class MoldSpotInspectionRecordMainServiceImpl implements MoldSpotInspecti |
|
|
|
pageReqVO.setClassType("MOLD"); |
|
|
|
IPage<DeviceSpotInspectionRecordMainDO> pageInfo = deviceSpotInspectionRecordMainMapper.getAppPage(new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()), pageReqVO); |
|
|
|
if (pageInfo != null) { |
|
|
|
for(DeviceSpotInspectionRecordMainDO en :pageInfo.getRecords()){ |
|
|
|
for (DeviceSpotInspectionRecordMainDO en : pageInfo.getRecords()) { |
|
|
|
String deviceNumber = en.getDeviceNumber(); |
|
|
|
String type = en.getType(); |
|
|
|
if("MOLD".equals(type)){//模具
|
|
|
|
if ("MOLD".equals(type)) {//模具
|
|
|
|
Map<String, Object> detailsByNumber = moldAccountsMapper.getDetailsByNumber(deviceNumber); |
|
|
|
en.setFactoryAreaNumber(detailsByNumber==null?"":detailsByNumber.get("factoryAreaNumber").toString()); |
|
|
|
en.setFactoryAreaName(detailsByNumber==null?"":detailsByNumber.get("factoryAreaName").toString()); |
|
|
|
en.setName(detailsByNumber==null?"":detailsByNumber.get("name").toString()); |
|
|
|
}else{//设备
|
|
|
|
en.setFactoryAreaNumber(detailsByNumber == null ? "" : detailsByNumber.get("factoryAreaNumber").toString()); |
|
|
|
en.setFactoryAreaName(detailsByNumber == null ? "" : detailsByNumber.get("factoryAreaName").toString()); |
|
|
|
en.setName(detailsByNumber == null ? "" : detailsByNumber.get("name").toString()); |
|
|
|
} else {//设备
|
|
|
|
Map<String, Object> detailsByNumber = deviceAccountsMapper.getDetailsByNumber(deviceNumber); |
|
|
|
en.setFactoryAreaNumber(detailsByNumber==null?"":detailsByNumber.get("factoryAreaNumber").toString()); |
|
|
|
en.setFactoryAreaName(detailsByNumber==null?"":detailsByNumber.get("factoryAreaName").toString()); |
|
|
|
en.setName(detailsByNumber==null?"":detailsByNumber.get("name").toString()); |
|
|
|
en.setFactoryAreaNumber(detailsByNumber == null ? "" : detailsByNumber.get("factoryAreaNumber").toString()); |
|
|
|
en.setFactoryAreaName(detailsByNumber == null ? "" : detailsByNumber.get("factoryAreaName").toString()); |
|
|
|
en.setName(detailsByNumber == null ? "" : detailsByNumber.get("name").toString()); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
@ -470,32 +468,31 @@ public class MoldSpotInspectionRecordMainServiceImpl implements MoldSpotInspecti |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void createSpotInspectionTask(int type) { |
|
|
|
String times = null; |
|
|
|
String classes = "0"; |
|
|
|
if(0==type){//早班巡检
|
|
|
|
if (0 == type) {//早班巡检
|
|
|
|
// 设置为当天的 8:30
|
|
|
|
ConfigDTO configByKey = apiConfigApi.getConfigByKey("record_spot_inspection.start_time"); |
|
|
|
String value = configByKey.getValue(); |
|
|
|
times = LocalDateTimeUtil.format(LocalDate.now(), "yyyy-MM-dd"); |
|
|
|
times = times+" "+value; |
|
|
|
}else{//晚班巡检
|
|
|
|
times = times + " " + value; |
|
|
|
} else {//晚班巡检
|
|
|
|
classes = "1"; |
|
|
|
// 设置为当天的 17:30
|
|
|
|
ConfigDTO configByKey = apiConfigApi.getConfigByKey("record_spot_inspection.end_time"); |
|
|
|
String value = configByKey.getValue(); |
|
|
|
times = LocalDateTimeUtil.format(LocalDate.now(), "yyyy-MM-dd"); |
|
|
|
times = times+" "+value; |
|
|
|
times = times + " " + value; |
|
|
|
} |
|
|
|
List<Map<String, Object>> list2 = deptApi.selectAllFactoryArea(); |
|
|
|
for (Map<String, Object> map : list2) { |
|
|
|
// 如果Map中已存在该键,则添加
|
|
|
|
String factoryAreaNumber = map.get("id").toString(); |
|
|
|
List<DeviceSpotInspectionRecordMainDO> list = deviceSpotInspectionRecordMainMapper.selectSpotInspectionTask(times,factoryAreaNumber,classes); |
|
|
|
List<DeviceSpotInspectionRecordMainDO> list = deviceSpotInspectionRecordMainMapper.selectSpotInspectionTask(times, factoryAreaNumber, classes); |
|
|
|
StringBuilder str = new StringBuilder(); |
|
|
|
for(DeviceSpotInspectionRecordMainDO en:list){ |
|
|
|
for (DeviceSpotInspectionRecordMainDO en : list) { |
|
|
|
str.append("<p> 设备名称("); |
|
|
|
String name = en.getName(); |
|
|
|
str.append(name); |
|
|
@ -507,11 +504,11 @@ public class MoldSpotInspectionRecordMainServiceImpl implements MoldSpotInspecti |
|
|
|
} |
|
|
|
//发送邮件
|
|
|
|
try { |
|
|
|
if(!list.isEmpty()){ |
|
|
|
sendEmails(times,str.toString(),factoryAreaNumber); |
|
|
|
if (!list.isEmpty()) { |
|
|
|
sendEmails(times, str.toString(), factoryAreaNumber); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
info("发送邮件异常:{}",e); |
|
|
|
info("发送邮件异常:{}", e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -522,9 +519,9 @@ public class MoldSpotInspectionRecordMainServiceImpl implements MoldSpotInspecti |
|
|
|
* @param str |
|
|
|
* @param factoryAreaNumber |
|
|
|
*/ |
|
|
|
private void sendEmails(String times,String str,String factoryAreaNumber){ |
|
|
|
private void sendEmails(String times, String str, String factoryAreaNumber) { |
|
|
|
List<ClassTypeDO> userBeanList = classTypeMapper.JudgeIdentity(null, "DEVICE", "1", factoryAreaNumber); |
|
|
|
userBeanList.stream().forEach(item ->{ |
|
|
|
userBeanList.stream().forEach(item -> { |
|
|
|
try { |
|
|
|
MailSendSingleToUserReqDTO mailSendSingleToUserReqDTO = new MailSendSingleToUserReqDTO(); |
|
|
|
mailSendSingleToUserReqDTO.setUserId(Long.valueOf(item.getUserId())); |
|
|
@ -534,8 +531,8 @@ public class MoldSpotInspectionRecordMainServiceImpl implements MoldSpotInspecti |
|
|
|
params.put("times", times); |
|
|
|
mailSendSingleToUserReqDTO.setTemplateParams(params); |
|
|
|
mailSendApi.sendSingleMailToAdmin(mailSendSingleToUserReqDTO); |
|
|
|
}catch(RuntimeException e){ |
|
|
|
info("巡检点检的日期为"+times+",来自"+factoryAreaNumber+"给设备工程师发送的邮件通知失败:{}", e); |
|
|
|
} catch (RuntimeException e) { |
|
|
|
info("巡检点检的日期为" + times + ",来自" + factoryAreaNumber + "给设备工程师发送的邮件通知失败:{}", e); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
@ -544,21 +541,21 @@ public class MoldSpotInspectionRecordMainServiceImpl implements MoldSpotInspecti |
|
|
|
* 巡检点验证给工程师发邮件 |
|
|
|
* @param mainDO |
|
|
|
*/ |
|
|
|
private void sendEmails(DeviceSpotInspectionRecordMainDO mainDO){ |
|
|
|
private void sendEmails(DeviceSpotInspectionRecordMainDO mainDO) { |
|
|
|
List<ClassTypeDO> userBeanList = classTypeMapper.JudgeIdentity(null, mainDO.getType(), "1", mainDO.getFactoryAreaNumber()); |
|
|
|
userBeanList.stream().forEach(item ->{ |
|
|
|
userBeanList.stream().forEach(item -> { |
|
|
|
try { |
|
|
|
MailSendSingleToUserReqDTO mailSendSingleToUserReqDTO = new MailSendSingleToUserReqDTO(); |
|
|
|
mailSendSingleToUserReqDTO.setUserId(Long.valueOf(item.getUserId())); |
|
|
|
mailSendSingleToUserReqDTO.setTemplateCode("record_spot_inspection_verify"); |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("typeName","设备"); |
|
|
|
params.put("typeName", "设备"); |
|
|
|
params.put("number", mainDO.getNumber()); |
|
|
|
params.put("name", item.getNickname()); |
|
|
|
mailSendSingleToUserReqDTO.setTemplateParams(params); |
|
|
|
mailSendApi.sendSingleMailToAdmin(mailSendSingleToUserReqDTO); |
|
|
|
}catch(RuntimeException e){ |
|
|
|
info("工单编号为"+mainDO.getNumber()+"的名为:"+mainDO.getDescribes()+"的工单给"+item.getNickname()+"发送的邮件通知失败:{}", e); |
|
|
|
} catch (RuntimeException e) { |
|
|
|
info("工单编号为" + mainDO.getNumber() + "的名为:" + mainDO.getDescribes() + "的工单给" + item.getNickname() + "发送的邮件通知失败:{}", e); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
@ -574,7 +571,7 @@ public class MoldSpotInspectionRecordMainServiceImpl implements MoldSpotInspecti |
|
|
|
String shift = currentTime.isAfter(startTime) && currentTime.isBefore(endTime) ? "白班" : "夜班"; |
|
|
|
|
|
|
|
List<ProducePlanDO> producePlanDOList = producePlanService.getProducePlan(planDate, shift); |
|
|
|
if(CollectionUtils.isEmpty(producePlanDOList)){ |
|
|
|
if (CollectionUtils.isEmpty(producePlanDOList)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
@ -582,7 +579,7 @@ public class MoldSpotInspectionRecordMainServiceImpl implements MoldSpotInspecti |
|
|
|
planMasterDtblMapper.insertBatch(planMasterDtblDOList); |
|
|
|
|
|
|
|
String previousPlanDate, previouseShift; |
|
|
|
if(currentTime.isAfter(startTime) && currentTime.isBefore(endTime)){ |
|
|
|
if (currentTime.isAfter(startTime) && currentTime.isBefore(endTime)) { |
|
|
|
LocalDate previousDate = currentDate.minusDays(1); |
|
|
|
previousPlanDate = previousDate.format(formatter); |
|
|
|
previouseShift = "夜班"; |
|
|
@ -597,7 +594,7 @@ public class MoldSpotInspectionRecordMainServiceImpl implements MoldSpotInspecti |
|
|
|
.orderByAsc(PlanMasterDtblDO::getPlanCode).orderByAsc(PlanMasterDtblDO::getSeq)); |
|
|
|
|
|
|
|
PlanMasterDtblDO previousPlan = null; |
|
|
|
if(!CollectionUtils.isEmpty(previousPlanList)){ |
|
|
|
if (!CollectionUtils.isEmpty(previousPlanList)) { |
|
|
|
previousPlan = previousPlanList.get(previousPlanList.size() - 1); |
|
|
|
} |
|
|
|
|
|
|
@ -605,7 +602,7 @@ public class MoldSpotInspectionRecordMainServiceImpl implements MoldSpotInspecti |
|
|
|
.map(PlanMasterDtblDO::getItemCode) |
|
|
|
.collect(Collectors.toSet()); |
|
|
|
|
|
|
|
if(previousPlan != null){ |
|
|
|
if (previousPlan != null) { |
|
|
|
itemCodeSet.add(previousPlan.getItemCode()); |
|
|
|
} |
|
|
|
|
|
|
@ -619,9 +616,9 @@ public class MoldSpotInspectionRecordMainServiceImpl implements MoldSpotInspecti |
|
|
|
(existing, replacement) -> existing)); |
|
|
|
|
|
|
|
String moldCode = previousPlan != null ? itemCodeMoldNumberMap.get(previousPlan.getItemCode()) : itemCodeMoldNumberMap.get(planMasterDtblDOList.get(0).getItemCode()); |
|
|
|
for(PlanMasterDtblDO planMasterDtblDO : planMasterDtblDOList){ |
|
|
|
for (PlanMasterDtblDO planMasterDtblDO : planMasterDtblDOList) { |
|
|
|
String nextMoldCode = itemCodeMoldNumberMap.get(planMasterDtblDO.getItemCode()); |
|
|
|
if(!StringUtils.isEmpty(moldCode) && !moldCode.equals(nextMoldCode)){ |
|
|
|
if (!StringUtils.isEmpty(moldCode) && !moldCode.equals(nextMoldCode)) { |
|
|
|
createModlInspection(moldCode); |
|
|
|
} |
|
|
|
moldCode = nextMoldCode; |
|
|
@ -635,10 +632,10 @@ public class MoldSpotInspectionRecordMainServiceImpl implements MoldSpotInspecti |
|
|
|
.eq(DeviceMoldMaintenanceConfigDO::getType, "MOLD") |
|
|
|
.eq(DeviceMoldMaintenanceConfigDO::getStatus, "INSPECTION")); |
|
|
|
|
|
|
|
if(deviceMoldMaintenanceConfigDO == null){ |
|
|
|
if (deviceMoldMaintenanceConfigDO == null) { |
|
|
|
return; |
|
|
|
} |
|
|
|
List<Long> maintenanceItemIds = Arrays.stream( deviceMoldMaintenanceConfigDO.getMaintenanceItemId().split(",")) |
|
|
|
List<Long> maintenanceItemIds = Arrays.stream(deviceMoldMaintenanceConfigDO.getMaintenanceItemId().split(",")) |
|
|
|
.map(Long::valueOf).collect(Collectors.toList()); |
|
|
|
List<DeviceMoldItemsDO> deviceMoldItemsDOList = deviceMoldItemsService.getDeviceMoldItemsList(maintenanceItemIds); |
|
|
|
|
|
|
@ -658,7 +655,7 @@ public class MoldSpotInspectionRecordMainServiceImpl implements MoldSpotInspecti |
|
|
|
deviceSpotInspectionRecordMainMapper.insert(deviceSpotInspectionRecordMain); |
|
|
|
|
|
|
|
List<DeviceSpotInspectionRecordDetailDO> detailDOList = new ArrayList<>(); |
|
|
|
for(DeviceMoldItemsDO deviceMoldItemsDO : deviceMoldItemsDOList){ |
|
|
|
for (DeviceMoldItemsDO deviceMoldItemsDO : deviceMoldItemsDOList) { |
|
|
|
DeviceSpotInspectionRecordDetailDO inspectionRecordDetailDO = new DeviceSpotInspectionRecordDetailDO(); |
|
|
|
inspectionRecordDetailDO.setMasterId(deviceSpotInspectionRecordMain.getId()); |
|
|
|
inspectionRecordDetailDO.setNumber(number); |
|
|
@ -668,4 +665,37 @@ public class MoldSpotInspectionRecordMainServiceImpl implements MoldSpotInspecti |
|
|
|
} |
|
|
|
deviceSpotInspectionRecordDetailMapper.insertBatch(detailDOList); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public DeleteFileVO<?> findeDeleteFileVO() { |
|
|
|
List<DeviceSpotInspectionRecordMainDO> mainList = deviceSpotInspectionRecordMainMapper.selectList( |
|
|
|
new LambdaQueryWrapper<DeviceSpotInspectionRecordMainDO>() |
|
|
|
.eq(DeviceSpotInspectionRecordMainDO::getStatus, OrderStatusEnum.COMPLETED_STATUS.getCode()) |
|
|
|
.ne(DeviceSpotInspectionRecordMainDO::getIsDeleteFile, 1) |
|
|
|
.lt(DeviceSpotInspectionRecordMainDO::getCreateTime, LocalDateTime.now().minusDays(30)) |
|
|
|
); |
|
|
|
if (CollectionUtils.isEmpty(mainList)) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
List<Long> mainVoList = mainList.stream().map(DeviceSpotInspectionRecordMainDO::getId).toList(); |
|
|
|
DeleteFileVO<DeviceSpotInspectionRecordMainDO> mainDeleteFileVO = new DeleteFileVO<>(); |
|
|
|
mainDeleteFileVO.setIds(mainVoList); |
|
|
|
mainDeleteFileVO.setNumberList(mainList.stream().map(DeviceSpotInspectionRecordMainDO::getNumber).toList()); |
|
|
|
mainDeleteFileVO.setBaseMapper(deviceSpotInspectionRecordMainMapper); |
|
|
|
|
|
|
|
List<String> mainIdList = mainList.stream().map(DeviceSpotInspectionRecordMainDO::getNumber).toList(); |
|
|
|
|
|
|
|
List<DeviceSpotInspectionRecordDetailDO> detailList = deviceSpotInspectionRecordDetailMapper.selectList( |
|
|
|
new LambdaQueryWrapper<DeviceSpotInspectionRecordDetailDO>() |
|
|
|
.ne(DeviceSpotInspectionRecordDetailDO::getIsDeleteFile, 1) |
|
|
|
.in(DeviceSpotInspectionRecordDetailDO::getMasterId, mainIdList)); |
|
|
|
List<Long> detailVoList = detailList.stream().map(DeviceSpotInspectionRecordDetailDO::getId).toList(); |
|
|
|
DeleteFileVO<DeviceSpotInspectionRecordDetailDO> detailDeleteFileVO = new DeleteFileVO<>(); |
|
|
|
detailDeleteFileVO.setIds(detailVoList); |
|
|
|
detailDeleteFileVO.setNumberList(detailList.stream().map(DeviceSpotInspectionRecordDetailDO::getNumber).toList()); |
|
|
|
detailDeleteFileVO.setFuncCode("INSPECTION_CREATE"); |
|
|
|
detailDeleteFileVO.setBaseMapper(deviceSpotInspectionRecordDetailMapper); |
|
|
|
mainDeleteFileVO.setSubVO(detailDeleteFileVO); |
|
|
|
return mainDeleteFileVO; |
|
|
|
} |
|
|
|
} |
|
|
|