| | |
| | | import com.java110.dto.log.AssetImportLogDto; |
| | | import com.java110.intf.common.IAssetImportLogDetailInnerServiceSMO; |
| | | import com.java110.intf.common.IAssetImportLogInnerServiceSMO; |
| | | import com.java110.po.log.AssetImportLogDetailPo; |
| | | import com.java110.po.log.AssetImportLogPo; |
| | | import com.java110.utils.factory.ApplicationContextFactory; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.ExceptionUtil; |
| | | import org.slf4j.Logger; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | String businessAdapt = importDataDto.getBusinessAdapt(); |
| | | |
| | | IImportDataAdapt importDataAdaptImpl = ApplicationContextFactory.getBean(businessAdapt+"QueueData", IImportDataAdapt.class); |
| | | IImportDataAdapt importDataAdaptImpl = ApplicationContextFactory.getBean(businessAdapt + "QueueData", IImportDataAdapt.class); |
| | | |
| | | if (importDataAdaptImpl == null) { |
| | | return; |
| | |
| | | try { |
| | | assetImportLogInnerServiceSMOImpl |
| | | = ApplicationContextFactory.getBean(IAssetImportLogInnerServiceSMO.class.getName(), IAssetImportLogInnerServiceSMO.class); |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | } |
| | | if(assetImportLogInnerServiceSMOImpl == null){ |
| | | if (assetImportLogInnerServiceSMOImpl == null) { |
| | | assetImportLogInnerServiceSMOImpl |
| | | = ApplicationContextFactory.getBean("assetImportLogInnerServiceSMOImpl",IAssetImportLogInnerServiceSMO.class); |
| | | = ApplicationContextFactory.getBean("assetImportLogInnerServiceSMOImpl", IAssetImportLogInnerServiceSMO.class); |
| | | } |
| | | Assert.hasLength(importDataDto.getLogId(), "未包含导入数据"); |
| | | Assert.hasLength(importDataDto.getCommunityId(), "未包含小区信息"); |
| | |
| | | throw new IllegalArgumentException("没有需要导入的房产数据" + importDataDto.getLogId()); |
| | | } |
| | | |
| | | //todo 修改为 导入中 |
| | | AssetImportLogPo assetImportLogPo = new AssetImportLogPo(); |
| | | assetImportLogPo.setLogId(importDataDto.getLogId()); |
| | | assetImportLogPo.setState(AssetImportLogDto.STATE_DOING_IMPORT); |
| | | assetImportLogInnerServiceSMOImpl.updateAssetImportLog(assetImportLogPo); |
| | | |
| | | // todo 查询detail数据 |
| | | try { |
| | | assetImportLogDetailInnerServiceSMOImpl |
| | | = ApplicationContextFactory.getBean(IAssetImportLogDetailInnerServiceSMO.class.getName(), IAssetImportLogDetailInnerServiceSMO.class); |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | } |
| | | if(assetImportLogDetailInnerServiceSMOImpl == null){ |
| | | if (assetImportLogDetailInnerServiceSMOImpl == null) { |
| | | assetImportLogDetailInnerServiceSMOImpl |
| | | = ApplicationContextFactory.getBean("assetImportLogDetailInnerServiceSMOImpl",IAssetImportLogDetailInnerServiceSMO.class); |
| | | = ApplicationContextFactory.getBean("assetImportLogDetailInnerServiceSMOImpl", IAssetImportLogDetailInnerServiceSMO.class); |
| | | } |
| | | |
| | | // todo 查询 房产 导入数据 |
| | |
| | | return; |
| | | } |
| | | |
| | | count = (int) Math.ceil((double) total / (double) MAX_ROW); |
| | | |
| | | for (int page = 1; page <= count; page++) { |
| | | assetImportLogDetailDto.setPage(page); |
| | | assetImportLogDetailDto.setRow(MAX_ROW); |
| | |
| | | |
| | | try { |
| | | importDataAdaptImpl.importData(assetImportLogDetailDtos); |
| | | } catch (Throwable e) { |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | updateImportLogDetailState(assetImportLogDetailDto.getDetailId(), e); |
| | | // throw new IllegalArgumentException(e); |
| | | } |
| | | } |
| | | |
| | | //todo 修改为 处理完成 |
| | | assetImportLogPo = new AssetImportLogPo(); |
| | | assetImportLogPo.setLogId(importDataDto.getLogId()); |
| | | assetImportLogPo.setState(AssetImportLogDto.STATE_COMPLETE_IMPORT); |
| | | assetImportLogPo.setRemark(""); |
| | | assetImportLogInnerServiceSMOImpl.updateAssetImportLog(assetImportLogPo); |
| | | } |
| | | |
| | | /** |
| | |
| | | log.debug("初始化导入队列完成"); |
| | | |
| | | } |
| | | |
| | | protected void updateImportLogDetailState(String detailId, Exception e) { |
| | | String state = AssetImportLogDetailDto.STATE_FAIL_IMPORT; |
| | | String message = ExceptionUtil.getStackTrace(e); |
| | | AssetImportLogDetailPo tmpAssetImportOwnerRoomPo = new AssetImportLogDetailPo(); |
| | | tmpAssetImportOwnerRoomPo.setDetailId(detailId); |
| | | tmpAssetImportOwnerRoomPo.setState(state); |
| | | tmpAssetImportOwnerRoomPo.setMessage(message); |
| | | assetImportLogDetailInnerServiceSMOImpl.updateAssetImportLogDetail(tmpAssetImportOwnerRoomPo); |
| | | } |
| | | } |