|
|
@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.yxt.anrui.base.api.basevehicle.BaseVehicleFeign; |
|
|
|
import com.yxt.anrui.base.api.basevehicle.BaseVehicleSelectVo; |
|
|
|
import com.yxt.anrui.base.api.commonappendix.CommonAppendix; |
|
|
|
import com.yxt.anrui.base.api.commonappendix.CommonAttachTypeEnum; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.CommonContractFeign; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.CommonContractPackageVo; |
|
|
|
import com.yxt.anrui.base.common.enums.BillTypeEnum; |
|
|
@ -14,6 +16,10 @@ import com.yxt.anrui.base.common.utils.domain.BillNo; |
|
|
|
import com.yxt.anrui.buscenter.api.buscenterfile.BuscenterFile; |
|
|
|
import com.yxt.anrui.buscenter.api.buscenterfile.BuscenterFileEnum; |
|
|
|
import com.yxt.anrui.buscenter.api.bushandoveritems.BusHandoverItems; |
|
|
|
import com.yxt.anrui.buscenter.api.bushandoverwait.BusHandoverWait; |
|
|
|
import com.yxt.anrui.buscenter.api.bushandoverwait.BusHandoverWaitListVo; |
|
|
|
import com.yxt.anrui.buscenter.api.bushandoverwait.BusHandoverWaitQuery; |
|
|
|
import com.yxt.anrui.buscenter.api.bushandoverwait.BusHandoverWaitVo; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicle; |
|
|
|
import com.yxt.anrui.buscenter.api.busvehicledatahandover.*; |
|
|
|
import com.yxt.anrui.buscenter.biz.buscenterfile.BuscenterFileService; |
|
|
@ -33,10 +39,12 @@ import com.yxt.common.base.utils.PagerUtil; |
|
|
|
import com.yxt.common.base.utils.StringUtils; |
|
|
|
import com.yxt.common.base.utils.WordConvertUtils; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
import com.yxt.common.core.result.FileUploadResult; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.io.InputStream; |
|
|
@ -365,6 +373,7 @@ public class BusVehicleDataHandoverService extends MybatisBaseService<BusVehicle |
|
|
|
newEntity.setCreateName(createName); |
|
|
|
newEntity.setCompleteStateValue("已完成"); |
|
|
|
newEntity.setCompleteStateKey("002"); |
|
|
|
newEntity.setOrgSidPath(dto.getOrgSidPath()); |
|
|
|
baseMapper.insert(newEntity); |
|
|
|
} |
|
|
|
} |
|
|
@ -400,17 +409,36 @@ public class BusVehicleDataHandoverService extends MybatisBaseService<BusVehicle |
|
|
|
/** |
|
|
|
* 上传确认单 |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @param |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean<String> uploadPdf(BusUploadDto dto) { |
|
|
|
public ResultBean<String> uploadPdf(String sid, MultipartFile file) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
buscenterFileService.delByLinkSidOrType(dto.getSid(), BuscenterFileEnum.VEHICLE_SECOND_DATA_HANDOVER.getAttachType()); |
|
|
|
List<String> images = dto.getImgs(); |
|
|
|
if (!images.isEmpty()) { |
|
|
|
buscenterFileService.saveAll(dto.getSid(), images, BuscenterFileEnum.VEHICLE_SECOND_DATA_HANDOVER.getAttachType()); |
|
|
|
if (file == null || file.isEmpty()) { |
|
|
|
return rb.setMsg("文件为空"); |
|
|
|
} |
|
|
|
BusVehicleDataHandover entity = fetchBySid(sid); |
|
|
|
String billNo = entity.getBillNo(); |
|
|
|
rb = fileUploadComponent.uploadFile(file); |
|
|
|
FileUploadResult data = (FileUploadResult) rb.getData(); |
|
|
|
List<BusVehicleDataHandover> entityByBillNo = getDataByBillNo(billNo).getData(); |
|
|
|
entityByBillNo.removeAll(Collections.singleton(null)); |
|
|
|
if (!entityByBillNo.isEmpty()) { |
|
|
|
for (BusVehicleDataHandover handover : entityByBillNo) { |
|
|
|
String saveSid = handover.getSid(); |
|
|
|
buscenterFileService.delByLinkSidOrType(saveSid, BuscenterFileEnum.VEHICLE_SECOND_DATA_HANDOVER.getAttachType()); |
|
|
|
BuscenterFile buscenterFile = new BuscenterFile(); |
|
|
|
buscenterFile.setLinkSid(saveSid); |
|
|
|
buscenterFile.setFilePath(data.getFilePath()); |
|
|
|
buscenterFile.setAttachType(BuscenterFileEnum.VEHICLE_SECOND_DATA_HANDOVER.getAttachType()); |
|
|
|
buscenterFile.setFileName(data.getSourceFileName()); |
|
|
|
buscenterFile.setFileSize(data.getSize()); |
|
|
|
String sourceFileName = data.getSourceFileName(); |
|
|
|
buscenterFile.setFileType(sourceFileName.substring(sourceFileName.lastIndexOf("."))); |
|
|
|
buscenterFileService.save(buscenterFile); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success().setData(dto.getSid()); |
|
|
|
return rb.success().setMsg("上传成功"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -437,9 +465,10 @@ public class BusVehicleDataHandoverService extends MybatisBaseService<BusVehicle |
|
|
|
BusVehicleDataHandoverDetailsVo vo = new BusVehicleDataHandoverDetailsVo(); |
|
|
|
List<BusVehicleDataListVo> vinList = new ArrayList<>(); |
|
|
|
List<String> sidList = new ArrayList<>(); |
|
|
|
StringBuffer sb = new StringBuffer(); |
|
|
|
|
|
|
|
int i = 1; |
|
|
|
for (String sid : sids) { |
|
|
|
StringBuffer sb = new StringBuffer(); |
|
|
|
sidList.add(sid); |
|
|
|
BusVehicleDataHandover entity = fetchBySid(sid); |
|
|
|
vo.setContractNo(entity.getContractNo()); |
|
|
@ -482,13 +511,13 @@ public class BusVehicleDataHandoverService extends MybatisBaseService<BusVehicle |
|
|
|
sb.append("气瓶检测合格证").append("、"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (sb.toString().length() > 0) { |
|
|
|
sb.delete(sb.length() - 1, sb.length()); |
|
|
|
dataListVo.setVinNo(handoverItem.getVinNo()); |
|
|
|
dataListVo.setVinSid(handoverItem.getVinSid()); |
|
|
|
if (sb.toString().length() > 0) { |
|
|
|
sb.delete(sb.length() - 1, sb.length()); |
|
|
|
} |
|
|
|
} |
|
|
|
dataListVo.setItems(sb.toString()); |
|
|
|
dataListVo.setVinNo(handoverItem.getVinNo()); |
|
|
|
dataListVo.setVinSid(handoverItem.getVinSid()); |
|
|
|
} |
|
|
|
} |
|
|
|
vinList.add(dataListVo); |
|
|
@ -504,11 +533,169 @@ public class BusVehicleDataHandoverService extends MybatisBaseService<BusVehicle |
|
|
|
* @param sid |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean<BusVehicleDataHandoverDetailsVo> details(String sid) { |
|
|
|
ResultBean<BusVehicleDataHandoverDetailsVo> rb = ResultBean.fireFail(); |
|
|
|
public ResultBean<BusDetailsVo> details(String sid) { |
|
|
|
ResultBean<BusDetailsVo> rb = ResultBean.fireFail(); |
|
|
|
BusVehicleDataHandover handover = fetchBySid(sid); |
|
|
|
BusVehicleDataHandoverDetailsVo vo = new BusVehicleDataHandoverDetailsVo(); |
|
|
|
BusDetailsVo vo = new BusDetailsVo(); |
|
|
|
List<BusVehicleDataHandover> entityList = baseMapper.getDataByBillNo(handover.getBillNo()); |
|
|
|
return null; |
|
|
|
entityList.removeAll(Collections.singleton(null)); |
|
|
|
vo.setContractNo(handover.getContractNo()); |
|
|
|
vo.setCustomerName(handover.getCustomerName()); |
|
|
|
vo.setRecName(handover.getRecName()); |
|
|
|
vo.setRecDate(handover.getRecDate()); |
|
|
|
List<BusVehicleDataDetailsVo> vinList = new ArrayList<>(); |
|
|
|
if (!entityList.isEmpty()) { |
|
|
|
for (BusVehicleDataHandover data : entityList) { |
|
|
|
BusVehicleDataDetailsVo dataListVo = new BusVehicleDataDetailsVo(); |
|
|
|
dataListVo.setVinNo(data.getVinNo()); |
|
|
|
dataListVo.setItems(data.getItems()); |
|
|
|
vinList.add(dataListVo); |
|
|
|
} |
|
|
|
} |
|
|
|
vo.setVinList(vinList); |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ResultBean<PagerVo<AppNotCompleteRecordVo>> getCarDocsRecordNotList(PagerQuery<AppListQuery> pagerQuery) { |
|
|
|
ResultBean<PagerVo<AppNotCompleteRecordVo>> rb = ResultBean.fireFail(); |
|
|
|
IPage<BusVehicleDataHandover> page = PagerUtil.queryToPage(pagerQuery); |
|
|
|
AppListQuery params = pagerQuery.getParams(); |
|
|
|
QueryWrapper<BusVehicleDataHandover> qw = new QueryWrapper<>(); |
|
|
|
if (params != null) { |
|
|
|
String orgPath = params.getOrgPath(); |
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(orgPath)) { |
|
|
|
orgPath = sysStaffOrgFeign.getOrgSidByPath(params.getOrgPath()).getData(); |
|
|
|
qw.eq("bvh.useOrgSid", orgPath); |
|
|
|
} |
|
|
|
// if (org.apache.commons.lang3.StringUtils.isNotBlank(params.getUserSid())) {
|
|
|
|
// qw.eq("bh.createBySid", params.getUserSid());
|
|
|
|
// }
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(params.getName())) { |
|
|
|
qw.and(wrapper -> wrapper.like("bvh.contractNo", params.getName()).or().like("bvh.customerName", params.getName())); |
|
|
|
} |
|
|
|
qw.eq("bvh.isDelete", 0); |
|
|
|
qw.eq("bvh.completeStateKey", "001"); |
|
|
|
} |
|
|
|
IPage<AppNotCompleteRecordVo> pagging = baseMapper.notCompletePageVo(page, qw); |
|
|
|
List<AppNotCompleteRecordVo> records = pagging.getRecords(); |
|
|
|
records.removeAll(Collections.singleton(null)); |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
for (AppNotCompleteRecordVo record : records) { |
|
|
|
String createName = record.getCreateName(); |
|
|
|
Date createTime = record.getCreateTime(); |
|
|
|
String createTimeFormat = sdf.format(createTime); |
|
|
|
record.setCreateInfo(createName + "," + createTimeFormat); |
|
|
|
String contractNo = record.getContractId(); |
|
|
|
//根据合同编号查询车辆列表
|
|
|
|
List<AppVinListVo> vinListVos = baseMapper.selectByNo(contractNo); |
|
|
|
vinListVos.removeAll(Collections.singleton(null)); |
|
|
|
if (!vinListVos.isEmpty()) { |
|
|
|
for (AppVinListVo vinVo : vinListVos) { |
|
|
|
String recordSid = vinVo.getRecordSid(); |
|
|
|
BusVehicleDataHandover handover = fetchBySid(recordSid); |
|
|
|
String linkSid = handover.getLinkSid(); |
|
|
|
//交车资料确认单
|
|
|
|
List<BuscenterFile> fileList = buscenterFileService.selectByLinkSid(linkSid, BuscenterFileEnum.ENTRUST_CONFIRM_IMAGES.getAttachType()); |
|
|
|
fileList.removeAll(Collections.singleton(null)); |
|
|
|
if (!fileList.isEmpty()) { |
|
|
|
List<String> entrustConfirmImages = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()).collect(Collectors.toList()); |
|
|
|
vinVo.setUrls(entrustConfirmImages); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
record.setVinList(vinListVos); |
|
|
|
} |
|
|
|
PagerVo<AppNotCompleteRecordVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return rb.success().setData(p); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<List<BusVehicleDataHandover>> getDataByBillNo(String billNo) { |
|
|
|
ResultBean<List<BusVehicleDataHandover>> rb = ResultBean.fireFail(); |
|
|
|
List<BusVehicleDataHandover> list = baseMapper.getDataByBillNo(billNo); |
|
|
|
return rb.success().setData(list); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 已完成 |
|
|
|
* |
|
|
|
* @param pagerQuery |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean<PagerVo<AppCompleteRecordVo>> getCarDocsConfirmList(PagerQuery<AppListQuery> pagerQuery) { |
|
|
|
ResultBean<PagerVo<AppCompleteRecordVo>> rb = ResultBean.fireFail(); |
|
|
|
IPage<BusVehicleDataHandover> page = PagerUtil.queryToPage(pagerQuery); |
|
|
|
AppListQuery params = pagerQuery.getParams(); |
|
|
|
QueryWrapper<BusVehicleDataHandover> qw = new QueryWrapper<>(); |
|
|
|
if (params != null) { |
|
|
|
String orgPath = params.getOrgPath(); |
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(orgPath)) { |
|
|
|
orgPath = sysStaffOrgFeign.getOrgSidByPath(params.getOrgPath()).getData(); |
|
|
|
qw.eq("bvh.useOrgSid", orgPath); |
|
|
|
} |
|
|
|
// if (org.apache.commons.lang3.StringUtils.isNotBlank(params.getUserSid())) {
|
|
|
|
// qw.eq("bh.createBySid", params.getUserSid());
|
|
|
|
// }
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(params.getName())) { |
|
|
|
qw.and(wrapper -> wrapper.like("bvh.contractNo", params.getName()).or().like("bvh.customerName", params.getName())); |
|
|
|
} |
|
|
|
qw.eq("bvh.isDelete", 0); |
|
|
|
qw.eq("bvh.completeStateKey", "002"); |
|
|
|
} |
|
|
|
String urlPrefix = docPdfComponent.getPrefixTemplateUrl(); |
|
|
|
IPage<AppCompleteRecordVo> pagging = baseMapper.completePageVo(page, qw); |
|
|
|
List<AppCompleteRecordVo> records = pagging.getRecords(); |
|
|
|
records.removeAll(Collections.singleton(null)); |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
for (AppCompleteRecordVo record : records) { |
|
|
|
if (StringUtils.isBlank(record.getLinkSid())) { |
|
|
|
record.setDownLoadUrl(urlPrefix + record.getDownLoadUrl()); |
|
|
|
record.setShowUpload(true); |
|
|
|
record.setShowDownload(true); |
|
|
|
} else { |
|
|
|
record.setDownLoadUrl(""); |
|
|
|
record.setShowDownload(false); |
|
|
|
record.setShowUpload(false); |
|
|
|
} |
|
|
|
String createName = record.getCreateName(); |
|
|
|
Date createTime = record.getCreateTime(); |
|
|
|
String createTimeFormat = sdf.format(createTime); |
|
|
|
record.setCreateInfo(createName + "," + createTimeFormat); |
|
|
|
String billId = record.getBillId(); |
|
|
|
//根据合同编号查询车辆列表
|
|
|
|
List<BusVehicleDataHandover> dataByBillNo = baseMapper.getDataByBillNo(billId); |
|
|
|
dataByBillNo.removeAll(Collections.singleton(null)); |
|
|
|
StringBuffer sb = new StringBuffer(); |
|
|
|
if (!dataByBillNo.isEmpty()) { |
|
|
|
for (BusVehicleDataHandover entity : dataByBillNo) { |
|
|
|
String recordSid = entity.getSid(); |
|
|
|
BusVehicleDataHandover handover = fetchBySid(recordSid); |
|
|
|
if (StringUtils.isNotBlank(handover.getLinkSid())) { |
|
|
|
String linkSid = handover.getLinkSid(); |
|
|
|
//交车资料确认单
|
|
|
|
List<BuscenterFile> fileList = buscenterFileService.selectByLinkSid(linkSid, BuscenterFileEnum.ENTRUST_CONFIRM_IMAGES.getAttachType()); |
|
|
|
fileList.removeAll(Collections.singleton(null)); |
|
|
|
if (!fileList.isEmpty()) { |
|
|
|
List<String> entrustConfirmImages = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()).collect(Collectors.toList()); |
|
|
|
record.setUrls(entrustConfirmImages); |
|
|
|
} |
|
|
|
} else { |
|
|
|
String sid = entity.getSid(); |
|
|
|
//交车资料确认单
|
|
|
|
List<BuscenterFile> fileList = buscenterFileService.selectByLinkSid(sid, BuscenterFileEnum.VEHICLE_SECOND_DATA_HANDOVER.getAttachType()); |
|
|
|
fileList.removeAll(Collections.singleton(null)); |
|
|
|
if (!fileList.isEmpty()) { |
|
|
|
List<String> entrustConfirmImages = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()).collect(Collectors.toList()); |
|
|
|
record.setUrls(entrustConfirmImages); |
|
|
|
} |
|
|
|
} |
|
|
|
sb.append(entity.getVinNo()).append(","); |
|
|
|
} |
|
|
|
sb.delete(sb.length() - 1, sb.length()); |
|
|
|
record.setVins(sb.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
PagerVo<AppCompleteRecordVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return rb.success().setData(p); |
|
|
|
} |
|
|
|
} |
|
|
|