|
|
@ -698,4 +698,239 @@ public class BusVehicleDataHandoverService extends MybatisBaseService<BusVehicle |
|
|
|
PagerVo<AppCompleteRecordVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return rb.success().setData(p); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 上传图片 |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean saveCarDocsRecordImg(AppUploadDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String billId = dto.getBillId(); |
|
|
|
List<BusVehicleDataHandover> data = getDataByBillNo(billId).getData(); |
|
|
|
data.removeAll(Collections.singleton(null)); |
|
|
|
if (!data.isEmpty()) { |
|
|
|
for (BusVehicleDataHandover handover : data) { |
|
|
|
String saveSid = handover.getSid(); |
|
|
|
buscenterFileService.delByLinkSidOrType(saveSid, BuscenterFileEnum.VEHICLE_SECOND_DATA_HANDOVER.getAttachType()); |
|
|
|
List<String> imgs = dto.getImgs(); |
|
|
|
if (!imgs.isEmpty()) { |
|
|
|
buscenterFileService.saveAll(saveSid, imgs, BuscenterFileEnum.VEHICLE_SECOND_DATA_HANDOVER.getAttachType()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 查看图片 |
|
|
|
* |
|
|
|
* @param billId |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean<List<String>> getCarDocsRecordImg(String billId) { |
|
|
|
ResultBean<List<String>> rb = ResultBean.fireFail(); |
|
|
|
List<BusVehicleDataHandover> data = getDataByBillNo(billId).getData(); |
|
|
|
data.removeAll(Collections.singleton(null)); |
|
|
|
if (!data.isEmpty()) { |
|
|
|
for (BusVehicleDataHandover datum : data) { |
|
|
|
String sid = datum.getSid(); |
|
|
|
if (StringUtils.isNotBlank(datum.getLinkSid())) { |
|
|
|
//交车资料确认单
|
|
|
|
List<BuscenterFile> fileList = buscenterFileService.selectByLinkSid(sid, 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()); |
|
|
|
return rb.success().setData(entrustConfirmImages); |
|
|
|
} |
|
|
|
} else { |
|
|
|
//交车资料确认单
|
|
|
|
List<BuscenterFile> fileList = buscenterFileService.selectByLinkSid(sid, BuscenterFileEnum.VEHICLE_SECOND_DATA_HANDOVER.getAttachType()); |
|
|
|
fileList.removeAll(Collections.singleton(null)); |
|
|
|
if (!fileList.isEmpty()) { |
|
|
|
List<String> entrustConfirmImages = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()).collect(Collectors.toList()); |
|
|
|
return rb.success().setData(entrustConfirmImages); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 编辑初始化/详情 |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean<AppInitVo> initCarDocsRecord(AppInitDto dto) { |
|
|
|
ResultBean<AppInitVo> rb = ResultBean.fireFail(); |
|
|
|
AppInitVo vo = new AppInitVo(); |
|
|
|
List<AppListBean> list = new ArrayList<>(); |
|
|
|
if (StringUtils.isNotBlank(dto.getBillId())) { |
|
|
|
return rb.success().setData(vo); |
|
|
|
} else { |
|
|
|
List<String> sids = dto.getVinRecordSid(); |
|
|
|
vo.setOperaDate(new Date()); |
|
|
|
for (String sid : sids) { |
|
|
|
StringBuffer sb = new StringBuffer(); |
|
|
|
BusVehicleDataHandover entity = fetchBySid(sid); |
|
|
|
vo.setContractId(entity.getContractNo()); |
|
|
|
vo.setCustomerName(entity.getCustomerName()); |
|
|
|
String linkSid = entity.getLinkSid(); |
|
|
|
List<BusHandoverItems> handoverItems = busHandoverItemsService.getItemsListByMainSid(linkSid).getData(); |
|
|
|
handoverItems.removeAll(Collections.singleton(null)); |
|
|
|
AppListBean dataListVo = new AppListBean(); |
|
|
|
if (!handoverItems.isEmpty()) { |
|
|
|
for (BusHandoverItems handoverItem : handoverItems) { |
|
|
|
if (handoverItem.getVinSid().equals(entity.getVinSid())) { |
|
|
|
String itemValue = handoverItem.getItemKey(); |
|
|
|
if (!itemValue.contains("001")) { |
|
|
|
sb.append("发票").append("、"); |
|
|
|
} |
|
|
|
if (!itemValue.contains("002")) { |
|
|
|
sb.append("合格证").append("、"); |
|
|
|
} |
|
|
|
if (!itemValue.contains("003")) { |
|
|
|
sb.append("车钥匙").append("、"); |
|
|
|
} |
|
|
|
if (!itemValue.contains("004")) { |
|
|
|
sb.append("一致性证书").append("、"); |
|
|
|
} |
|
|
|
if (!itemValue.contains("005")) { |
|
|
|
sb.append("申请表").append("、"); |
|
|
|
} |
|
|
|
if (!itemValue.contains("006")) { |
|
|
|
sb.append("保修手册、说明书").append("、"); |
|
|
|
} |
|
|
|
if (!itemValue.contains("007")) { |
|
|
|
sb.append("环保清单").append("、"); |
|
|
|
} |
|
|
|
if (!itemValue.contains("008")) { |
|
|
|
sb.append("驾驶员卡").append("、"); |
|
|
|
} |
|
|
|
if (!itemValue.contains("009")) { |
|
|
|
if (handoverItem.getIsFuelVehicle().equals("0")) { |
|
|
|
sb.append("气瓶检测合格证").append("、"); |
|
|
|
} |
|
|
|
} |
|
|
|
dataListVo.setVin(handoverItem.getVinNo()); |
|
|
|
dataListVo.setCarRecordSid(sid); |
|
|
|
if (sb.toString().length() > 0) { |
|
|
|
sb.delete(sb.length() - 1, sb.length()); |
|
|
|
} |
|
|
|
} |
|
|
|
dataListVo.setInfo(sb.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
list.add(dataListVo); |
|
|
|
vo.setList(list); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ResultBean confirmCarDocsRecord(AppInitVo dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
List<AppListBean> listBeans = dto.getList(); |
|
|
|
List<String> sids = new ArrayList<>(); |
|
|
|
if (!listBeans.isEmpty()) { |
|
|
|
for (AppListBean listBean : listBeans) { |
|
|
|
sids.add(listBean.getCarRecordSid()); |
|
|
|
} |
|
|
|
} |
|
|
|
String model = ""; |
|
|
|
String contractNo = ""; |
|
|
|
String customerName = ""; |
|
|
|
if (!sids.isEmpty()) { |
|
|
|
for (String sid : sids) { |
|
|
|
BusVehicleDataHandover entity = fetchBySid(sid); |
|
|
|
entity.setCompleteStateKey("002"); |
|
|
|
entity.setCompleteStateValue("已完成"); |
|
|
|
model = entity.getModel(); |
|
|
|
contractNo = entity.getContractNo(); |
|
|
|
customerName = entity.getCustomerName(); |
|
|
|
baseMapper.updateById(entity); |
|
|
|
} |
|
|
|
} |
|
|
|
String userOrgSid = ""; |
|
|
|
String billNo = ""; |
|
|
|
String userOrgName = ""; |
|
|
|
String createName = ""; |
|
|
|
ResultBean<String> orgSidByPath = sysStaffOrgFeign.getOrgSidByPath(dto.getOrgPath()); |
|
|
|
if (orgSidByPath.getSuccess()) { |
|
|
|
userOrgSid = orgSidByPath.getData(); |
|
|
|
//交车资料确认单编号
|
|
|
|
billNo = getApplyCode(userOrgSid); |
|
|
|
ResultBean<SysOrganizationVo> organizationVo = sysOrganizationFeign.fetchBySid(userOrgSid); |
|
|
|
if (organizationVo.getSuccess()) { |
|
|
|
SysOrganizationVo organizationVoData = organizationVo.getData(); |
|
|
|
if (null != organizationVoData) { |
|
|
|
userOrgName = organizationVoData.getName(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
ResultBean<SysUserVo> sysUserVoResultBean = sysUserFeign.fetchBySid(dto.getUserSid()); |
|
|
|
if (sysUserVoResultBean.getSuccess()) { |
|
|
|
SysUserVo data = sysUserVoResultBean.getData(); |
|
|
|
if (null != data) { |
|
|
|
createName = data.getName(); |
|
|
|
} |
|
|
|
} |
|
|
|
List<String> newSids = new ArrayList<>(); |
|
|
|
if (!listBeans.isEmpty()) { |
|
|
|
for (AppListBean vinData : listBeans) { |
|
|
|
String recordSid = vinData.getCarRecordSid(); |
|
|
|
BusVehicleDataHandover handover = fetchBySid(recordSid); |
|
|
|
String vinSid = handover.getVinSid(); |
|
|
|
BusVehicleDataHandover newEntity = new BusVehicleDataHandover(); |
|
|
|
newSids.add(newEntity.getSid()); |
|
|
|
newEntity.setCreateBySid(dto.getUserSid()); |
|
|
|
newEntity.setRecDate(dto.getOperaDate()); |
|
|
|
newEntity.setRecName(dto.getOperaName()); |
|
|
|
newEntity.setUseOrgSid(userOrgSid); |
|
|
|
newEntity.setBillNo(billNo); |
|
|
|
newEntity.setUseOrgName(userOrgName); |
|
|
|
newEntity.setVinNo(vinData.getVin()); |
|
|
|
newEntity.setVinSid(vinSid); |
|
|
|
newEntity.setContractNo(dto.getContractId()); |
|
|
|
newEntity.setCustomerName(dto.getCustomerName()); |
|
|
|
newEntity.setModel(model); |
|
|
|
newEntity.setItems(vinData.getInfo()); |
|
|
|
newEntity.setCreateName(createName); |
|
|
|
newEntity.setCompleteStateValue("已完成"); |
|
|
|
newEntity.setCompleteStateKey("002"); |
|
|
|
newEntity.setOrgSidPath(dto.getOrgPath()); |
|
|
|
baseMapper.insert(newEntity); |
|
|
|
} |
|
|
|
} |
|
|
|
BusVehicleDataHandoverPdfVo pdfVo = new BusVehicleDataHandoverPdfVo(); |
|
|
|
List<BusDataListPdfVo> pdfVos = new ArrayList<>(); |
|
|
|
pdfVo.setBillNo(billNo); |
|
|
|
pdfVo.setContractNo(contractNo); |
|
|
|
pdfVo.setCustomerName(customerName); |
|
|
|
if (!listBeans.isEmpty()) { |
|
|
|
int sNo = 1; |
|
|
|
for (AppListBean dataVo : listBeans) { |
|
|
|
BusDataListPdfVo dataPdfVo = new BusDataListPdfVo(); |
|
|
|
dataPdfVo.setSNo(String.valueOf(sNo++)); |
|
|
|
dataPdfVo.setVinNo(dataVo.getVin()); |
|
|
|
dataPdfVo.setItems(dataVo.getInfo()); |
|
|
|
pdfVos.add(dataPdfVo); |
|
|
|
} |
|
|
|
} |
|
|
|
pdfVo.setPdfVos(pdfVos); |
|
|
|
String s = commonCreatePdf(pdfVo); |
|
|
|
String filePath = s.substring(docPdfComponent.getUploadTemplateUrl().length()); |
|
|
|
if (!newSids.isEmpty()) { |
|
|
|
for (String newSid : newSids) { |
|
|
|
BusVehicleDataHandover handover = fetchBySid(newSid); |
|
|
|
handover.setDownloadPath(filePath); |
|
|
|
baseMapper.updateById(handover); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
} |
|
|
|