| 
						
						
						
					 | 
					 | 
					@ -1,29 +1,21 @@
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					package com.glxp.api.admin.thread;
 | 
					 | 
					 | 
					 | 
					package com.glxp.api.admin.thread;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.config.WebSocketServer;
 | 
					 | 
					 | 
					 | 
					import com.glxp.api.admin.config.WebSocketServer;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.constant.UdiInfoImportStatus;
 | 
					 | 
					 | 
					 | 
					import com.glxp.api.admin.constant.BasicProcessStatus;
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.entity.basic.BasicThirdSysDetailEntity;
 | 
					 | 
					 | 
					 | 
					import com.glxp.api.admin.entity.basic.BasicThirdSysDetailEntity;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.entity.inout.ErpOrderEntity;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.entity.thrsys.*;
 | 
					 | 
					 | 
					 | 
					import com.glxp.api.admin.entity.thrsys.*;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.httpclient.ErpBasicClient;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.httpclient.ErpInvClient;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.httpclient.ErpOrderClient;
 | 
					 | 
					 | 
					 | 
					import com.glxp.api.admin.httpclient.ErpOrderClient;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.req.basic.BasicUnitMaintainFilterRequest;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.req.inout.FilterOrderRequest;
 | 
					 | 
					 | 
					 | 
					import com.glxp.api.admin.req.inout.FilterOrderRequest;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.req.inventory.ErpOnhandRequest;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.req.thrsys.FilterThrInvProductsRequest;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.req.thrsys.FilterThrOrderDetailRequest;
 | 
					 | 
					 | 
					 | 
					import com.glxp.api.admin.req.thrsys.FilterThrOrderDetailRequest;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.req.thrsys.FilterThrOrderRequest;
 | 
					 | 
					 | 
					 | 
					import com.glxp.api.admin.req.thrsys.FilterThrOrderRequest;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.glxp.api.admin.req.thrsys.PostThrOrderRequest;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.req.thrsys.ThrOrderExportRequest;
 | 
					 | 
					 | 
					 | 
					import com.glxp.api.admin.req.thrsys.ThrOrderExportRequest;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.res.PageSimpleResponse;
 | 
					 | 
					 | 
					 | 
					import com.glxp.api.admin.res.PageSimpleResponse;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.res.basic.ErpUnitsResponse;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.res.inout.ErpOrderResponse;
 | 
					 | 
					 | 
					 | 
					import com.glxp.api.admin.res.inout.ErpOrderResponse;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.res.inventory.ErpInvProductResponse;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.service.basic.BasicThirdSysDetailService;
 | 
					 | 
					 | 
					 | 
					import com.glxp.api.admin.service.basic.BasicThirdSysDetailService;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.service.basic.BussinessTypeService;
 | 
					 | 
					 | 
					 | 
					import com.glxp.api.admin.service.basic.BussinessTypeService;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.service.thrsys.*;
 | 
					 | 
					 | 
					 | 
					import com.glxp.api.admin.service.thrsys.*;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.util.Constant;
 | 
					 | 
					 | 
					 | 
					import com.glxp.api.admin.util.Constant;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.util.CustomUtil;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.util.ExcelUtil;
 | 
					 | 
					 | 
					 | 
					import com.glxp.api.admin.util.ExcelUtil;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.admin.util.RedisUtil;
 | 
					 | 
					 | 
					 | 
					import com.glxp.api.admin.util.RedisUtil;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.glxp.api.common.res.BaseResponse;
 | 
					 | 
					 | 
					 | 
					import com.glxp.api.common.res.BaseResponse;
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -33,9 +25,7 @@ import org.springframework.stereotype.Service;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import javax.annotation.Resource;
 | 
					 | 
					 | 
					 | 
					import javax.annotation.Resource;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.util.ArrayList;
 | 
					 | 
					 | 
					 | 
					import java.util.ArrayList;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.util.Date;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.util.List;
 | 
					 | 
					 | 
					 | 
					import java.util.List;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.util.stream.Collectors;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					@Service
 | 
					 | 
					 | 
					 | 
					@Service
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					public class ThrOrdersDlService {
 | 
					 | 
					 | 
					 | 
					public class ThrOrdersDlService {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -73,7 +63,7 @@ public class ThrOrdersDlService {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        redisUtil.set(Constant.dlThrProducts, "false");
 | 
					 | 
					 | 
					 | 
					        redisUtil.set(Constant.dlThrProducts, "false");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        WebSocketServer.sendInfo("业务单据信息下载已完成,请刷新查看!", "sid");
 | 
					 | 
					 | 
					 | 
					        WebSocketServer.sendInfo("业务单据信息下载已完成,请刷新查看!", "sid");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					//        thrOrderImportLogEntity.setStatus(UdiInfoImportStatus.UDIINFO_IMPORT_SUCCESS);
 | 
					 | 
					 | 
					 | 
					//        thrOrderImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					//        thrOrderImportLogService.updateImportLog(thrOrderImportLogEntity);
 | 
					 | 
					 | 
					 | 
					//        thrOrderImportLogService.updateImportLog(thrOrderImportLogEntity);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -126,13 +116,13 @@ public class ThrOrdersDlService {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailService.selectByKey("orderQueryUrl", thrOrderExportRequest.getThirdSysFk());
 | 
					 | 
					 | 
					 | 
					            BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailService.selectByKey("orderQueryUrl", thrOrderExportRequest.getThirdSysFk());
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (basicThirdSysDetailEntity == null || basicThirdSysDetailEntity.getValue() == null) {
 | 
					 | 
					 | 
					 | 
					            if (basicThirdSysDetailEntity == null || basicThirdSysDetailEntity.getValue() == null) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                thrOrderExportLogEntity.setStatus(UdiInfoImportStatus.UDIINFO_IMPORT_FAIL);
 | 
					 | 
					 | 
					 | 
					                thrOrderExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                thrOrderExportLogEntity.setRemark("往来单位接口地址未定义");
 | 
					 | 
					 | 
					 | 
					                thrOrderExportLogEntity.setRemark("往来单位接口地址未定义");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                thrOrderExportLogService.updateThrOrderExportLog(thrOrderExportLogEntity);
 | 
					 | 
					 | 
					 | 
					                thrOrderExportLogService.updateThrOrderExportLog(thrOrderExportLogEntity);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                return;
 | 
					 | 
					 | 
					 | 
					                return;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (!basicThirdSysDetailEntity.getEnabled() ) {
 | 
					 | 
					 | 
					 | 
					            if (!basicThirdSysDetailEntity.getEnabled()) {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                thrOrderExportLogEntity.setStatus(UdiInfoImportStatus.UDIINFO_IMPORT_FAIL);
 | 
					 | 
					 | 
					 | 
					                thrOrderExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                thrOrderExportLogEntity.setRemark("第三方往来单位服务未启用");
 | 
					 | 
					 | 
					 | 
					                thrOrderExportLogEntity.setRemark("第三方往来单位服务未启用");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                thrOrderExportLogService.updateThrOrderExportLog(thrOrderExportLogEntity);
 | 
					 | 
					 | 
					 | 
					                thrOrderExportLogService.updateThrOrderExportLog(thrOrderExportLogEntity);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                return;
 | 
					 | 
					 | 
					 | 
					                return;
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -155,10 +145,73 @@ public class ThrOrdersDlService {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        String sheetName = "业务单据";
 | 
					 | 
					 | 
					 | 
					        String sheetName = "业务单据";
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        new ExcelUtil().exportExcel(excelData, sheetName, thrOrderExportLogEntity.getFilePath(), 20);
 | 
					 | 
					 | 
					 | 
					        new ExcelUtil().exportExcel(excelData, sheetName, thrOrderExportLogEntity.getFilePath(), 20);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        thrOrderExportLogEntity.setStatus(UdiInfoImportStatus.UDIINFO_IMPORT_SUCCESS);
 | 
					 | 
					 | 
					 | 
					        thrOrderExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        thrOrderExportLogService.updateThrOrderExportLog(thrOrderExportLogEntity);
 | 
					 | 
					 | 
					 | 
					        thrOrderExportLogService.updateThrOrderExportLog(thrOrderExportLogEntity);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Async
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    public void uploadSmp(String genKey, ThrOrderExportRequest thrOrderExportRequest) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        ThrOrderExportLogEntity thrOrderExportLogEntity = thrOrderExportLogService.selectByGenKey(genKey);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        PostThrOrderRequest postThrOrderRequest = new PostThrOrderRequest();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        //选中导出
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (thrOrderExportRequest.getErpOrderResponses() != null && thrOrderExportRequest.getErpOrderResponses().size() > 0) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            List<ErpOrderResponse> erpOrderResponses = thrOrderExportRequest.getErpOrderResponses();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            postThrOrderRequest.setDatas(erpOrderResponses);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        } else {//一键导出
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            List<ErpOrderResponse> erpOrderResponses =new ArrayList<>();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailService.selectByKey("orderQueryUrl", thrOrderExportRequest.getThirdSysFk());
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (basicThirdSysDetailEntity == null || basicThirdSysDetailEntity.getValue() == null) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                thrOrderExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                thrOrderExportLogEntity.setRemark("往来单位接口地址未定义");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                thrOrderExportLogService.updateThrOrderExportLog(thrOrderExportLogEntity);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                return;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (!basicThirdSysDetailEntity.getEnabled()) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                thrOrderExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                thrOrderExportLogEntity.setRemark("第三方往来单位服务未启用");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                thrOrderExportLogService.updateThrOrderExportLog(thrOrderExportLogEntity);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                return;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (basicThirdSysDetailEntity.getFromType() == 0 && !basicThirdSysDetailEntity.getItrCache()) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                FilterThrOrderRequest filterThrOrderRequest = new FilterThrOrderRequest();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                BeanUtils.copyProperties(thrOrderExportRequest, filterThrOrderRequest);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                List<ErpOrderResponse> datas = getThrOrders(filterThrOrderRequest);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                erpOrderResponses.addAll(datas);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            } else {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                FilterThrOrderRequest filterThrOrderRequest = new FilterThrOrderRequest();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                BeanUtils.copyProperties(thrOrderExportRequest, filterThrOrderRequest);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                List<List<String>> excelData = new ArrayList<>();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                List<ThrOrderEntity> thrOrderEntities = thrOrderService.filterThrOrder(filterThrOrderRequest);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                for (ThrOrderEntity thrOrderEntity : thrOrderEntities) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    ErpOrderResponse erpOrderResponse = new ErpOrderResponse();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    BeanUtils.copyProperties(thrOrderEntity,erpOrderResponse);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    FilterThrOrderDetailRequest filterThrOrderDetailRequest = new FilterThrOrderDetailRequest();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    filterThrOrderDetailRequest.setOrderIdFk(thrOrderEntity.getId() + "");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    List<ThrOrderDetailEntity> thrOrderDetailEntities = thrOrderDetailService.filterThrOrderDetailDetail(filterThrOrderDetailRequest);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    if (thrOrderDetailEntities != null) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        List<ErpOrderResponse.SubErpOrder > subErpOrders = new ArrayList<>();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        for (ThrOrderDetailEntity thrOrderDetailEntity : thrOrderDetailEntities) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                            ErpOrderResponse.SubErpOrder subErpOrder = new ErpOrderResponse.SubErpOrder();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                            BeanUtils.copyProperties(thrOrderDetailEntity,subErpOrder);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                            subErpOrders.add(subErpOrder);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        erpOrderResponse.setSubErpOrders(subErpOrders);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    erpOrderResponses.add(erpOrderResponse);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        //toDo 上傳SMP
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        postThrOrderRequest.setGenKey(genKey);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        postThrOrderRequest.setThirdSys(thrOrderExportRequest.getThirdSysFk());
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        thrOrderExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        thrOrderExportLogService.updateThrOrderExportLog(thrOrderExportLogEntity);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public int getOrders(int page, int limit, String orderUrl, String thirdSys, ThrOrderImportLogEntity thrOrderImportLogEntity, String action) {
 | 
					 | 
					 | 
					 | 
					    public int getOrders(int page, int limit, String orderUrl, String thirdSys, ThrOrderImportLogEntity thrOrderImportLogEntity, String action) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        FilterOrderRequest filterOrderRequest = new FilterOrderRequest();
 | 
					 | 
					 | 
					 | 
					        FilterOrderRequest filterOrderRequest = new FilterOrderRequest();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        filterOrderRequest.setPage(page);
 | 
					 | 
					 | 
					 | 
					        filterOrderRequest.setPage(page);
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -189,7 +242,7 @@ public class ThrOrdersDlService {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                }
 | 
					 | 
					 | 
					 | 
					                }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } else {
 | 
					 | 
					 | 
					 | 
					        } else {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            thrOrderImportLogEntity.setStatus(UdiInfoImportStatus.UDIINFO_IMPORT_FAIL);
 | 
					 | 
					 | 
					 | 
					            thrOrderImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (responseBaseResponse != null) {
 | 
					 | 
					 | 
					 | 
					            if (responseBaseResponse != null) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                thrOrderImportLogEntity.setRemark(responseBaseResponse.getMessage());
 | 
					 | 
					 | 
					 | 
					                thrOrderImportLogEntity.setRemark(responseBaseResponse.getMessage());
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } else {
 | 
					 | 
					 | 
					 | 
					            } else {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -198,7 +251,7 @@ public class ThrOrdersDlService {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            thrOrderImportLogService.updateImportLog(thrOrderImportLogEntity);
 | 
					 | 
					 | 
					 | 
					            thrOrderImportLogService.updateImportLog(thrOrderImportLogEntity);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return -1;
 | 
					 | 
					 | 
					 | 
					            return -1;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        thrOrderImportLogEntity.setStatus(UdiInfoImportStatus.UDIINFO_IMPORT_SUCCESS);
 | 
					 | 
					 | 
					 | 
					        thrOrderImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        thrOrderImportLogService.updateImportLog(thrOrderImportLogEntity);
 | 
					 | 
					 | 
					 | 
					        thrOrderImportLogService.updateImportLog(thrOrderImportLogEntity);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        return -1;
 | 
					 | 
					 | 
					 | 
					        return -1;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -243,6 +296,26 @@ public class ThrOrdersDlService {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        return excelData;
 | 
					 | 
					 | 
					 | 
					        return excelData;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    public List<ErpOrderResponse> getThrOrders(FilterThrOrderRequest filterThrOrderRequest) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailService.selectByKey("orderQueryUrl", filterThrOrderRequest.getThirdSysFk());
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        int page = 1;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        int limit = 100;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<ErpOrderResponse> erpOrderResponseList = new ArrayList<>();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        while (true) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            List<ErpOrderResponse> datas = getThrOrders(page, limit, basicThirdSysDetailEntity.getValue(), filterThrOrderRequest);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (datas != null && datas.size() >= limit) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                erpOrderResponseList.addAll(datas);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                page++;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            } else {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                if (datas != null) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    erpOrderResponseList.addAll(datas);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                break;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        return erpOrderResponseList;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public List<ErpOrderResponse> getThrOrders(int page, int limit, String orderQueryUrl, FilterThrOrderRequest filterThrOrderRequest) {
 | 
					 | 
					 | 
					 | 
					    public List<ErpOrderResponse> getThrOrders(int page, int limit, String orderQueryUrl, FilterThrOrderRequest filterThrOrderRequest) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        FilterOrderRequest filterOrderRequest = new FilterOrderRequest();
 | 
					 | 
					 | 
					 | 
					        FilterOrderRequest filterOrderRequest = new FilterOrderRequest();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        BeanUtils.copyProperties(filterThrOrderRequest, filterOrderRequest);
 | 
					 | 
					 | 
					 | 
					        BeanUtils.copyProperties(filterThrOrderRequest, filterOrderRequest);
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |