|
|
|
|
@ -19,19 +19,22 @@ import org.springblade.desk.basic.util.QueryUtils; |
|
|
|
|
import org.springblade.desk.dashboard.pojo.vo.DsProModelVO; |
|
|
|
|
import org.springblade.desk.quality.excel.InspectionTemplateExcel; |
|
|
|
|
import org.springblade.desk.quality.mapper.InspectionTemplateMapper; |
|
|
|
|
import org.springblade.desk.quality.pojo.entity.InspectionItem; |
|
|
|
|
import org.springblade.desk.quality.pojo.entity.InspectionTemplate; |
|
|
|
|
import org.springblade.desk.quality.pojo.entity.RelInsTemplateItem; |
|
|
|
|
import org.springblade.desk.quality.pojo.entity.Standard; |
|
|
|
|
import org.springblade.desk.quality.pojo.request.InspectionTemplateSearch; |
|
|
|
|
import org.springblade.desk.quality.pojo.vo.InspectionTemplateVO; |
|
|
|
|
import org.springblade.desk.quality.service.IInspectionItemService; |
|
|
|
|
import org.springblade.desk.quality.service.IInspectionTemplateService; |
|
|
|
|
import org.springblade.desk.quality.service.IRelInsTemplateItemService; |
|
|
|
|
import org.springblade.desk.quality.service.IStandardService; |
|
|
|
|
import org.springblade.system.feign.IDictClient; |
|
|
|
|
import org.springblade.system.feign.IUserClient; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.function.Function; |
|
|
|
|
import java.util.regex.Matcher; |
|
|
|
|
import java.util.regex.Pattern; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
@ -56,6 +59,11 @@ public class InspectionTemplateServiceImpl extends BaseServiceImpl<InspectionTem |
|
|
|
|
private IUserClient userClient; |
|
|
|
|
@Resource |
|
|
|
|
private IRelInsTemplateItemService relInsTemplateItemService; |
|
|
|
|
@Resource |
|
|
|
|
private IInspectionItemService inspectionItemService; |
|
|
|
|
@Resource |
|
|
|
|
private IStandardService standardService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<InspectionTemplateVO> selectInspectionTemplatePage(IPage<InspectionTemplateVO> page, |
|
|
|
|
@ -81,6 +89,50 @@ public class InspectionTemplateServiceImpl extends BaseServiceImpl<InspectionTem |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
List<RelInsTemplateItem> detailList = relInsTemplateItemService.getListByTemplateId(vo.getId()); |
|
|
|
|
if (CollectionUtils.isNotEmpty(detailList)) { |
|
|
|
|
// 检验项目
|
|
|
|
|
Set<Long> inspectionItemIds = detailList.stream() |
|
|
|
|
.map(RelInsTemplateItem::getInspectionItemId) |
|
|
|
|
.filter(Objects::nonNull) |
|
|
|
|
.collect(Collectors.toSet()); |
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(inspectionItemIds)) { |
|
|
|
|
List<InspectionItem> inspectionItems = inspectionItemService.listByIds(inspectionItemIds); |
|
|
|
|
Map<Long, InspectionItem> inspectionItemMap = inspectionItems.stream() |
|
|
|
|
.collect(Collectors.toMap(InspectionItem::getId, Function.identity())); |
|
|
|
|
|
|
|
|
|
// 设置检验项目名称
|
|
|
|
|
detailList.forEach(item -> { |
|
|
|
|
if (item.getInspectionItemId() != null) { |
|
|
|
|
InspectionItem inspectionItem = inspectionItemMap.get(item.getInspectionItemId()); |
|
|
|
|
if (inspectionItem != null) { |
|
|
|
|
item.setInspectionItemName(inspectionItem.getName()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 检验标准
|
|
|
|
|
Set<Long> standardIds = detailList.stream() |
|
|
|
|
.map(RelInsTemplateItem::getStandardId) |
|
|
|
|
.filter(Objects::nonNull) |
|
|
|
|
.collect(Collectors.toSet()); |
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(standardIds)) { |
|
|
|
|
List<Standard> standards = standardService.listByIds(standardIds); |
|
|
|
|
Map<Long, Standard> standardMap = standards.stream() |
|
|
|
|
.collect(Collectors.toMap(Standard::getId, Function.identity())); |
|
|
|
|
|
|
|
|
|
detailList.forEach(item -> { |
|
|
|
|
if (item.getStandardId() != null) { |
|
|
|
|
Standard standard = standardMap.get(item.getStandardId()); |
|
|
|
|
if (standard != null) { |
|
|
|
|
item.setStandardName(standard.getName()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
vo.setDetailList(detailList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -136,7 +188,7 @@ public class InspectionTemplateServiceImpl extends BaseServiceImpl<InspectionTem |
|
|
|
|
log.error("查询类别名称失败, category: {}", vo.getCategory(), e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 4. 按英文部分排序
|
|
|
|
|
result.sort((o1, o2) -> { |
|
|
|
|
|