|
|
@ -75,6 +75,7 @@ import com.yxt.anrui.buscenter.biz.bussalesordervehicle.BusSalesOrderVehicleServ |
|
|
|
import com.yxt.anrui.buscenter.biz.bussalesreturnorders.BusSalesReturnOrdersService; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTempFeign; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTempVo; |
|
|
|
import com.yxt.anrui.fin.api.finpaymentrecord.FinPaymentrecordSourceLCVo; |
|
|
|
import com.yxt.anrui.fin.api.finselectedreceivablesdetailed.FinSelectedReceivablesDetailed; |
|
|
|
import com.yxt.anrui.fin.api.finselectedreceivablesdetailed.FinSelectedReceivablesDetailedFeign; |
|
|
|
import com.yxt.anrui.fin.api.finuncollectedreceivablesdetailed.FinUncollectedReceivablesDetailed; |
|
|
@ -93,6 +94,7 @@ import com.yxt.anrui.flowable.api.flowtask.FlowTaskVo; |
|
|
|
import com.yxt.anrui.flowable.api.flowtask.LatestTaskVo; |
|
|
|
import com.yxt.anrui.flowable.api.utils.ProcDefEnum; |
|
|
|
import com.yxt.anrui.flowable.sqloperationsymbol.BusinessVariables; |
|
|
|
import com.yxt.anrui.portal.api.flow.PCHistTaskListAndCommentList; |
|
|
|
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationVo; |
|
|
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrg; |
|
|
@ -100,10 +102,18 @@ import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserVo; |
|
|
|
import com.yxt.anrui.scm.api.scmvehrebate.ScmVehRebateFeign; |
|
|
|
import com.yxt.anrui.scm.api.scmvehrebatecheckapply.ScmVehRebateCheckPdfVo; |
|
|
|
import com.yxt.anrui.scm.api.scmvehrebatecheckapply.ScmVehrebateCheckapplyDetailsVo; |
|
|
|
import com.yxt.anrui.scm.api.scmvehrebatecheckapplydetail.ScmVehrebateCheckapplydetailDetailsVo; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
|
import com.yxt.common.base.utils.ConstantUtils; |
|
|
|
import com.yxt.common.base.utils.WordUtils; |
|
|
|
import com.yxt.messagecenter.api.message.Message; |
|
|
|
import com.yxt.messagecenter.api.message.MessageFeign; |
|
|
|
import com.yxt.messagecenter.api.message.MessageFlowVo; |
|
|
|
import com.yxt.messagecenter.api.message.MessageFlowableQuery; |
|
|
|
import com.yxt.messagecenter.api.messagelist.MessageList; |
|
|
|
import com.yxt.messagecenter.api.messagelist.MessageListFeign; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
@ -120,19 +130,8 @@ import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* Project: anrui_buscenter(销售订单退车) <br/> |
|
|
|
* File: BusSalesOrderReturnVehApplyService.java <br/> |
|
|
|
* Class: com.yxt.anrui.buscenter.biz.bussalesorderreturnvehapply.BusSalesOrderReturnVehApplyService <br/> |
|
|
|
* Description: 销售订单车辆退库申请 业务逻辑. <br/> |
|
|
|
* Copyright: Copyright (c) 2011 <br/> |
|
|
|
* Company: https://gitee.com/liuzp315 <br/>
|
|
|
|
* Makedate: 2023-03-09 14:26:23 <br/> |
|
|
|
* |
|
|
|
* @author liupopo |
|
|
|
* @version 1.0 |
|
|
|
* @since 1.0 |
|
|
|
*/ |
|
|
|
import static java.util.Comparator.comparing; |
|
|
|
|
|
|
|
@Service |
|
|
|
public class BusSalesOrderReturnVehApplyService extends MybatisBaseService<BusSalesOrderReturnVehApplyMapper, BusSalesOrderReturnVehApply> { |
|
|
|
|
|
|
@ -174,21 +173,22 @@ public class BusSalesOrderReturnVehApplyService extends MybatisBaseService<BusSa |
|
|
|
private BaseVehicleStateFeign baseVehicleStateFeign; |
|
|
|
@Autowired |
|
|
|
private FinVehicleInvoiceFeign finVehicleInvoiceFeign; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private BusSalesOrderBorrowerService busSalesOrderBorrowerService; |
|
|
|
@Autowired |
|
|
|
private BaseVehicleOutFeign baseVehicleOutFeign; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private BusSalesReturnOrdersService busSalesReturnOrdersService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private BusDeliveredApplyDetailsService busDeliveredApplyDetailsService; |
|
|
|
@Autowired |
|
|
|
private FinKingDeeFeign finKingDeeFeign; |
|
|
|
@Autowired |
|
|
|
private ScmVehRebateFeign scmVehRebateFeign; |
|
|
|
@Autowired |
|
|
|
private com.yxt.anrui.portal.api.flow.FlowableFeign flowableFeignSp; |
|
|
|
@Autowired |
|
|
|
private MessageListFeign messageListFeign; |
|
|
|
|
|
|
|
|
|
|
|
public PagerVo<BusSalesOrderReturnVehApplyVo> listPageVo(PagerQuery<BusSalesOrderReturnVehApplyQuery> pq) { |
|
|
@ -762,7 +762,6 @@ public class BusSalesOrderReturnVehApplyService extends MybatisBaseService<BusSa |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
//------------------------修改车辆持久状态--------------------------
|
|
|
|
BusSalesOrderVehicle busSalesOrderVehicle = busSalesOrderVehicleService.fetchBySid(busSalesOrderReturnVehDetailsVo.getBusVinSid()); |
|
|
@ -1336,4 +1335,120 @@ public class BusSalesOrderReturnVehApplyService extends MybatisBaseService<BusSa |
|
|
|
vo.setBusSalesOrderReturnVehs(busSalesOrderReturnVehDetailsVos); |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
|
|
|
|
public String createPdf(String sid, String userName) { |
|
|
|
BusSalesOrderReturnVehApplyDetailsVo data = fetchDetailsVoBySid(sid).getData(); |
|
|
|
Map<String, Object> dataMap = new HashMap<String, Object>(); |
|
|
|
//分公司
|
|
|
|
dataMap.put("orgName", data.getUseOrgName()); |
|
|
|
//创建部门
|
|
|
|
String deptName = ""; |
|
|
|
List<String> split = Arrays.asList(data.getOrgSidPath().split("/")); |
|
|
|
if (split.size() > 1) { |
|
|
|
//获取本级sid获取本级部门信息
|
|
|
|
SysOrganizationVo sysOrganization = sysOrganizationFeign.fetchBySid(split.get(split.size() - 2)).getData(); |
|
|
|
SysOrganizationVo sysOrganization1 = sysOrganizationFeign.fetchBySid(split.get(split.size() - 1)).getData(); |
|
|
|
deptName = sysOrganization.getName() + "/" + sysOrganization1.getName(); |
|
|
|
deptName = sysOrganization1.getName(); |
|
|
|
} else { |
|
|
|
SysOrganizationVo sysOrganization = sysOrganizationFeign.fetchBySid(split.get(0)).getData(); |
|
|
|
deptName = sysOrganization.getName(); |
|
|
|
deptName = sysOrganization.getName(); |
|
|
|
} |
|
|
|
dataMap.put("deptName", deptName); |
|
|
|
//创建人
|
|
|
|
dataMap.put("createName", data.getCreateByName()); |
|
|
|
//创建日期
|
|
|
|
dataMap.put("createTime", data.getCreatTime()); |
|
|
|
//办结日期
|
|
|
|
dataMap.put("finishTime", DateUtil.formatDate(data.getFinishTime())); |
|
|
|
//审批编号
|
|
|
|
dataMap.put("billNo", data.getApplyNo()); |
|
|
|
List<BusSalesOrderReturnVehPdfVo> busSalesOrderReturnVehPdfVos = new ArrayList<>(); |
|
|
|
//循环获取车辆信息
|
|
|
|
Integer i = 1; |
|
|
|
for (BusSalesOrderReturnVehDetailsVo busSalesOrderReturnVehDetailsVo : data.getBusSalesOrderReturnVehs()) { |
|
|
|
BusSalesOrderReturnVehPdfVo busSalesOrderReturnVehPdfVo = new BusSalesOrderReturnVehPdfVo(); |
|
|
|
busSalesOrderReturnVehPdfVo.setId(i); |
|
|
|
i = i + 1; |
|
|
|
busSalesOrderReturnVehPdfVo.setVinNo(busSalesOrderReturnVehDetailsVo.getVinNo()); |
|
|
|
busSalesOrderReturnVehPdfVo.setColor(busSalesOrderReturnVehDetailsVo.getCarColorValue()); |
|
|
|
busSalesOrderReturnVehPdfVo.setHgzState(busSalesOrderReturnVehDetailsVo.getCertificateStateValue()); |
|
|
|
busSalesOrderReturnVehPdfVo.setKpState(busSalesOrderReturnVehDetailsVo.getInvoicingStateValue()); |
|
|
|
busSalesOrderReturnVehPdfVo.setTbState(busSalesOrderReturnVehDetailsVo.getInsureStateValue()); |
|
|
|
busSalesOrderReturnVehPdfVo.setKcState(busSalesOrderReturnVehDetailsVo.getStockStateValue()); |
|
|
|
busSalesOrderReturnVehPdfVos.add(busSalesOrderReturnVehPdfVo); |
|
|
|
} |
|
|
|
dataMap.put("wlList", busSalesOrderReturnVehPdfVos); |
|
|
|
dataMap.put("contractNo", data.getContractNo()); |
|
|
|
dataMap.put("saleType", data.getSaleTypeValue()); |
|
|
|
dataMap.put("model", data.getModelName()); |
|
|
|
dataMap.put("num", data.getOrderNum()); |
|
|
|
dataMap.put("skqk", data.getCollection()); |
|
|
|
dataMap.put("zzyy", data.getStopRemarks()); |
|
|
|
dataMap.put("remarks", data.getRemarks()); |
|
|
|
//获取审批记录
|
|
|
|
List<PCHistTaskListAndCommentList> flowRecordVo = flowableFeignSp.flowRecordAndComment(data.getProcInstId(), "1").getData(); |
|
|
|
List<FinPaymentrecordSourceLCVo> finPaymentrecordSourceLCVos = new ArrayList<>(); |
|
|
|
for (PCHistTaskListAndCommentList flowTask : flowRecordVo) { |
|
|
|
if (flowTask.getFlowableRecordVo() != null) { |
|
|
|
Map<String, Object> flowableRecordVo = flowTask.getFlowableRecordVo(); |
|
|
|
FinPaymentrecordSourceLCVo finPaymentrecordSourceLCVo = new FinPaymentrecordSourceLCVo(); |
|
|
|
List<Map<String, Object>> taskUserInfos = ConstantUtils.getListData(flowableRecordVo, "taskUserInfos"); |
|
|
|
Map<String, Object> comment = ConstantUtils.getMap(flowableRecordVo, "comment"); |
|
|
|
String assigneeName = (String) taskUserInfos.get(0).get("assigneeName"); |
|
|
|
String comment1 = (String) comment.get("comment"); |
|
|
|
finPaymentrecordSourceLCVo.setName(assigneeName); |
|
|
|
finPaymentrecordSourceLCVo.setComment(comment1); |
|
|
|
finPaymentrecordSourceLCVo.setSpsj(flowableRecordVo.get("finishTime").toString()); |
|
|
|
finPaymentrecordSourceLCVos.add(finPaymentrecordSourceLCVo); |
|
|
|
} else { |
|
|
|
Map<String, Object> processCommentVo = flowTask.getProcessCommentVo(); |
|
|
|
FinPaymentrecordSourceLCVo finPaymentrecordSourceLCVo = new FinPaymentrecordSourceLCVo(); |
|
|
|
finPaymentrecordSourceLCVo.setName(processCommentVo.get("title").toString()); |
|
|
|
finPaymentrecordSourceLCVo.setComment(processCommentVo.get("content").toString()); |
|
|
|
finPaymentrecordSourceLCVo.setSpsj(processCommentVo.get("time").toString()); |
|
|
|
finPaymentrecordSourceLCVos.add(finPaymentrecordSourceLCVo); |
|
|
|
} |
|
|
|
} |
|
|
|
List<Message> messages = messageFeign.selectByBusinessSid(data.getSid()).getData(); |
|
|
|
if (messages.size() > 0) { |
|
|
|
for (Message message : messages) { |
|
|
|
FinPaymentrecordSourceLCVo finPaymentrecordSourceLCVo = new FinPaymentrecordSourceLCVo(); |
|
|
|
String receiverNames = ""; |
|
|
|
List<MessageList> messageLists = messageListFeign.fetchByMainSid(message.getSid()).getData(); |
|
|
|
if (messageLists.size() > 0) { |
|
|
|
for (MessageList messageList : messageLists) { |
|
|
|
receiverNames = receiverNames + messageList.getReceiverName() + ","; |
|
|
|
} |
|
|
|
} |
|
|
|
finPaymentrecordSourceLCVo.setName("系统"); |
|
|
|
finPaymentrecordSourceLCVo.setComment("抄送 " + receiverNames.substring(0, receiverNames.lastIndexOf(","))); |
|
|
|
finPaymentrecordSourceLCVo.setSpsj(DateUtil.format(message.getCreateTime(), "yyyy-MM-dd HH:mm:ss")); |
|
|
|
finPaymentrecordSourceLCVos.add(finPaymentrecordSourceLCVo); |
|
|
|
} |
|
|
|
} |
|
|
|
finPaymentrecordSourceLCVos.sort(comparing(FinPaymentrecordSourceLCVo::getSpsj)); |
|
|
|
dataMap.put("lcList", finPaymentrecordSourceLCVos); |
|
|
|
//下载人
|
|
|
|
dataMap.put("downName", userName); |
|
|
|
//下载时间
|
|
|
|
dataMap.put("downTime", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss")); |
|
|
|
//获取模板
|
|
|
|
//模板路径
|
|
|
|
String sourcePath = "D:\\anrui\\upload\\template\\"; |
|
|
|
//生成word文件名
|
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
|
long seconds = System.currentTimeMillis(); |
|
|
|
String typeName = dateStr + seconds + ".doc"; |
|
|
|
// 生成文件路径
|
|
|
|
String targetPath = sourcePath + dateStr; |
|
|
|
WordUtils.creatWord(dataMap, "xstc", sourcePath, targetPath, typeName); |
|
|
|
//新生成的word路径
|
|
|
|
String wordPath = targetPath + "\\" + typeName; |
|
|
|
//生成出门证文件名
|
|
|
|
String pdfName = "销售退车_" + dateStr + seconds + ".pdf"; |
|
|
|
WordUtils.doc2pdf(wordPath, targetPath, pdfName, userName); |
|
|
|
return "/template/" + dateStr + "/" + pdfName; |
|
|
|
} |
|
|
|
} |
|
|
|