|
|
@ -19,6 +19,7 @@ import com.yxt.common.core.vo.PagerVo; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
@ -44,12 +45,14 @@ public class BusVehicleInformationHandoverService extends MybatisBaseService<Bus |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean<String> saveOrUpdate(BusVehicleInformationHandoverDto dto) { |
|
|
|
|
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
if (StringUtils.isNotBlank(dto.getSid())) { |
|
|
|
String sid = dto.getSid(); |
|
|
|
BusVehicleInformationHandover entity = fetchBySid(sid); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
//移交状态改为移交中
|
|
|
|
entity.setTransferStateKey("003"); |
|
|
|
entity.setTransferStateValue("移交中"); |
|
|
|
BusVehicleInformationDto informationDto = dto.getBusVehicleInformation(); |
|
|
|
//判断是不是一次交接还是二次
|
|
|
|
List<BusVehicleInformation> informations = busVehicleInformationService.getByHandoverSid(sid); |
|
|
@ -57,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", "recTime", "transferName", "remarks", "vehicleHandoverData"); |
|
|
|
BeanUtil.copyProperties(information, twiceInformation, "id", "sid", "recTime", "transferRemarks", "remarks", "vehicleHandoverData"); |
|
|
|
if (null != informationDto.getRecTime()) { |
|
|
|
twiceInformation.setRecTime(informationDto.getRecTime()); |
|
|
|
} |
|
|
@ -75,7 +78,7 @@ public class BusVehicleInformationHandoverService extends MybatisBaseService<Bus |
|
|
|
twiceInformation.setEnvironmentalList(1); |
|
|
|
twiceInformation.setDirverCard(1); |
|
|
|
twiceInformation.setHandoverNum("002"); |
|
|
|
twiceInformation.setRemarks(informationDto.getRemarks()); |
|
|
|
twiceInformation.setTransferRemarks(informationDto.getTransferRemarks()); |
|
|
|
twiceInformation.setVehicleHandoverData(informationDto.getVehicleHandoverData()); |
|
|
|
busVehicleInformationService.insert(twiceInformation); |
|
|
|
} |
|
|
@ -85,7 +88,11 @@ public class BusVehicleInformationHandoverService extends MybatisBaseService<Bus |
|
|
|
BusVehicleInformation newInformation = new BusVehicleInformation(); |
|
|
|
BeanUtil.copyProperties(informationDto, newInformation, "id", "sid"); |
|
|
|
newInformation.setHandoverNum("001"); |
|
|
|
//接收人
|
|
|
|
newInformation.setRecName(dto.getRecName()); |
|
|
|
//移交人
|
|
|
|
newInformation.setTransferName(informationDto.getTransferName()); |
|
|
|
newInformation.setTransferRemarks(informationDto.getTransferRemarks()); |
|
|
|
newInformation.setHandoverSid(sid); |
|
|
|
if (null != fetchBySid(sid).getIsFuelVehicle()) { |
|
|
|
newInformation.setIsFuelVehicle(fetchBySid(sid).getIsFuelVehicle()); |
|
|
@ -140,22 +147,22 @@ public class BusVehicleInformationHandoverService extends MybatisBaseService<Bus |
|
|
|
|| busVehicleInformation.getEnvironmentalList() < 1 |
|
|
|
|| busVehicleInformation.getDirverCard() < 1 |
|
|
|
) { |
|
|
|
entity.setHandoverState(1); |
|
|
|
entity.setCompleteState(0); |
|
|
|
} else { |
|
|
|
if (busVehicleInformation.getGasCertificate() < 1) { |
|
|
|
if (busVehicleInformation.getIsFuelVehicle() == 0) { |
|
|
|
entity.setHandoverState(2); |
|
|
|
entity.setCompleteState(1); |
|
|
|
} else { |
|
|
|
entity.setHandoverState(1); |
|
|
|
entity.setCompleteState(0); |
|
|
|
} |
|
|
|
} else { |
|
|
|
entity.setHandoverState(2); |
|
|
|
entity.setCompleteState(0); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if ("002".equals(busVehicleInformation.getHandoverNum())) { |
|
|
|
entity.setHandoverState(2); |
|
|
|
} |
|
|
|
// if ("002".equals(busVehicleInformation.getHandoverNum())) {
|
|
|
|
// entity.setCompleteState(1);
|
|
|
|
// }
|
|
|
|
} |
|
|
|
} |
|
|
|
baseMapper.updateById(entity); |
|
|
@ -175,6 +182,8 @@ public class BusVehicleInformationHandoverService extends MybatisBaseService<Bus |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
entity.setTransferStateKey("002"); |
|
|
|
entity.setTransferStateValue("待移交"); |
|
|
|
baseMapper.insert(entity); |
|
|
|
return rb.success().setData(entity.getSid()); |
|
|
|
} |
|
|
@ -376,58 +385,31 @@ public class BusVehicleInformationHandoverService extends MybatisBaseService<Bus |
|
|
|
* @param dto |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean<String> updateHandoverState(BusVehicleInformationHandoverDto dto) { |
|
|
|
public ResultBean<String> updateCompleteState(BusVehicleInformationHandoverDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
BusVehicleInformationHandover entity = fetchBySid(dto.getSid()); |
|
|
|
entity.setTransferStateKey("004"); |
|
|
|
entity.setTransferStateValue("已移交"); |
|
|
|
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 |
|
|
|
|| 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())) { |
|
|
|
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); |
|
|
|
if (entity.getCompleteState() == 0 && informationList.size() > 1) { |
|
|
|
entity.setCompleteState(1); |
|
|
|
} |
|
|
|
if (null != dto.getBusVehicleInformation()) { |
|
|
|
BusVehicleInformationDto informationDto = dto.getBusVehicleInformation(); |
|
|
|
if (informationList.size() > 0) { |
|
|
|
if (informationList.size() > 1) { |
|
|
|
BusVehicleInformation information = busVehicleInformationService.selectByHandoverNumAndHandoverSid("002", dto.getSid()); |
|
|
|
information.setRemarks(informationDto.getRemarks()); |
|
|
|
information.setRecTime(informationDto.getRecTime()); |
|
|
|
busVehicleInformationService.updateById(information); |
|
|
|
} else { |
|
|
|
BusVehicleInformation information = busVehicleInformationService.selectByHandoverNumAndHandoverSid("001", dto.getSid()); |
|
|
|
information.setRemarks(informationDto.getRemarks()); |
|
|
|
information.setRecTime(informationDto.getRecTime()); |
|
|
|
busVehicleInformationService.updateById(information); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
baseMapper.updateById(entity); |
|
|
|
return rb.success().setData(dto.getSid()); |
|
|
|