|
|
@ -3,13 +3,24 @@ package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesBasDowntimeReasonTypeService;
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesBasDowntimeReasonTypeService;
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.util.StringUtil;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesDowntimeReason;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesDowntimeReasonType;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesDowntimeReasonType;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.IMesBasDowntimeReasonRepository;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -22,12 +33,15 @@ import org.springframework.stereotype.Service;
|
|
|
|
@Service
|
|
|
|
@Service
|
|
|
|
@Slf4j
|
|
|
|
@Slf4j
|
|
|
|
public class MesBasDowntimeReasonTypeServiceImpl extends BaseMesService<MesDowntimeReasonType> implements IMesBasDowntimeReasonTypeService {
|
|
|
|
public class MesBasDowntimeReasonTypeServiceImpl extends BaseMesService<MesDowntimeReasonType> implements IMesBasDowntimeReasonTypeService {
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private IMesBasDowntimeReasonRepository downtimeReasonRDao;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void setPackQueryBean(MesDowntimeReasonType bean, DdlPackBean packBean) {
|
|
|
|
protected void setPackQueryBean(MesDowntimeReasonType bean, DdlPackBean packBean) {
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getReasonTypeCode(), "reasonTypeCode", packBean);
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getReasonTypeCode(), "reasonTypeCode", packBean);
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getReasonTypeName(), "reasonTypeName", packBean);
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getReasonTypeName(), "reasonTypeName", packBean);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onInsertBean(MesDowntimeReasonType item) {
|
|
|
|
protected void onInsertBean(MesDowntimeReasonType item) {
|
|
|
|
// 数据校验
|
|
|
|
// 数据校验
|
|
|
@ -49,4 +63,34 @@ public class MesBasDowntimeReasonTypeServiceImpl extends BaseMesService<MesDownt
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 查询设备停机类型和原因
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param downtimeReasonType
|
|
|
|
|
|
|
|
* @param pager
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public List<MesDowntimeReasonType> findMesDowntimeTypeReason(MesDowntimeReasonType downtimeReasonType, Pager pager) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ListPager<MesDowntimeReasonType> downtimeReasonTypeListPager = this.queryPager(downtimeReasonType, pager);
|
|
|
|
|
|
|
|
List<MesDowntimeReasonType> downtimeReasonTypeList = downtimeReasonTypeListPager.getObjectList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(downtimeReasonTypeList)) {
|
|
|
|
|
|
|
|
//查对应原因
|
|
|
|
|
|
|
|
List<MesDowntimeReason> mesDowntimeReasonList = downtimeReasonRDao.findByProperty(
|
|
|
|
|
|
|
|
new String[]{"organizeCode", "isDeleted", "isValid"},
|
|
|
|
|
|
|
|
new Object[]{downtimeReasonType.getOrganizeCode(),
|
|
|
|
|
|
|
|
CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue()});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, List<MesDowntimeReason>> reasonMap = mesDowntimeReasonList.stream().collect(Collectors.groupingBy(MesDowntimeReason::getReasonTypeCode));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (MesDowntimeReasonType mesDowntimeReasonType : downtimeReasonTypeList) {
|
|
|
|
|
|
|
|
if (!StringUtil.isEmpty(reasonMap.get(mesDowntimeReasonType.getReasonTypeCode()))) {
|
|
|
|
|
|
|
|
mesDowntimeReasonType.setDowntimeReasonList(reasonMap.get(mesDowntimeReasonType.getReasonTypeCode()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return downtimeReasonTypeList;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|