|  |  | @ -1,6 +1,8 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | package com.glxp.api.service.basic; |  |  |  | package com.glxp.api.service.basic; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.exception.JsonException; |  |  |  | import com.glxp.api.exception.JsonException; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import lombok.extern.slf4j.Slf4j; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import org.apache.commons.lang3.exception.ExceptionUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.beans.BeanUtils; |  |  |  | import org.springframework.beans.BeanUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.common.res.BaseResponse; |  |  |  | import com.glxp.api.common.res.BaseResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.constant.ConstantStatus; |  |  |  | import com.glxp.api.constant.ConstantStatus; | 
			
		
	
	
		
		
			
				
					|  |  | @ -25,152 +27,14 @@ import javax.annotation.Resource; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.*; |  |  |  | import java.util.*; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | @Service |  |  |  | @Service | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | @Slf4j | 
			
		
	
		
		
			
				
					
					|  |  |  | public class BasicBackUpdateProductService { |  |  |  | public class BasicBackUpdateProductService { | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |     UdiRelevanceService udiRelevanceService; |  |  |  |     UdiRelevanceService udiRelevanceService; | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |     UdiProductService udiProductService; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     ThrProductsService thrProductsService; |  |  |  |     ThrProductsService thrProductsService; | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |     SystemParamConfigService systemParamConfigService; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     ThrSystemService thrSystemService; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     private ErpBasicClient erpBasicClient; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     RedisUtil redisUtil; |  |  |  |     RedisUtil redisUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     GennerOrderUtils gennerOrderUtils; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     //定时或一键下载更新全部线上产品信息
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Async |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     public void addAllProducts(FilterThrProductsRequest filterThrProductsRequest, String productUrl, String onHandUrl, String thirdSysId, Boolean isEnable) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         int page = 1; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (filterThrProductsRequest == null) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             filterThrProductsRequest = new FilterThrProductsRequest(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         filterThrProductsRequest.setPage(1); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         filterThrProductsRequest.setLimit(100); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         while (page != -1) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             page = getAllProducts(filterThrProductsRequest, productUrl, onHandUrl, thirdSysId, isEnable); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     //定时或一键下载更新全部线上产品信息
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     public int getAllProducts(FilterThrProductsRequest filterThrProductsRequest, String productUrl, String |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             onHandUrl, String thirdSysId, Boolean isEnable) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         BaseResponse<PageSimpleResponse<ThrProductsResponse>> erpProducts = erpBasicClient.getErpProducts(filterThrProductsRequest); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<ThrProductsResponse> invmandocResponses = erpProducts.getData().getList(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         SystemParamConfigEntity isUpdate = systemParamConfigService.selectByParamKey("erp_updateErpData_type"); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (isEnable == null || isEnable == false) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             isUpdate.setParamValue("1"); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         Map<String, ThrProductsResponse> erpProductsMap = new HashMap<>(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (invmandocResponses != null && invmandocResponses.size() > 0) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             List<String> inventoryCodes = new ArrayList<>(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //            if (filterThrProductsRequest.getCode() != null) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                inventoryCodes.add(filterThrProductsRequest.getCode());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                erpProductsMap.put(filterThrProductsRequest.getCode(), invmandocResponses.get(0));
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //            } else {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             for (ThrProductsResponse invmandocResponse : invmandocResponses) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectByThirdId(invmandocResponse.getCode(), thirdSysId); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (udiRelevanceEntity == null) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     inventoryCodes.add(invmandocResponse.getCode()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     erpProductsMap.put(invmandocResponse.getCode(), invmandocResponse); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     if (isUpdate.getParamValue().equals("1")) {//不根据库存信息过滤
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         UdiProductEntity udiProductEntity = new UdiProductEntity(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         udiProductEntity.setNameCode(invmandocResponse.getCode()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         udiProductEntity.setCpmctymc(invmandocResponse.getName()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         udiProductEntity.setGgxh(invmandocResponse.getSpec()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         udiProductEntity.setUuid(CustomUtil.getUUId()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         udiProductEntity.setDiType(1); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         udiProductEntity.setProductType(ConstantStatus.PRODUCT_TYPE_THIRD); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         udiProductEntity.setManufactory(invmandocResponses.get(0).getManufactory()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         udiProductEntity.setYlqxzcrbarmc(invmandocResponses.get(0).getManufactory()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         udiProductEntity.setZczbhhzbapzbh(invmandocResponses.get(0).getRegisterNo()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         udiProductService.insertUdiInfo(udiProductEntity); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         UdiRelevanceEntity udiRelevanceEntity1 = new UdiRelevanceEntity(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         udiRelevanceEntity1.setUuid(udiProductEntity.getUuid()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         if ("thirdId".equals(thirdSysId)) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                             udiRelevanceEntity1.setThirdId(invmandocResponse.getCode()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } else if ("thirdId1".equals(thirdSysId)) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                             udiRelevanceEntity1.setThirdId1(invmandocResponse.getCode()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } else if ("thirdId2".equals(thirdSysId)) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                             udiRelevanceEntity1.setThirdId4(invmandocResponse.getCode()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } else if ("thirdId3".equals(thirdSysId)) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                             udiRelevanceEntity1.setThirdId3(invmandocResponse.getCode()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } else if ("thirdId4".equals(thirdSysId)) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                             udiRelevanceEntity1.setThirdId4(invmandocResponse.getCode()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         ThrSystemEntity thrSystemEntity = thrSystemService.selectMainThrSys(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         String mainSys = thrSystemEntity.getThirdId(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         if (mainSys.equals("thirdId")) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                             udiRelevanceEntity1.setMainId(udiRelevanceEntity1.getThirdId()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } else if (mainSys.equals("thirdId1")) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                             udiRelevanceEntity1.setMainId(udiRelevanceEntity1.getThirdId1()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } else if (mainSys.equals("thirdId2")) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                             udiRelevanceEntity1.setMainId(udiRelevanceEntity1.getThirdId2()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } else if (mainSys.equals("thirdId3")) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                             udiRelevanceEntity1.setMainId(udiRelevanceEntity1.getThirdId3()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } else if (mainSys.equals("thirdId4")) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                             udiRelevanceEntity1.setMainId(udiRelevanceEntity1.getThirdId4()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         udiRelevanceEntity1.setThirdId(invmandocResponse.getCode()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         udiRelevanceEntity1.setUpdateTime(new Date()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         udiRelevanceEntity.setModifyTime(new Date()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         udiRelevanceEntity.setIsDisable(false); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         udiRelevanceEntity1.setId(gennerOrderUtils.getRelId()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         udiRelevanceEntity1 = udiRelevanceService.insertDefaultLevel(udiRelevanceEntity1, udiProductEntity); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         udiRelevanceService.insertUdiRelevance(udiRelevanceEntity1); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         udiProductService.updateLevelCount(udiRelevanceEntity1); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                }
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             //若需要对照库存信息
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (!isUpdate.getParamValue().equals("1")) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                if (inventoryCodes.size() > 0) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                    ErpOnhandRequest erpOnhandRequest = new ErpOnhandRequest();
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                    erpOnhandRequest.setInventoryCodes(inventoryCodes);
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                    List<ErpInvProductResponse> erpOnHandResponses = new ErpInvClient().getInvPrdoduct(erpOnhandRequest, onHandUrl);
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                    if (erpOnHandResponses != null) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        Map<String, List<ErpInvProductResponse>> map = erpOnHandResponses.stream().collect(Collectors.groupingBy(ErpInvProductResponse::getCode));
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        for (List<ErpInvProductResponse> onHandResponses : map.values()) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                            if (onHandResponses != null && onHandResponses.size() > 0) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                                ErpInvProductResponse onhandQueryResponse = onHandResponses.get(0);
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                                if (isUpdate.getParamValue().equals("2")) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                                    addRl(onhandQueryResponse, thirdSysId, erpProductsMap);
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                                } else if (isUpdate.getParamValue().equals("3")) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                                    if (onhandQueryResponse.getCount() != null && onhandQueryResponse.getCount() > 0) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                                        addRl(onhandQueryResponse, thirdSysId, erpProductsMap);
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                                    }
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                                } else if (isUpdate.getParamValue().equals("4")) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                                    if (onhandQueryResponse.getCount() == null || onhandQueryResponse.getCount() <= 0) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                                        addRl(onhandQueryResponse, thirdSysId, erpProductsMap);
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                                    }
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                                }
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                            }
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        }
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                    }
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                }
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             filterThrProductsRequest.setPage(filterThrProductsRequest.getPage() + 1); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (filterThrProductsRequest.getPage() * filterThrProductsRequest.getLimit() < erpProducts.getData().getTotal()) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 return filterThrProductsRequest.getPage(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             return -1; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         return -1; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |     UdiContrastService udiContrastService; |  |  |  |     UdiContrastService udiContrastService; | 
			
		
	
	
		
		
			
				
					|  |  | @ -178,8 +42,6 @@ public class BasicBackUpdateProductService { | 
			
		
	
		
		
			
				
					
					|  |  |  |     //定时或一键下载更新本地所有产品信息
 |  |  |  |     //定时或一键下载更新本地所有产品信息
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Async |  |  |  |     @Async | 
			
		
	
		
		
			
				
					
					|  |  |  |     public void loadLocal(FilterThrProductsRequest filterThrProductsRequest, String thirdSysId, String onHandUrl, Boolean isEnable) { |  |  |  |     public void loadLocal(FilterThrProductsRequest filterThrProductsRequest, String thirdSysId, String onHandUrl, Boolean isEnable) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (filterThrProductsRequest == null) { |  |  |  |         if (filterThrProductsRequest == null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             filterThrProductsRequest = new FilterThrProductsRequest(); |  |  |  |             filterThrProductsRequest = new FilterThrProductsRequest(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
	
		
		
			
				
					|  |  | @ -187,73 +49,14 @@ public class BasicBackUpdateProductService { | 
			
		
	
		
		
			
				
					
					|  |  |  |         BeanUtils.copyProperties(filterThrProductsRequest, filterThrInvProductsRequest); |  |  |  |         BeanUtils.copyProperties(filterThrProductsRequest, filterThrInvProductsRequest); | 
			
		
	
		
		
			
				
					
					|  |  |  |         filterThrInvProductsRequest.setPage(null); |  |  |  |         filterThrInvProductsRequest.setPage(null); | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<ThrProductsEntity> thrProductsEntities = thrProductsService.filterThrProducts(filterThrInvProductsRequest); |  |  |  |         List<ThrProductsEntity> thrProductsEntities = thrProductsService.filterThrProducts(filterThrInvProductsRequest); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //        SystemParamConfigEntity isUpdate = systemParamConfigService.selectByParamKey("erp_updateErpData_type");
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //        if (isEnable == null || isEnable == false) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //            isUpdate.setParamValue("1");
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //        }
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (thrProductsEntities != null && thrProductsEntities.size() > 0) { |  |  |  |         if (thrProductsEntities != null && thrProductsEntities.size() > 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             for (ThrProductsEntity thrProductsEntity : thrProductsEntities) { |  |  |  |             for (ThrProductsEntity thrProductsEntity : thrProductsEntities) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectByThirdId(thrProductsEntity.getCode(), thirdSysId); |  |  |  |                 UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectByThirdId(thrProductsEntity.getCode(), thirdSysId); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (udiRelevanceEntity == null) { |  |  |  |                 if (udiRelevanceEntity == null) { | 
			
		
	
		
		
			
				
					
					|  |  |  | //                    if (isUpdate.getParamValue().equals("1")) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        UdiProductEntity udiProductEntity = new UdiProductEntity();
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        udiProductEntity.setNameCode(thrProductsEntity.getCode());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        udiProductEntity.setCpmctymc(thrProductsEntity.getName());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        udiProductEntity.setGgxh(thrProductsEntity.getSpec());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        udiProductEntity.setUuid(CustomUtil.getUUId());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        udiProductEntity.setProductType(ConstantStatus.PRODUCT_TYPE_THIRD);
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        udiProductEntity.setDiType(1);
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        udiProductEntity.setManufactory(thrProductsEntity.getManufactory());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        udiProductEntity.setYlqxzcrbarmc(thrProductsEntity.getManufactory());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        udiProductEntity.setZczbhhzbapzbh(thrProductsEntity.getRegisterNo());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        udiProductEntity.setRequireScanCode(0);
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        udiProductService.insertUdiInfo(udiProductEntity);
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        UdiRelevanceEntity udiRelevanceEntity1 = new UdiRelevanceEntity();
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        udiRelevanceEntity1.setUuid(udiProductEntity.getUuid());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        udiRelevanceEntity1.setIsDisable(false);
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        udiRelevanceEntity1.setSupName(thrProductsEntity.getSupName());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        if ("thirdId".equals(thirdSysId)) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                            udiRelevanceEntity1.setThirdId(thrProductsEntity.getCode());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        } else if ("thirdId1".equals(thirdSysId)) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                            udiRelevanceEntity1.setThirdId1(thrProductsEntity.getCode());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        } else if ("thirdId2".equals(thirdSysId)) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                            udiRelevanceEntity1.setThirdId4(thrProductsEntity.getCode());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        } else if ("thirdId3".equals(thirdSysId)) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                            udiRelevanceEntity1.setThirdId3(thrProductsEntity.getCode());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        } else if ("thirdId4".equals(thirdSysId)) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                            udiRelevanceEntity1.setThirdId4(thrProductsEntity.getCode());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        }
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        ThrSystemEntity thrSystemEntity = thrSystemService.selectMainThrSys();
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        String mainSys = thrSystemEntity.getThirdId();
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        if (mainSys.equals("thirdId")) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                            udiRelevanceEntity1.setMainId(udiRelevanceEntity1.getThirdId());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        } else if (mainSys.equals("thirdId1")) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                            udiRelevanceEntity1.setMainId(udiRelevanceEntity1.getThirdId1());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        } else if (mainSys.equals("thirdId2")) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                            udiRelevanceEntity1.setMainId(udiRelevanceEntity1.getThirdId2());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        } else if (mainSys.equals("thirdId3")) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                            udiRelevanceEntity1.setMainId(udiRelevanceEntity1.getThirdId3());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        } else if (mainSys.equals("thirdId4")) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                            udiRelevanceEntity1.setMainId(udiRelevanceEntity1.getThirdId4());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        }
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        udiRelevanceEntity1.setThirdId(thrProductsEntity.getCode());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        udiRelevanceEntity1.setUpdateTime(new Date());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        udiRelevanceEntity1.setModifyTime(new Date());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        udiRelevanceEntity1.setId(gennerOrderUtils.getRelId());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        udiRelevanceService.insertUdiRelevanceignore(udiRelevanceEntity1);
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                    }
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     try { |  |  |  |                     try { | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        Thread.sleep(2000);
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         udiContrastService.createOnlyMainId(thrProductsEntity.getCode()); |  |  |  |                         udiContrastService.createOnlyMainId(thrProductsEntity.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } catch (Exception e) { |  |  |  |                     } catch (Exception e) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |                         log.error("拉取基础数据==="+ ExceptionUtils.getStackTrace(e)); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | 
 |