@ -5,14 +5,8 @@ import cn.hutool.core.bean.BeanUtil;
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.basevehicle.BaseVehicleVo ;
import com.yxt.anrui.base.api.basevehiclemodel.BaseVehicleModel ;
import com.yxt.anrui.base.api.basevehiclemodel.BaseVehicleModelFeign ;
import com.yxt.anrui.base.api.commonappendix.CommonAppendixVo ;
import com.yxt.anrui.buscenter.api.bussealapply.BusSealApply ;
import com.yxt.anrui.buscenter.api.bussealapply.BusSealApplyQuery ;
import com.yxt.anrui.buscenter.api.bussealapply.BusSealApplyVo ;
import com.yxt.anrui.buscenter.api.busvehicleinformation.BusVehicleInformation ;
import com.yxt.anrui.buscenter.api.busvehicleinformation.BusVehicleInformationDto ;
import com.yxt.anrui.buscenter.api.busvehicleinformation.BusVehicleInformationVo ;
@ -28,6 +22,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.stereotype.Service ;
import java.util.ArrayList ;
import java.util.Date ;
import java.util.List ;
@ -42,8 +37,6 @@ public class BusVehicleInformationHandoverService extends MybatisBaseService<Bus
@Autowired
private BusVehicleInformationService busVehicleInformationService ;
@Autowired
private BaseVehicleFeign baseVehicleFeign ;
@Autowired
private BaseVehicleModelFeign baseVehicleModelFeign ;
@ -67,7 +60,7 @@ public class BusVehicleInformationHandoverService extends MybatisBaseService<Bus
for ( BusVehicleInformation information : informations ) {
BusVehicleInformation twiceInformation = new BusVehicleInformation ( ) ;
if ( "001" . equals ( information . getHandoverNum ( ) ) ) {
BeanUtil . copyProperties ( information , twiceInformation , "id" , "sid" ) ;
BeanUtil . copyProperties ( information , twiceInformation , "id" , "sid" , "recTime" , "transferName" , "remarks" , "vehicleHandoverData" ) ;
if ( null ! = informationDto . getRecTime ( ) ) {
twiceInformation . setRecTime ( informationDto . getRecTime ( ) ) ;
}
@ -85,6 +78,8 @@ public class BusVehicleInformationHandoverService extends MybatisBaseService<Bus
twiceInformation . setEnvironmentalList ( 1 ) ;
twiceInformation . setDirverCard ( 1 ) ;
twiceInformation . setHandoverNum ( "002" ) ;
twiceInformation . setRemarks ( informationDto . getRemarks ( ) ) ;
twiceInformation . setVehicleHandoverData ( informationDto . getVehicleHandoverData ( ) ) ;
busVehicleInformationService . insert ( twiceInformation ) ;
}
}
@ -99,10 +94,72 @@ public class BusVehicleInformationHandoverService extends MybatisBaseService<Bus
newInformation . setIsFuelVehicle ( fetchBySid ( sid ) . getIsFuelVehicle ( ) ) ;
}
busVehicleInformationService . insert ( newInformation ) ;
BusVehicleInformation busVehicleInformation = busVehicleInformationService . fetchBySid ( newInformation . getSid ( ) ) ;
StringBuffer str = new StringBuffer ( ) ;
//车钥匙
if ( busVehicleInformation . getVehicleKeyNum ( ) > 0 ) {
Integer num = busVehicleInformation . getVehicleKeyNum ( ) ;
int value = num . intValue ( ) ;
str . append ( "车钥匙" + value + "把、" ) ;
}
//一致性证书
if ( busVehicleInformation . getCertificate ( ) > 0 ) {
str . append ( "一致性证书、" ) ;
}
//申请表
if ( busVehicleInformation . getApplyForm ( ) > 0 ) {
str . append ( "申请表、" ) ;
}
//保修手册、说明书
if ( busVehicleInformation . getManual ( ) > 0 ) {
str . append ( "保修手册、说明书、" ) ;
}
//环保清单
if ( busVehicleInformation . getEnvironmentalList ( ) > 0 ) {
str . append ( "环保清单、" ) ;
}
//驾驶员卡
if ( busVehicleInformation . getDirverCard ( ) > 0 ) {
str . append ( "驾驶员卡、" ) ;
}
if ( busVehicleInformation . getGasCertificate ( ) > 0 ) {
if ( busVehicleInformation . getIsFuelVehicle ( ) ! = 0 ) {
str . append ( "气瓶检测合格证、" ) ;
}
}
str . delete ( str . length ( ) - 1 , str . length ( ) ) ;
busVehicleInformation . setVehicleHandoverData ( str . toString ( ) ) ;
busVehicleInformationService . updateById ( busVehicleInformation ) ;
}
List < BusVehicleInformation > informationList = busVehicleInformationService . getByHandoverSid ( sid ) ;
if ( null ! = informationList ) {
entity . setHandoverState ( 1 ) ;
List < BusVehicleInformation > informationList = busVehicleInformationService . getByHandoverSid ( dto . getSid ( ) ) ;
if ( null ! = informationList & & informationList . size ( ) > 0 ) {
for ( BusVehicleInformation busVehicleInformation : informationList ) {
if ( "001" . equals ( busVehicleInformation . getHandoverNum ( ) ) ) {
if ( busVehicleInformation . getVehicleKeyNum ( ) < 1
| | busVehicleInformation . getCertificate ( ) < 1
| | busVehicleInformation . getApplyForm ( ) < 1
| | busVehicleInformation . getManual ( ) < 1
| | busVehicleInformation . getEnvironmentalList ( ) < 1
| | busVehicleInformation . getDirverCard ( ) < 1
) {
entity . setHandoverState ( 1 ) ;
} else {
if ( busVehicleInformation . getGasCertificate ( ) < 1 ) {
if ( busVehicleInformation . getIsFuelVehicle ( ) = = 0 ) {
entity . setHandoverState ( 2 ) ;
} else {
entity . setHandoverState ( 1 ) ;
}
} else {
entity . setHandoverState ( 2 ) ;
}
}
}
if ( "002" . equals ( busVehicleInformation . getHandoverNum ( ) ) ) {
entity . setHandoverState ( 2 ) ;
}
}
}
baseMapper . updateById ( entity ) ;
return rb . success ( ) . setData ( sid ) ;
@ -177,40 +234,111 @@ public class BusVehicleInformationHandoverService extends MybatisBaseService<Bus
* @param sid
* @return
* /
public ResultBean < BusVehicleInformationHandoverDetailsVo > fetchDetailsBySid ( String sid ) {
public ResultBean < BusVehicleInformationHandoverDetailsVo > fetchDetailsBySid ( String sid , String times ) {
ResultBean rb = ResultBean . fireFail ( ) ;
BusVehicleInformationHandover informationHandover = fetchBySid ( sid ) ;
BusVehicleInformationHandoverDetailsVo vo = new BusVehicleInformationHandoverDetailsVo ( ) ;
BeanUtil . copyProperties ( informationHandover , vo , "id" , "sid" ) ;
vo . setSid ( sid ) ;
String recName = "" ;
if ( StringUtils . isNotBlank ( vo . getRecName ( ) ) ) {
recName = vo . getRecName ( ) ;
}
List < BusVehicleInformation > busVehicleInformations = busVehicleInformationService . getByHandoverSid ( sid ) ;
if ( null ! = busVehicleInformations ) {
if ( null ! = busVehicleInformations & & busVehicleInformations . size ( ) > 0 ) {
for ( BusVehicleInformation informationServiceByHandoverSid : busVehicleInformations ) {
BusVehicleInformationVo informationVo = new BusVehicleInformationVo ( ) ;
BeanUtil . copyProperties ( informationServiceByHandoverSid , informationVo , "id" , "sid" ) ;
if ( null = = informationServiceByHandoverSid . getApplyForm ( ) ) {
informationVo . setApplyForm ( "" ) ;
}
if ( null = = informationServiceByHandoverSid . getCertificate ( ) ) {
informationVo . setCertificate ( "" ) ;
}
if ( null = = informationServiceByHandoverSid . getVehicleKeyNum ( ) ) {
informationVo . setVehicleKeyNum ( "" ) ;
}
if ( null = = informationServiceByHandoverSid . getManual ( ) ) {
informationVo . setManual ( "" ) ;
}
if ( null = = informationServiceByHandoverSid . getEnvironmentalList ( ) ) {
informationVo . setEnvironmentalList ( "" ) ;
}
if ( null = = informationServiceByHandoverSid . getDirverCard ( ) ) {
informationVo . setDirverCard ( "" ) ;
//第一次的记录编辑回显
if ( times . equals ( "1" ) & & informationServiceByHandoverSid . getHandoverNum ( ) . equals ( "001" ) ) {
BusVehicleInformationVo informationVo = new BusVehicleInformationVo ( ) ;
BeanUtil . copyProperties ( informationServiceByHandoverSid , informationVo , "id" , "sid" ) ;
if ( null = = informationServiceByHandoverSid . getApplyForm ( ) ) {
informationVo . setApplyForm ( "" ) ;
}
if ( null = = informationServiceByHandoverSid . getCertificate ( ) ) {
informationVo . setCertificate ( "" ) ;
}
if ( null = = informationServiceByHandoverSid . getVehicleKeyNum ( ) ) {
informationVo . setVehicleKeyNum ( "" ) ;
}
if ( null = = informationServiceByHandoverSid . getManual ( ) ) {
informationVo . setManual ( "" ) ;
}
if ( null = = informationServiceByHandoverSid . getEnvironmentalList ( ) ) {
informationVo . setEnvironmentalList ( "" ) ;
}
if ( null = = informationServiceByHandoverSid . getDirverCard ( ) ) {
informationVo . setDirverCard ( "" ) ;
}
if ( null = = informationServiceByHandoverSid . getGasCertificate ( ) ) {
informationVo . setGasCertificate ( "" ) ;
}
informationVo . setVehicleHandoverData ( informationServiceByHandoverSid . getVehicleHandoverData ( ) ) ;
informationVo . setInformationSid ( informationServiceByHandoverSid . getSid ( ) ) ;
informationVo . setRecName ( recName ) ;
vo . setBusVehicleInformation ( informationVo ) ;
}
if ( null = = informationServiceByHandoverSid . getGasCertificate ( ) ) {
informationVo . setGasCertificate ( "" ) ;
if ( times . equals ( "2" ) ) {
BusVehicleInformationVo informationVo = new BusVehicleInformationVo ( ) ;
BeanUtil . copyProperties ( informationServiceByHandoverSid , informationVo , "id" , "sid" ) ;
if ( null = = informationServiceByHandoverSid . getApplyForm ( ) ) {
informationVo . setApplyForm ( "" ) ;
}
if ( null = = informationServiceByHandoverSid . getCertificate ( ) ) {
informationVo . setCertificate ( "" ) ;
}
if ( null = = informationServiceByHandoverSid . getVehicleKeyNum ( ) ) {
informationVo . setVehicleKeyNum ( "" ) ;
}
if ( null = = informationServiceByHandoverSid . getManual ( ) ) {
informationVo . setManual ( "" ) ;
}
if ( null = = informationServiceByHandoverSid . getEnvironmentalList ( ) ) {
informationVo . setEnvironmentalList ( "" ) ;
}
if ( null = = informationServiceByHandoverSid . getDirverCard ( ) ) {
informationVo . setDirverCard ( "" ) ;
}
if ( null = = informationServiceByHandoverSid . getGasCertificate ( ) ) {
informationVo . setGasCertificate ( "" ) ;
}
String handoverNum = "001" ;
StringBuffer str = new StringBuffer ( ) ;
BusVehicleInformation infor = busVehicleInformationService . selectByHandoverNumAndHandoverSid ( handoverNum , sid ) ;
//车钥匙
if ( infor . getVehicleKeyNum ( ) < 1 ) {
str . append ( "车钥匙、" ) ;
}
//一致性证书
if ( infor . getCertificate ( ) < 1 ) {
str . append ( "一致性证书、" ) ;
}
//申请表
if ( infor . getApplyForm ( ) < 1 ) {
str . append ( "申请表、" ) ;
}
//保修手册、说明书
if ( infor . getManual ( ) < 1 ) {
str . append ( "保修手册、说明书、" ) ;
}
//环保清单
if ( infor . getEnvironmentalList ( ) < 1 ) {
str . append ( "环保清单、" ) ;
}
//驾驶员卡
if ( infor . getDirverCard ( ) < 1 ) {
str . append ( "驾驶员卡、" ) ;
}
if ( infor . getGasCertificate ( ) < 1 ) {
if ( infor . getIsFuelVehicle ( ) ! = 0 ) {
str . append ( "气瓶检测合格证、" ) ;
}
}
str . delete ( str . length ( ) - 1 , str . length ( ) ) ;
informationVo . setVehicleHandoverData ( str . toString ( ) ) ;
informationVo . setInformationSid ( informationServiceByHandoverSid . getSid ( ) ) ;
informationVo . setRecName ( recName ) ;
vo . setBusVehicleInformation ( informationVo ) ;
}
vo . setBusVehicleInformation ( informationVo ) ;
}
} else {
BusVehicleInformationVo informationVo = new BusVehicleInformationVo ( ) ;
@ -221,22 +349,24 @@ public class BusVehicleInformationHandoverService extends MybatisBaseService<Bus
informationVo . setEnvironmentalList ( "" ) ;
informationVo . setDirverCard ( "" ) ;
informationVo . setGasCertificate ( "" ) ;
informationVo . setRecName ( recName ) ;
vo . setBusVehicleInformation ( informationVo ) ;
}
return rb . success ( ) . setData ( vo ) ;
}
public void delAllBySids ( String [ ] sids ) {
// for (String sid : sids) {
// deleteBySid(sid);
// BusVehicleInformation vehicleInformation = busVehicleInformationService.getByHandoverSid(sid);
// if (null != vehicleInformation) {
// busVehicleInformationService.deleteBySid(vehicleInformation.getSid());
// }
// }
for ( String sid : sids ) {
deleteBySid ( sid ) ;
List < BusVehicleInformation > vehicleInformation = busVehicleInformationService . getByHandoverSid ( sid ) ;
if ( null ! = vehicleInformation & & vehicleInformation . size ( ) > 0 ) {
for ( BusVehicleInformation busVehicleInformation : vehicleInformation ) {
busVehicleInformationService . deleteBySid ( busVehicleInformation . getSid ( ) ) ;
}
}
}
}
public ResultBean < BusVehicleInformationHandover > selectByVehicleSid ( String vehicleSid ) {
ResultBean rb = ResultBean . fireFail ( ) ;
BusVehicleInformationHandover busVehicleInformationHandover = baseMapper . selectByVehicleSid ( vehicleSid ) ;
@ -253,9 +383,21 @@ public class BusVehicleInformationHandoverService extends MybatisBaseService<Bus
ResultBean rb = ResultBean . fireFail ( ) ;
BusVehicleInformationHandover entity = fetchBySid ( dto . getSid ( ) ) ;
List < BusVehicleInformation > informationList = busVehicleInformationService . getByHandoverSid ( dto . getSid ( ) ) ;
BusVehicleInformationDto informationDto = dto . getBusVehicleInformation ( ) ;
if ( null ! = informationList ) {
for ( BusVehicleInformation busVehicleInformation : informationList ) {
if ( "001" . equals ( busVehicleInformation . getHandoverNum ( ) ) ) {
if ( informationList . size ( ) < 2 ) {
if ( null ! = informationDto ) {
if ( null ! = informationDto . getRecTime ( ) ) {
busVehicleInformation . setRecTime ( informationDto . getRecTime ( ) ) ;
}
if ( StringUtils . isNotBlank ( informationDto . getTransferName ( ) ) ) {
busVehicleInformation . setTransferName ( informationDto . getTransferName ( ) ) ;
}
busVehicleInformationService . updateById ( busVehicleInformation ) ;
}
}
if ( busVehicleInformation . getVehicleKeyNum ( ) < 1
| | busVehicleInformation . getCertificate ( ) < 1
| | busVehicleInformation . getApplyForm ( ) < 1
@ -277,6 +419,15 @@ public class BusVehicleInformationHandoverService extends MybatisBaseService<Bus
}
}
if ( "002" . equals ( busVehicleInformation . getHandoverNum ( ) ) ) {
if ( null ! = informationDto ) {
if ( null ! = informationDto . getRecTime ( ) ) {
busVehicleInformation . setRecTime ( informationDto . getRecTime ( ) ) ;
}
if ( StringUtils . isNotBlank ( informationDto . getTransferName ( ) ) ) {
busVehicleInformation . setTransferName ( informationDto . getTransferName ( ) ) ;
}
busVehicleInformationService . updateById ( busVehicleInformation ) ;
}
entity . setHandoverState ( 2 ) ;
}
}
@ -284,4 +435,31 @@ public class BusVehicleInformationHandoverService extends MybatisBaseService<Bus
baseMapper . updateById ( entity ) ;
return rb . success ( ) . setData ( dto . getSid ( ) ) ;
}
/ * *
* 随车资料交接详情
*
* @param sid
* @return
* /
public ResultBean < BusVehicleInformationHandoverDetailsListVo > details ( String sid ) {
ResultBean rb = ResultBean . fireFail ( ) ;
BusVehicleInformationHandoverDetailsListVo vo = new BusVehicleInformationHandoverDetailsListVo ( ) ;
BusVehicleInformationHandover entity = fetchBySid ( sid ) ;
if ( null ! = entity ) {
BeanUtil . copyProperties ( entity , vo ) ;
}
List < BusVehicleInformationVo > voList = new ArrayList < > ( ) ;
List < BusVehicleInformation > informations = busVehicleInformationService . getByHandoverSid ( sid ) ;
if ( null ! = informations & & informations . size ( ) > 0 ) {
for ( BusVehicleInformation information : informations ) {
BusVehicleInformationVo informationVo = new BusVehicleInformationVo ( ) ;
BeanUtil . copyProperties ( information , informationVo ) ;
informationVo . setInformationSid ( information . getSid ( ) ) ;
voList . add ( informationVo ) ;
}
}
vo . setInformations ( voList ) ;
return rb . success ( ) . setData ( vo ) ;
}
}