|
|
@ -3,8 +3,6 @@ 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.commoncontract.*; |
|
|
|
import com.yxt.anrui.base.biz.basemodelszconfig.BaseModelSzconfigService; |
|
|
@ -16,10 +14,7 @@ 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.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.CrmCustomerFileFeign; |
|
|
|
import com.yxt.anrui.flowable.api.sysformlink.SysFormLinkFeign; |
|
|
@ -50,10 +45,8 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
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; |
|
|
|
|
|
|
|
/** |
|
|
@ -1099,234 +1092,5 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
save(commonContract); |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
//ToDo:
|
|
|
|
/** |
|
|
|
* 合同信息数据 |
|
|
|
* |
|
|
|
* @param map 封装数据 |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
/* public Map<String, Object> getMap(Map<String, Object> map, PrintConfirmDto dto) { |
|
|
|
Map<String, Object> commonContractMap = map;*/ |
|
|
|
/** |
|
|
|
* 车辆登记合同参数: |
|
|
|
* 甲方:${partyA} |
|
|
|
* 乙方:${partyB} |
|
|
|
* 签订时间:${createDate} |
|
|
|
* 车辆出售方:${partyA} |
|
|
|
* 车辆信息List: |
|
|
|
* { |
|
|
|
* 序号: |
|
|
|
* 品牌:${item.brandName} |
|
|
|
* 车架号:${item.VINNo} |
|
|
|
* 发动机号:${item.engineNo} |
|
|
|
* } |
|
|
|
*/ |
|
|
|
//甲方为卖方,即xxx公司,即根据销售订单的单位sid查询单位的名称
|
|
|
|
//乙方为受卖方,即销售订单的客户名称
|
|
|
|
/* ResultBean<BusOrderVo> busOrderVoResultBean = busOrderFeign.fetchSid(dto.getBusSid()); |
|
|
|
if (busOrderVoResultBean.getSuccess() && busOrderVoResultBean.getData() != null) { |
|
|
|
BusOrderVo orderVo = busOrderVoResultBean.getData(); |
|
|
|
//乙方
|
|
|
|
commonContractMap.put("partyB", orderVo.getCustomerName()); |
|
|
|
//客户名称
|
|
|
|
commonContractMap.put("customerName", orderVo.getCustomerName()); |
|
|
|
} |
|
|
|
return commonContractMap;*/ |
|
|
|
|
|
|
|
/* }*/ |
|
|
|
|
|
|
|
/** |
|
|
|
* 涉及高低开票的,需要打印两套合同: |
|
|
|
* 1、一套按照成交价打印(记账) |
|
|
|
* 2、一套为价格空白的合同(开票用) |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @param map |
|
|
|
* @param vo |
|
|
|
* @return 按照成交价打印的合同地址 |
|
|
|
*/ |
|
|
|
/* public String getCarContract(PrintConfirmDto dto, Map<String, Object> map, BusOrderVo vo) { |
|
|
|
//下载地址
|
|
|
|
String url = ""; |
|
|
|
//模板名称
|
|
|
|
String typeName = ""; |
|
|
|
//生成的word名称
|
|
|
|
String docName = ""; |
|
|
|
//判断是现车还是订车
|
|
|
|
if ("01".equals(vo.getSaleTypeKey())) { |
|
|
|
//现车
|
|
|
|
//车辆含税总价为:主车单价*数量,大写
|
|
|
|
|
|
|
|
map.put("taxNum", vo.get); |
|
|
|
typeName = ContractTemplateEnum.CARSALECONTRACTNEW.getName(); |
|
|
|
|
|
|
|
} |
|
|
|
if ("02".equals(vo.getSaleTypeKey())) { |
|
|
|
//订车
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
/** |
|
|
|
* 打印项-确认 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
/* public ResultBean<List<PrintConfirmVo>> printConfirm1(PrintConfirmDto dto) { |
|
|
|
Map<String, Object> map = new HashMap<>();*/ |
|
|
|
|
|
|
|
/** |
|
|
|
* 车辆登记合同参数: |
|
|
|
* 甲方:${partyA} |
|
|
|
* 乙方:${partyB} |
|
|
|
* 签订时间:${createDate} |
|
|
|
* 车辆出售方:${partyA} |
|
|
|
* 车辆信息List: |
|
|
|
* { |
|
|
|
* 序号: |
|
|
|
* 品牌:${item.brandName} |
|
|
|
* 车架号:${item.VINNo} |
|
|
|
* 发动机号:${item.engineNo} |
|
|
|
* } |
|
|
|
*/ |
|
|
|
//甲方为卖方,即xxx公司,即根据销售订单的单位sid查询单位的名称
|
|
|
|
//乙方为受卖方,即销售订单的客户名称
|
|
|
|
/* ResultBean<BusOrderVo> busOrderVoResultBean = busOrderFeign.fetchSid(dto.getBusSid()); |
|
|
|
if (busOrderVoResultBean.getSuccess() && busOrderVoResultBean.getData() != null) { |
|
|
|
BusOrderVo orderVo = busOrderVoResultBean.getData(); |
|
|
|
//乙方
|
|
|
|
map.put("partyB", orderVo.getCustomerName()); |
|
|
|
//客户名称
|
|
|
|
map.put("customerName", orderVo.getCustomerName()); |
|
|
|
map.put("mobile", orderVo.getMobile()); |
|
|
|
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); |
|
|
|
}*/ |
|
|
|
|
|
|
|
} |