|  |  | @ -3,6 +3,7 @@ package com.glxp.api.service.collect; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.hutool.core.collection.CollUtil; |  |  |  | import cn.hutool.core.collection.CollUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.hutool.core.thread.ThreadUtil; |  |  |  | import cn.hutool.core.thread.ThreadUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import cn.hutool.core.util.ArrayUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.hutool.core.util.StrUtil; |  |  |  | import cn.hutool.core.util.StrUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
			
		
	
	
		
		
			
				
					|  |  | @ -32,10 +33,12 @@ import com.glxp.api.http.ErpBasicClient; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.http.sync.SpGetHttpClient; |  |  |  | import com.glxp.api.http.sync.SpGetHttpClient; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.req.collect.CollectOrderBizRequest; |  |  |  | import com.glxp.api.req.collect.CollectOrderBizRequest; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.req.collect.CollectOrderRequest; |  |  |  | import com.glxp.api.req.collect.CollectOrderRequest; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.glxp.api.req.collect.CollectOrderUploadCountRequest; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.req.collect.PostCollectOrderRequest; |  |  |  | import com.glxp.api.req.collect.PostCollectOrderRequest; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.req.inout.ReviewFinishRequest; |  |  |  | import com.glxp.api.req.inout.ReviewFinishRequest; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.res.basic.UdiRelevanceResponse; |  |  |  | import com.glxp.api.res.basic.UdiRelevanceResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.res.collect.CollectOrderBizResponse; |  |  |  | import com.glxp.api.res.collect.CollectOrderBizResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.glxp.api.res.collect.CollectOrderUploadCountResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.res.collect.IoCollectOrderResponse; |  |  |  | import com.glxp.api.res.collect.IoCollectOrderResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.auth.InvWarehouseService; |  |  |  | import com.glxp.api.service.auth.InvWarehouseService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.auth.SysWorkplaceService; |  |  |  | import com.glxp.api.service.auth.SysWorkplaceService; | 
			
		
	
	
		
		
			
				
					|  |  | @ -54,6 +57,7 @@ import org.springframework.transaction.annotation.Isolation; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.transaction.annotation.Transactional; |  |  |  | import org.springframework.transaction.annotation.Transactional; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.annotation.Resource; |  |  |  | import javax.annotation.Resource; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import java.math.BigDecimal; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.*; |  |  |  | import java.util.*; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.stream.Collectors; |  |  |  | import java.util.stream.Collectors; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -181,8 +185,8 @@ public class IoCollectOrderBackupService extends ServiceImpl<IoCollectOrderBacku | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         SysWorkplaceDocumentEntity sysWorkplaceDocumentEntity = sysWorkplaceDocumentService.findByWorkplaceCode(collectOrder.getWorkPlaceCode(), collectOrder.getBusType()); |  |  |  |         SysWorkplaceDocumentEntity sysWorkplaceDocumentEntity = sysWorkplaceDocumentService.findByWorkplaceCode(collectOrder.getWorkPlaceCode(), collectOrder.getBusType()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         // 如果是null 就可能是上货工位进行医保上传
 |  |  |  |         // 如果是null 就可能是上货工位进行医保上传
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         if(Objects.isNull(sysWorkplaceDocumentEntity)){ |  |  |  |         if (Objects.isNull(sysWorkplaceDocumentEntity)) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |              sysWorkplaceDocumentEntity = sysWorkplaceDocumentService.filterListExhibitGoods(collectOrder.getWorkPlaceCode(), collectOrder.getBusType()); |  |  |  |             sysWorkplaceDocumentEntity = sysWorkplaceDocumentService.filterListExhibitGoods(collectOrder.getWorkPlaceCode(), collectOrder.getBusType()); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -427,13 +431,13 @@ public class IoCollectOrderBackupService extends ServiceImpl<IoCollectOrderBacku | 
			
		
	
		
		
			
				
					
					|  |  |  |         for (CollectOrderBizResponse collectOrderBizResponse : orderRequest.getCollectOrderList().get(0).getCollectOrderBizResponseList()) { |  |  |  |         for (CollectOrderBizResponse collectOrderBizResponse : orderRequest.getCollectOrderList().get(0).getCollectOrderBizResponseList()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             long count = ioCollectCodeBackService.count( |  |  |  |             long count = ioCollectCodeBackService.count( | 
			
		
	
		
		
			
				
					
					|  |  |  |                     new QueryWrapper<IoCollectCodeBackup>() |  |  |  |                     new QueryWrapper<IoCollectCodeBackup>() | 
			
		
	
		
		
			
				
					
					|  |  |  |                             .eq("billNo",collectOrderBizResponse.getBillNo()) |  |  |  |                             .eq("billNo", collectOrderBizResponse.getBillNo()) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             .eq("fifoSplit","1").or().eq("fifoSplit","4") |  |  |  |                             .eq("fifoSplit", "1").or().eq("fifoSplit", "4") | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                             .last("limit 1") |  |  |  |                             .last("limit 1") | 
			
		
	
		
		
			
				
					
					|  |  |  |             ); |  |  |  |             ); | 
			
		
	
		
		
			
				
					
					|  |  |  |             if(count >0){ |  |  |  |             if (count > 0) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 collectOrderBizResponse.setTrdnFlag("1"); |  |  |  |                 collectOrderBizResponse.setTrdnFlag("1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |             }else { |  |  |  |             } else { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 collectOrderBizResponse.setTrdnFlag("0"); |  |  |  |                 collectOrderBizResponse.setTrdnFlag("0"); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
	
		
		
			
				
					|  |  | @ -650,4 +654,123 @@ public class IoCollectOrderBackupService extends ServiceImpl<IoCollectOrderBacku | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         return collectOrderBizResponses; |  |  |  |         return collectOrderBizResponses; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * 计算上传率 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public void calculatedUploadRate(CollectOrderUploadCountRequest collectOrderUploadCountRequest, CollectOrderUploadCountResponse collectOrderUploadCountResponse) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         List<IoCollectOrderResponse> list = ioCollectOrderBackupMapper.getList(collectOrderUploadCountRequest); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Map<String, String[]> buyTypeMap = new HashMap<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Integer buyerScanCount = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Integer salesScanCount = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Integer buyerScanCountReturn = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Integer salesScanCountReturn = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Integer buyerScanSumCount = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Integer salesScanSumCount = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Integer buyerScanSumCountReturn = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Integer salesScanSumCountReturn = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         BigDecimal buyerCentage = new BigDecimal(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         BigDecimal salesCentage = new BigDecimal(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Integer codeCount = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Integer fifoSplitOneCount = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Integer fifoSplitTwoCount = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         String sum = "sum"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (list != null && list.size() > 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             BaseResponse<Map<String, String[]>> baseResponse = erpBasicClient.getBuyType("thirdId"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (baseResponse.getCode() == 20000) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 buyTypeMap = baseResponse.getData(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             Map<String, Integer> map = new HashMap(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             for (IoCollectOrderResponse collectOrderResponse : list) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 for (Map.Entry<String, String[]> entry : buyTypeMap.entrySet()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     String key = entry.getKey(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     if(ArrayUtil.isEmpty(entry.getValue())){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         continue; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     String result = String.join(", ", entry.getValue()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         if (result.contains(collectOrderResponse.getBusType())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             int count = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             if (collectOrderResponse.getRelCodeCount() != null && collectOrderResponse.getRelCodeCount() > 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 count += collectOrderResponse.getRelCodeCount(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 count++; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             if (2 == collectOrderResponse.getUploadStatus()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 map.put(key, count); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             map.put(key+sum, count); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (collectOrderResponse.getRelCodeCount() != null && collectOrderResponse.getRelCodeCount() > 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     codeCount += collectOrderResponse.getRelCodeCount(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     codeCount++; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             // 数据做处理
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             for (Map.Entry<String, Integer> entry : map.entrySet()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 String key = entry.getKey(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 Integer value = entry.getValue(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (key.equals("buyType_3502")) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     buyerScanCount += value; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } else if (key.equals("buyType_3504")) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     buyerScanCountReturn += value; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } else if (key.equals("buyType_3505")) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     salesScanCount += value; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } else if (key.equals("buyType_35051")) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     salesScanCount += value; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } else if (key.equals("buyType_3506")) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     salesScanCountReturn += value; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (key.equals("buyType_3502"+sum)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     buyerScanSumCount += value; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } else if (key.equals("buyType_3504"+sum)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     buyerScanSumCountReturn += value; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } else if (key.equals("buyType_3505"+sum)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     salesScanSumCount += value; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } else if (key.equals("buyType_35051"+sum)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     salesScanSumCount += value; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } else if (key.equals("buyType_3506"+sum)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     salesScanSumCountReturn += value; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         collectOrderUploadCountResponse.setBuyerCentage(buyerCentage); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         collectOrderUploadCountResponse.setSalesCentage(salesCentage); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         collectOrderUploadCountResponse.setBuyerScanCount(buyerScanCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         collectOrderUploadCountResponse.setSalesScanCount(salesScanCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         collectOrderUploadCountResponse.setBuyerScanCountReturn(buyerScanCountReturn); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         collectOrderUploadCountResponse.setSalesScanCountReturn(salesScanCountReturn); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         collectOrderUploadCountResponse.setBuyerScanSumCount(buyerScanSumCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         collectOrderUploadCountResponse.setSalesScanSumCount(salesScanSumCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         collectOrderUploadCountResponse.setBuyerScanSumCountReturn(buyerScanSumCountReturn); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         collectOrderUploadCountResponse.setSalesScanSumCountReturn(salesScanSumCountReturn); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         collectOrderUploadCountResponse.setCodeCount(codeCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         collectOrderUploadCountResponse.setFifoSplitOneCount(fifoSplitOneCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         collectOrderUploadCountResponse.setFifoSplitTwoCount(fifoSplitTwoCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |