|  |  |  | @ -16,6 +16,7 @@ import com.glxp.api.dao.thrsys.ThrInvOrderDetailMapper; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.dao.thrsys.ThrInvOrderMapper; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.basic.BasicProductsEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.basic.BasicSkProjectDetailEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.basic.UdiEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.inout.IoOrderDetailBizEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.inout.IoOrderEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.system.SystemParamConfigEntity; | 
			
		
	
	
		
			
				
					|  |  |  | @ -42,6 +43,7 @@ import com.glxp.api.service.system.SystemParamConfigService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.thrsys.ThrInvOrderService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.util.GennerOrderUtils; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.util.OrderNoTypeBean; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.util.udi.FilterUdiUtils; | 
			
		
	
		
			
				
					|  |  |  |  | import lombok.extern.slf4j.Slf4j; | 
			
		
	
		
			
				
					|  |  |  |  | import org.springframework.beans.BeanUtils; | 
			
		
	
		
			
				
					|  |  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
	
		
			
				
					|  |  |  | @ -89,8 +91,8 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { | 
			
		
	
		
			
				
					|  |  |  |  |     SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |  |     public void handleExternalThrInvOrderSf(FilterInvProductRequest filterInvProductRequest) { | 
			
		
	
		
			
				
					|  |  |  |  |         BaseResponse<PageSimpleResponse<ThrInvResultResponse>> baseResponse = erpInvClient.getInvResultSf(filterInvProductRequest); | 
			
		
	
		
			
				
					|  |  |  |  |     public void handleExternalThrInvSfOrder(FilterInvProductRequest filterInvProductRequest) { | 
			
		
	
		
			
				
					|  |  |  |  |         BaseResponse<PageSimpleResponse<ThrInvResultResponse>> baseResponse = erpInvClient.getInvSfResult(filterInvProductRequest); | 
			
		
	
		
			
				
					|  |  |  |  |         if (baseResponse.getCode() == 20000) { | 
			
		
	
		
			
				
					|  |  |  |  |             List<ThrInvResultResponse> list = baseResponse.getData().getList(); | 
			
		
	
		
			
				
					|  |  |  |  |             if (CollectionUtil.isNotEmpty(list)) { | 
			
		
	
	
		
			
				
					|  |  |  | @ -114,8 +116,8 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |  |     public void handleExternalThrInvOrderPh(FilterInvProductRequest filterInvProductRequest) { | 
			
		
	
		
			
				
					|  |  |  |  |         BaseResponse<PageSimpleResponse<ThrInvResultResponse>> baseResponse = erpInvClient.getInvResultPh(filterInvProductRequest); | 
			
		
	
		
			
				
					|  |  |  |  |     public void handleExternalThrInvPhOrder(FilterInvProductRequest filterInvProductRequest) { | 
			
		
	
		
			
				
					|  |  |  |  |         BaseResponse<PageSimpleResponse<ThrInvResultResponse>> baseResponse = erpInvClient.getInvPhResult(filterInvProductRequest); | 
			
		
	
		
			
				
					|  |  |  |  |         if (baseResponse.getCode() == 20000) { | 
			
		
	
		
			
				
					|  |  |  |  |             List<ThrInvResultResponse> list = baseResponse.getData().getList(); | 
			
		
	
		
			
				
					|  |  |  |  |             if (CollectionUtil.isNotEmpty(list)) { | 
			
		
	
	
		
			
				
					|  |  |  | @ -138,7 +140,61 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |  |     public void downloadInvOrder(ThrSystemDetailEntity thrSystemDetailEntity) { | 
			
		
	
		
			
				
					|  |  |  |  |     public void handleExternalThrInvGhOrder(FilterInvProductRequest filterInvProductRequest) { | 
			
		
	
		
			
				
					|  |  |  |  |         BaseResponse<PageSimpleResponse<ThrInvResultResponse>> baseResponse = erpInvClient.getInvGhResult(filterInvProductRequest); | 
			
		
	
		
			
				
					|  |  |  |  |         if (baseResponse.getCode() == 20000) { | 
			
		
	
		
			
				
					|  |  |  |  |             List<ThrInvResultResponse> list = baseResponse.getData().getList(); | 
			
		
	
		
			
				
					|  |  |  |  |             if (CollectionUtil.isNotEmpty(list)) { | 
			
		
	
		
			
				
					|  |  |  |  |                 String billNo = generateBillNo(filterInvProductRequest);//单据号
 | 
			
		
	
		
			
				
					|  |  |  |  |                 //处理 返回实体 转换成 单据 和 单据明细
 | 
			
		
	
		
			
				
					|  |  |  |  |                 ThrInvOrder thrInvOrder = new ThrInvOrder(); | 
			
		
	
		
			
				
					|  |  |  |  |                 List<ThrInvOrderDetail> thrInvOrderDetails = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |  |                 String thirdSys = filterInvProductRequest.getThirdSys(); | 
			
		
	
		
			
				
					|  |  |  |  |                 handleExternalConvertThrInvGhOrderDetail(list, thrInvOrderDetails, billNo, thirdSys,thrInvOrder); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 if (CollectionUtil.isNotEmpty(thrInvOrderDetails)) { | 
			
		
	
		
			
				
					|  |  |  |  |                     handleExternalConvertThrInvOrder(billNo, filterInvProductRequest, thrInvOrder, list.get(0),Constant.THR_INV_PH_ORDER_TYPE); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                     //保存数据
 | 
			
		
	
		
			
				
					|  |  |  |  |                     thrInvOrderMapper.insert(thrInvOrder); | 
			
		
	
		
			
				
					|  |  |  |  |                     thrInvOrderDetailMapper.insertBatch(thrInvOrderDetails); | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |  |      * 处理高耗 | 
			
		
	
		
			
				
					|  |  |  |  |      * @param list | 
			
		
	
		
			
				
					|  |  |  |  |      * @param thrInvOrderDetails | 
			
		
	
		
			
				
					|  |  |  |  |      * @param billNo | 
			
		
	
		
			
				
					|  |  |  |  |      * @param thirdSys | 
			
		
	
		
			
				
					|  |  |  |  |      * @param thrInvOrder | 
			
		
	
		
			
				
					|  |  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |  |     private void handleExternalConvertThrInvGhOrderDetail(List<ThrInvResultResponse> list, List<ThrInvOrderDetail> thrInvOrderDetails, String billNo, String thirdSys, ThrInvOrder thrInvOrder) { | 
			
		
	
		
			
				
					|  |  |  |  |         list.forEach( item -> { | 
			
		
	
		
			
				
					|  |  |  |  |             String udiCode = item.getUdiCode(); | 
			
		
	
		
			
				
					|  |  |  |  |             UdiEntity udi = FilterUdiUtils.getUdi(udiCode); | 
			
		
	
		
			
				
					|  |  |  |  |             /** | 
			
		
	
		
			
				
					|  |  |  |  |              * udi 的 产品编号 获取产品信息 包装 | 
			
		
	
		
			
				
					|  |  |  |  |              *  | 
			
		
	
		
			
				
					|  |  |  |  |              */ | 
			
		
	
		
			
				
					|  |  |  |  |             // TODO: 2024/3/4  
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             ThrInvOrderDetail thrInvOrderDetail = new ThrInvOrderDetail(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         }); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |  |     public void downloadInvSfOrder(ThrSystemDetailEntity thrSystemDetailEntity) { | 
			
		
	
		
			
				
					|  |  |  |  |         log.info("自动抓取第三方收费出入库明细生成单据定时任务开始"); | 
			
		
	
		
			
				
					|  |  |  |  |         FilterInvProductRequest filterInvProductRequest = new FilterInvProductRequest(); | 
			
		
	
		
			
				
					|  |  |  |  |         filterInvProductRequest.setThirdSys(thrSystemDetailEntity.getThirdSysFk()); | 
			
		
	
	
		
			
				
					|  |  |  | @ -147,11 +203,42 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         filterInvProductRequest.setStartDate(stringToDate(days + " 00:00:00")); | 
			
		
	
		
			
				
					|  |  |  |  |         filterInvProductRequest.setEndDate(stringToDate(days + " 23:59:59")); | 
			
		
	
		
			
				
					|  |  |  |  |         handleExternalThrInvOrderSf(filterInvProductRequest); | 
			
		
	
		
			
				
					|  |  |  |  |         handleExternalThrInvSfOrder(filterInvProductRequest); | 
			
		
	
		
			
				
					|  |  |  |  |         log.info("自动抓取第三方收费出入库明细生成单据定时任务结束"); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |  |     public void downloadInvPhOrder(ThrSystemDetailEntity thrSystemDetailEntity) { | 
			
		
	
		
			
				
					|  |  |  |  |         log.info("自动抓取第三方普耗出入库明细生成单据定时任务开始"); | 
			
		
	
		
			
				
					|  |  |  |  |         FilterInvProductRequest filterInvProductRequest = new FilterInvProductRequest(); | 
			
		
	
		
			
				
					|  |  |  |  |         filterInvProductRequest.setThirdSys(thrSystemDetailEntity.getThirdSysFk()); | 
			
		
	
		
			
				
					|  |  |  |  |         filterInvProductRequest.setThirdSysUrlValue(thrSystemDetailEntity.getValue()); | 
			
		
	
		
			
				
					|  |  |  |  |         String days = getBeginAndEndDateByDays(1); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         filterInvProductRequest.setStartDate(stringToDate(days + " 00:00:00")); | 
			
		
	
		
			
				
					|  |  |  |  |         filterInvProductRequest.setEndDate(stringToDate(days + " 23:59:59")); | 
			
		
	
		
			
				
					|  |  |  |  |         handleExternalThrInvPhOrder(filterInvProductRequest); | 
			
		
	
		
			
				
					|  |  |  |  |         log.info("自动抓取第三方普耗出入库明细生成单据定时任务结束"); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |  |     public void downloadInvGhOrder(ThrSystemDetailEntity thrSystemDetailEntity) { | 
			
		
	
		
			
				
					|  |  |  |  |         log.info("自动抓取第三方高耗出入库明细生成单据定时任务开始"); | 
			
		
	
		
			
				
					|  |  |  |  |         FilterInvProductRequest filterInvProductRequest = new FilterInvProductRequest(); | 
			
		
	
		
			
				
					|  |  |  |  |         filterInvProductRequest.setThirdSys(thrSystemDetailEntity.getThirdSysFk()); | 
			
		
	
		
			
				
					|  |  |  |  |         filterInvProductRequest.setThirdSysUrlValue(thrSystemDetailEntity.getValue()); | 
			
		
	
		
			
				
					|  |  |  |  |         String days = getBeginAndEndDateByDays(1); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         filterInvProductRequest.setStartDate(stringToDate(days + " 00:00:00")); | 
			
		
	
		
			
				
					|  |  |  |  |         filterInvProductRequest.setEndDate(stringToDate(days + " 23:59:59")); | 
			
		
	
		
			
				
					|  |  |  |  |         handleExternalThrInvGhOrder(filterInvProductRequest); | 
			
		
	
		
			
				
					|  |  |  |  |         log.info("自动抓取第三方高耗出入库明细生成单据定时任务结束"); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |  |     public List<ThrInvOrder> filterThrInvOrder(FilterThrInvOrderRequest filterThrInvOrderRequest) { | 
			
		
	
		
			
				
					|  |  |  |  |         if (filterThrInvOrderRequest == null) { | 
			
		
	
	
		
			
				
					|  |  |  | @ -293,6 +380,7 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { | 
			
		
	
		
			
				
					|  |  |  |  |             String thirdSysFk = thrInvOrder.getThirdSysFk(); | 
			
		
	
		
			
				
					|  |  |  |  |             List<String> thrCodes = thrInvOrderDetails.stream().filter(x->ObjectUtil.isNull(x.getRelId())) | 
			
		
	
		
			
				
					|  |  |  |  |                     .map(ThrInvOrderDetail::getThrCode).collect(Collectors.toList()); | 
			
		
	
		
			
				
					|  |  |  |  |             if (CollectionUtil.isNotEmpty(thrCodes)) { | 
			
		
	
		
			
				
					|  |  |  |  |                 MainIdRelIdAndProductResponse map = udiRelevanceService.selectMainIdRelIdAndProductMap(thrCodes, thirdSysFk); | 
			
		
	
		
			
				
					|  |  |  |  |                 Map<String, Long> mainIdRelIdMap = map.getMainIdRelIdMap(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -308,7 +396,7 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                 }); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             if (exmsg.length() > 0){ | 
			
		
	
		
			
				
					|  |  |  |  |                 exmsg.deleteCharAt(exmsg.length()-1); | 
			
		
	
	
		
			
				
					|  |  |  | 
 |