|
|
@ -1,39 +1,55 @@ |
|
|
|
package com.yxt.anrui.buscenter.biz.bushandover; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.google.common.util.concurrent.ThreadFactoryBuilder; |
|
|
|
import com.yxt.anrui.base.api.basemodelconfig.BaseModelConfigFeign; |
|
|
|
import com.yxt.anrui.base.api.basemodelconfig.BaseModelConfigSelectVo; |
|
|
|
import com.yxt.anrui.base.api.basevehiclemodel.BaseVehicleModelFeign; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.CommonContract; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.CommonContractFeign; |
|
|
|
import com.yxt.anrui.base.common.enums.DictCommonEnum; |
|
|
|
import com.yxt.anrui.buscenter.api.buscenterfile.BuscenterFile; |
|
|
|
import com.yxt.anrui.buscenter.api.buscenterfile.BuscenterFileEnum; |
|
|
|
import com.yxt.anrui.buscenter.api.bushandover.*; |
|
|
|
import com.yxt.anrui.buscenter.api.bushandoveritems.BusHanItemDto; |
|
|
|
import com.yxt.anrui.buscenter.api.bushandoveritems.BusHandoverItems; |
|
|
|
import com.yxt.anrui.buscenter.api.bushandoveritems.BusItemDto; |
|
|
|
import com.yxt.anrui.buscenter.api.bushandoveritems.*; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.app.order.AppOrderDetailsVo; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.app.order.AppOrderModelInfoVo; |
|
|
|
import com.yxt.anrui.buscenter.biz.buscenterfile.BuscenterFileService; |
|
|
|
import com.yxt.anrui.buscenter.biz.bushandoveritems.BusHandoverItemsService; |
|
|
|
import com.yxt.anrui.buscenter.biz.bushandoverwait.BusHandoverWaitService; |
|
|
|
import com.yxt.anrui.buscenter.biz.bussalesorder.BusSalesOrderService; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.AppCrmCustomerTempInfoVo; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTempFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysstaffinfo.SysStaffinfoDetailsVo; |
|
|
|
import com.yxt.anrui.portal.api.sysstaffinfo.SysStaffinfoFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserVo; |
|
|
|
import com.yxt.common.base.config.component.DocPdfComponent; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
|
import com.yxt.common.base.utils.WordConvertUtils; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.tomcat.util.threads.ThreadPoolExecutor; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.List; |
|
|
|
import java.io.File; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.text.MessageFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import static cn.hutool.core.util.ClassLoaderUtil.getClassLoader; |
|
|
|
|
|
|
|
/** |
|
|
|
* Project: anrui-buscenter(业务中心) <br/> |
|
|
|
* File: BusHandoverService.java <br/> |
|
|
@ -64,9 +80,22 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
|
private FileUploadComponent fileUploadComponent; |
|
|
|
@Autowired |
|
|
|
private BuscenterFileService buscenterFileService; |
|
|
|
@Autowired |
|
|
|
private DocPdfComponent docPdfComponent; |
|
|
|
@Autowired |
|
|
|
private CrmCustomerTempFeign crmCustomerTempFeign; |
|
|
|
@Autowired |
|
|
|
private SysStaffinfoFeign sysStaffinfoFeign; |
|
|
|
@Autowired |
|
|
|
private BusSalesOrderService busSalesOrderService; |
|
|
|
@Autowired |
|
|
|
private BaseVehicleModelFeign baseVehicleModelFeign; |
|
|
|
@Autowired |
|
|
|
private BaseModelConfigFeign baseModelConfigFeign; |
|
|
|
|
|
|
|
public ResultBean<List<BusHandoverListVo>> saveDeliverybill(BusHandoverDto dto) { |
|
|
|
ResultBean<List<BusHandoverListVo>> rb = ResultBean.fireFail(); |
|
|
|
//ToDo:验证是否包含已存在的车辆
|
|
|
|
BusHandover busHandover = new BusHandover(); |
|
|
|
BeanUtil.copyProperties(dto, busHandover, "sid"); |
|
|
|
String userSid = dto.getUserSid(); |
|
|
@ -84,6 +113,7 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
|
busHandover.setContractNo(commonContract.getContractNo()); |
|
|
|
busHandover.setCustomerName(commonContract.getPartyB()); |
|
|
|
busHandover.setCustomerSid(commonContract.getCustomerSid()); |
|
|
|
busHandover.setOrderSid(commonContract.getBusSid()); |
|
|
|
} |
|
|
|
//根据用户sid获取staffSid
|
|
|
|
ResultBean<SysUserVo> userVoResultBean = sysUserFeign.fetchBySid(dto.getUserSid()); |
|
|
@ -122,19 +152,277 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
|
} |
|
|
|
} |
|
|
|
baseMapper.insert(busHandover); |
|
|
|
//生成接收车辆确认书、交车资料确认单
|
|
|
|
List<BusHandoverListVo> list = new ArrayList<>(); |
|
|
|
BusHandoverListVo vo = new BusHandoverListVo(); |
|
|
|
vo.setName("<<接收车辆确认书>>"); |
|
|
|
list.add(vo); |
|
|
|
vo = new BusHandoverListVo(); |
|
|
|
vo.setName("<<出门证>>"); |
|
|
|
list.add(vo); |
|
|
|
vo = new BusHandoverListVo(); |
|
|
|
vo.setName("<<交车资料确认单>>"); |
|
|
|
list.add(vo); |
|
|
|
List<BuscenterFile> buscenterFileList = new ArrayList<>(); |
|
|
|
try { |
|
|
|
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder() |
|
|
|
.setNameFormat("demo-pool-%d").build(); |
|
|
|
ExecutorService pool = new ThreadPoolExecutor(2, 100, |
|
|
|
0L, TimeUnit.MILLISECONDS, |
|
|
|
new LinkedBlockingQueue<Runnable>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); |
|
|
|
//接收车辆确认书
|
|
|
|
BusHandoverListVo busHandoverListVo = null; |
|
|
|
BuscenterFile buscenterFile = null; |
|
|
|
Future<String> future1 = pool.submit(() -> { |
|
|
|
return receiveCar(busHandover.getSid()); |
|
|
|
}); |
|
|
|
if (StringUtils.isNotBlank(future1.get())) { |
|
|
|
busHandoverListVo = new BusHandoverListVo(); |
|
|
|
busHandoverListVo.setName(MessageFormat.format("《{0}》", BuscenterFileEnum.RECEIVE_CAR.getMark())); |
|
|
|
busHandoverListVo.setDownloadUrl(docPdfComponent.getPrefixTemplateUrl() + future1.get()); |
|
|
|
list.add(busHandoverListVo); |
|
|
|
String str = future1.get(); |
|
|
|
buscenterFile = new BuscenterFile(); |
|
|
|
buscenterFile.setLinkSid(busHandover.getSid()); |
|
|
|
buscenterFile.setFilePath(future1.get()); |
|
|
|
buscenterFile.setAttachType(BuscenterFileEnum.RECEIVE_CAR.getAttachType()); |
|
|
|
File file = new File(fileUploadComponent.getUploadPath() + str.replace("/", File.separator)); |
|
|
|
if (file != null) { |
|
|
|
buscenterFile.setFileSize(fileUploadComponent.getPrintSize(file.length())); |
|
|
|
} |
|
|
|
buscenterFile.setFileName(BuscenterFileEnum.RECEIVE_CAR.getMark()); |
|
|
|
buscenterFile.setFileType(str.substring(str.lastIndexOf(".") + 1)); |
|
|
|
buscenterFileService.insert(buscenterFile); |
|
|
|
} |
|
|
|
/* Future<String> future2 = pool.submit(() -> { |
|
|
|
return entrustConfirmImages(busHandover.getSid()); |
|
|
|
}); |
|
|
|
if (StringUtils.isNotBlank(future2.get())) { |
|
|
|
busHandoverListVo = new BusHandoverListVo(); |
|
|
|
busHandoverListVo.setName(MessageFormat.format("《{0}》", BuscenterFileEnum.ENTRUST_CONFIRM_IMAGES.getMark())); |
|
|
|
busHandoverListVo.setDownloadUrl(docPdfComponent.getPrefixTemplateUrl() + future2.get()); |
|
|
|
list.add(busHandoverListVo); |
|
|
|
String str = future1.get(); |
|
|
|
buscenterFile = new BuscenterFile(); |
|
|
|
buscenterFile.setLinkSid(busHandover.getSid()); |
|
|
|
buscenterFile.setFilePath(future2.get()); |
|
|
|
buscenterFile.setAttachType(BuscenterFileEnum.ENTRUST_CONFIRM.getAttachType()); |
|
|
|
File file = new File(fileUploadComponent.getUploadPath() + str.replace("/", File.separator)); |
|
|
|
if (file != null) { |
|
|
|
buscenterFile.setFileSize(fileUploadComponent.getPrintSize(file.length())); |
|
|
|
} |
|
|
|
buscenterFile.setFileName(BuscenterFileEnum.ENTRUST_CONFIRM_IMAGES.getMark()); |
|
|
|
buscenterFile.setFileType(str.substring(str.lastIndexOf(".") + 1)); |
|
|
|
buscenterFileService.insert(buscenterFile); |
|
|
|
} |
|
|
|
Future<String> future3 = pool.submit(() -> { |
|
|
|
return entrustImages(busHandover.getSid()); |
|
|
|
}); |
|
|
|
if (StringUtils.isNotBlank(future3.get())) { |
|
|
|
busHandoverListVo = new BusHandoverListVo(); |
|
|
|
busHandoverListVo.setName(MessageFormat.format("《{0}》", BuscenterFileEnum.ENTRUST_IMAGES.getMark())); |
|
|
|
busHandoverListVo.setDownloadUrl(docPdfComponent.getPrefixTemplateUrl() + future3.get()); |
|
|
|
list.add(busHandoverListVo); |
|
|
|
String str = future1.get(); |
|
|
|
buscenterFile = new BuscenterFile(); |
|
|
|
buscenterFile.setLinkSid(busHandover.getSid()); |
|
|
|
buscenterFile.setFilePath(future3.get()); |
|
|
|
buscenterFile.setAttachType(BuscenterFileEnum.ENTRUST.getAttachType()); |
|
|
|
File file = new File(fileUploadComponent.getUploadPath() + str.replace("/", File.separator)); |
|
|
|
if (file != null) { |
|
|
|
buscenterFile.setFileSize(fileUploadComponent.getPrintSize(file.length())); |
|
|
|
} |
|
|
|
buscenterFile.setFileName(BuscenterFileEnum.ENTRUST_IMAGES.getMark()); |
|
|
|
buscenterFile.setFileType(str.substring(str.lastIndexOf(".") + 1)); |
|
|
|
buscenterFileService.insert(buscenterFile); |
|
|
|
} |
|
|
|
Future<String> future4 = pool.submit(() -> { |
|
|
|
return outDoor(busHandover.getSid()); |
|
|
|
}); |
|
|
|
if (StringUtils.isNotBlank(future4.get())) { |
|
|
|
busHandoverListVo = new BusHandoverListVo(); |
|
|
|
busHandoverListVo.setName(MessageFormat.format("《{0}》", BuscenterFileEnum.EXIT_TICKET_IMAGES.getMark())); |
|
|
|
busHandoverListVo.setDownloadUrl(docPdfComponent.getPrefixTemplateUrl() + future4.get()); |
|
|
|
list.add(busHandoverListVo); |
|
|
|
String str = future1.get(); |
|
|
|
buscenterFile = new BuscenterFile(); |
|
|
|
buscenterFile.setLinkSid(busHandover.getSid()); |
|
|
|
buscenterFile.setFilePath(future4.get()); |
|
|
|
buscenterFile.setAttachType(BuscenterFileEnum.EXIT_TICKET.getAttachType()); |
|
|
|
File file = new File(fileUploadComponent.getUploadPath() + str.replace("/", File.separator)); |
|
|
|
if (file != null) { |
|
|
|
buscenterFile.setFileSize(fileUploadComponent.getPrintSize(file.length())); |
|
|
|
} |
|
|
|
buscenterFile.setFileName(BuscenterFileEnum.EXIT_TICKET_IMAGES.getMark()); |
|
|
|
buscenterFile.setFileType(str.substring(str.lastIndexOf(".") + 1)); |
|
|
|
buscenterFileService.insert(buscenterFile); |
|
|
|
}*/ |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
return rb.setMsg("生成文件失败"); |
|
|
|
} |
|
|
|
return rb.success().setData(list); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 接收车辆确认书 |
|
|
|
* |
|
|
|
* @param sid 交车确认sid |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private String receiveCar(String sid) { |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
//组装数据
|
|
|
|
BusHandover busHandover = fetchBySid(sid); |
|
|
|
ResultBean<CommonContract> resultBean = commonContractFeign.selectByNo(busHandover.getContractNo()); |
|
|
|
CommonContract commonContract = resultBean.getData(); |
|
|
|
map.put("useOrgName", commonContract.getPartyA()); |
|
|
|
map.put("contractNo", busHandover.getContractNo()); |
|
|
|
ResultBean<SysStaffinfoDetailsVo> voResultBean = sysStaffinfoFeign.fetchBySid(busHandover.getStaffSid()); |
|
|
|
SysStaffinfoDetailsVo staffinfoDetailsVo = voResultBean.getData(); |
|
|
|
if (staffinfoDetailsVo != null) { |
|
|
|
map.put("staffName", staffinfoDetailsVo.getName()); |
|
|
|
} |
|
|
|
map.put("customerName", busHandover.getCustomerName()); |
|
|
|
ResultBean<AppCrmCustomerTempInfoVo> customerTempResultBean = crmCustomerTempFeign.getAppCustomerTempDetailsBySid(commonContract.getCustomerSid()); |
|
|
|
AppCrmCustomerTempInfoVo appCrmCustomerTempInfoVo = customerTempResultBean.getData(); |
|
|
|
map.put("idNo", appCrmCustomerTempInfoVo.getIdNumber()); |
|
|
|
map.put("name", busHandover.getRecipient()); |
|
|
|
map.put("idNumber", busHandover.getIdNo()); |
|
|
|
map.put("date", busHandover.getDeliverDate()); |
|
|
|
map.put("address", busHandover.getDeliverAddress()); |
|
|
|
ResultBean<AppOrderDetailsVo> orderDetailsVoResultBean = busSalesOrderService.getSaleOrderDetails(busHandover.getOrderSid()); |
|
|
|
AppOrderDetailsVo appOrderDetailsVo = orderDetailsVoResultBean.getData(); |
|
|
|
AppOrderModelInfoVo appOrderModelInfoVo = appOrderDetailsVo.getModelInfo(); |
|
|
|
map.put("brandName", appOrderModelInfoVo.getBrand()); |
|
|
|
map.put("model", appOrderModelInfoVo.getModelName()); |
|
|
|
ResultBean<BaseModelConfigSelectVo> baseVehicleConfigVoResultBean = baseModelConfigFeign.details(appOrderModelInfoVo.getConfigSid()); |
|
|
|
BaseModelConfigSelectVo baseModelConfigSelectVo = baseVehicleConfigVoResultBean.getData(); |
|
|
|
map.put("color", baseModelConfigSelectVo.getCarColor()); |
|
|
|
List<BusItemsListVo> busItemsListVoList = busHandoverItemsService.getListOne(sid); |
|
|
|
map.put("busItemsListVoList", busItemsListVoList); |
|
|
|
// File file = new File(getClass().getClassLoader().getResource("ftl/receiveCar.ftl").getFile());
|
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/receiveCar.ftl"); |
|
|
|
// String dir = getClassLoader().getResource("ftl").getPath();
|
|
|
|
String dir = this.getClass().getResource("ftl").getPath(); |
|
|
|
//生成word文件名
|
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
|
long seconds = System.currentTimeMillis(); |
|
|
|
String typeName = dateStr + seconds + ".doc"; |
|
|
|
File file = new File(targetPath +"receiveCar.ftl"); |
|
|
|
WordConvertUtils.inputStreamToFile(inputStream, file); |
|
|
|
WordConvertUtils.creatWord(map, file, targetPath, typeName, dir); |
|
|
|
//新生成的word路径
|
|
|
|
String wordPath = targetPath + typeName; |
|
|
|
//生成出门证文件名
|
|
|
|
String pdfName = dateStr + seconds + ".pdf"; |
|
|
|
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); |
|
|
|
return pdfName; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 委托提车授权书 |
|
|
|
* |
|
|
|
* @param sid |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public String entrustImages(String sid) { |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
//组装数据
|
|
|
|
//根据合同编号查询委托提车授权书
|
|
|
|
BusHandover busHandover = fetchBySid(sid); |
|
|
|
ResultBean<CommonContract> resultBean = commonContractFeign.selectByNo(busHandover.getContractNo()); |
|
|
|
CommonContract commonContract = resultBean.getData(); |
|
|
|
map.put("orgName", commonContract.getPartyA()); |
|
|
|
map.put("customerName", commonContract.getPartyB()); |
|
|
|
ResultBean<AppCrmCustomerTempInfoVo> customerTempResultBean = crmCustomerTempFeign.getAppCustomerTempDetailsBySid(commonContract.getCustomerSid()); |
|
|
|
AppCrmCustomerTempInfoVo appCrmCustomerTempInfoVo = customerTempResultBean.getData(); |
|
|
|
map.put("idNo", appCrmCustomerTempInfoVo.getIdNumber()); |
|
|
|
map.put("name", busHandover.getRecipient()); |
|
|
|
map.put("idNumber", busHandover.getIdNo()); |
|
|
|
map.put("contractNo", busHandover.getContractNo()); |
|
|
|
List<BusItemVo> list = busHandoverItemsService.getList(sid); |
|
|
|
List<String> stringList = list.stream().map(v -> v.getVinNo()).collect(Collectors.toList()); |
|
|
|
map.put("vinNo", String.join(",", stringList)); |
|
|
|
File file = new File(getClass().getClassLoader().getResource("ftl/entrust.ftl").getFile()); |
|
|
|
String dir = getClassLoader().getResource("ftl").getPath(); |
|
|
|
//生成word文件名
|
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
|
long seconds = System.currentTimeMillis(); |
|
|
|
String typeName = dateStr + seconds + ".doc"; |
|
|
|
WordConvertUtils.creatWord(map, file, targetPath, typeName, dir); |
|
|
|
//新生成的word路径
|
|
|
|
String wordPath = targetPath + typeName; |
|
|
|
//生成出门证文件名
|
|
|
|
String pdfName = dateStr + seconds + ".pdf"; |
|
|
|
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); |
|
|
|
return pdfName; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 交车资料确认单 |
|
|
|
* |
|
|
|
* @param sid |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public String entrustConfirmImages(String sid) { |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
//组装数据
|
|
|
|
BusHandover busHandover = fetchBySid(sid); |
|
|
|
map.put("contractNo", busHandover.getContractNo()); |
|
|
|
map.put("customerName", busHandover.getCustomerName()); |
|
|
|
List<BusItemVo> list = busHandoverItemsService.getList(sid); |
|
|
|
map.put("list", list); |
|
|
|
File file = new File(getClass().getClassLoader().getResource("ftl/entrustConfirm.ftl").getFile()); |
|
|
|
String dir = getClassLoader().getResource("ftl").getPath(); |
|
|
|
//生成word文件名
|
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
|
long seconds = System.currentTimeMillis(); |
|
|
|
String typeName = dateStr + seconds + ".doc"; |
|
|
|
WordConvertUtils.creatWord(map, file, targetPath, typeName, dir); |
|
|
|
//新生成的word路径
|
|
|
|
String wordPath = targetPath + typeName; |
|
|
|
//生成出门证文件名
|
|
|
|
String pdfName = dateStr + seconds + ".pdf"; |
|
|
|
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); |
|
|
|
return pdfName; |
|
|
|
} |
|
|
|
|
|
|
|
public String outDoor(String sid) { |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
//组装数据
|
|
|
|
BusHandover busHandover = fetchBySid(sid); |
|
|
|
ResultBean<SysStaffinfoDetailsVo> voResultBean = sysStaffinfoFeign.fetchBySid(busHandover.getStaffSid()); |
|
|
|
SysStaffinfoDetailsVo staffinfoDetailsVo = voResultBean.getData(); |
|
|
|
if (staffinfoDetailsVo != null) { |
|
|
|
map.put("apply", staffinfoDetailsVo.getName()); |
|
|
|
} |
|
|
|
ResultBean<CommonContract> resultBean = commonContractFeign.selectByNo(busHandover.getContractNo()); |
|
|
|
CommonContract commonContract = resultBean.getData(); |
|
|
|
map.put("orgName", commonContract.getPartyA()); |
|
|
|
map.put("name", busHandover.getCustomerName()); |
|
|
|
List<BusItemVo> list = busHandoverItemsService.getList(sid); |
|
|
|
map.put("number", list.size()); |
|
|
|
map.put("vinNo", String.join(",", list.stream().map(v -> v.getVinNo()).collect(Collectors.toList()))); |
|
|
|
map.put("reason", "全款交车"); |
|
|
|
map.put("operator", staffinfoDetailsVo.getName()); |
|
|
|
map.put("operator", staffinfoDetailsVo.getName()); |
|
|
|
map.put("carCollector", "-"); |
|
|
|
map.put("date", busHandover.getDeliverDate()); |
|
|
|
ResultBean<AppOrderDetailsVo> orderDetailsVoResultBean = busSalesOrderService.getSaleOrderDetails(busHandover.getOrderSid()); |
|
|
|
AppOrderDetailsVo appOrderDetailsVo = orderDetailsVoResultBean.getData(); |
|
|
|
AppOrderModelInfoVo appOrderModelInfoVo = appOrderDetailsVo.getModelInfo(); |
|
|
|
map.put("modelName", appOrderModelInfoVo.getModelName()); |
|
|
|
File file = new File(getClass().getClassLoader().getResource("ftl/outdoor.ftl").getFile()); |
|
|
|
String dir = getClassLoader().getResource("ftl").getPath(); |
|
|
|
//生成word文件名
|
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
|
long seconds = System.currentTimeMillis(); |
|
|
|
String typeName = dateStr + seconds + ".doc"; |
|
|
|
WordConvertUtils.creatWord(map, file, targetPath, typeName, dir); |
|
|
|
//新生成的word路径
|
|
|
|
String wordPath = targetPath + typeName; |
|
|
|
//生成出门证文件名
|
|
|
|
String pdfName = dateStr + seconds + ".pdf"; |
|
|
|
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); |
|
|
|
return pdfName; |
|
|
|
} |
|
|
|
|
|
|
|
public PagerVo<BusHandoverVo> pagerList(PagerQuery<BusHandoverQuery> pagerQuery) { |
|
|
|
IPage<BusHandover> page = PagerUtil.queryToPage(pagerQuery); |
|
|
|
BusHandoverQuery params = pagerQuery.getParams(); |
|
|
@ -159,6 +447,30 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
|
} else { |
|
|
|
record.setShowUpdate(true); |
|
|
|
} |
|
|
|
List<DownloadVo> stringList = new ArrayList<>(); |
|
|
|
DownloadVo vo = new DownloadVo(); |
|
|
|
BuscenterFile buscenterFile = buscenterFileService.selectByLinkSidOne(record.getSid(), BuscenterFileEnum.RECEIVE_CAR.getAttachType()); |
|
|
|
vo.setName(buscenterFile.getFileName()); |
|
|
|
vo.setDownloadUrl(docPdfComponent.getPrefixTemplateUrl() + buscenterFile.getFilePath()); |
|
|
|
stringList.add(vo); |
|
|
|
vo = new DownloadVo(); |
|
|
|
buscenterFile = buscenterFileService.selectByLinkSidOne(record.getSid(), BuscenterFileEnum.ENTRUST_CONFIRM.getAttachType()); |
|
|
|
vo.setName(buscenterFile.getFileName()); |
|
|
|
vo.setDownloadUrl(docPdfComponent.getPrefixTemplateUrl() + buscenterFile.getFilePath()); |
|
|
|
stringList.add(vo); |
|
|
|
vo = new DownloadVo(); |
|
|
|
buscenterFile = buscenterFileService.selectByLinkSidOne(record.getSid(), BuscenterFileEnum.ENTRUST.getAttachType()); |
|
|
|
vo.setName(buscenterFile.getFileName()); |
|
|
|
vo.setDownloadUrl(docPdfComponent.getPrefixTemplateUrl() + buscenterFile.getFilePath()); |
|
|
|
stringList.add(vo); |
|
|
|
vo = new DownloadVo(); |
|
|
|
buscenterFile = buscenterFileService.selectByLinkSidOne(record.getSid(), BuscenterFileEnum.EXIT_TICKET.getAttachType()); |
|
|
|
vo.setName(buscenterFile.getFileName()); |
|
|
|
vo.setDownloadUrl(docPdfComponent.getPrefixTemplateUrl() + buscenterFile.getFilePath()); |
|
|
|
stringList.add(vo); |
|
|
|
|
|
|
|
record.setFileResps(stringList); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
PagerVo<BusHandoverVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|