|
|
@ -7,7 +7,8 @@ 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.basevehicle.BaseVehicleFeign; |
|
|
|
import com.yxt.anrui.base.api.basevehicle.BaseVehicleSelectVo; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.CommonContract; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.CommonContractFeign; |
|
|
|
import com.yxt.anrui.base.common.enums.DictCommonEnum; |
|
|
@ -40,6 +41,7 @@ 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 org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.io.InputStream; |
|
|
@ -87,13 +89,24 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
|
@Autowired |
|
|
|
private BusSalesOrderService busSalesOrderService; |
|
|
|
@Autowired |
|
|
|
private BaseVehicleModelFeign baseVehicleModelFeign; |
|
|
|
@Autowired |
|
|
|
private BaseModelConfigFeign baseModelConfigFeign; |
|
|
|
@Autowired |
|
|
|
private BaseVehicleFeign baseVehicleFeign; |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public ResultBean<List<BusHandoverListVo>> saveDeliverybill(BusHandoverDto dto) { |
|
|
|
ResultBean<List<BusHandoverListVo>> rb = ResultBean.fireFail(); |
|
|
|
//ToDo:验证是否包含已存在的车辆
|
|
|
|
String contractNo = dto.getContractNo(); |
|
|
|
List<BusHanItemDto> vinList = dto.getVinList(); |
|
|
|
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("选择的车辆包含已存在交车确认记录的数据"); |
|
|
|
} |
|
|
|
BusHandover busHandover = new BusHandover(); |
|
|
|
BeanUtil.copyProperties(dto, busHandover, "sid"); |
|
|
|
String userSid = dto.getUserSid(); |
|
|
@ -265,49 +278,78 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
|
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(); |
|
|
|
//客户相关信息
|
|
|
|
ResultBean<AppCrmCustomerTempInfoVo> customerTempResultBean = crmCustomerTempFeign.getAppCustomerTempDetailsBySid(commonContract.getCustomerSid()); |
|
|
|
AppCrmCustomerTempInfoVo appCrmCustomerTempInfoVo = customerTempResultBean.getData(); |
|
|
|
//销售订单相关信息
|
|
|
|
ResultBean<AppOrderDetailsVo> orderDetailsVoResultBean = busSalesOrderService.getSaleOrderDetails(busHandover.getOrderSid()); |
|
|
|
AppOrderDetailsVo appOrderDetailsVo = orderDetailsVoResultBean.getData(); |
|
|
|
AppOrderModelInfoVo appOrderModelInfoVo = appOrderDetailsVo.getModelInfo(); |
|
|
|
//车型配置相关信息
|
|
|
|
ResultBean<BaseModelConfigSelectVo> baseVehicleConfigVoResultBean = baseModelConfigFeign.details(appOrderModelInfoVo.getConfigSid()); |
|
|
|
BaseModelConfigSelectVo baseModelConfigSelectVo = baseVehicleConfigVoResultBean.getData(); |
|
|
|
List<BusItemsListVo> busItemsListVoList = busHandoverItemsService.getListOne(sid); |
|
|
|
busItemsListVoList.removeAll(Collections.singleton(null)); |
|
|
|
for (BusItemsListVo v : busItemsListVoList) { |
|
|
|
String vinSid = v.getVinSid(); |
|
|
|
//根据车辆sid查询车辆信息获取发动机号
|
|
|
|
ResultBean<BaseVehicleSelectVo> baseVehicleSelectVoResultBean = baseVehicleFeign.details(vinSid); |
|
|
|
if (baseVehicleSelectVoResultBean.getSuccess()) { |
|
|
|
BaseVehicleSelectVo baseVehicleSelectVo = baseVehicleSelectVoResultBean.getData(); |
|
|
|
if (baseVehicleSelectVo != null) { |
|
|
|
v.setEngineNo(baseVehicleSelectVo.getEngineNo()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//分公司名称
|
|
|
|
map.put("useOrgName", commonContract.getPartyA()); |
|
|
|
//合同编号
|
|
|
|
map.put("contractNo", busHandover.getContractNo()); |
|
|
|
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("config","");
|
|
|
|
//颜色
|
|
|
|
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();
|
|
|
|
//生成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"+seconds+".ftl"); |
|
|
|
File file = new File(targetPath + "receiveCar" + seconds + ".ftl"); |
|
|
|
File dir = new File(targetPath); |
|
|
|
WordConvertUtils.inputStreamToFile(inputStream, file); |
|
|
|
WordConvertUtils.creatWord1(map, file, targetPath, typeName, dir); |
|
|
|
//新生成的word路径
|
|
|
|
String wordPath = targetPath + typeName; |
|
|
|
//生成出门证文件名
|
|
|
|
String pdfName = "接收车辆确认书_"+dateStr + seconds + ".pdf"; |
|
|
|
//生成文件名
|
|
|
|
String pdfName = "接收车辆确认书_" + dateStr + seconds + ".pdf"; |
|
|
|
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); |
|
|
|
return pdfName; |
|
|
|
} |
|
|
@ -325,33 +367,31 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
|
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(); |
|
|
|
List<BusItemVo> list = busHandoverItemsService.getList(sid); |
|
|
|
List<String> stringList = list.stream().map(v -> v.getVinNo()).collect(Collectors.toList()); |
|
|
|
map.put("orgName", commonContract.getPartyA()); |
|
|
|
map.put("customerName", commonContract.getPartyB()); |
|
|
|
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());
|
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/entrust.ftl"); |
|
|
|
// 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"; |
|
|
|
File file = new File(targetPath + "entrust"+seconds+".ftl"); |
|
|
|
File file = new File(targetPath + "entrust" + seconds + ".ftl"); |
|
|
|
File dir = new File(targetPath); |
|
|
|
WordConvertUtils.inputStreamToFile(inputStream, file); |
|
|
|
WordConvertUtils.creatWord1(map, file, targetPath, typeName, dir); |
|
|
|
//新生成的word路径
|
|
|
|
String wordPath = targetPath + typeName; |
|
|
|
//生成文件名
|
|
|
|
String pdfName = "委托提车授权书_"+dateStr + seconds + ".pdf"; |
|
|
|
String pdfName = "委托提车授权书_" + dateStr + seconds + ".pdf"; |
|
|
|
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); |
|
|
|
return pdfName; |
|
|
|
} |
|
|
@ -370,22 +410,20 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
|
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();
|
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/entrustConfirm.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 + "entrustConfirm"+seconds+".ftl"); |
|
|
|
File file = new File(targetPath + "entrustConfirm" + seconds + ".ftl"); |
|
|
|
File dir = new File(targetPath); |
|
|
|
WordConvertUtils.inputStreamToFile(inputStream, file); |
|
|
|
WordConvertUtils.creatWord1(map, file, targetPath, typeName, dir); |
|
|
|
//新生成的word路径
|
|
|
|
String wordPath = targetPath + typeName; |
|
|
|
//生成文件名
|
|
|
|
String pdfName = "交车资料确认单_"+dateStr + seconds + ".pdf"; |
|
|
|
String pdfName = "交车资料确认单_" + dateStr + seconds + ".pdf"; |
|
|
|
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); |
|
|
|
return pdfName; |
|
|
|
} |
|
|
@ -396,11 +434,14 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
|
BusHandover busHandover = fetchBySid(sid); |
|
|
|
ResultBean<SysStaffinfoDetailsVo> voResultBean = sysStaffinfoFeign.fetchBySid(busHandover.getStaffSid()); |
|
|
|
SysStaffinfoDetailsVo staffinfoDetailsVo = voResultBean.getData(); |
|
|
|
ResultBean<CommonContract> resultBean = commonContractFeign.selectByNo(busHandover.getContractNo()); |
|
|
|
CommonContract commonContract = resultBean.getData(); |
|
|
|
ResultBean<AppOrderDetailsVo> orderDetailsVoResultBean = busSalesOrderService.getSaleOrderDetails(busHandover.getOrderSid()); |
|
|
|
AppOrderDetailsVo appOrderDetailsVo = orderDetailsVoResultBean.getData(); |
|
|
|
AppOrderModelInfoVo appOrderModelInfoVo = appOrderDetailsVo.getModelInfo(); |
|
|
|
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); |
|
|
@ -411,26 +452,21 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
|
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();
|
|
|
|
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 + "outdoor"+seconds+".ftl"); |
|
|
|
File file = new File(targetPath + "outdoor" + seconds + ".ftl"); |
|
|
|
File dir = new File(targetPath); |
|
|
|
WordConvertUtils.inputStreamToFile(inputStream, file); |
|
|
|
WordConvertUtils.creatWord1(map, file, targetPath, typeName, dir); |
|
|
|
//新生成的word路径
|
|
|
|
String wordPath = targetPath + typeName; |
|
|
|
//生成出门证文件名
|
|
|
|
String pdfName = "出门证_"+dateStr + seconds + ".pdf"; |
|
|
|
String pdfName = "出门证_" + dateStr + seconds + ".pdf"; |
|
|
|
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); |
|
|
|
return pdfName; |
|
|
|
} |
|
|
@ -470,7 +506,7 @@ public class BusHandoverService extends MybatisBaseService<BusHandoverMapper, Bu |
|
|
|
vo.setName(buscenterFile.getFileName()); |
|
|
|
vo.setDownloadUrl(docPdfComponent.getPrefixTemplateUrl() + buscenterFile.getFilePath()); |
|
|
|
stringList.add(vo); |
|
|
|
if(!record.getCustomerName().equals(record.getRecipient())){ |
|
|
|
if (!record.getCustomerName().equals(record.getRecipient())) { |
|
|
|
vo = new DownloadVo(); |
|
|
|
buscenterFile = buscenterFileService.selectByLinkSidOne(record.getSid(), BuscenterFileEnum.ENTRUST.getAttachType()); |
|
|
|
vo.setName(buscenterFile.getFileName()); |
|
|
|