| | |
| | | package com.java110.job.importData.adapt; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.dto.log.AssetImportLogDetailDto; |
| | | import com.java110.intf.common.ICarInoutInnerServiceSMO; |
| | | import com.java110.intf.community.*; |
| | | import com.java110.job.importData.DefaultImportData; |
| | | import com.java110.job.importData.IImportDataAdapt; |
| | | import com.java110.po.car.CarInoutPo; |
| | | import com.java110.po.owner.VisitPo; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.utils.util.DateUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | * 前端请求 时 必须传入 |
| | | * param.append('importAdapt', "importRoomOwner"); |
| | | */ |
| | | @Service("ImportCarInoutQueueData") |
| | | @Service("importCarInoutQueueData") |
| | | public class ImportCarInoutQueueV2DataAdapt extends DefaultImportData implements IImportDataAdapt { |
| | | |
| | | @Autowired |
| | |
| | | try { |
| | | doImportData(assetImportLogDetailDto); |
| | | updateImportLogDetailState(assetImportLogDetailDto.getDetailId()); |
| | | try { |
| | | Thread.sleep(100); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | updateImportLogDetailState(assetImportLogDetailDto.getDetailId(), e); |
| | |
| | | * @param assetImportLogDetailDto |
| | | */ |
| | | private void doImportData(AssetImportLogDetailDto assetImportLogDetailDto) { |
| | | CarInoutPo carInoutPo = BeanConvertUtil.covertBean(JSONObject.parseObject(assetImportLogDetailDto.getContent()), CarInoutPo.class); |
| | | JSONObject jsonObj = JSONObject.parseObject(assetImportLogDetailDto.getContent()); |
| | | VisitPo visitPo = BeanConvertUtil.covertBean(jsonObj.get("visitPo"), VisitPo.class); |
| | | visitPo.setvId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_vId)); |
| | | visitPo.setState("0"); |
| | | jsonObj.remove("visitPo"); |
| | | CarInoutPo carInoutPo = BeanConvertUtil.covertBean(jsonObj, CarInoutPo.class); |
| | | carInoutPo.setVisitPo(visitPo); |
| | | carInoutPo.setbId("-1"); |
| | | carInoutPo.setVehicleType("temp"); |
| | | carInoutPo.setInoutId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_inoutId)); |
| | | carInoutPo.setCreateTime(DateUtil.getNow("yyyy-MM-dd HH:mm:ss")); |
| | | if (carInoutPo.getPaymentAmount() == null) { |
| | | carInoutPo.setState("100300"); |
| | | } else if (carInoutPo.getOutTime() == null) { |
| | | carInoutPo.setState("100400"); |
| | | } else { |
| | | carInoutPo.setState("100500"); |
| | | } |
| | | List<CarInoutPo> objects = new ArrayList<>(); |
| | | objects.add(carInoutPo); |
| | | int[] ints = carInoutInnerServiceSMOImpl.batchSaveCarInout(objects); |
| | | if (carInoutPo.getErrorTest()!= null) { |
| | | throw new IllegalArgumentException(carInoutPo.getErrorTest()); |
| | | } |
| | | if (ints == null || ints.length == 0) { |
| | | throw new IllegalArgumentException("添加临时停车费失败"); |
| | | } |
| | | if (carInoutPo.getCarNum() != null && !"".equals(carInoutPo.getCarNum())) { |
| | | try { |
| | | |
| | | visitInnerServiceSMOImpl.saveVisit(carInoutPo.getVisitPo()); |
| | | } catch (Exception e) { |
| | | throw new IllegalArgumentException("添加临时停车访客失败"); |