@ -8,18 +8,24 @@ import com.yxt.anrui.base.api.basevehicle.BaseVehicleFeign;
import com.yxt.anrui.base.api.basevehicle.BaseVehicleSelectVo ;
import com.yxt.anrui.base.api.commoncontract.CommonContractFeign ;
import com.yxt.anrui.base.api.commoncontract.CommonContractPackageVo ;
import com.yxt.anrui.base.common.enums.BillTypeEnum ;
import com.yxt.anrui.base.common.utils.Rule ;
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.bussalesordervehicle.BusSalesOrderVehicle ;
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicleFeign ;
import com.yxt.anrui.buscenter.api.busvehicledatahandover.* ;
import com.yxt.anrui.buscenter.api.busvehiclehandoverdata.BusVehicleHandoverData ;
import com.yxt.anrui.buscenter.api.busvehiclehandoverdata.BusVehicleHandoverDataDetailsVo ;
import com.yxt.anrui.buscenter.api.busvehiclehandoverdata.BusVehicleHandoverDataDto ;
import com.yxt.anrui.buscenter.api.busvehicleinformationhandover.BusVehicleInformationHandover ;
import com.yxt.anrui.buscenter.api.busvehicleinformationhandover.BusVehicleInformationHandoverQuery ;
import com.yxt.anrui.buscenter.api.busvehicleinformationhandover.BusVehicleInformationHandoverVo ;
import com.yxt.anrui.buscenter.biz.buscenterfile.BuscenterFileService ;
import com.yxt.anrui.buscenter.biz.bushandover.BusHandoverService ;
import com.yxt.anrui.buscenter.biz.bushandoveritems.BusHandoverItemsService ;
import com.yxt.anrui.buscenter.biz.bussalesordervehicle.BusSalesOrderVehicleService ;
import com.yxt.anrui.buscenter.biz.busvehiclehandoverdata.BusVehicleHandoverDataService ;
import com.yxt.anrui.fin.api.finuncollectedreceivablesdetailed.FinUncollectedReceivablesDetailedPdfVo ;
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationFeign ;
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationVo ;
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.common.base.config.component.DocPdfComponent ;
import com.yxt.common.base.config.component.FileUploadComponent ;
import com.yxt.common.base.service.MybatisBaseService ;
@ -34,7 +40,9 @@ import org.springframework.stereotype.Service;
import java.io.File ;
import java.io.InputStream ;
import java.text.SimpleDateFormat ;
import java.util.* ;
import java.util.stream.Collectors ;
/ * *
* @author Administrator
@ -62,6 +70,24 @@ public class BusVehicleDataHandoverService extends MybatisBaseService<BusVehicle
@Autowired
private DocPdfComponent docPdfComponent ;
@Autowired
private SysUserFeign sysUserFeign ;
@Autowired
private BuscenterFileService buscenterFileService ;
@Autowired
private BusHandoverService busHandoverService ;
@Autowired
private BusHandoverItemsService busHandoverItemsService ;
@Autowired
private SysOrganizationFeign sysOrganizationFeign ;
@Autowired
private SysStaffOrgFeign sysStaffOrgFeign ;
/ * *
* 根据当前用户查询合同信息
*
@ -103,80 +129,6 @@ public class BusVehicleDataHandoverService extends MybatisBaseService<BusVehicle
return rb . success ( ) . setData ( dtos ) ;
}
/ * *
* 新增修改
*
* @param dto
* @return
* /
public ResultBean < String > saveOrUpdate ( BusVehicleDataHandoverDto dto ) {
ResultBean rb = ResultBean . fireFail ( ) ;
String returnSid = "" ;
if ( StringUtils . isNotBlank ( dto . getSid ( ) ) ) {
returnSid = dto . getSid ( ) ;
BusVehicleDataHandover entity = fetchBySid ( dto . getSid ( ) ) ;
BeanUtil . copyProperties ( dto , entity , "id" , "sid" ) ;
if ( null ! = dto . getFilePath ( ) & & ! dto . getFilePath ( ) . isEmpty ( ) ) {
StringBuffer sb = new StringBuffer ( ) ;
String urlPrefix = fileUploadComponent . getUrlPrefix ( ) ;
for ( String s : dto . getFilePath ( ) ) {
String substring = s . substring ( urlPrefix . length ( ) ) ;
sb . append ( substring ) . append ( "," ) ;
}
sb . delete ( sb . length ( ) - 1 , sb . length ( ) ) ;
entity . setFilePath ( sb . toString ( ) ) ;
}
baseMapper . updateById ( entity ) ;
if ( null ! = dto . getHandoverDataList ( ) ) {
List < BusVehicleHandoverDataDto > handoverDataList = dto . getHandoverDataList ( ) ;
for ( BusVehicleHandoverDataDto data : handoverDataList ) {
if ( StringUtils . isNotBlank ( data . getSid ( ) ) ) {
BusVehicleHandoverData handoverData = busVehicleHandoverDataService . fetchBySid ( data . getSid ( ) ) ;
BeanUtil . copyProperties ( data , handoverData , "id" , "sid" ) ;
busVehicleHandoverDataService . updateById ( handoverData ) ;
} else {
BusVehicleHandoverData handoverData = new BusVehicleHandoverData ( ) ;
BeanUtil . copyProperties ( data , handoverData , "id" , "sid" ) ;
handoverData . setUseOrgSid ( dto . getUseOrgSid ( ) ) ;
handoverData . setUseOrgName ( dto . getUseOrgName ( ) ) ;
handoverData . setCreateBySid ( dto . getCreateBySid ( ) ) ;
handoverData . setLinkSid ( dto . getSid ( ) ) ;
boolean b = busVehicleHandoverDataService . save ( handoverData ) ;
}
}
}
} else {
BusVehicleDataHandover entity = new BusVehicleDataHandover ( ) ;
BeanUtil . copyProperties ( dto , entity , "id" , "sid" ) ;
if ( null ! = dto . getFilePath ( ) & & ! dto . getFilePath ( ) . isEmpty ( ) ) {
StringBuffer sb = new StringBuffer ( ) ;
String urlPrefix = fileUploadComponent . getUrlPrefix ( ) ;
for ( String s : dto . getFilePath ( ) ) {
String substring = s . substring ( urlPrefix . length ( ) ) ;
sb . append ( substring ) . append ( "," ) ;
}
sb . delete ( sb . length ( ) - 1 , sb . length ( ) ) ;
entity . setFilePath ( sb . toString ( ) ) ;
}
baseMapper . insert ( entity ) ;
if ( null ! = dto . getHandoverDataList ( ) ) {
for ( BusVehicleHandoverDataDto busVehicleHandoverData : dto . getHandoverDataList ( ) ) {
if ( null ! = busVehicleHandoverData ) {
BusVehicleHandoverData data = new BusVehicleHandoverData ( ) ;
BeanUtil . copyProperties ( busVehicleHandoverData , data , "id" , "sid" ) ;
data . setUseOrgSid ( dto . getUseOrgSid ( ) ) ;
data . setUseOrgName ( dto . getUseOrgName ( ) ) ;
data . setCreateBySid ( dto . getCreateBySid ( ) ) ;
data . setLinkSid ( entity . getSid ( ) ) ;
boolean b = busVehicleHandoverDataService . save ( data ) ;
}
}
}
returnSid = entity . getSid ( ) ;
}
return rb . success ( ) . setData ( returnSid ) ;
}
/ * *
* 详情交车资料确认单
*
@ -186,36 +138,6 @@ public class BusVehicleDataHandoverService extends MybatisBaseService<BusVehicle
public ResultBean < BusVehicleDataHandoverDetailsVo > fetchDetailsBySid ( String sid ) {
ResultBean rb = ResultBean . fireFail ( ) ;
BusVehicleDataHandoverDetailsVo vo = new BusVehicleDataHandoverDetailsVo ( ) ;
BusVehicleDataHandover busVehicleDataHandover = fetchBySid ( sid ) ;
if ( null ! = busVehicleDataHandover ) {
if ( StringUtils . isNotBlank ( busVehicleDataHandover . getContractNo ( ) ) ) {
vo . setContractNo ( busVehicleDataHandover . getContractNo ( ) ) ;
}
if ( StringUtils . isNotBlank ( busVehicleDataHandover . getCustomerName ( ) ) ) {
vo . setCustomerName ( busVehicleDataHandover . getCustomerName ( ) ) ;
}
if ( StringUtils . isNotBlank ( busVehicleDataHandover . getFilePath ( ) ) ) {
String filePath = busVehicleDataHandover . getFilePath ( ) ;
List < String > filePaths = new ArrayList < > ( ) ;
for ( String s : filePath . split ( "," ) ) {
String urlPrefix = fileUploadComponent . getUrlPrefix ( ) ;
filePaths . add ( urlPrefix + s ) ;
}
vo . setFilePath ( filePaths ) ;
}
}
List < BusVehicleHandoverData > dataList = busVehicleHandoverDataService . selectByLinkSid ( sid ) ;
if ( null ! = dataList ) {
List < BusVehicleHandoverDataDetailsVo > dataDetailsVos = new ArrayList < > ( ) ;
int sNo = 1 ;
for ( BusVehicleHandoverData data : dataList ) {
BusVehicleHandoverDataDetailsVo dataVo = new BusVehicleHandoverDataDetailsVo ( ) ;
BeanUtil . copyProperties ( data , dataVo ) ;
dataVo . setSNo ( String . valueOf ( sNo + + ) ) ;
dataDetailsVos . add ( dataVo ) ;
}
vo . setHandoverDataList ( dataDetailsVos ) ;
}
return rb . success ( ) . setData ( vo ) ;
}
@ -223,14 +145,20 @@ public class BusVehicleDataHandoverService extends MybatisBaseService<BusVehicle
// todo: 这里根据具体业务调整查询条件
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
QueryWrapper < BusVehicleDataHandover > qw = new QueryWrapper < > ( ) ;
if ( org . apache . commons . lang3 . StringUtils . isNotBlank ( query . getContractNo ( ) ) ) {
if ( StringUtils . isNotBlank ( query . getContractNo ( ) ) ) {
qw . like ( "contractNo" , query . getContractNo ( ) ) ;
}
if ( org . apache . commons . lang3 . StringUtils . isNotBlank ( query . getCustomerName ( ) ) ) {
if ( StringUtils . isNotBlank ( query . getCustomerName ( ) ) ) {
qw . like ( "customerName" , query . getCustomerName ( ) ) ;
}
if ( StringUtils . isNotBlank ( query . getName ( ) ) ) {
qw . and ( wrapper - > wrapper . like ( "contractNo" , query . getName ( ) ) . or ( ) . like ( "customerName" , query . getName ( ) ) ) ;
if ( StringUtils . isNotBlank ( query . getBillNo ( ) ) ) {
qw . like ( "billNo" , query . getBillNo ( ) ) ;
}
if ( StringUtils . isNotBlank ( query . getVinNo ( ) ) ) {
qw . like ( "vinNo " , query . getVinNo ( ) ) ;
}
if ( StringUtils . isNotBlank ( query . getCompleteValue ( ) ) ) {
qw . eq ( "completeStateValue " , query . getCompleteValue ( ) ) ;
}
qw . eq ( "useOrgSid" , query . getUseOrgSid ( ) ) ;
qw . eq ( "isDelete" , 0 ) ;
@ -250,45 +178,50 @@ public class BusVehicleDataHandoverService extends MybatisBaseService<BusVehicle
QueryWrapper < BusVehicleDataHandover > qw = createQueryWrapper ( query ) ;
IPage < BusVehicleDataHandover > page = PagerUtil . queryToPage ( pq ) ;
IPage < BusVehicleDataHandoverVo > pagging = baseMapper . selectPageVo ( page , qw ) ;
return rb . success ( ) . setData ( pagging ) ;
}
/ * *
* 打印交车资料确认单
*
* @param dto
* @return
* /
public ResultBean < String > createPdf ( BusVehicleDataHandoverDto dto ) {
ResultBean rb = ResultBean . fireFail ( ) ;
String filePath = "" ;
if ( StringUtils . isNotBlank ( dto . getSid ( ) ) ) {
BusVehicleDataHandoverDetailsVo data = fetchDetailsBySid ( dto . getSid ( ) ) . getData ( ) ;
if ( null ! = data ) {
filePath = commonCreatePdf ( data ) ;
}
} else {
String sid = this . saveOrUpdate ( dto ) . getData ( ) ;
BusVehicleDataHandoverDetailsVo data = this . fetchDetailsBySid ( sid ) . getData ( ) ;
if ( null ! = data ) {
filePath = commonCreatePdf ( data ) ;
List < BusVehicleDataHandoverVo > records = pagging . getRecords ( ) ;
records . removeAll ( Collections . singleton ( null ) ) ;
String path = "/template/" ;
if ( ! records . isEmpty ( ) ) {
for ( BusVehicleDataHandoverVo record : records ) {
if ( StringUtils . isNotBlank ( record . getDownloadPath ( ) ) ) {
record . setDownloadPath ( path + record . getDownloadPath ( ) ) ;
}
if ( StringUtils . isNotBlank ( record . getLinkSid ( ) ) ) {
List < BuscenterFile > fileList = buscenterFileService . selectByLinkSid ( record . getLinkSid ( ) , BuscenterFileEnum . ENTRUST_CONFIRM_IMAGES . getAttachType ( ) ) ;
fileList . removeAll ( Collections . singleton ( null ) ) ;
if ( ! fileList . isEmpty ( ) ) {
List < String > entrustImages = fileList . stream ( ) . map ( c - > fileUploadComponent . getUrlPrefix ( ) + c . getFilePath ( ) ) . collect ( Collectors . toList ( ) ) ;
record . setImgs ( entrustImages ) ;
}
} else {
List < BuscenterFile > fileList = buscenterFileService . selectByLinkSid ( record . getSid ( ) , BuscenterFileEnum . VEHICLE_SECOND_DATA_HANDOVER . getAttachType ( ) ) ;
fileList . removeAll ( Collections . singleton ( null ) ) ;
if ( ! fileList . isEmpty ( ) ) {
List < String > entrustImages = fileList . stream ( ) . map ( c - > fileUploadComponent . getUrlPrefix ( ) + c . getFilePath ( ) ) . collect ( Collectors . toList ( ) ) ;
record . setImgs ( entrustImages ) ;
}
}
}
}
return rb . success ( ) . setData ( filePath ) ;
return rb . success ( ) . setData ( pagging ) ;
}
public String commonCreatePdf ( BusVehicleDataHandoverDetailsVo pdfVo ) {
public String commonCreatePdf ( BusVehicleDataHandoverPdfVo pdfVo ) {
Map < String , Object > dataMap = new HashMap < String , Object > ( ) ;
List < BusVehicleHandoverDataDetailsVo > handoverDataList = pdfVo . getHandoverDataList ( ) ;
List < BusDataListPdfVo > pdfVos = pdfVo . getPdfVos ( ) ;
List < Map < String , Object > > newList = new ArrayList < > ( ) ;
SimpleDateFormat sdf = new SimpleDateFormat ( "yyyy-MM-dd" ) ;
dataMap . put ( "contractNo" , pdfVo . getContractNo ( ) ) ;
dataMap . put ( "customerName" , pdfVo . getCustomerName ( ) ) ;
if ( null ! = handoverDataList ) {
for ( BusVehicleHandoverDataDetailsVo detailsVo : handoverDataList ) {
dataMap . put ( "createTime" , sdf . format ( new Date ( ) ) ) ;
dataMap . put ( "documentNumber" , pdfVo . getBillNo ( ) ) ;
if ( ! pdfVos . isEmpty ( ) ) {
for ( BusDataListPdfVo detailsVo : pdfVos ) {
Map < String , Object > map = new HashMap < > ( ) ;
map . put ( "sNo" , detailsVo . getSNo ( ) ) ;
map . put ( "vinNo" , detailsVo . getVinNo ( ) ) ;
map . put ( "vehicleHandoverData" , detailsVo . getVehicleHandoverData ( ) ) ;
map . put ( "vehicleHandoverData" , detailsVo . getItems ( ) ) ;
newList . add ( map ) ;
}
}
@ -313,4 +246,269 @@ public class BusVehicleDataHandoverService extends MybatisBaseService<BusVehicle
return path ;
}
/ * *
* 新增推送
*
* @param dto
* @return
* /
public ResultBean < String > saveData ( BusVehicleDataHandoverDto dto ) {
ResultBean rb = ResultBean . fireFail ( ) ;
BusVehicleDataHandover entity = new BusVehicleDataHandover ( ) ;
BeanUtil . copyProperties ( dto , entity , "id" , "sid" ) ;
baseMapper . insert ( entity ) ;
return rb . success ( ) . setData ( entity . getSid ( ) ) ;
}
/ * *
* 交车资料确认详情
*
* @param
* @return
* /
public ResultBean < BusVehicleDataHandoverDetailsVo > getDeliveryInfo ( String sid ) {
ResultBean < BusVehicleDataHandoverDetailsVo > rb = ResultBean . fireFail ( ) ;
BusVehicleDataHandoverDetailsVo vo = new BusVehicleDataHandoverDetailsVo ( ) ;
// BusVehicleDataHandover entity = fetchBySid(sid);
// BeanUtil.copyProperties(entity, vo);
// List<BusVehicleSecondDataVo> secondDataVos = busVehicleSecondDataService.getRecordsByMainSid(sid).getData();
// secondDataVos.removeAll(Collections.singleton(null));
// if (!secondDataVos.isEmpty()) {
// vo.setItems(secondDataVos);
// }
return rb . success ( ) . setData ( vo ) ;
}
/ * *
* 生成交车资料确认单单据编号
*
* @param orgSid
* @return
* /
public String getApplyCode ( String orgSid ) {
//获取分公司sid
ResultBean < SysOrganizationVo > resultBean1 = sysOrganizationFeign . fetchBySid ( orgSid ) ;
String orgCode = resultBean1 . getData ( ) . getOrgCode ( ) ;
BillNo b = new BillNo ( ) ;
b . setOrgCode ( orgCode ) ;
b . setBillType ( BillTypeEnum . JCZLQRD . getBillType ( ) ) ;
String bill = Rule . getBill ( b ) ;
int i = baseMapper . selectNum ( bill ) ;
String billNo = Rule . getBillNo ( bill , i ) ;
return billNo ;
}
/ * *
* 保存交车资料确认
*
* @param dto
* @return
* /
public ResultBean < String > saveDeliveryInfo ( BusDeliveryInfoDto dto ) {
ResultBean < String > rb = ResultBean . fireFail ( ) ;
List < String > sids = dto . getSids ( ) ;
String model = "" ;
String contractNo = "" ;
String customerName = "" ;
for ( String sid : sids ) {
BusVehicleDataHandover entity = fetchBySid ( sid ) ;
entity . setCompleteStateKey ( "002" ) ;
entity . setCompleteStateValue ( "已完成" ) ;
model = entity . getModel ( ) ;
contractNo = entity . getContractNo ( ) ;
customerName = entity . getCustomerName ( ) ;
baseMapper . updateById ( entity ) ;
}
String userOrgSid = "" ;
String billNo = "" ;
String userOrgName = "" ;
String createName = "" ;
ResultBean < String > orgSidByPath = sysStaffOrgFeign . getOrgSidByPath ( dto . getOrgSidPath ( ) ) ;
if ( orgSidByPath . getSuccess ( ) ) {
userOrgSid = orgSidByPath . getData ( ) ;
//交车资料确认单编号
billNo = getApplyCode ( userOrgSid ) ;
ResultBean < SysOrganizationVo > organizationVo = sysOrganizationFeign . fetchBySid ( userOrgSid ) ;
if ( organizationVo . getSuccess ( ) ) {
SysOrganizationVo organizationVoData = organizationVo . getData ( ) ;
if ( null ! = organizationVoData ) {
userOrgName = organizationVoData . getName ( ) ;
}
}
}
ResultBean < SysUserVo > sysUserVoResultBean = sysUserFeign . fetchBySid ( dto . getUserSid ( ) ) ;
if ( sysUserVoResultBean . getSuccess ( ) ) {
SysUserVo data = sysUserVoResultBean . getData ( ) ;
if ( null ! = data ) {
createName = data . getName ( ) ;
}
}
List < BusVehicleDataListVo > vinList = dto . getVinList ( ) ;
List < String > newSids = new ArrayList < > ( ) ;
if ( ! vinList . isEmpty ( ) ) {
for ( BusVehicleDataListVo vinData : vinList ) {
BusVehicleDataHandover newEntity = new BusVehicleDataHandover ( ) ;
newSids . add ( newEntity . getSid ( ) ) ;
newEntity . setCreateBySid ( dto . getUserSid ( ) ) ;
newEntity . setRecDate ( dto . getRecDate ( ) ) ;
newEntity . setRecName ( dto . getRecName ( ) ) ;
newEntity . setUseOrgSid ( userOrgSid ) ;
newEntity . setBillNo ( billNo ) ;
newEntity . setUseOrgName ( userOrgName ) ;
newEntity . setVinNo ( vinData . getVinNo ( ) ) ;
newEntity . setVinSid ( vinData . getVinSid ( ) ) ;
newEntity . setContractNo ( dto . getContractNo ( ) ) ;
newEntity . setCustomerName ( dto . getCustomerName ( ) ) ;
newEntity . setModel ( model ) ;
newEntity . setItems ( vinData . getItems ( ) ) ;
newEntity . setCreateName ( createName ) ;
newEntity . setCompleteStateValue ( "已完成" ) ;
newEntity . setCompleteStateKey ( "002" ) ;
baseMapper . insert ( newEntity ) ;
}
}
BusVehicleDataHandoverPdfVo pdfVo = new BusVehicleDataHandoverPdfVo ( ) ;
List < BusDataListPdfVo > pdfVos = new ArrayList < > ( ) ;
pdfVo . setBillNo ( billNo ) ;
pdfVo . setContractNo ( contractNo ) ;
pdfVo . setCustomerName ( customerName ) ;
if ( ! vinList . isEmpty ( ) ) {
int sNo = 1 ;
for ( BusVehicleDataListVo dataVo : vinList ) {
BusDataListPdfVo dataPdfVo = new BusDataListPdfVo ( ) ;
dataPdfVo . setSNo ( String . valueOf ( sNo + + ) ) ;
dataPdfVo . setVinNo ( dataVo . getVinNo ( ) ) ;
dataPdfVo . setItems ( dataVo . getItems ( ) ) ;
pdfVos . add ( dataPdfVo ) ;
}
}
pdfVo . setPdfVos ( pdfVos ) ;
String s = commonCreatePdf ( pdfVo ) ;
String template = "/template/" ;
String filePath = s . substring ( docPdfComponent . getUploadTemplateUrl ( ) . length ( ) ) ;
if ( ! newSids . isEmpty ( ) ) {
for ( String newSid : newSids ) {
BusVehicleDataHandover handover = fetchBySid ( newSid ) ;
handover . setDownloadPath ( filePath ) ;
baseMapper . updateById ( handover ) ;
}
}
return rb . success ( ) . setData ( template + filePath ) ;
}
/ * *
* 上传确认单
*
* @param dto
* @return
* /
public ResultBean < String > uploadPdf ( BusUploadDto dto ) {
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 ( ) ) ;
}
return rb . success ( ) . setData ( dto . getSid ( ) ) ;
}
public ResultBean < List < String > > getImages ( String sid ) {
ResultBean rb = ResultBean . fireFail ( ) ;
List < BuscenterFile > fileList = buscenterFileService . selectByLinkSid ( sid , BuscenterFileEnum . VEHICLE_SECOND_DATA_HANDOVER . getAttachType ( ) ) ;
fileList . removeAll ( Collections . singleton ( null ) ) ;
if ( ! fileList . isEmpty ( ) ) {
List < String > imgs = fileList . stream ( ) . map ( c - > fileUploadComponent . getUrlPrefix ( ) + c . getFilePath ( ) ) .
collect ( Collectors . toList ( ) ) ;
return rb . success ( ) . setData ( imgs ) ;
}
return rb . success ( ) ;
}
/ * *
* 编辑初始化
*
* @param sids
* @return
* /
public ResultBean < BusVehicleDataHandoverDetailsVo > getDeliveryInfoBySids ( String [ ] sids ) {
ResultBean < BusVehicleDataHandoverDetailsVo > rb = ResultBean . fireFail ( ) ;
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 ) {
sidList . add ( sid ) ;
BusVehicleDataHandover entity = fetchBySid ( sid ) ;
vo . setContractNo ( entity . getContractNo ( ) ) ;
vo . setCustomerName ( entity . getCustomerName ( ) ) ;
String linkSid = entity . getLinkSid ( ) ;
List < BusHandoverItems > handoverItems = busHandoverItemsService . getItemsListByMainSid ( linkSid ) . getData ( ) ;
handoverItems . removeAll ( Collections . singleton ( null ) ) ;
BusVehicleDataListVo dataListVo = new BusVehicleDataListVo ( ) ;
if ( ! handoverItems . isEmpty ( ) ) {
for ( BusHandoverItems handoverItem : handoverItems ) {
int j = i + + ;
if ( handoverItem . getVinSid ( ) . equals ( entity . getVinSid ( ) ) ) {
String itemValue = handoverItem . getItemKey ( ) ;
if ( ! itemValue . contains ( "001" ) ) {
sb . append ( "发票" ) . append ( "、" ) ;
}
if ( ! itemValue . contains ( "002" ) ) {
sb . append ( "合格证" ) . append ( "、" ) ;
}
if ( ! itemValue . contains ( "003" ) ) {
sb . append ( "车钥匙" ) . append ( "、" ) ;
}
if ( ! itemValue . contains ( "004" ) ) {
sb . append ( "一致性证书" ) . append ( "、" ) ;
}
if ( ! itemValue . contains ( "005" ) ) {
sb . append ( "申请表" ) . append ( "、" ) ;
}
if ( ! itemValue . contains ( "006" ) ) {
sb . append ( "保修手册、说明书" ) . append ( "、" ) ;
}
if ( ! itemValue . contains ( "007" ) ) {
sb . append ( "环保清单" ) . append ( "、" ) ;
}
if ( ! itemValue . contains ( "008" ) ) {
sb . append ( "驾驶员卡" ) . append ( "、" ) ;
}
if ( ! itemValue . contains ( "009" ) ) {
if ( handoverItem . getIsFuelVehicle ( ) . equals ( "0" ) ) {
sb . append ( "气瓶检测合格证" ) . append ( "、" ) ;
}
}
}
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 ) ;
vo . setVinList ( vinList ) ;
vo . setSids ( sidList ) ;
}
return rb . success ( ) . setData ( vo ) ;
}
/ * *
* 详情
*
* @param sid
* @return
* /
public ResultBean < BusVehicleDataHandoverDetailsVo > details ( String sid ) {
ResultBean < BusVehicleDataHandoverDetailsVo > rb = ResultBean . fireFail ( ) ;
BusVehicleDataHandover handover = fetchBySid ( sid ) ;
BusVehicleDataHandoverDetailsVo vo = new BusVehicleDataHandoverDetailsVo ( ) ;
List < BusVehicleDataHandover > entityList = baseMapper . getDataByBillNo ( handover . getBillNo ( ) ) ;
return null ;
}
}