|
|
@ -81,6 +81,7 @@ import org.apache.tomcat.util.threads.ThreadPoolExecutor; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.io.InputStream; |
|
|
@ -702,7 +703,6 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
|
List<BusHandoverInitListDto> carList = dto.getCarList(); |
|
|
|
carList.removeAll(Collections.singleton(null)); |
|
|
|
if (!carList.isEmpty()) { |
|
|
|
|
|
|
|
for (BusHandoverInitListDto busHandoverInitListDto : carList) { |
|
|
|
String vinSid = busHandoverInitListDto.getVinSid(); |
|
|
|
List<String> policyImagesList = busHandoverInitListDto.getPolicyImages(); |
|
|
@ -845,40 +845,24 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
|
/** |
|
|
|
* 确认交付信息回显 |
|
|
|
* |
|
|
|
* @param sids |
|
|
|
* @param |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
|
|
|
|
public ResultBean<BusHandoverDeliveryVo> deliveryByHandoverWaitSids(String[] sids) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
public ResultBean<BusHandoverDeliveryVo> deliveryByHandoverWaitSids(AppDeliveryConQuery query) { |
|
|
|
ResultBean<BusHandoverDeliveryVo> rb = ResultBean.fireFail(); |
|
|
|
BusHandoverDeliveryVo vo = new BusHandoverDeliveryVo(); |
|
|
|
vo.setDeliverDate((new Date())); |
|
|
|
vo.setUserSid(query.getUserSid()); |
|
|
|
vo.setOrgSidPath(query.getOrgSidPath()); |
|
|
|
List<BusHandoverItemForDeliveryVo> voList = new ArrayList<>(); |
|
|
|
vo.setCarNum(String.valueOf(sids.length)); |
|
|
|
List<String> sids = query.getList(); |
|
|
|
sids.removeAll(Collections.singleton(null)); |
|
|
|
for (String sid : sids) { |
|
|
|
//遍历sid从待交车列表中查询信息
|
|
|
|
BusHandoverWait handoverWait = busHandoverWaitService.fetchBySid(sid); |
|
|
|
if (handoverWait != null) { |
|
|
|
BusHandoverItemForDeliveryVo itemVo = new BusHandoverItemForDeliveryVo(); |
|
|
|
CommonContract contract = commonContractFeign.selectByNo(handoverWait.getContractNo()).getData(); |
|
|
|
if (null != contract) { |
|
|
|
if (StringUtils.isNotBlank(contract.getBusSid())) { |
|
|
|
vo.setOrderSid(contract.getBusSid()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(contract.getStaffSid())) { |
|
|
|
vo.setStaffSid(contract.getStaffSid()); |
|
|
|
} |
|
|
|
} |
|
|
|
//合同号
|
|
|
|
vo.setContractNo(handoverWait.getContractNo()); |
|
|
|
vo.setCustomerName(handoverWait.getCustomerName()); |
|
|
|
vo.setCustomerSid(handoverWait.getCustomerSid()); |
|
|
|
vo.setPayTypeKey(handoverWait.getPayTypeKey()); |
|
|
|
vo.setPayTypeValue(handoverWait.getPayTypeValue()); |
|
|
|
vo.setModelName(handoverWait.getModelName()); |
|
|
|
itemVo.setVinSid(handoverWait.getVinSid()); |
|
|
|
itemVo.setVinNo(handoverWait.getVinNo()); |
|
|
|
itemVo.setModelSid(handoverWait.getModelSid()); |
|
|
|
itemVo.setModelName(handoverWait.getModelName()); |
|
|
|
StringBuffer sb = new StringBuffer(); |
|
|
|
StringBuffer sbKey = new StringBuffer(); |
|
|
|
//从交车准备中查询交车资料
|
|
|
@ -895,7 +879,6 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
|
if (prepareVehicle.getOnBoardDataState() > 0) { |
|
|
|
BusVehicleInformationHandoverDetailsListVo data = busVehicleInformationHandoverService.detailsByVinSid(handoverWait.getVinSid()).getData(); |
|
|
|
if (null != data) { |
|
|
|
itemVo.setIsFuelVehicle(data.getIsFuelVehicle()); |
|
|
|
if (data.getInformations().size() > 0) { |
|
|
|
List<BusVehicleInformationVo> informations = data.getInformations(); |
|
|
|
for (BusVehicleInformationVo information : informations) { |
|
|
@ -946,19 +929,8 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
|
sbKey.delete(sbKey.length() - 1, sbKey.length()); |
|
|
|
itemVo.setItemValue(sb.toString()); |
|
|
|
itemVo.setItemKey(sbKey.toString()); |
|
|
|
if (itemVo.getIsFuelVehicle().equals("0")) { |
|
|
|
if (itemVo.getItemKey().equals("001、002、003、004、005、006、007、008、009")) { |
|
|
|
itemVo.setCompleteState("1"); |
|
|
|
} else { |
|
|
|
itemVo.setCompleteState("0"); |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (itemVo.getItemKey().equals("001、002、003、004、005、006、007、008")) { |
|
|
|
itemVo.setCompleteState("1"); |
|
|
|
} else { |
|
|
|
itemVo.setCompleteState("0"); |
|
|
|
} |
|
|
|
} |
|
|
|
itemVo.setVinNo(handoverWait.getVinNo()); |
|
|
|
itemVo.setSid(sid); |
|
|
|
} |
|
|
|
voList.add(itemVo); |
|
|
|
} |
|
|
@ -974,67 +946,120 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean<String> saveOrUpdateBusHandover(BusHandoverDeliveryDto dto) throws Exception { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
//ToDo:验证是否包含已存在的车辆
|
|
|
|
String contractNo = dto.getContractNo(); |
|
|
|
List<BusHandoverItemForDeliveryDto> vinList = dto.getBusItemvos(); |
|
|
|
if (vinList.size() == 0) { |
|
|
|
return rb.setMsg("请选择车辆"); |
|
|
|
} |
|
|
|
List<String> vinSidList = vinList.stream().map(v -> v.getVinSid()).collect(Collectors.toList()); |
|
|
|
int count = baseMapper.selectByCount(contractNo, vinSidList); |
|
|
|
if (count > 0) { |
|
|
|
return rb.setMsg("选择的车辆包含已存在交车确认记录的数据"); |
|
|
|
ResultBean<String> rb = ResultBean.fireFail(); |
|
|
|
BusHandover busHandover = new BusHandover(); |
|
|
|
BeanUtil.copyProperties(dto, busHandover, "id", "sid"); |
|
|
|
//流程状态
|
|
|
|
busHandover.setNodeState("待提交"); |
|
|
|
//交车状态
|
|
|
|
busHandover.setHandoverStateKey("001"); |
|
|
|
busHandover.setHandoverStateValue("未交车"); |
|
|
|
busHandover.setCreateBySid(dto.getUserSid()); |
|
|
|
ResultBean<String> orgSidByPath = sysStaffOrgFeign.getOrgSidByPath(dto.getOrgSidPath()); |
|
|
|
if (orgSidByPath.getSuccess()) { |
|
|
|
String userOrgSid = orgSidByPath.getData(); |
|
|
|
busHandover.setUseOrgSid(userOrgSid); |
|
|
|
//交车资料确认单编号
|
|
|
|
String billNo = getApplyCode(userOrgSid); |
|
|
|
busHandover.setBillNo(billNo); |
|
|
|
ResultBean<SysOrganizationVo> organizationVo = sysOrganizationFeign.fetchBySid(userOrgSid); |
|
|
|
if (organizationVo.getSuccess()) { |
|
|
|
SysOrganizationVo organizationVoData = organizationVo.getData(); |
|
|
|
if (null != organizationVoData) { |
|
|
|
busHandover.setUseOrgName(organizationVoData.getName()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
BusHandover entity = new BusHandover(); |
|
|
|
String sid = entity.getSid(); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
entity.setHandoverStateKey("001"); |
|
|
|
entity.setHandoverStateValue("未交车"); |
|
|
|
if (StringUtils.isNotBlank(dto.getUserSid())) { |
|
|
|
entity.setCreateBySid(dto.getUserSid()); |
|
|
|
} |
|
|
|
//交车资料确认单编号
|
|
|
|
String billNo = getApplyCode(dto.getUseOrgSid()); |
|
|
|
entity.setBillNo(billNo); |
|
|
|
entity.setNodeState("待提交"); |
|
|
|
baseMapper.insert(entity); |
|
|
|
List<BusHandoverItemForDeliveryDto> busItemvos = dto.getBusItemvos(); |
|
|
|
for (BusHandoverItemForDeliveryDto busItemvo : busItemvos) { |
|
|
|
BusHandoverItems items = new BusHandoverItems(); |
|
|
|
BeanUtil.copyProperties(busItemvo, items); |
|
|
|
items.setHandoverSid(sid); |
|
|
|
int insert = busHandoverItemsService.insert(items); |
|
|
|
if (insert > 0) { |
|
|
|
//逻辑删除待交车车辆列表中勾选车辆
|
|
|
|
busHandoverWaitService.deleteByVinSid(dto.getContractNo(), busItemvo.getVinSid()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//打印pdf
|
|
|
|
List<String> filePaths = createPdf(entity.getSid()).getData(); |
|
|
|
List<File> fileList = new ArrayList<>(); |
|
|
|
if (!filePaths.isEmpty()) { |
|
|
|
for (String filePath : filePaths) { |
|
|
|
File file = new File(filePath); |
|
|
|
fileList.add(file); |
|
|
|
if (!CollectionUtils.isEmpty(dto.getBusItemvos())) { |
|
|
|
List<BusHandoverItemForDeliveryDto> vinList = dto.getBusItemvos(); |
|
|
|
for (BusHandoverItemForDeliveryDto deliveryConDto : vinList) { |
|
|
|
String recordSid = deliveryConDto.getSid(); |
|
|
|
BusHandoverWait handoverWait = busHandoverWaitService.fetchBySid(recordSid); |
|
|
|
//交车数量
|
|
|
|
busHandover.setCarNum(String.valueOf(vinList.size())); |
|
|
|
//合同号
|
|
|
|
busHandover.setContractNo(handoverWait.getContractNo()); |
|
|
|
//客户名
|
|
|
|
busHandover.setCustomerName(handoverWait.getCustomerName()); |
|
|
|
//客户sid
|
|
|
|
busHandover.setCustomerSid(handoverWait.getCustomerSid()); |
|
|
|
//付款方式
|
|
|
|
busHandover.setPayTypeKey(handoverWait.getPayTypeKey()); |
|
|
|
busHandover.setPayTypeValue(handoverWait.getPayTypeValue()); |
|
|
|
//车型
|
|
|
|
busHandover.setModelName(handoverWait.getModelName()); |
|
|
|
//业务员sid 业务订单sid
|
|
|
|
CommonContract contract = commonContractFeign.selectByNo(handoverWait.getContractNo()).getData(); |
|
|
|
if (null != contract) { |
|
|
|
if (StringUtils.isNotBlank(contract.getBusSid())) { |
|
|
|
busHandover.setOrderSid(contract.getBusSid()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(contract.getStaffSid())) { |
|
|
|
busHandover.setStaffSid(contract.getStaffSid()); |
|
|
|
} |
|
|
|
} |
|
|
|
BusHandoverItems items = new BusHandoverItems(); |
|
|
|
items.setItemKey(deliveryConDto.getItemKey()); |
|
|
|
items.setItemValue(deliveryConDto.getItemValue()); |
|
|
|
items.setVinNo(deliveryConDto.getVinNo()); |
|
|
|
items.setVinSid(handoverWait.getVinSid()); |
|
|
|
items.setHandoverSid(busHandover.getSid()); |
|
|
|
items.setModelSid(handoverWait.getModelSid()); |
|
|
|
items.setModelName(handoverWait.getModelName()); |
|
|
|
BusVehicleInformationHandoverDetailsListVo data = busVehicleInformationHandoverService.detailsByVinSid(handoverWait.getVinSid()).getData(); |
|
|
|
if (null != data) { |
|
|
|
items.setIsFuelVehicle(data.getIsFuelVehicle()); |
|
|
|
} |
|
|
|
if (items.getIsFuelVehicle().equals("0")) { |
|
|
|
if (items.getItemKey().equals("001、002、003、004、005、006、007、008、009")) { |
|
|
|
items.setCompleteState("1"); |
|
|
|
} else { |
|
|
|
items.setCompleteState("0"); |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (items.getItemKey().equals("001、002、003、004、005、006、007、008")) { |
|
|
|
items.setCompleteState("1"); |
|
|
|
} else { |
|
|
|
items.setCompleteState("0"); |
|
|
|
} |
|
|
|
} |
|
|
|
items.setVehivelOrTrailer("主车"); |
|
|
|
busHandoverItemsService.insert(items); |
|
|
|
//逻辑删除待准备交车列表
|
|
|
|
busHandoverWaitService.deleteByVinSid(handoverWait.getContractNo(), handoverWait.getVinSid()); |
|
|
|
} |
|
|
|
} |
|
|
|
baseMapper.insert(busHandover); |
|
|
|
ResultBean<List<String>> pdf = createPdf(busHandover.getSid()); |
|
|
|
String path = ""; |
|
|
|
String filePath = "/template/"; |
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
|
long seconds = System.currentTimeMillis(); |
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
File file = WordConvertUtils.mulFile2One(fileList, targetPath + dateStr + seconds + "交车确认.pdf"); |
|
|
|
if (fileList.size() <= 0) { |
|
|
|
path = null; |
|
|
|
} else { |
|
|
|
for (File fileDelete : fileList) { |
|
|
|
fileDelete.delete(); |
|
|
|
if (pdf.getSuccess()) { |
|
|
|
//打印pdf
|
|
|
|
List<String> filePaths = pdf.getData(); |
|
|
|
List<File> fileList = new ArrayList<>(); |
|
|
|
if (!filePaths.isEmpty()) { |
|
|
|
for (String filePath : filePaths) { |
|
|
|
File file = new File(filePath); |
|
|
|
fileList.add(file); |
|
|
|
} |
|
|
|
} |
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
|
long seconds = System.currentTimeMillis(); |
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
File file = WordConvertUtils.mulFile2One(fileList, targetPath + dateStr + seconds + "交车确认.pdf"); |
|
|
|
if (fileList.size() <= 0) { |
|
|
|
path = null; |
|
|
|
} else { |
|
|
|
for (File fileDelete : fileList) { |
|
|
|
fileDelete.delete(); |
|
|
|
} |
|
|
|
path = dateStr + seconds + "交车确认.pdf"; |
|
|
|
} |
|
|
|
path = filePath + dateStr + seconds + "交车确认.pdf"; |
|
|
|
} |
|
|
|
return rb.success().setData(path); |
|
|
|
BusHandover entity = fetchBySid(busHandover.getSid()); |
|
|
|
entity.setFilePath(path); |
|
|
|
baseMapper.updateById(entity); |
|
|
|
String temp = "/template/"; |
|
|
|
return rb.success().setData(temp + path); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -1339,15 +1364,11 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
|
if (StringUtils.isNotBlank(query.getCustomerName())) { |
|
|
|
qw.like("customerName", query.getCustomerName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getPayTypeValue())) { |
|
|
|
qw.like("payTypeValue", query.getPayTypeValue()); |
|
|
|
if (StringUtils.isNotBlank(query.getPayTypeKey())) { |
|
|
|
qw.like("payTypeKey", query.getPayTypeKey()); |
|
|
|
} |
|
|
|
qw.eq("createBySid", query.getUserSid()); |
|
|
|
qw.eq("isDelete", 0); |
|
|
|
if (StringUtils.isNotBlank(query.getName())) { |
|
|
|
qw.and(wrapper -> wrapper.like("contractNo", query.getName()).or().like("customerName", query.getName()) |
|
|
|
.or().like("payTypeValue", query.getName())); |
|
|
|
} |
|
|
|
return qw; |
|
|
|
} |
|
|
|
|
|
|
@ -1363,6 +1384,42 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
|
QueryWrapper<BusHandover> qw = createQueryWrapper(query); |
|
|
|
IPage<BusHandover> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<BusHandoverVos> pagging = baseMapper.selectListPageVo(page, qw); |
|
|
|
List<BusHandoverVos> records = pagging.getRecords(); |
|
|
|
records.removeAll(Collections.singleton(null)); |
|
|
|
String temp = "/template/"; |
|
|
|
if (records.size() > 0) { |
|
|
|
for (BusHandoverVos record : records) { |
|
|
|
if (record.getNodeState().equals("待提交") || record.getNodeState().equals("发起申请")) { |
|
|
|
record.setShowUpdate(true); |
|
|
|
} else { |
|
|
|
record.setShowUpdate(false); |
|
|
|
} |
|
|
|
if (record.getHandoverStateValue().equals("已交车")) { |
|
|
|
List<BusHandoverInitListVo> deliveryConfirmInfo = busHandoverItemsService.getDeliveryConfirmInfo(record.getSid()); |
|
|
|
deliveryConfirmInfo.removeAll(Collections.singleton(null)); |
|
|
|
if (!deliveryConfirmInfo.isEmpty()) { |
|
|
|
for (BusHandoverInitListVo vo : deliveryConfirmInfo) { |
|
|
|
List<BaseTrailer> trailers = baseTrailerFeign.getByVehSid(vo.getVinSid()).getData(); |
|
|
|
trailers.removeAll(Collections.singleton(null)); |
|
|
|
if (!trailers.isEmpty() && trailers.size() > 0) { |
|
|
|
record.setShowGcBtn(true); |
|
|
|
} else { |
|
|
|
record.setShowGcBtn(false); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
record.setShowGcBtn(false); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(record.getTrailerFilePath())) { |
|
|
|
record.setShowGcBtn(false); |
|
|
|
record.setShowGcBtn2(true); |
|
|
|
record.setShowGcDownload(true); |
|
|
|
} |
|
|
|
record.setFilePath(temp + record.getFilePath()); |
|
|
|
record.setTrailerFilePath(temp + record.getTrailerFilePath()); |
|
|
|
} |
|
|
|
} |
|
|
|
PagerVo<BusHandoverVos> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return rb.success().setData(p); |
|
|
|
} |
|
|
@ -1378,6 +1435,7 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
|
BusHandover busHandover = fetchBySid(sid); |
|
|
|
BusHandoverDetailVo vo = new BusHandoverDetailVo(); |
|
|
|
BeanUtil.copyProperties(busHandover, vo); |
|
|
|
vo.setProcInsId(busHandover.getProcInstId()); |
|
|
|
List<BusHandoverItemListDetailsVo> items = new ArrayList<>(); |
|
|
|
//查询车辆
|
|
|
|
List<BusHandoverItems> itemsList = busHandoverItemsService.getItemsListByMainSid(sid).getData(); |
|
|
@ -1385,10 +1443,11 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
|
for (BusHandoverItems v : itemsList) { |
|
|
|
BusHandoverItemListDetailsVo detailsVo = new BusHandoverItemListDetailsVo(); |
|
|
|
String handoverPhoto = v.getHandoverPhoto(); |
|
|
|
String policyPhoto = v.getPolicyPhoto(); |
|
|
|
BeanUtil.copyProperties(v, detailsVo); |
|
|
|
if (StringUtils.isNotBlank(handoverPhoto)) { |
|
|
|
List<String> stringList = Arrays.asList(handoverPhoto.split(",")).stream().map(c -> fileUploadComponent.getUrlPrefix() + c).collect(Collectors.toList()); |
|
|
|
detailsVo.setHandoverPhoto(stringList); |
|
|
|
detailsVo.setDeliveryImages(stringList); |
|
|
|
} |
|
|
|
BusHandoverPrepareVehicle busHandoverPrepareVehicle = busHandoverPrepareVehicleService.fetchDetailsByVinSid(v.getVinSid()); |
|
|
|
if (null != busHandoverPrepareVehicle) { |
|
|
@ -1397,12 +1456,13 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
|
if (!fileList.isEmpty()) { |
|
|
|
List<String> policyPhotoList = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()). |
|
|
|
collect(Collectors.toList()); |
|
|
|
detailsVo.setHandoverPhoto(policyPhotoList); |
|
|
|
detailsVo.setPolicyImages(policyPhotoList); |
|
|
|
} |
|
|
|
} |
|
|
|
detailsVo.setVinSid(v.getVinSid()); |
|
|
|
items.add(detailsVo); |
|
|
|
} |
|
|
|
vo.setItems(items); |
|
|
|
vo.setCarList(items); |
|
|
|
//接收车辆确认书照片
|
|
|
|
List<BuscenterFile> fileList = buscenterFileService.selectByLinkSid(sid, BuscenterFileEnum.RECEIVE_CAR_IMAGES.getAttachType()); |
|
|
|
fileList.removeAll(Collections.singleton(null)); |
|
|
@ -2468,6 +2528,115 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
|
return rb.success().setData(dto.getSid()); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<String> saveGcVinBill(GcVinBillDto dto) { |
|
|
|
ResultBean<String> rb = ResultBean.fireFail(); |
|
|
|
String sid = dto.getSid(); |
|
|
|
BusHandover busHandover = fetchBySid(sid); |
|
|
|
busHandover.setTrailerAddress(dto.getTrailerAddress()); |
|
|
|
busHandover.setTrailerIdNo(dto.getTrailerIdNo()); |
|
|
|
busHandover.setTrailerDeliverDate(new Date()); |
|
|
|
busHandover.setTrailerMobile(dto.getTrailerMobile()); |
|
|
|
busHandover.setTrailerRecipient(dto.getTrailerRecipient()); |
|
|
|
baseMapper.updateById(busHandover); |
|
|
|
List<BusHandoverInitListVo> info = busHandoverItemsService.getDeliveryConfirmInfo(sid); |
|
|
|
info.removeAll(Collections.singleton(null)); |
|
|
|
List<BusHandoverItems> itemsList = new ArrayList<>(); |
|
|
|
if (info.size() > 0) { |
|
|
|
for (BusHandoverInitListVo vo : info) { |
|
|
|
List<BaseTrailer> baseTrailers = baseTrailerFeign.getByVehSid(vo.getVinSid()).getData(); |
|
|
|
baseTrailers.removeAll(Collections.singleton(null)); |
|
|
|
if (baseTrailers.size() > 0) { |
|
|
|
for (BaseTrailer baseTrailer : baseTrailers) { |
|
|
|
BusHandoverItems items = new BusHandoverItems(); |
|
|
|
items.setVehivelOrTrailer("挂车"); |
|
|
|
items.setHandoverSid(sid); |
|
|
|
items.setVinSid(baseTrailer.getSid()); |
|
|
|
items.setVinNo(baseTrailer.getVinNo()); |
|
|
|
itemsList.add(items); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (!itemsList.isEmpty()) { |
|
|
|
for (BusHandoverItems items : itemsList) { |
|
|
|
busHandoverItemsService.insert(items); |
|
|
|
} |
|
|
|
} |
|
|
|
BusHandover handoverPdf = fetchBySid(sid); |
|
|
|
BusReceiveVehiclePdfVo pdfVo = new BusReceiveVehiclePdfVo(); |
|
|
|
pdfVo.setUseOrgName(handoverPdf.getUseOrgName()); |
|
|
|
String staffSid = handoverPdf.getStaffSid(); |
|
|
|
ResultBean<SysStaffinfoDetailsVo> voResultBean = sysStaffinfoFeign.fetchBySid(staffSid); |
|
|
|
if (voResultBean.getSuccess()) { |
|
|
|
if (null != voResultBean.getData()) { |
|
|
|
SysStaffinfoDetailsVo data = voResultBean.getData(); |
|
|
|
if (StringUtils.isNotBlank(data.getName())) { |
|
|
|
pdfVo.setStaffName(data.getName()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
pdfVo.setContractNo(handoverPdf.getContractNo()); |
|
|
|
pdfVo.setCustomerName(handoverPdf.getCustomerName()); |
|
|
|
String customerSid = handoverPdf.getCustomerSid(); |
|
|
|
if (StringUtils.isNotBlank(customerSid)) { |
|
|
|
ResultBean<CrmCustomerTempVo> resultBean = crmCustomerTempFeign.fetchSid(customerSid); |
|
|
|
if (resultBean.getSuccess()) { |
|
|
|
if (null != resultBean.getData()) { |
|
|
|
CrmCustomerTempVo data = resultBean.getData(); |
|
|
|
if (StringUtils.isNotBlank(data.getIDNumber())) { |
|
|
|
pdfVo.setIdNumber(data.getIDNumber()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
pdfVo.setRecipient(handoverPdf.getTrailerRecipient()); |
|
|
|
pdfVo.setIdNo(handoverPdf.getTrailerIdNo()); |
|
|
|
pdfVo.setDeliverDate(handoverPdf.getTrailerDeliverDate()); |
|
|
|
pdfVo.setDeliverAddress(handoverPdf.getTrailerAddress()); |
|
|
|
List<BusHandoverItems> items = busHandoverItemsService.getItemsListByMainSid(sid).getData(); |
|
|
|
items.removeAll(Collections.singleton(null)); |
|
|
|
List<BusReceiveVehicleListPdfVo> listPdfVos = new ArrayList<>(); |
|
|
|
if (!items.isEmpty()) { |
|
|
|
int sortNo = 1; |
|
|
|
for (BusHandoverItems item : items) { |
|
|
|
if ("挂车".equals(item.getVehivelOrTrailer())) { |
|
|
|
BusReceiveVehicleListPdfVo listPdfVo = new BusReceiveVehicleListPdfVo(); |
|
|
|
listPdfVo.setEngineVo("-"); |
|
|
|
listPdfVo.setSortNo(String.valueOf(sortNo++)); |
|
|
|
listPdfVo.setVinNo(item.getVinNo()); |
|
|
|
listPdfVos.add(listPdfVo); |
|
|
|
BaseTrailerDetailsVo trailerDetailsVo = baseTrailerFeign.fetchBySid(item.getVinSid()).getData(); |
|
|
|
if (null != trailerDetailsVo) { |
|
|
|
if (StringUtils.isNotBlank(trailerDetailsVo.getTrailerModelSid())) { |
|
|
|
BaseTrailerModelDetailsVo modelDetailsVo = baseTrailerModelFeign.fetchDetailsBySid(trailerDetailsVo.getTrailerModelSid()).getData(); |
|
|
|
if (null != modelDetailsVo) { |
|
|
|
if (StringUtils.isNotBlank(modelDetailsVo.getBrandName())) { |
|
|
|
pdfVo.setBrandName(modelDetailsVo.getBrandName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(modelDetailsVo.getTrailerTypeValue())) { |
|
|
|
pdfVo.setModel(modelDetailsVo.getTrailerTypeValue()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(modelDetailsVo.getCarModelName())) { |
|
|
|
pdfVo.setConfig(modelDetailsVo.getCarModelName()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
pdfVo.setColor("-"); |
|
|
|
pdfVo.setListPdfVos(listPdfVos); |
|
|
|
String uploadTemplateUrl = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
String s = receiveVehicleConfirmationCreatePdf(pdfVo); |
|
|
|
BusHandover entity = fetchBySid(sid); |
|
|
|
String savePath = s.substring(uploadTemplateUrl.length()); |
|
|
|
entity.setTrailerFilePath(savePath); |
|
|
|
baseMapper.updateById(entity); |
|
|
|
String temp = "/template/"; |
|
|
|
return rb.success().setData(temp + savePath); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*@Autowired |
|
|
|