|  |  |  | @ -3,14 +3,19 @@ package com.glxp.api.controller.basic; | 
			
		
	
		
			
				
					|  |  |  |  | import cn.hutool.core.bean.BeanUtil; | 
			
		
	
		
			
				
					|  |  |  |  | import cn.hutool.core.collection.CollUtil; | 
			
		
	
		
			
				
					|  |  |  |  | import cn.hutool.core.util.StrUtil; | 
			
		
	
		
			
				
					|  |  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
			
		
	
		
			
				
					|  |  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
			
		
	
		
			
				
					|  |  |  |  | import com.github.pagehelper.Page; | 
			
		
	
		
			
				
					|  |  |  |  | import com.github.pagehelper.PageInfo; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.annotation.AuthRuleAnnotation; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.common.res.BaseResponse; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.common.util.ResultVOUtils; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.constant.AsyncDiDlHelper; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.controller.BaseController; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.dao.basic.BasicProductsRegistrationCertDao; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.dto.DictDto; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.basic.*; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.dev.DeviceInfoEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.req.basic.*; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.res.PageSimpleResponse; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.basic.*; | 
			
		
	
	
		
			
				
					|  |  |  | @ -22,6 +27,7 @@ import org.springframework.web.bind.annotation.RestController; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | import javax.annotation.Resource; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.ArrayList; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.Date; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.List; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.stream.Collectors; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -30,7 +36,7 @@ import java.util.stream.Collectors; | 
			
		
	
		
			
				
					|  |  |  |  |  */ | 
			
		
	
		
			
				
					|  |  |  |  | @Slf4j | 
			
		
	
		
			
				
					|  |  |  |  | @RestController | 
			
		
	
		
			
				
					|  |  |  |  | public class UdiSyncController { | 
			
		
	
		
			
				
					|  |  |  |  | public class UdiSyncController extends BaseController { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     UdiRelevanceService udiRelevanceService; | 
			
		
	
	
		
			
				
					|  |  |  | @ -44,6 +50,8 @@ public class UdiSyncController { | 
			
		
	
		
			
				
					|  |  |  |  |     ProductInfoService productInfoService; | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     UdiCompanyService udiCompanyService; | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     BasicProductsRegistrationCertDao registrationCertDao; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     //获取同步库UDI信息
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -224,6 +232,8 @@ public class UdiSyncController { | 
			
		
	
		
			
				
					|  |  |  |  |                     List<ProductInfoEntity> productInfoEntityList = listBaseResponse.getData(); | 
			
		
	
		
			
				
					|  |  |  |  |                     if (CollUtil.isNotEmpty(productInfoEntityList)) { | 
			
		
	
		
			
				
					|  |  |  |  |                         productInfoService.insertProductInfos(productInfoEntityList); | 
			
		
	
		
			
				
					|  |  |  |  |                         //处理注册证插入
 | 
			
		
	
		
			
				
					|  |  |  |  |                         handleRegistrationCert(productInfoEntityList); | 
			
		
	
		
			
				
					|  |  |  |  |                         udiDlDeviceResponse = syncUdiService.filterUdi(productInfoFilterRequest); | 
			
		
	
		
			
				
					|  |  |  |  |                     } else { | 
			
		
	
		
			
				
					|  |  |  |  |                         ResultVOUtils.error(500, "未查询到该产品DI"); | 
			
		
	
	
		
			
				
					|  |  |  | @ -266,6 +276,37 @@ public class UdiSyncController { | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     private void handleRegistrationCert(List<ProductInfoEntity> productInfoEntityList) { | 
			
		
	
		
			
				
					|  |  |  |  |         for (int i = 0; i < productInfoEntityList.size(); i++) { | 
			
		
	
		
			
				
					|  |  |  |  |             ProductInfoEntity productInfoEntity = productInfoEntityList.get(i); | 
			
		
	
		
			
				
					|  |  |  |  |             String zczbhhzbapzbh = productInfoEntity.getZczbhhzbapzbh(); | 
			
		
	
		
			
				
					|  |  |  |  |             if (StrUtil.isNotEmpty(zczbhhzbapzbh)){ | 
			
		
	
		
			
				
					|  |  |  |  |                 // 使用逗号作为分隔符进行分割
 | 
			
		
	
		
			
				
					|  |  |  |  |                 String[] parts = zczbhhzbapzbh.split(","); | 
			
		
	
		
			
				
					|  |  |  |  |                 // 将结果转换为一个列表(如果你需要使用List类型)
 | 
			
		
	
		
			
				
					|  |  |  |  |                 java.util.List<String> resultList = java.util.Arrays.asList(parts); | 
			
		
	
		
			
				
					|  |  |  |  |                 List<BasicProductsRegistrationCertEntity> adds = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |  |                 BasicProductsRegistrationCertEntity oBean = new BasicProductsRegistrationCertEntity(); | 
			
		
	
		
			
				
					|  |  |  |  |                 oBean.setUuid(productInfoEntity.getUuid()); | 
			
		
	
		
			
				
					|  |  |  |  |                 oBean.setNameCode(productInfoEntity.getNameCode()); | 
			
		
	
		
			
				
					|  |  |  |  |                 oBean.setCreateUser(String.valueOf(getUser().getId())); | 
			
		
	
		
			
				
					|  |  |  |  |                 oBean.setCreateTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |  |                 resultList.forEach( item -> { | 
			
		
	
		
			
				
					|  |  |  |  |                     BasicProductsRegistrationCertEntity addBean = new BasicProductsRegistrationCertEntity(); | 
			
		
	
		
			
				
					|  |  |  |  |                     BeanUtils.copyProperties(oBean,addBean); | 
			
		
	
		
			
				
					|  |  |  |  |                     addBean.setZczbhhzbapzbh(item); | 
			
		
	
		
			
				
					|  |  |  |  |                     adds.add(addBean); | 
			
		
	
		
			
				
					|  |  |  |  |                 }); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 //删除当前已保存的 nameCode 的证书列表
 | 
			
		
	
		
			
				
					|  |  |  |  |                 registrationCertDao.delete(new QueryWrapper<BasicProductsRegistrationCertEntity>().eq("nameCode", productInfoEntity.getNameCode())); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 //进行批量保存
 | 
			
		
	
		
			
				
					|  |  |  |  |                 registrationCertDao.insertBatch(adds); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @AuthRuleAnnotation("") | 
			
		
	
		
			
				
					|  |  |  |  |     @GetMapping("/udiwms/basic/instrument/maintain/filterProduct") | 
			
		
	
		
			
				
					|  |  |  |  |     public BaseResponse filterProduct(FilterUdiRelRequest filterUdiRelRequest) { | 
			
		
	
	
		
			
				
					|  |  |  | 
 |