|
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.google.common.util.concurrent.ThreadFactoryBuilder; |
|
|
import com.google.common.util.concurrent.ThreadFactoryBuilder; |
|
|
import com.yxt.anrui.base.api.basemodelconfig.BaseModelConfigFeign; |
|
|
import com.yxt.anrui.base.api.basemodelconfig.BaseModelConfigFeign; |
|
|
import com.yxt.anrui.base.api.basemodelconfig.BaseModelConfigSelectVo; |
|
|
import com.yxt.anrui.base.api.basemodelconfig.BaseModelConfigSelectVo; |
|
|
|
|
|
import com.yxt.anrui.base.api.basevehicle.BaseExistingCarListVo; |
|
|
import com.yxt.anrui.base.api.basevehicle.BaseVehicleFeign; |
|
|
import com.yxt.anrui.base.api.basevehicle.BaseVehicleFeign; |
|
|
import com.yxt.anrui.base.api.basevehicle.BaseVehicleSelectVo; |
|
|
import com.yxt.anrui.base.api.basevehicle.BaseVehicleSelectVo; |
|
|
import com.yxt.anrui.base.api.commoncontract.CommonContract; |
|
|
import com.yxt.anrui.base.api.commoncontract.CommonContract; |
|
@ -16,17 +17,29 @@ import com.yxt.anrui.buscenter.api.buscenterfile.BuscenterFile; |
|
|
import com.yxt.anrui.buscenter.api.buscenterfile.BuscenterFileEnum; |
|
|
import com.yxt.anrui.buscenter.api.buscenterfile.BuscenterFileEnum; |
|
|
import com.yxt.anrui.buscenter.api.bushandover.*; |
|
|
import com.yxt.anrui.buscenter.api.bushandover.*; |
|
|
import com.yxt.anrui.buscenter.api.bushandoveritems.*; |
|
|
import com.yxt.anrui.buscenter.api.bushandoveritems.*; |
|
|
|
|
|
import com.yxt.anrui.buscenter.api.bushandoverpreparevehicle.BusHandoverPrepareVehicle; |
|
|
|
|
|
import com.yxt.anrui.buscenter.api.bushandoverwait.BusHandoverWait; |
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.app.order.AppOrderDetailsVo; |
|
|
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.api.bussalesorder.app.order.AppOrderModelInfoVo; |
|
|
|
|
|
import com.yxt.anrui.buscenter.api.busvehicledatahandover.BusVehicleDataHandoverDetailsVo; |
|
|
|
|
|
import com.yxt.anrui.buscenter.api.busvehiclehandoverdata.BusVehicleHandoverDataDetailsVo; |
|
|
|
|
|
import com.yxt.anrui.buscenter.api.busvehicleinformation.BusVehicleInformationVo; |
|
|
|
|
|
import com.yxt.anrui.buscenter.api.busvehicleinformationhandover.BusVehicleInformationHandoverDetailsListVo; |
|
|
import com.yxt.anrui.buscenter.biz.buscenterfile.BuscenterFileService; |
|
|
import com.yxt.anrui.buscenter.biz.buscenterfile.BuscenterFileService; |
|
|
import com.yxt.anrui.buscenter.biz.bushandoveritems.BusHandoverItemsService; |
|
|
import com.yxt.anrui.buscenter.biz.bushandoveritems.BusHandoverItemsService; |
|
|
|
|
|
import com.yxt.anrui.buscenter.biz.bushandoverpreparevehicle.BusHandoverPrepareVehicleService; |
|
|
import com.yxt.anrui.buscenter.biz.bushandoverwait.BusHandoverWaitService; |
|
|
import com.yxt.anrui.buscenter.biz.bushandoverwait.BusHandoverWaitService; |
|
|
import com.yxt.anrui.buscenter.biz.bussalesorder.BusSalesOrderService; |
|
|
import com.yxt.anrui.buscenter.biz.bussalesorder.BusSalesOrderService; |
|
|
|
|
|
import com.yxt.anrui.buscenter.biz.busvehicleinformationhandover.BusVehicleInformationHandoverService; |
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.AppCrmCustomerTempInfoVo; |
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.AppCrmCustomerTempInfoVo; |
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTempFeign; |
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTempFeign; |
|
|
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTempVo; |
|
|
|
|
|
import com.yxt.anrui.fin.api.finvehicleinvoice.FinVehicleInvoice; |
|
|
|
|
|
import com.yxt.anrui.fin.api.finvehicleinvoice.FinVehicleInvoiceFeign; |
|
|
import com.yxt.anrui.portal.api.sysstaffinfo.SysStaffinfoDetailsVo; |
|
|
import com.yxt.anrui.portal.api.sysstaffinfo.SysStaffinfoDetailsVo; |
|
|
import com.yxt.anrui.portal.api.sysstaffinfo.SysStaffinfoFeign; |
|
|
import com.yxt.anrui.portal.api.sysstaffinfo.SysStaffinfoFeign; |
|
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign; |
|
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign; |
|
|
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUser; |
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserVo; |
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserVo; |
|
|
import com.yxt.common.base.config.component.DocPdfComponent; |
|
|
import com.yxt.common.base.config.component.DocPdfComponent; |
|
@ -45,6 +58,7 @@ import org.springframework.stereotype.Service; |
|
|
import java.io.File; |
|
|
import java.io.File; |
|
|
import java.io.InputStream; |
|
|
import java.io.InputStream; |
|
|
import java.text.MessageFormat; |
|
|
import java.text.MessageFormat; |
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.concurrent.*; |
|
|
import java.util.concurrent.*; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
@ -92,6 +106,15 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
@Autowired |
|
|
@Autowired |
|
|
private BaseVehicleFeign baseVehicleFeign; |
|
|
private BaseVehicleFeign baseVehicleFeign; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private BusHandoverPrepareVehicleService busHandoverPrepareVehicleService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private BusVehicleInformationHandoverService busVehicleInformationHandoverService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private FinVehicleInvoiceFeign finVehicleInvoiceFeign; |
|
|
|
|
|
|
|
|
// @Transactional(rollbackFor = Exception.class)
|
|
|
// @Transactional(rollbackFor = Exception.class)
|
|
|
public ResultBean<List<BusHandoverListVo>> saveDeliverybill(BusHandoverDto dto) { |
|
|
public ResultBean<List<BusHandoverListVo>> saveDeliverybill(BusHandoverDto dto) { |
|
|
ResultBean<List<BusHandoverListVo>> rb = ResultBean.fireFail(); |
|
|
ResultBean<List<BusHandoverListVo>> rb = ResultBean.fireFail(); |
|
@ -721,6 +744,509 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
public int selectByCount(String contractId, List<String> vinSids) { |
|
|
public int selectByCount(String contractId, List<String> vinSids) { |
|
|
return baseMapper.selectByCount(contractId, vinSids); |
|
|
return baseMapper.selectByCount(contractId, vinSids); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 确认交付信息回显 |
|
|
|
|
|
* |
|
|
|
|
|
* @param sids |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
public ResultBean<BusHandoverDeliveryVo> deliveryByHandoverWaitSids(String[] sids) { |
|
|
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
|
|
BusHandoverDeliveryVo vo = new BusHandoverDeliveryVo(); |
|
|
|
|
|
List<BusHandoverItemForDeliveryVo> voList = new ArrayList<>(); |
|
|
|
|
|
vo.setCarNum(String.valueOf(sids.length)); |
|
|
|
|
|
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(); |
|
|
|
|
|
//从交车准备中查询交车资料
|
|
|
|
|
|
BusHandoverPrepareVehicle prepareVehicle = busHandoverPrepareVehicleService.fetchDetailsByVinSid(handoverWait.getVinSid()); |
|
|
|
|
|
if (null != prepareVehicle) { |
|
|
|
|
|
if (prepareVehicle.getInvoicingState() > 0) { |
|
|
|
|
|
sb.append("发票、"); |
|
|
|
|
|
} |
|
|
|
|
|
if (prepareVehicle.getCertificateState() > 0) { |
|
|
|
|
|
sb.append("合格证、"); |
|
|
|
|
|
} |
|
|
|
|
|
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(); |
|
|
|
|
|
String keyNum = ""; |
|
|
|
|
|
for (BusVehicleInformationVo information : informations) { |
|
|
|
|
|
keyNum = information.getVehicleKeyNum(); |
|
|
|
|
|
} |
|
|
|
|
|
if (Integer.parseInt(data.getIsFuelVehicle()) > 0) { |
|
|
|
|
|
//0是燃气车 1不是燃气车
|
|
|
|
|
|
sb.append(keyNum + "把车钥匙、一致性证书、申请表、保修手册、说明书、环保清单、驾驶员卡、"); |
|
|
|
|
|
} else { |
|
|
|
|
|
sb.append(keyNum + "把车钥匙、一致性证书、申请表、保修手册、说明书、环保清单、驾驶员卡、气瓶产品质量证书(燃气车)、"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
sb.delete(sb.length() - 1, sb.length()); |
|
|
|
|
|
itemVo.setItemValue(sb.toString()); |
|
|
|
|
|
} |
|
|
|
|
|
voList.add(itemVo); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
vo.setBusItemvos(voList); |
|
|
|
|
|
return rb.success().setData(vo); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 保存交车确认信息,并打印《接收车辆确认书》、《出门证》、《交车资料确认单》 |
|
|
|
|
|
* |
|
|
|
|
|
* @param dto |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
public ResultBean<String> saveOrUpdateBusHandover(BusHandoverDeliveryDto dto) throws Exception { |
|
|
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
|
|
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()); |
|
|
|
|
|
} |
|
|
|
|
|
baseMapper.insert(entity); |
|
|
|
|
|
List<BusHandoverItemForDeliveryDto> busItemvos = dto.getBusItemvos(); |
|
|
|
|
|
for (BusHandoverItemForDeliveryDto busItemvo : busItemvos) { |
|
|
|
|
|
BusHandoverItems items = new BusHandoverItems(); |
|
|
|
|
|
BeanUtil.copyProperties(busItemvo, items); |
|
|
|
|
|
items.setHandoverSid(sid); |
|
|
|
|
|
busHandoverItemsService.insert(items); |
|
|
|
|
|
} |
|
|
|
|
|
//打印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); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
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(); |
|
|
|
|
|
} |
|
|
|
|
|
path = filePath + dateStr + seconds + "交车确认.pdf"; |
|
|
|
|
|
} |
|
|
|
|
|
return rb.success().setData(path); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 打印《接收车辆确认书》 |
|
|
|
|
|
*/ |
|
|
|
|
|
public ResultBean<List<String>> createPdf(String sid) { |
|
|
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
|
|
BusHandover busHandover = fetchBySid(sid); |
|
|
|
|
|
//接收车辆确认书、交车资料确认单
|
|
|
|
|
|
BusReceiveVehiclePdfVo pdfVo = new BusReceiveVehiclePdfVo(); |
|
|
|
|
|
//出门证
|
|
|
|
|
|
BusExitPermitVo permitVo = new BusExitPermitVo(); |
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
|
|
if (null != busHandover) { |
|
|
|
|
|
if (StringUtils.isNotBlank(busHandover.getPayTypeValue())) { |
|
|
|
|
|
if ("全款".equals(busHandover.getPayTypeValue())) { |
|
|
|
|
|
permitVo.setReason("全款交车"); |
|
|
|
|
|
} else if ("贷款".equals(busHandover.getPayTypeValue())) { |
|
|
|
|
|
permitVo.setReason("消贷交车"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//申请人
|
|
|
|
|
|
if (StringUtils.isNotBlank(busHandover.getCreateBySid())) { |
|
|
|
|
|
SysUser sysUser = sysUserFeign.selectBySid(busHandover.getCreateBySid()).getData(); |
|
|
|
|
|
SysStaffinfoDetailsVo staffinfoDetailsVo = sysStaffinfoFeign.fetchBySid(sysUser.getStaffSid()).getData(); |
|
|
|
|
|
permitVo.setApply(staffinfoDetailsVo.getName()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(busHandover.getUseOrgName())) { |
|
|
|
|
|
permitVo.setOrgName(busHandover.getUseOrgName()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(sdf.format(busHandover.getDeliverDate()))) { |
|
|
|
|
|
permitVo.setDate(sdf.format(busHandover.getDeliverDate())); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(busHandover.getContractNo())) { |
|
|
|
|
|
permitVo.setContract(busHandover.getContractNo()); |
|
|
|
|
|
List<FinVehicleInvoice> invoices = finVehicleInvoiceFeign.selectByContractNo(busHandover.getContractNo()).getData(); |
|
|
|
|
|
if (!invoices.isEmpty()) { |
|
|
|
|
|
for (FinVehicleInvoice invoice : invoices) { |
|
|
|
|
|
permitVo.setFinOperator(invoice.getDrawer()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(busHandover.getCustomerName())) { |
|
|
|
|
|
permitVo.setName(busHandover.getCustomerName()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(busHandover.getCarNum())) { |
|
|
|
|
|
permitVo.setNumber(busHandover.getCarNum()); |
|
|
|
|
|
} |
|
|
|
|
|
//====================================================
|
|
|
|
|
|
BeanUtil.copyProperties(busHandover, pdfVo); |
|
|
|
|
|
pdfVo.setModel(busHandover.getModelName()); |
|
|
|
|
|
String customerSid = busHandover.getCustomerSid(); |
|
|
|
|
|
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()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
String staffSid = busHandover.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()); |
|
|
|
|
|
//出门证业务经办人
|
|
|
|
|
|
permitVo.setOperator(data.getName()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//查询交车车辆
|
|
|
|
|
|
List<BusHandoverItems> items = busHandoverItemsService.getItemsListByMainSid(sid).getData(); |
|
|
|
|
|
List<BusReceiveVehicleListPdfVo> listPdfVos = new ArrayList<>(); |
|
|
|
|
|
StringBuffer sbVin = new StringBuffer(); |
|
|
|
|
|
StringBuffer sbModel = new StringBuffer(); |
|
|
|
|
|
if (items.size() > 0) { |
|
|
|
|
|
int sNo = 1; |
|
|
|
|
|
int sortNo = 1; |
|
|
|
|
|
for (BusHandoverItems item : items) { |
|
|
|
|
|
BusReceiveVehicleListPdfVo listPdfVo = new BusReceiveVehicleListPdfVo(); |
|
|
|
|
|
listPdfVo.setSortNo(String.valueOf(sortNo++)); |
|
|
|
|
|
listPdfVo.setSNo(String.valueOf(sNo++)); |
|
|
|
|
|
listPdfVo.setVinNo(item.getVinNo()); |
|
|
|
|
|
listPdfVo.setVehicleHandoverData(item.getItemValue()); |
|
|
|
|
|
String vinSid = item.getVinSid(); |
|
|
|
|
|
BaseVehicleSelectVo vehicle = baseVehicleFeign.details(vinSid).getData(); |
|
|
|
|
|
if (StringUtils.isNotBlank(vehicle.getCarBrandName())) { |
|
|
|
|
|
pdfVo.setBrandName(vehicle.getCarBrandName()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(vehicle.getVehMark())) { |
|
|
|
|
|
pdfVo.setConfig(vehicle.getVehMark()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(vehicle.getEngineNo())) { |
|
|
|
|
|
listPdfVo.setEngineVo(vehicle.getEngineNo()); |
|
|
|
|
|
} |
|
|
|
|
|
listPdfVos.add(listPdfVo); |
|
|
|
|
|
String vinNo = item.getVinNo(); |
|
|
|
|
|
sbVin.append(vinNo).append(","); |
|
|
|
|
|
if (StringUtils.isNotBlank(vehicle.getModelConfigSid())) { |
|
|
|
|
|
String modelConfigSid = vehicle.getModelConfigSid(); |
|
|
|
|
|
BaseModelConfigSelectVo data = baseModelConfigFeign.details(modelConfigSid).getData(); |
|
|
|
|
|
if (null != data) { |
|
|
|
|
|
if (StringUtils.isNotBlank(data.getCarColor())) { |
|
|
|
|
|
pdfVo.setColor(data.getCarColor()); |
|
|
|
|
|
String modelName = item.getModelName(); |
|
|
|
|
|
String carColor = data.getCarColor(); |
|
|
|
|
|
sbModel.append(modelName + carColor).append(","); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
sbVin.delete(sbVin.length() - 1, sbVin.length()); |
|
|
|
|
|
sbModel.delete(sbModel.length() - 1, sbModel.length()); |
|
|
|
|
|
permitVo.setVinNo(sbVin.toString()); |
|
|
|
|
|
permitVo.setModelName(sbModel.toString()); |
|
|
|
|
|
} |
|
|
|
|
|
pdfVo.setListPdfVos(listPdfVos); |
|
|
|
|
|
} |
|
|
|
|
|
List<String> filePaths = new ArrayList<>(); |
|
|
|
|
|
String s1 = receiveVehicleConfirmationCreatePdf(pdfVo); |
|
|
|
|
|
String s2 = exitPermitCreatePdf(permitVo); |
|
|
|
|
|
String s3 = commonCreatePdf(pdfVo); |
|
|
|
|
|
filePaths.add(s1); |
|
|
|
|
|
filePaths.add(s2); |
|
|
|
|
|
filePaths.add(s3); |
|
|
|
|
|
return rb.success().setData(filePaths); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 打印《接收车辆确认书》 |
|
|
|
|
|
*/ |
|
|
|
|
|
public String receiveVehicleConfirmationCreatePdf(BusReceiveVehiclePdfVo pdfVo) { |
|
|
|
|
|
Map<String, Object> dataMap = new HashMap<String, Object>(); |
|
|
|
|
|
List<BusReceiveVehicleListPdfVo> list = pdfVo.getListPdfVos(); |
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
|
|
List<Map<String, Object>> newList = new ArrayList<>(); |
|
|
|
|
|
dataMap.put("contractNo", pdfVo.getContractNo()); |
|
|
|
|
|
dataMap.put("customerName", pdfVo.getCustomerName()); |
|
|
|
|
|
dataMap.put("useOrgName", pdfVo.getUseOrgName()); |
|
|
|
|
|
dataMap.put("staffName", pdfVo.getStaffName()); |
|
|
|
|
|
dataMap.put("idNumber", pdfVo.getIdNumber()); |
|
|
|
|
|
dataMap.put("recipient", pdfVo.getRecipient()); |
|
|
|
|
|
dataMap.put("idNo", pdfVo.getIdNo()); |
|
|
|
|
|
dataMap.put("deliverDate", sdf.format(pdfVo.getDeliverDate())); |
|
|
|
|
|
dataMap.put("deliverAddress", pdfVo.getDeliverAddress()); |
|
|
|
|
|
dataMap.put("brandName", pdfVo.getBrandName()); |
|
|
|
|
|
dataMap.put("model", pdfVo.getModel()); |
|
|
|
|
|
dataMap.put("config", pdfVo.getConfig()); |
|
|
|
|
|
dataMap.put("color", pdfVo.getColor()); |
|
|
|
|
|
if (null != list && list.size() > 0) { |
|
|
|
|
|
for (BusReceiveVehicleListPdfVo listPdfVo : list) { |
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
|
map.put("sortNo", listPdfVo.getSortNo()); |
|
|
|
|
|
map.put("vinNo", listPdfVo.getVinNo()); |
|
|
|
|
|
map.put("engineNo", listPdfVo.getEngineVo()); |
|
|
|
|
|
newList.add(map); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
dataMap.put("newList", newList); |
|
|
|
|
|
//获取模板
|
|
|
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/receiveVehicleConfirmation.ftl"); |
|
|
|
|
|
//生成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 + "receiveVehicleConfirmation" + seconds + ".ftl"); |
|
|
|
|
|
File dir = new File(targetPath); |
|
|
|
|
|
WordConvertUtils.inputStreamToFile(inputStream, file); |
|
|
|
|
|
WordConvertUtils.creatWord1(dataMap, file, targetPath, typeName, dir); |
|
|
|
|
|
//新生成的word路径
|
|
|
|
|
|
String wordPath = targetPath + typeName; |
|
|
|
|
|
//生成出门证文件名
|
|
|
|
|
|
String pdfName = "接收车辆确认书" + dateStr + seconds + ".pdf"; |
|
|
|
|
|
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); |
|
|
|
|
|
String path = targetPath + pdfName; |
|
|
|
|
|
return path; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 随车资料 |
|
|
|
|
|
* |
|
|
|
|
|
* @param pdfVo |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
public String commonCreatePdf(BusReceiveVehiclePdfVo pdfVo) { |
|
|
|
|
|
Map<String, Object> dataMap = new HashMap<String, Object>(); |
|
|
|
|
|
List<BusReceiveVehicleListPdfVo> listPdfVos = pdfVo.getListPdfVos(); |
|
|
|
|
|
List<Map<String, Object>> newList = new ArrayList<>(); |
|
|
|
|
|
dataMap.put("contractNo", pdfVo.getContractNo()); |
|
|
|
|
|
dataMap.put("customerName", pdfVo.getCustomerName()); |
|
|
|
|
|
if (null != listPdfVos && listPdfVos.size() > 0) { |
|
|
|
|
|
for (BusReceiveVehicleListPdfVo detailsVo : listPdfVos) { |
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
|
map.put("sNo", detailsVo.getSNo()); |
|
|
|
|
|
map.put("vinNo", detailsVo.getVinNo()); |
|
|
|
|
|
map.put("vehicleHandoverData", detailsVo.getVehicleHandoverData()); |
|
|
|
|
|
newList.add(map); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
dataMap.put("newList", newList); |
|
|
|
|
|
//获取模板
|
|
|
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/vehicledatahandover.ftl"); |
|
|
|
|
|
//生成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 + "vehicledatahandover" + seconds + ".ftl"); |
|
|
|
|
|
File dir = new File(targetPath); |
|
|
|
|
|
WordConvertUtils.inputStreamToFile(inputStream, file); |
|
|
|
|
|
WordConvertUtils.creatWord1(dataMap, file, targetPath, typeName, dir); |
|
|
|
|
|
//新生成的word路径
|
|
|
|
|
|
String wordPath = targetPath + typeName; |
|
|
|
|
|
//生成出门证文件名
|
|
|
|
|
|
String pdfName = "交车资料确认单" + dateStr + seconds + ".pdf"; |
|
|
|
|
|
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); |
|
|
|
|
|
String path = targetPath + pdfName; |
|
|
|
|
|
return path; |
|
|
|
|
|
} |
|
|
|
|
|
/** |
|
|
|
|
|
* 出门证 |
|
|
|
|
|
* |
|
|
|
|
|
* @param sid |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
// public ResultBean<String> exitPermit(String sid) {
|
|
|
|
|
|
// ResultBean rb = ResultBean.fireFail();
|
|
|
|
|
|
// BusHandover busHandover = fetchBySid(sid);
|
|
|
|
|
|
// BusExitPermitVo permitVo = new BusExitPermitVo();
|
|
|
|
|
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
|
// if (StringUtils.isNotBlank(busHandover.getUseOrgName())) {
|
|
|
|
|
|
// permitVo.setOrgName(busHandover.getUseOrgName());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (StringUtils.isNotBlank(sdf.format(busHandover.getDeliverDate()))) {
|
|
|
|
|
|
// permitVo.setDate(sdf.format(busHandover.getDeliverDate()));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (StringUtils.isNotBlank(busHandover.getCreateBySid())) {
|
|
|
|
|
|
// SysUser sysUser = sysUserFeign.selectBySid(busHandover.getCreateBySid()).getData();
|
|
|
|
|
|
// SysStaffinfoDetailsVo staffinfoDetailsVo = sysStaffinfoFeign.fetchBySid(sysUser.getStaffSid()).getData();
|
|
|
|
|
|
// permitVo.setApply(staffinfoDetailsVo.getName());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (StringUtils.isNotBlank(busHandover.getContractNo())) {
|
|
|
|
|
|
// permitVo.setContract(busHandover.getContractNo());
|
|
|
|
|
|
// List<FinVehicleInvoice> invoices = finVehicleInvoiceFeign.selectByContractNo(busHandover.getContractNo()).getData();
|
|
|
|
|
|
// if (!invoices.isEmpty()) {
|
|
|
|
|
|
// for (FinVehicleInvoice invoice : invoices) {
|
|
|
|
|
|
// permitVo.setFinOperator(invoice.getDrawer());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (StringUtils.isNotBlank(busHandover.getCustomerName())) {
|
|
|
|
|
|
// permitVo.setName(busHandover.getCustomerName());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (StringUtils.isNotBlank(busHandover.getCarNum())) {
|
|
|
|
|
|
// permitVo.setNumber(busHandover.getCarNum());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (StringUtils.isNotBlank(busHandover.getStaffSid())) {
|
|
|
|
|
|
// SysStaffinfoDetailsVo staffinfoDetailsVo = sysStaffinfoFeign.fetchBySid(busHandover.getStaffSid()).getData();
|
|
|
|
|
|
// permitVo.setOperator(staffinfoDetailsVo.getName());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (StringUtils.isNotBlank(busHandover.getPayTypeValue())) {
|
|
|
|
|
|
// if ("全款".equals(busHandover.getPayTypeValue())) {
|
|
|
|
|
|
// permitVo.setReason("全款交车");
|
|
|
|
|
|
// } else if ("贷款".equals(busHandover.getPayTypeValue())) {
|
|
|
|
|
|
// permitVo.setReason("消贷交车");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// StringBuffer sbVin = new StringBuffer();
|
|
|
|
|
|
// StringBuffer sbModel = new StringBuffer();
|
|
|
|
|
|
// List<BusHandoverItems> items = busHandoverItemsService.getItemsListByMainSid(sid).getData();
|
|
|
|
|
|
// if (!items.isEmpty()) {
|
|
|
|
|
|
// for (BusHandoverItems item : items) {
|
|
|
|
|
|
// String vinNo = item.getVinNo();
|
|
|
|
|
|
// sbVin.append(vinNo).append(",");
|
|
|
|
|
|
// String modelName = item.getModelName();
|
|
|
|
|
|
// BaseVehicleSelectVo vehicle = baseVehicleFeign.details(item.getVinSid()).getData();
|
|
|
|
|
|
// BaseModelConfigSelectVo configSelectVo = baseModelConfigFeign.details(vehicle.getModelConfigSid()).getData();
|
|
|
|
|
|
// String carColor = configSelectVo.getCarColor();
|
|
|
|
|
|
// sbModel.append(modelName + carColor).append(",");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// sbVin.delete(sbVin.length() - 1, sbVin.length());
|
|
|
|
|
|
// sbModel.delete(sbModel.length() - 1, sbModel.length());
|
|
|
|
|
|
// permitVo.setVinNo(sbVin.toString());
|
|
|
|
|
|
// permitVo.setModelName(sbModel.toString());
|
|
|
|
|
|
// String s = exitPermitCreatePdf(permitVo);
|
|
|
|
|
|
// return rb.success().setData(s);
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 打印《出门证》 |
|
|
|
|
|
*/ |
|
|
|
|
|
public String exitPermitCreatePdf(BusExitPermitVo pdfVo) { |
|
|
|
|
|
Map<String, Object> dataMap = new HashMap<String, Object>(); |
|
|
|
|
|
List<Map<String, Object>> newList = new ArrayList<>(); |
|
|
|
|
|
dataMap.put("orgName", pdfVo.getOrgName()); |
|
|
|
|
|
dataMap.put("date", pdfVo.getDate()); |
|
|
|
|
|
dataMap.put("apply", pdfVo.getApply()); |
|
|
|
|
|
dataMap.put("contract", pdfVo.getContract()); |
|
|
|
|
|
dataMap.put("name", pdfVo.getName()); |
|
|
|
|
|
dataMap.put("number", pdfVo.getNumber()); |
|
|
|
|
|
dataMap.put("modelName", pdfVo.getModelName()); |
|
|
|
|
|
dataMap.put("vinNo", pdfVo.getVinNo()); |
|
|
|
|
|
dataMap.put("reason", pdfVo.getReason()); |
|
|
|
|
|
dataMap.put("operator", pdfVo.getOperator()); |
|
|
|
|
|
dataMap.put("finOperator", pdfVo.getFinOperator()); |
|
|
|
|
|
dataMap.put("carCollector", pdfVo.getCarCollector()); |
|
|
|
|
|
dataMap.put("signature", pdfVo.getSignature()); |
|
|
|
|
|
//获取模板
|
|
|
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/outdoor.ftl"); |
|
|
|
|
|
//生成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 + "exitPermit" + seconds + ".ftl"); |
|
|
|
|
|
File dir = new File(targetPath); |
|
|
|
|
|
WordConvertUtils.inputStreamToFile(inputStream, file); |
|
|
|
|
|
WordConvertUtils.creatWord1(dataMap, file, targetPath, typeName, dir); |
|
|
|
|
|
//新生成的word路径
|
|
|
|
|
|
String wordPath = targetPath + typeName; |
|
|
|
|
|
//生成出门证文件名
|
|
|
|
|
|
String pdfName = "出门证" + dateStr + seconds + ".pdf"; |
|
|
|
|
|
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); |
|
|
|
|
|
String path = targetPath + pdfName; |
|
|
|
|
|
return path; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 条件构造器 |
|
|
|
|
|
*/ |
|
|
|
|
|
private QueryWrapper<BusHandover> createQueryWrapper(BusHandoverQuery query) { |
|
|
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
|
|
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
|
|
|
|
|
QueryWrapper<BusHandover> qw = new QueryWrapper<>(); |
|
|
|
|
|
if (StringUtils.isNotBlank(query.getContractNo())) { |
|
|
|
|
|
qw.like("contractNo", query.getContractNo()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(query.getCustomerName())) { |
|
|
|
|
|
qw.like("customerName", query.getCustomerName()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(query.getPayTypeValue())) { |
|
|
|
|
|
qw.like("payTypeValue", query.getPayTypeValue()); |
|
|
|
|
|
} |
|
|
|
|
|
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; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 交车办理分页列表 |
|
|
|
|
|
* |
|
|
|
|
|
* @param pq |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
public ResultBean<PagerVo<BusHandoverVos>> listPage(PagerQuery<BusHandoverQuery> pq) { |
|
|
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
|
|
BusHandoverQuery query = pq.getParams(); |
|
|
|
|
|
QueryWrapper<BusHandover> qw = createQueryWrapper(query); |
|
|
|
|
|
IPage<BusHandover> page = PagerUtil.queryToPage(pq); |
|
|
|
|
|
IPage<BusHandoverVos> pagging = baseMapper.selectListPageVo(page, qw); |
|
|
|
|
|
PagerVo<BusHandoverVos> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
|
|
return rb.success().setData(p); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*@Autowired |
|
|
/*@Autowired |
|
|
private SysOrganizationFeign sysOrganizationFeign; |
|
|
private SysOrganizationFeign sysOrganizationFeign; |
|
|
|
|
|
|
|
|