| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.base.smo.BaseServiceSMO; |
| | | import com.java110.dto.businessDatabus.BusinessDatabusDto; |
| | | import com.java110.dto.businessDatabus.CustomBusinessDatabusDto; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.dto.data.DatabusQueueDataDto; |
| | | import com.java110.dto.log.LogSystemErrorDto; |
| | | import com.java110.dto.system.BusinessDatabusDto; |
| | | import com.java110.dto.data.DatabusDataDto; |
| | | import com.java110.dto.machine.CarInoutDto; |
| | | import com.java110.dto.machine.MachineDto; |
| | | import com.java110.dto.tempCarFeeConfig.TempCarPayOrderDto; |
| | | import com.java110.entity.order.Business; |
| | | import com.java110.dto.fee.TempCarPayOrderDto; |
| | | import com.java110.dto.system.Business; |
| | | import com.java110.intf.job.IDataBusInnerServiceSMO; |
| | | import com.java110.job.adapt.IDatabusAdapt; |
| | | import com.java110.job.databus.DatabusDataQueue; |
| | | import com.java110.po.log.LogSystemErrorPo; |
| | | import com.java110.service.smo.ISaveSystemErrorSMO; |
| | | import com.java110.utils.cache.DatabusCache; |
| | | import com.java110.utils.factory.ApplicationContextFactory; |
| | | import com.java110.utils.util.ExceptionUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.slf4j.Logger; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | public static final String DEFAULT_NOTIFY_TEMP_CAR_FEE_ORDER_PROTOCOL = "notifyTempCarFeeOrderAdapt";//重新送数据 |
| | | public static final String DEFAULT_DEFAULT_SEND_MACHINE_RECORD = "defaultSendMachineRecordAdapt";//默认设备记录适配器 |
| | | |
| | | @Autowired |
| | | private ISaveSystemErrorSMO saveSystemErrorSMOImpl; |
| | | |
| | | @Override |
| | | public boolean exchange(@RequestBody List<Business> businesses) { |
| | |
| | | for (Business business : businesses) { |
| | | doExchange(business, businesses, databusDtos); |
| | | } |
| | | return false; |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | |
| | | return databusAdaptImpl.openDoor(reqJson); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public ResultVo closeDoor(@RequestBody JSONObject reqJson) { |
| | | IDatabusAdapt databusAdaptImpl = ApplicationContextFactory.getBean(DEFAULT_OPEN_DOOR_PROTOCOL, IDatabusAdapt.class); |
| | |
| | | IDatabusAdapt databusAdaptImpl = ApplicationContextFactory.getBean(DEFAULT_OPEN_DOOR_PROTOCOL, IDatabusAdapt.class); |
| | | return databusAdaptImpl.heartbeatVideo(reqJson); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | |
| | | /** |
| | | * 门禁开门记录 |
| | | * |
| | | * @param customBusinessDatabusDto |
| | | * @param databusDataDto |
| | | * @return |
| | | */ |
| | | @Override |
| | | public void customExchange(@RequestBody CustomBusinessDatabusDto customBusinessDatabusDto) { |
| | | IDatabusAdapt databusAdaptImpl = null; |
| | | public boolean databusData(@RequestBody DatabusDataDto databusDataDto) { |
| | | // IDatabusAdapt databusAdaptImpl = null; |
| | | List<BusinessDatabusDto> databusDtos = DatabusCache.getDatabuss(); |
| | | Business business = null; |
| | | List<Business> businesses = null; |
| | | for (BusinessDatabusDto databusDto : databusDtos) { |
| | | try { |
| | | if (customBusinessDatabusDto.getBusinessTypeCd().equals(databusDto.getBusinessTypeCd())) { |
| | | databusAdaptImpl = ApplicationContextFactory.getBean(databusDto.getBeanName(), IDatabusAdapt.class); |
| | | databusAdaptImpl.customExchange(customBusinessDatabusDto); |
| | | if (!databusDataDto.getBusinessTypeCd().equals(databusDto.getBusinessTypeCd())) { |
| | | continue; |
| | | } |
| | | businesses = new ArrayList<>(); |
| | | business = new Business(); |
| | | business.setData(databusDataDto.getData()); |
| | | business.setBusinessTypeCd(databusDataDto.getBusinessTypeCd()); |
| | | businesses.add(business); |
| | | //todo 存放队列中 |
| | | DatabusDataQueue.addMsg(new DatabusQueueDataDto(databusDto.getBeanName(), business, businesses)); |
| | | |
| | | // databusAdaptImpl = ApplicationContextFactory.getBean(databusDto.getBeanName(), IDatabusAdapt.class); |
| | | // databusAdaptImpl.customExchange(customBusinessDatabusDto); |
| | | } catch (Exception e) { |
| | | logger.error("执行databus失败", e); |
| | | } |
| | | } |
| | | |
| | | return true; |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | * @param databusDtos databus |
| | | */ |
| | | private void doExchange(Business business, List<Business> businesses, List<BusinessDatabusDto> databusDtos) { |
| | | IDatabusAdapt databusAdaptImpl = null; |
| | | // IDatabusAdapt databusAdaptImpl = null; |
| | | for (BusinessDatabusDto databusDto : databusDtos) { |
| | | try { |
| | | if (business.getBusinessTypeCd().equals(databusDto.getBusinessTypeCd())) { |
| | | databusAdaptImpl = ApplicationContextFactory.getBean(databusDto.getBeanName(), IDatabusAdapt.class); |
| | | databusAdaptImpl.execute(business, businesses); |
| | | if (!business.getBusinessTypeCd().equals(databusDto.getBusinessTypeCd())) { |
| | | continue; |
| | | } |
| | | //todo 存放队列中 |
| | | DatabusDataQueue.addMsg(new DatabusQueueDataDto(databusDto.getBeanName(), business, businesses)); |
| | | // databusAdaptImpl = ApplicationContextFactory.getBean(databusDto.getBeanName(), IDatabusAdapt.class); |
| | | // databusAdaptImpl.execute(business, businesses); |
| | | } catch (Exception e) { |
| | | logger.error("执行databus失败", e); |
| | | |
| | | LogSystemErrorPo logSystemErrorPo = new LogSystemErrorPo(); |
| | | logSystemErrorPo.setErrId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_errId)); |
| | | logSystemErrorPo.setErrType(LogSystemErrorDto.ERR_TYPE_NOTICE); |
| | | logSystemErrorPo.setMsg(ExceptionUtil.getStackTrace(e)); |
| | | saveSystemErrorSMOImpl.saveLog(logSystemErrorPo); |
| | | logger.error("通知异常", e); |
| | | } |
| | | } |
| | | } |