|
|
@ -30,6 +30,7 @@ import cn.hutool.core.date.DateUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
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.basevehicle.*; |
|
|
|
import com.yxt.anrui.base.api.basevehiclemodel.BaseVehicleModelFeign; |
|
|
|
import com.yxt.anrui.base.api.basevehicletempstate.BaseVehicleTempstateDto; |
|
|
@ -71,9 +72,12 @@ import com.yxt.anrui.scm.biz.scmexitpermit.ScmExitPermitService; |
|
|
|
import com.yxt.anrui.scm.biz.scmfile.ScmFileService; |
|
|
|
import com.yxt.anrui.scm.biz.scmvehiclegressionveh.ScmVehicleGressionVehService; |
|
|
|
import com.yxt.anrui.scm.biz.scmwarehouse.ScmWarehouseService; |
|
|
|
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.base.utils.WordUtils; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
@ -81,14 +85,19 @@ import com.yxt.messagecenter.api.message.MessageFeign; |
|
|
|
import com.yxt.messagecenter.api.message.MessageFlowVo; |
|
|
|
import com.yxt.messagecenter.api.message.MessageFlowableQuery; |
|
|
|
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.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import static cn.hutool.core.util.ClassLoaderUtil.getClassLoader; |
|
|
|
|
|
|
|
/** |
|
|
|
* Project: scm(scm) <br/> |
|
|
|
* File: ScmVehicleGressionService.java <br/> |
|
|
@ -148,6 +157,8 @@ public class ScmVehicleGressionService extends MybatisBaseService<ScmVehicleGres |
|
|
|
FinKingDeeFeign finKingDeeFeign; |
|
|
|
@Autowired |
|
|
|
private ScmWarehouseService scmWarehouseService; |
|
|
|
@Autowired |
|
|
|
private DocPdfComponent docPdfComponent; |
|
|
|
|
|
|
|
private QueryWrapper<ScmVehicleGression> createQueryWrapper(ScmVehicleGressionQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
@ -219,7 +230,7 @@ public class ScmVehicleGressionService extends MybatisBaseService<ScmVehicleGres |
|
|
|
//查询出门证
|
|
|
|
ScmExitPermit scmExitPermit = scmExitPermitService.selectByLinkSid(record.getSid()); |
|
|
|
if (scmExitPermit != null) { |
|
|
|
record.setDownloadUrl(fileUploadComponent.getUrlPrefix() + scmExitPermit.getUrl()); |
|
|
|
record.setDownloadUrl(docPdfComponent.getPrefixTemplateUrl() + scmExitPermit.getUrl()); |
|
|
|
} |
|
|
|
List<ScmFile> scmFiles1 = scmFileService.getByLinkSidAndType(sid, type1); |
|
|
|
for (ScmFile scmFile : scmFiles1) { |
|
|
@ -312,24 +323,21 @@ public class ScmVehicleGressionService extends MybatisBaseService<ScmVehicleGres |
|
|
|
public IPage<AppScmVehicleGressionPageVo> getCarTransferList(PagerQuery<AppScmVehicleGressionPageQuery> pagerQuery) { |
|
|
|
String type = "05"; |
|
|
|
IPage<AppScmVehicleGressionPageQuery> page = PagerUtil.queryToPage(pagerQuery); |
|
|
|
String useOrgSid = sysStaffOrgFeign.getPathSidByUserSid(pagerQuery.getParams().getUserSid()).getData(); |
|
|
|
pagerQuery.getParams().setUseOrgSid(useOrgSid); |
|
|
|
/*String useOrgSid = sysStaffOrgFeign.getPathSidByUserSid(pagerQuery.getParams().getUserSid()).getData(); |
|
|
|
pagerQuery.getParams().setUseOrgSid(useOrgSid);*/ |
|
|
|
QueryWrapper<AppScmVehicleGressionPageVo> qw = appQueryWrapper(pagerQuery.getParams()); |
|
|
|
AppScmVehicleGressionPageQuery params = pagerQuery.getParams(); |
|
|
|
IPage<AppScmVehicleGressionPageVo> iPage = baseMapper.getCarTransferList(page, qw, params.getNames()); |
|
|
|
List<AppScmVehicleGressionPageVo> records = iPage.getRecords(); |
|
|
|
for (AppScmVehicleGressionPageVo record : records) { |
|
|
|
|
|
|
|
List<ScmVehicleGressionVehVo> scmVehicleGressionVehVos = scmVehicleGressionVehService.selectInfoVoByMainSid(record.getSid()); |
|
|
|
|
|
|
|
record.setScmVehicleGressionVehs(scmVehicleGressionVehVos); |
|
|
|
|
|
|
|
if ("已办结".equals(record.getState())) { |
|
|
|
record.setShowDownloadBtn(true); |
|
|
|
//查询出门证
|
|
|
|
ScmExitPermit scmExitPermit = scmExitPermitService.selectByLinkSid(record.getSid()); |
|
|
|
if (scmExitPermit != null) { |
|
|
|
record.setDownloadUrl(fileUploadComponent.getUrlPrefix() + scmExitPermit.getUrl()); |
|
|
|
record.setDownloadUrl(docPdfComponent.getPrefixTemplateUrl() + scmExitPermit.getUrl()); |
|
|
|
} |
|
|
|
List<ScmFile> list = scmFileService.getByLinkSidAndType(record.getSid(), type); |
|
|
|
if (list.size() > 0) { |
|
|
@ -357,6 +365,9 @@ public class ScmVehicleGressionService extends MybatisBaseService<ScmVehicleGres |
|
|
|
if (StringUtils.isNotBlank(query.getType())) { |
|
|
|
qw.eq("svg.handleState", query.getType()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getOrgPath())) { |
|
|
|
qw.eq("svg.useOrgSid", query.getOrgPath()); |
|
|
|
} |
|
|
|
return qw; |
|
|
|
} |
|
|
|
|
|
|
@ -375,25 +386,33 @@ public class ScmVehicleGressionService extends MybatisBaseService<ScmVehicleGres |
|
|
|
} |
|
|
|
String userSid = dto.getUserSid(); |
|
|
|
String sid = dto.getSid(); |
|
|
|
//机构sid
|
|
|
|
String useOrgSid = dto.getOrgPath(); |
|
|
|
if (StringUtils.isBlank(useOrgSid)) { |
|
|
|
useOrgSid = sysStaffOrgFeign.getPathSidByUserSid(userSid).getData(); |
|
|
|
} |
|
|
|
//获取用户信息
|
|
|
|
ResultBean<SysUserVo> userVoResultBean = sysUserFeign.fetchBySid(userSid); |
|
|
|
if (!userVoResultBean.getSuccess()) { |
|
|
|
return rb.setMsg(userVoResultBean.getMsg()); |
|
|
|
} |
|
|
|
SysUserVo sysUserVo = userVoResultBean.getData(); |
|
|
|
//获取分公司
|
|
|
|
String useOrgSid = sysStaffOrgFeign.getPathSidByUserSid(userSid).getData(); |
|
|
|
//获取当天日期
|
|
|
|
String today = DateUtil.today(); |
|
|
|
if (StringUtils.isBlank(sid)) { |
|
|
|
if (StringUtils.isBlank(sid)) {//新增
|
|
|
|
ScmVehicleGression scmVehicleGression = new ScmVehicleGression(); |
|
|
|
BeanUtil.copyProperties(dto, scmVehicleGression, "sid"); |
|
|
|
scmVehicleGression.setApplicantName(sysUserVo.getName());//申请人
|
|
|
|
scmVehicleGression.setApplicantDate(today);//申请时间
|
|
|
|
scmVehicleGression.setUseOrgSid(useOrgSid);//分公司sid
|
|
|
|
scmVehicleGression.setCreateBySid(dto.getUserSid()); |
|
|
|
//申请人
|
|
|
|
scmVehicleGression.setApplicantName(sysUserVo.getName()); |
|
|
|
//申请时间
|
|
|
|
scmVehicleGression.setApplicantDate(today); |
|
|
|
//分公司sid
|
|
|
|
scmVehicleGression.setUseOrgSid(useOrgSid); |
|
|
|
scmVehicleGression.setCreateBySid(userSid); |
|
|
|
//1待办 2已办
|
|
|
|
scmVehicleGression.setHandleState("1"); |
|
|
|
String billNo = getApplyCode(dto);//申请编号
|
|
|
|
//申请编号
|
|
|
|
String billNo = getApplyCode(dto); |
|
|
|
scmVehicleGression.setApplicantNo(billNo); |
|
|
|
int i = baseMapper.insert(scmVehicleGression); |
|
|
|
sid = scmVehicleGression.getSid(); |
|
|
@ -403,7 +422,7 @@ public class ScmVehicleGressionService extends MybatisBaseService<ScmVehicleGres |
|
|
|
return rb.setMsg("保存失败"); |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
} else {//编辑
|
|
|
|
ScmVehicleGression scmVehicleGression = fetchBySid(sid); |
|
|
|
if (scmVehicleGression == null) { |
|
|
|
return rb.setMsg("该申请不存在"); |
|
|
@ -855,18 +874,87 @@ public class ScmVehicleGressionService extends MybatisBaseService<ScmVehicleGres |
|
|
|
appMap.put("sid", bv.getBusinessSid()); |
|
|
|
variables.put("app", appMap); |
|
|
|
bv.setFormVariables(variables); |
|
|
|
//===============================添加多线程开始======================
|
|
|
|
if (bv.getTaskId().equals(scmVehicleGression.getTaskId())) { |
|
|
|
ResultBean<UpdateFlowFieldVo> resultBean = flowableFeign.handleProsess(bv); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
} |
|
|
|
if ("Event_end".equals(resultBean.getData().getTaskDefKey())) { |
|
|
|
/* String pdfPath = createPdf(bv.getBusinessSid()); |
|
|
|
//将生成的出门证添加到出门证表中
|
|
|
|
ScmExitPermit scmExitPermit = new ScmExitPermit(); |
|
|
|
scmExitPermit.setLinkSid(bv.getBusinessSid()); |
|
|
|
scmExitPermit.setUrl(pdfPath); |
|
|
|
scmExitPermitService.insert(scmExitPermit);*/ |
|
|
|
UpdateFlowFieldVo ufVo = resultBean.getData(); |
|
|
|
updateFlowFiled(BeanUtil.beanToMap(resultBean.getData())); |
|
|
|
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()); |
|
|
|
if ("Event_end".equals(resultBean.getData().getTaskDefKey())) { |
|
|
|
Future future1 = pool.submit(() -> { |
|
|
|
String pdfPath = createPdf(bv.getBusinessSid()); |
|
|
|
//将生成的出门证添加到出门证表中
|
|
|
|
ScmExitPermit scmExitPermit = new ScmExitPermit(); |
|
|
|
scmExitPermit.setLinkSid(bv.getBusinessSid()); |
|
|
|
scmExitPermit.setUrl(pdfPath); |
|
|
|
scmExitPermitService.insert(scmExitPermit); |
|
|
|
}); |
|
|
|
ScmVehicleGression finalScmVehicleGression = scmVehicleGression; |
|
|
|
Future future2 = pool.submit(() -> { |
|
|
|
//推送调拨单
|
|
|
|
List<String> vinList = scmVehicleGressionVehService.fetchVoByMainSid(bv.getBusinessSid()); |
|
|
|
if (vinList.size() > 0) { |
|
|
|
//根据分公司sid查询分公司编码
|
|
|
|
String useOrgSid = finalScmVehicleGression.getUseOrgSid(); |
|
|
|
ResultBean<SysOrganizationVo> sysOrg = sysOrganizationFeign.fetchBySid(useOrgSid); |
|
|
|
SysOrganizationVo sysOrganizationVo = sysOrg.getData(); |
|
|
|
for (String s : vinList) { |
|
|
|
BaseVehicleVo baseVehicleVo = baseVehicleFeign.selVehicleByVinNo(s).getData(); |
|
|
|
List<StkTransferDirect.FBillEntry> FPAYBILLENTRYs = new ArrayList<>(); |
|
|
|
StkTransferDirect stkTransferDirect = new StkTransferDirect(); |
|
|
|
stkTransferDirect.setFStockOrgId(sysOrganizationVo.getOrgCode()); //调入库存组织
|
|
|
|
stkTransferDirect.setFDate(simpleDateFormat.format(baseVehicleVo.getPriceDate())); //日期
|
|
|
|
StkTransferDirect.FBillEntry fBillEntry = new StkTransferDirect.FBillEntry(); |
|
|
|
ScmWarehouse scmWarehouse = scmWarehouseService.fetchBySid(finalScmVehicleGression.getTargetLocationSid()); |
|
|
|
fBillEntry.setFDestStockId(scmWarehouse.getGressionCode());//调入仓库
|
|
|
|
fBillEntry.setFMaterialId(s);//物料编码
|
|
|
|
scmWarehouse = scmWarehouseService.fetchBySid(finalScmVehicleGression.getLocationSid()); |
|
|
|
fBillEntry.setFSrcStockId(scmWarehouse.getGressionCode());//调出仓库
|
|
|
|
FPAYBILLENTRYs.add(fBillEntry); |
|
|
|
stkTransferDirect.setFBillEntry(FPAYBILLENTRYs); |
|
|
|
finKingDeeFeign.draftStkTransferDirect(stkTransferDirect); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
} else { |
|
|
|
//极光推送
|
|
|
|
scmVehicleGression = fetchBySid(bv.getBusinessSid()); |
|
|
|
ufVo.setProcInsId(scmVehicleGression.getProcInstId()); |
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(ufVo, messageFlowVo); |
|
|
|
ufVo.setProcInsId(scmVehicleGression.getProcInstId()); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap(appMap); |
|
|
|
messageFlowableQuery.setBusinessSid(bv.getBusinessSid()); |
|
|
|
messageFlowableQuery.setModuleName("存放地点变更申请"); |
|
|
|
messageFlowableQuery.setMsgContent(scmVehicleGression.getApplicantName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
messageFlowableQuery.setMsgTitle("存放地点变更"); |
|
|
|
ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
return rb.success().setData(resultBean.getData()); |
|
|
|
} else { |
|
|
|
return rb.setMsg("操作失败!提交的数据不一致"); |
|
|
|
} |
|
|
|
//===============================添加多线程结束======================
|
|
|
|
/*if (bv.getTaskId().equals(scmVehicleGression.getTaskId())) { |
|
|
|
ResultBean<UpdateFlowFieldVo> resultBean = flowableFeign.handleProsess(bv); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
} |
|
|
|
UpdateFlowFieldVo ufVo = resultBean.getData(); |
|
|
|
updateFlowFiled(BeanUtil.beanToMap(resultBean.getData())); |
|
|
@ -887,15 +975,6 @@ public class ScmVehicleGressionService extends MybatisBaseService<ScmVehicleGres |
|
|
|
ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
|
|
|
|
} else { |
|
|
|
// //推送车辆台账数据
|
|
|
|
// VehicleGression vehicleGression = new VehicleGression();
|
|
|
|
// List<String> list = scmVehicleGressionVehService.fetchVoByMainSid(scmVehicleGression.getSid());
|
|
|
|
// vehicleGression.setVin(list);
|
|
|
|
// vehicleGression.setLocation(scmVehicleGression.getTargetLocationSid());
|
|
|
|
// vehicleGression.setLocationName(scmVehicleGression.getTargetLocation());
|
|
|
|
// baseVehicleFeign.updateVehicleGressionByVin(vehicleGression);
|
|
|
|
// //删除申请状态
|
|
|
|
// baseVehicleTempstateFeign.delByBusSid(bv.getBusinessSid());
|
|
|
|
//推送调拨单
|
|
|
|
List<String> vinList = scmVehicleGressionVehService.fetchVoByMainSid(bv.getBusinessSid()); |
|
|
|
if (vinList.size() > 0) { |
|
|
@ -907,19 +986,14 @@ public class ScmVehicleGressionService extends MybatisBaseService<ScmVehicleGres |
|
|
|
BaseVehicleVo baseVehicleVo = baseVehicleFeign.selVehicleByVinNo(s).getData(); |
|
|
|
List<StkTransferDirect.FBillEntry> FPAYBILLENTRYs = new ArrayList<>(); |
|
|
|
StkTransferDirect stkTransferDirect = new StkTransferDirect(); |
|
|
|
// stkTransferDirect.setFStockOutOrgId("101"); //调出库存组织
|
|
|
|
// stkTransferDirect.setFStockOutOrgId(sysOrganizationVo.getOrgCode()); //调出库存组织
|
|
|
|
// stkTransferDirect.setFStockOrgId("101"); //调入库存组织
|
|
|
|
stkTransferDirect.setFStockOrgId(sysOrganizationVo.getOrgCode()); //调入库存组织
|
|
|
|
stkTransferDirect.setFDate(simpleDateFormat.format(baseVehicleVo.getPriceDate())); //日期
|
|
|
|
StkTransferDirect.FBillEntry fBillEntry = new StkTransferDirect.FBillEntry(); |
|
|
|
ScmWarehouse scmWarehouse = scmWarehouseService.fetchBySid(scmVehicleGression.getTargetLocationSid()); |
|
|
|
// fBillEntry.setFDestStockId("CK003");//调入仓库
|
|
|
|
fBillEntry.setFDestStockId(scmWarehouse.getGressionCode());//调入仓库
|
|
|
|
fBillEntry.setFMaterialId(s);//物料编码
|
|
|
|
scmWarehouse = scmWarehouseService.fetchBySid(scmVehicleGression.getLocationSid()); |
|
|
|
fBillEntry.setFSrcStockId(scmWarehouse.getGressionCode());//调出仓库
|
|
|
|
// fBillEntry.setFSrcStockId("CK001");//调出仓库
|
|
|
|
FPAYBILLENTRYs.add(fBillEntry); |
|
|
|
stkTransferDirect.setFBillEntry(FPAYBILLENTRYs); |
|
|
|
finKingDeeFeign.draftStkTransferDirect(stkTransferDirect); |
|
|
@ -930,7 +1004,7 @@ public class ScmVehicleGressionService extends MybatisBaseService<ScmVehicleGres |
|
|
|
} else { |
|
|
|
return rb.setMsg("操作失败!提交的数据不一致"); |
|
|
|
} |
|
|
|
|
|
|
|
*/ |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -943,10 +1017,6 @@ public class ScmVehicleGressionService extends MybatisBaseService<ScmVehicleGres |
|
|
|
ResultBean<List<GetNodeVo>> rb = new ResultBean<>(); |
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
|
BeanUtil.copyProperties(query, bv); |
|
|
|
// Map<String, Object> formVariables = query.getFormVariables();
|
|
|
|
//判断流程分支
|
|
|
|
// Map<String, Object> map = IsTrue(formVariables.get("businessSid"));
|
|
|
|
// bv.setFormVariables(map);
|
|
|
|
bv.setModelId(ProcDefEnum.SCMCARTRANSFER.getProDefId()); |
|
|
|
ResultBean<List<Map<String, Object>>> resultBean = flowTaskFeign.getPreviousNodesForReject(bv); |
|
|
|
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给getNodeVo
|
|
|
@ -964,13 +1034,8 @@ public class ScmVehicleGressionService extends MybatisBaseService<ScmVehicleGres |
|
|
|
ResultBean<List<GetNodeVo>> rb = ResultBean.fireFail(); |
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
|
BeanUtil.copyProperties(query, bv); |
|
|
|
// Map<String, Object> formVariables = query.getFormVariables();
|
|
|
|
//判断流程分支
|
|
|
|
// Map<String, Object> map = IsTrue(formVariables.get("businessSid"));
|
|
|
|
// bv.setFormVariables(map);
|
|
|
|
bv.setModelId(ProcDefEnum.SCMCARTRANSFER.getProDefId()); |
|
|
|
ResultBean<List<Map<String, Object>>> resultBean = flowTaskFeign.getNextNodesForSubmit(bv); |
|
|
|
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给getNodeVo
|
|
|
|
List<GetNodeVo> voList = Optional.ofNullable(resultBean.getData()).orElse(new ArrayList<>()).stream().map(m -> JSON.parseObject(JSON.toJSONString(m), GetNodeVo.class)).collect(Collectors.toList()); |
|
|
|
return rb.success().setData(voList); |
|
|
|
} |
|
|
@ -1188,10 +1253,11 @@ public class ScmVehicleGressionService extends MybatisBaseService<ScmVehicleGres |
|
|
|
return rb.success().setData(temporaryExitPermitInfo); |
|
|
|
} |
|
|
|
|
|
|
|
/*public String createPdf(String sid) { |
|
|
|
public String createPdf_old(String sid) { |
|
|
|
ScmVehicleGression scmVehicleGression = fetchBySid(sid); |
|
|
|
SysOrganization sysOrganization = sysOrganizationFeign.selectBySid(scmVehicleGression.getUseOrgSid()).getData(); |
|
|
|
BaseVehicleSelectVo data = baseVehicleFeign.details(scmVehicleGression.getVehicleSid()).getData(); |
|
|
|
// BaseVehicleSelectVo data = baseVehicleFeign.details(scmVehicleGression.getVehicleSid()).getData();
|
|
|
|
BaseVehicleSelectVo data = baseVehicleFeign.details(scmVehicleGression.getSid()).getData(); |
|
|
|
ExiCarConfigDetailVo exiCarConfigDetailVo = baseVehicleFeign.selectExiCarConfig(data.getModelSid(), data.getModelConfigSid(), data.getVehModelConfigSid()).getData(); |
|
|
|
Map<String, Object> dataMap = new HashMap<String, Object>(); |
|
|
|
dataMap.put("date", DateUtil.today()); |
|
|
@ -1227,7 +1293,73 @@ public class ScmVehicleGressionService extends MybatisBaseService<ScmVehicleGres |
|
|
|
return "template" + "/" + dateStr + "/" + pdfName; |
|
|
|
|
|
|
|
|
|
|
|
}*/ |
|
|
|
} |
|
|
|
|
|
|
|
public String createPdf(String sid) { |
|
|
|
ScmVehicleGression scmVehicleGression = fetchBySid(sid); |
|
|
|
SysOrganization sysOrganization = sysOrganizationFeign.selectBySid(scmVehicleGression.getUseOrgSid()).getData(); |
|
|
|
List<String> vinList = new ArrayList<>(); |
|
|
|
List<String> vinSidList = new ArrayList<>(); |
|
|
|
List<ScmVehicleGressionVehVo> scmVehicleGressionVehVos = scmVehicleGressionVehService.selectInfoVoByMainSid(sid); |
|
|
|
if (scmVehicleGressionVehVos.size() > 0) { |
|
|
|
for (ScmVehicleGressionVehVo v : scmVehicleGressionVehVos) { |
|
|
|
String vehSid = v.getVehSid(); |
|
|
|
String vin = v.getVehVin(); |
|
|
|
vinList.add(vin); |
|
|
|
vinSidList.add(vehSid); |
|
|
|
} |
|
|
|
} |
|
|
|
String vin = String.join(",", vinList); |
|
|
|
List<String> modelNameList = new ArrayList<>(); |
|
|
|
for (String vinSid : vinSidList) { |
|
|
|
BaseVehicleSelectVo data = baseVehicleFeign.details(vinSid).getData(); |
|
|
|
ExiCarConfigDetailVo exiCarConfigDetailVo = baseVehicleFeign.selectExiCarConfig(data.getModelSid(), data.getModelConfigSid(), data.getVehModelConfigSid()).getData(); |
|
|
|
String model = exiCarConfigDetailVo.getVehicleAlias() + exiCarConfigDetailVo.getCarColor(); |
|
|
|
modelNameList.add(model); |
|
|
|
} |
|
|
|
String modelName = String.join(",", modelNameList); |
|
|
|
Map<String, Object> dataMap = new HashMap<String, Object>(); |
|
|
|
//日期
|
|
|
|
dataMap.put("date", DateUtil.today()); |
|
|
|
//合同编号
|
|
|
|
dataMap.put("contract", "—"); |
|
|
|
//机构名称
|
|
|
|
dataMap.put("orgName", sysOrganization.getName()); |
|
|
|
//客户名称
|
|
|
|
dataMap.put("name", "—"); |
|
|
|
//车型
|
|
|
|
dataMap.put("modelName", modelName); |
|
|
|
//台数
|
|
|
|
dataMap.put("number", vinSidList.size()); |
|
|
|
dataMap.put("vinNo", vin); |
|
|
|
//出门原因
|
|
|
|
dataMap.put("reason", "存放地点变更"); |
|
|
|
//业务经办人
|
|
|
|
dataMap.put("operator", scmVehicleGression.getOperator()); |
|
|
|
//财务经办人
|
|
|
|
// dataMap.put("finOperator", "-");
|
|
|
|
//提车人
|
|
|
|
dataMap.put("carCollector", "—"); |
|
|
|
//出门签章
|
|
|
|
// dataMap.put("signature", "-");
|
|
|
|
//申请人
|
|
|
|
dataMap.put("apply", scmVehicleGression.getApplicantName()); |
|
|
|
//获取模板
|
|
|
|
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(dataMap, file, targetPath, typeName, dir); |
|
|
|
//新生成的word路径
|
|
|
|
String wordPath = targetPath + typeName; |
|
|
|
//生成出门证文件名
|
|
|
|
String pdfName = "出门证_" + dateStr + seconds + ".pdf"; |
|
|
|
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); |
|
|
|
return pdfName; |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<String> getToDoNum(String userSid) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|