|
|
@ -580,31 +580,57 @@ public class BusVehicleDataHandoverService extends MybatisBaseService<BusVehicle |
|
|
|
IPage<AppNotCompleteRecordVo> pagging = baseMapper.notCompletePageVo(page, qw); |
|
|
|
List<AppNotCompleteRecordVo> records = pagging.getRecords(); |
|
|
|
records.removeAll(Collections.singleton(null)); |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
// 组装的map
|
|
|
|
Map<String, List<AppVinListVo>> map = new HashMap<>(); |
|
|
|
// 最后返回的list
|
|
|
|
for (AppNotCompleteRecordVo record : records) { |
|
|
|
List<AppVinListVo> forMapList = new ArrayList<>(); |
|
|
|
// 外层
|
|
|
|
String createName = record.getCreateName(); |
|
|
|
Date createTime = record.getCreateTime(); |
|
|
|
String createTimeFormat = sdf.format(createTime); |
|
|
|
record.setCreateInfo(createName + "," + createTimeFormat); |
|
|
|
record.setCreateInfo(createName); |
|
|
|
String contractNo = record.getContractId(); |
|
|
|
//根据合同编号查询车辆列表
|
|
|
|
// 根据合同编号查询车辆列表
|
|
|
|
List<AppVinListVo> vinListVos = baseMapper.selectByNo(contractNo); |
|
|
|
vinListVos.removeAll(Collections.singleton(null)); |
|
|
|
map.clear(); |
|
|
|
if (!vinListVos.isEmpty()) { |
|
|
|
// 组装
|
|
|
|
for (AppVinListVo vinVo : vinListVos) { |
|
|
|
String recordSid = vinVo.getRecordSid(); |
|
|
|
BusVehicleDataHandover handover = fetchBySid(recordSid); |
|
|
|
String linkSid = handover.getLinkSid(); |
|
|
|
//交车资料确认单
|
|
|
|
List<BuscenterFile> fileList = buscenterFileService.selectByLinkSid(linkSid, BuscenterFileEnum.ENTRUST_CONFIRM_IMAGES.getAttachType()); |
|
|
|
fileList.removeAll(Collections.singleton(null)); |
|
|
|
if (!fileList.isEmpty()) { |
|
|
|
List<String> entrustConfirmImages = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()).collect(Collectors.toList()); |
|
|
|
vinVo.setUrls(entrustConfirmImages); |
|
|
|
// 循环当前合同下的车架号
|
|
|
|
String billId = vinVo.getBillId(); |
|
|
|
// 取出来
|
|
|
|
List<AppVinListVo> vinListVos1 = map.get(billId); |
|
|
|
if (vinListVos1 == null) |
|
|
|
vinListVos1 = new ArrayList<>(); |
|
|
|
vinListVos1.add(vinVo); |
|
|
|
map.put(billId, vinListVos1); |
|
|
|
} |
|
|
|
for (Map.Entry<String, List<AppVinListVo>> m : map.entrySet()) { |
|
|
|
List<AppVinListVo> value = m.getValue(); |
|
|
|
for (int i = 0; i < value.size(); i++) { |
|
|
|
// 当前单据编号下的所有车架号
|
|
|
|
AppVinListVo appVinListVo = value.get(i); |
|
|
|
if (i == 0) { |
|
|
|
AppVinListVo appVinListVo1 = new AppVinListVo(); |
|
|
|
appVinListVo1.setViewType(0); |
|
|
|
appVinListVo1.setBillId(appVinListVo.getBillId()); |
|
|
|
BusVehicleDataHandover handover = fetchBySid(appVinListVo.getRecordSid()); |
|
|
|
String linkSid = handover.getLinkSid(); |
|
|
|
//交车资料确认单
|
|
|
|
List<BuscenterFile> fileList = buscenterFileService.selectByLinkSid(linkSid, BuscenterFileEnum.ENTRUST_CONFIRM_IMAGES.getAttachType()); |
|
|
|
fileList.removeAll(Collections.singleton(null)); |
|
|
|
if (!fileList.isEmpty()) { |
|
|
|
List<String> entrustConfirmImages = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()).collect(Collectors.toList()); |
|
|
|
appVinListVo1.setUrls(entrustConfirmImages); |
|
|
|
} |
|
|
|
forMapList.add(appVinListVo1); |
|
|
|
} |
|
|
|
appVinListVo.setViewType(1); |
|
|
|
forMapList.add(appVinListVo); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
record.setVinList(vinListVos); |
|
|
|
record.setVinList(forMapList); |
|
|
|
} |
|
|
|
PagerVo<AppNotCompleteRecordVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return rb.success().setData(p); |
|
|
|