|
|
@ -3,9 +3,9 @@ package com.yxt.anrui.base.biz.commoncontract; |
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
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.basemodelszconfig.AppBaseModelSzconfigDetailsVo; |
|
|
|
import com.yxt.anrui.base.api.commonappendix.CommonAppendix; |
|
|
|
import com.yxt.anrui.base.api.commonappendix.CommonAttachTypeEnum; |
|
|
|
import com.yxt.anrui.base.api.commonappendix.PcCommonAppendixDto; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.*; |
|
|
|
import com.yxt.anrui.base.biz.basemodelszconfig.BaseModelSzconfigService; |
|
|
|
import com.yxt.anrui.base.biz.basetrailer.BaseTrailerService; |
|
|
@ -16,11 +16,12 @@ import com.yxt.anrui.base.biz.flow.FlowableService; |
|
|
|
import com.yxt.anrui.buscenter.api.busdeposit.BusDepositFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.busdepositvehicle.BusDepositVehicleFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.busorder.BusOrderVo; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.AppBusSalesOrderVo; |
|
|
|
import com.yxt.anrui.buscenter.api.busorderdiscount.AppBusOrderDiscountListVo; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.BusSalesOrderDetailsVo; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.BusSalesOrderFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesordermodel.BusSalesOrderModelDetailsVo; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomer.CrmCustomerFeign; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomerfile.CrmCustomerFile; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomerfile.CrmCustomerFileFeign; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomerfile.CrmCustomerFileListVo; |
|
|
|
import com.yxt.anrui.flowable.api.sysformlink.SysFormLinkFeign; |
|
|
|
import com.yxt.anrui.flowable.api.sysformlink.SysFormStateVo; |
|
|
|
import com.yxt.anrui.flowable.api.utils.ProcDefEnum; |
|
|
@ -47,11 +48,12 @@ import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import javax.xml.crypto.Data; |
|
|
|
import java.io.File; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.MessageFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -119,6 +121,8 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
private BaseModelSzconfigService baseModelSzconfigService; |
|
|
|
@Autowired |
|
|
|
private BaseTrailerService baseTrailerService; |
|
|
|
@Autowired |
|
|
|
private BusSalesOrderFeign busSalesOrderFeign; |
|
|
|
|
|
|
|
private QueryWrapper<CommonContract> createQueryWrapper(CommonContractQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
@ -577,7 +581,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
* @param dto |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
/* public ResultBean<List<PrintConfirmVo>> printConfirm(PrintConfirmDto dto) { |
|
|
|
/*public ResultBean<List<PrintConfirmVo>> printConfirm(PrintConfirmDto dto) { |
|
|
|
Map<String, Object> map = new HashMap<String, Object>(); |
|
|
|
// 合同信息
|
|
|
|
CommonContract contract = fetchBySid(dto.getSid()); |
|
|
@ -587,6 +591,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
map.put("contractNo", contract.getContractNo()); // 合同编号
|
|
|
|
map.put("createDate", contract.getCreateDate()); // 签订时间
|
|
|
|
// 客户信息;
|
|
|
|
|
|
|
|
BusOrderVo order = busOrderFeign.fetchSid(dto.getBusSid()).getData(); |
|
|
|
map.put("customerName", order.getCustomerName()); // 联系电话
|
|
|
|
map.put("mobile", order.getMobile()); // 联系电话
|
|
|
@ -1171,6 +1176,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
*/ |
|
|
|
/* public ResultBean<List<PrintConfirmVo>> printConfirm1(PrintConfirmDto dto) { |
|
|
|
Map<String, Object> map = new HashMap<>();*/ |
|
|
|
|
|
|
|
/** |
|
|
|
* 车辆登记合同参数: |
|
|
|
* 甲方:${partyA} |
|
|
@ -1179,10 +1185,10 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
* 车辆出售方:${partyA} |
|
|
|
* 车辆信息List: |
|
|
|
* { |
|
|
|
* 序号: |
|
|
|
* 品牌:${item.brandName} |
|
|
|
* 车架号:${item.VINNo} |
|
|
|
* 发动机号:${item.engineNo} |
|
|
|
* 序号: |
|
|
|
* 品牌:${item.brandName} |
|
|
|
* 车架号:${item.VINNo} |
|
|
|
* 发动机号:${item.engineNo} |
|
|
|
* } |
|
|
|
*/ |
|
|
|
//甲方为卖方,即xxx公司,即根据销售订单的单位sid查询单位的名称
|
|
|
@ -1198,4 +1204,129 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
map.put("IDNumber", orderVo.getIDNumber()); |
|
|
|
}*/ |
|
|
|
// }
|
|
|
|
/* public ResultBean<List<PrintConfirmVo>> printConfirm2(PrintConfirmDto dto) { |
|
|
|
ResultBean<List<PrintConfirmVo>> rb = ResultBean.fireFail(); |
|
|
|
Map<String, Object> map = new HashMap<String, Object>(); |
|
|
|
// 合同信息
|
|
|
|
CommonContract contract = fetchBySid(dto.getSid()); |
|
|
|
// 甲方
|
|
|
|
map.put("partyA", contract.getPartyA()); |
|
|
|
// 乙方
|
|
|
|
map.put("partyB", contract.getPartyB()); |
|
|
|
// 合同编号
|
|
|
|
map.put("contractNo", contract.getContractNo()); |
|
|
|
// 客户信息
|
|
|
|
ResultBean<BusSalesOrderDetailsVo> busSalesOrderDetailsVoResultBean = busSalesOrderFeign.fetchDetailsBySid(dto.getBusSid()); |
|
|
|
BusSalesOrderDetailsVo order = busSalesOrderDetailsVoResultBean.getData(); |
|
|
|
if (!busSalesOrderDetailsVoResultBean.getSuccess()) { |
|
|
|
return rb.setMsg("该业务数据不存在"); |
|
|
|
} |
|
|
|
map.put("customerName", busSalesOrderDetailsVoResultBean.getData().getCustomerName()); |
|
|
|
map.put("mobile", busSalesOrderDetailsVoResultBean.getData().getMobile()); |
|
|
|
BusSalesOrderModelDetailsVo busSalesOrderModel = busSalesOrderDetailsVoResultBean.getData().getBusSalesOrderModel(); |
|
|
|
// 车型、主车信息
|
|
|
|
map.put("modelName", busSalesOrderModel.getModelName()); |
|
|
|
map.put("modelConfig", busSalesOrderModel.getConfig()); |
|
|
|
map.put("mainVehicleNum", busSalesOrderDetailsVoResultBean.getData().getBusSalesOrderPrice().getQuantity()); |
|
|
|
map.put("mainVehicleSinglePrice", busSalesOrderDetailsVoResultBean.getData().getBusSalesOrderPrice().getSingleFinalPrice()); |
|
|
|
ResultBean<String> vinNo = busOrderVehicleFeign.getVehicleVINNoByOrderSid(dto.getBusSid()); |
|
|
|
map.put("VINNo", vinNo.getData()); // 车架号
|
|
|
|
// 上装信息
|
|
|
|
AppBaseModelSzconfigDetailsVo szconfig = baseModelSzconfigService.getAppBaseModelSzconfigDetailsVo(model.getData().getSid()); |
|
|
|
map.put("topName", szconfig.getTopName()); // 上装
|
|
|
|
// 优惠说明信息
|
|
|
|
ResultBean<List<AppBusOrderDiscountListVo>> discountList = busOrderDiscountFeign.getAppDiscountListVoByOrderSid(order.getOrderSid()); |
|
|
|
map.put("discountDetail", ""); // 优惠说明 ?待确认
|
|
|
|
if (discountList.getSuccess()) { |
|
|
|
map.put("discountDetail", discountList.getData().get(0).getDetail()); // 优惠说明 ?待确认
|
|
|
|
} |
|
|
|
// 保险说明信息
|
|
|
|
map.put("insuranceDetail", "首次在本店投保,第二、三年继续在本店续保。(不在公司投保的,不显示)"); // 保险说明 ?待确认
|
|
|
|
// 车辆交付地点
|
|
|
|
// map.put("deliveryPlace", model.getData().getExpected_takecar_location());
|
|
|
|
|
|
|
|
List<PrintConfirmVo> list = new ArrayList<>(); |
|
|
|
try { |
|
|
|
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder() |
|
|
|
.setNameFormat("demo-pool-%d").build(); |
|
|
|
ExecutorService pool = new ThreadPoolExecutor(5, 100, |
|
|
|
0L, TimeUnit.MILLISECONDS, |
|
|
|
new LinkedBlockingQueue<Runnable>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); |
|
|
|
Future<String> future1 = pool.submit(() -> { |
|
|
|
return genCarSaleContract(dto, map, order); |
|
|
|
}); |
|
|
|
Future<String> future2 = pool.submit(() -> { |
|
|
|
return genVehicleRegistration(dto, map); |
|
|
|
}); |
|
|
|
Future<String> future3 = pool.submit(() -> { |
|
|
|
// 客户开票申请书(暂时先不考虑)
|
|
|
|
if (dto.getIsAdvanceInvoice() == 1) { |
|
|
|
return genAdvanceInvoice(dto, map); |
|
|
|
} else { |
|
|
|
return ""; |
|
|
|
} |
|
|
|
}); |
|
|
|
Future<String> future4 = pool.submit(() -> { |
|
|
|
// 委托提车授权书
|
|
|
|
if (dto.getIsEntrustVehicle() == 1) { |
|
|
|
return genEntrustVehicle(dto, map); |
|
|
|
} else { |
|
|
|
return ""; |
|
|
|
} |
|
|
|
}); |
|
|
|
Future<String> future5 = pool.submit(() -> { |
|
|
|
return genCarSaleContractBlank(dto, map, order); |
|
|
|
}); |
|
|
|
|
|
|
|
future1.get(); |
|
|
|
future2.get(); |
|
|
|
future3.get(); |
|
|
|
future4.get(); |
|
|
|
future5.get(); |
|
|
|
PrintConfirmVo printConfirmVo = null; |
|
|
|
if (StringUtils.isNotBlank(future1.get())) { |
|
|
|
printConfirmVo = new PrintConfirmVo(); |
|
|
|
// 待确认:现车或订车
|
|
|
|
// 现车
|
|
|
|
// printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CARSALECONTRACTNEW.getName()));
|
|
|
|
// 订车
|
|
|
|
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CARSALECONTRACTBOOK.getName())); |
|
|
|
printConfirmVo.setDownloadUrl(future1.get()); |
|
|
|
list.add(printConfirmVo); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(future2.get())) { |
|
|
|
printConfirmVo = new PrintConfirmVo(); |
|
|
|
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.VEHICLEREGISTRATION.getName())); |
|
|
|
printConfirmVo.setDownloadUrl(future2.get()); |
|
|
|
list.add(printConfirmVo); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(future3.get())) { |
|
|
|
printConfirmVo = new PrintConfirmVo(); |
|
|
|
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CUSTOMERINVOICINGAPPLICATION.getName())); |
|
|
|
printConfirmVo.setDownloadUrl(future3.get()); |
|
|
|
list.add(printConfirmVo); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(future4.get())) { |
|
|
|
printConfirmVo = new PrintConfirmVo(); |
|
|
|
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.ENTRUSTPICKUPAUTHORIZATION.getName())); |
|
|
|
printConfirmVo.setDownloadUrl(future4.get()); |
|
|
|
list.add(printConfirmVo); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(future5.get())) { |
|
|
|
printConfirmVo = new PrintConfirmVo(); |
|
|
|
// 待确认:现车或订车
|
|
|
|
// 现车
|
|
|
|
// printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CARSALECONTRACTNEWBLANK.getName()));
|
|
|
|
// 订车
|
|
|
|
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CARSALECONTRACTBOOKBLANK.getName())); |
|
|
|
printConfirmVo.setDownloadUrl(future5.get()); |
|
|
|
list.add(printConfirmVo); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
return new ResultBean().fail().setMsg("生成文件失败"); |
|
|
|
} |
|
|
|
return new ResultBean().success().setData(list); |
|
|
|
}*/ |
|
|
|
|
|
|
|
} |