|  |  | @ -1,10 +1,16 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | package com.glxp.api.service.collect; |  |  |  | package com.glxp.api.service.collect; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |  |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.github.pagehelper.PageHelper; |  |  |  | import com.github.pagehelper.PageHelper; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.common.res.BaseResponse; |  |  |  | import com.glxp.api.common.res.BaseResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.glxp.api.dao.collect.IoCollectCodeBackMapper; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.glxp.api.dao.collect.IoCollectCodeMapper; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.dao.collect.IoCollectOrderBizBackupMapper; |  |  |  | import com.glxp.api.dao.collect.IoCollectOrderBizBackupMapper; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.glxp.api.entity.collect.IoCollectCode; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.glxp.api.entity.collect.IoCollectCodeBackup; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.entity.collect.IoCollectOrderBizBackup; |  |  |  | import com.glxp.api.entity.collect.IoCollectOrderBizBackup; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.http.ErpBasicClient; |  |  |  | import com.glxp.api.http.ErpBasicClient; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.req.collect.CollectOrderBizRequest; |  |  |  | import com.glxp.api.req.collect.CollectOrderBizRequest; | 
			
		
	
	
		
		
			
				
					|  |  | @ -27,6 +33,8 @@ public class IoCollectOrderBizBackupService extends ServiceImpl<IoCollectOrderBi | 
			
		
	
		
		
			
				
					
					|  |  |  |     IoCollectOrderBizBackupMapper ioCollectOrderBizBackupMapper; |  |  |  |     IoCollectOrderBizBackupMapper ioCollectOrderBizBackupMapper; | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |     private ErpBasicClient erpBasicClient; |  |  |  |     private ErpBasicClient erpBasicClient; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private IoCollectCodeBackMapper ioCollectCodeBackMapper; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public List<CollectOrderBizResponse> filterList(CollectOrderBizRequest collectOrderRequest) { |  |  |  |     public List<CollectOrderBizResponse> filterList(CollectOrderBizRequest collectOrderRequest) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (collectOrderRequest == null) { |  |  |  |         if (collectOrderRequest == null) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -48,13 +56,20 @@ public class IoCollectOrderBizBackupService extends ServiceImpl<IoCollectOrderBi | 
			
		
	
		
		
			
				
					
					|  |  |  |         Map<String, String[]> buyTypeMap = new HashMap<>(); |  |  |  |         Map<String, String[]> buyTypeMap = new HashMap<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<String> buyTypeBuyer = new ArrayList<>(); |  |  |  |         List<String> buyTypeBuyer = new ArrayList<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<String> buyTypeSales = new ArrayList<>(); |  |  |  |         List<String> buyTypeSales = new ArrayList<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         Integer buyerCount = 0; |  |  |  | //        Integer buyerCount = 0;
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         Integer salesCount = 0; |  |  |  | //        Integer salesCount = 0;
 | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         Integer buyerScanCount = 0; |  |  |  |         Integer buyerScanCount = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |         Integer salesScanCount = 0; |  |  |  |         Integer salesScanCount = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |         BigDecimal buyerCentage = new BigDecimal(0); |  |  |  |         BigDecimal buyerCentage = new BigDecimal(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |         BigDecimal salesCentage = new BigDecimal(0); |  |  |  |         BigDecimal salesCentage = new BigDecimal(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |         Integer codeCount = 0; |  |  |  |         Integer codeCount = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Integer fifoSplitOneCount = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Integer fifoSplitTwoCount = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Integer fifoSplitThreeCount = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (list != null && list.size() > 0) { |  |  |  |         if (list != null && list.size() > 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             BaseResponse<Map<String, String[]>> baseResponse = erpBasicClient.getBuyType("thirdId"); |  |  |  |             BaseResponse<Map<String, String[]>> baseResponse = erpBasicClient.getBuyType("thirdId"); | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (baseResponse.getCode() == 20000) { |  |  |  |             if (baseResponse.getCode() == 20000) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -67,47 +82,71 @@ public class IoCollectOrderBizBackupService extends ServiceImpl<IoCollectOrderBi | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             for (CollectOrderBizResponse collectOrderBizResponse : list) { |  |  |  |             for (CollectOrderBizResponse collectOrderBizResponse : list) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 for (String buyType : buyTypeBuyer) { |  |  |  |                 collectOrderBizResponse.setCount(collectOrderBizResponse.getCount() == null  ? 0 : collectOrderBizResponse.getCount()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     if (buyType.equals(collectOrderBizResponse.getBusType())) { |  |  |  |                 collectOrderBizResponse.setScanCount(collectOrderBizResponse.getScanCount() == null  ? 0 : collectOrderBizResponse.getScanCount()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         buyerCount += collectOrderBizResponse.getCount(); |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         // 只有已上传的码才是正确的码
 |  |  |  | 
 | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if(2 == collectOrderBizResponse.getUploadStatus()){ |  |  |  |                 if(2 == collectOrderBizResponse.getUploadStatus()){ | 
			
		
	
		
		
			
				
					
					|  |  |  |                             buyerScanCount += collectOrderBizResponse.getScanCount(); |  |  |  |                     for (String buyType : buyTypeSales) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |                         if (buyType.equals(collectOrderBizResponse.getBusType())) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //                        salesCount += collectOrderBizResponse.getCount();
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             salesScanCount ++; | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 for (String buyType : buyTypeSales) { |  |  |  |                     for (String buyType : buyTypeBuyer) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                         if (buyType.equals(collectOrderBizResponse.getBusType())) { |  |  |  |                         if (buyType.equals(collectOrderBizResponse.getBusType())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                         salesCount += collectOrderBizResponse.getCount(); |  |  |  | //                        buyerCount += collectOrderBizResponse.getCount();
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         if (2 == collectOrderBizResponse.getUploadStatus()) { |  |  |  |                             // 只有已上传的码才是正确的码
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             salesScanCount += collectOrderBizResponse.getScanCount(); |  |  |  |                             buyerScanCount ++; | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     if(collectOrderBizResponse.getFifoSplit() == 1){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         fifoSplitOneCount ++; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     }else if(collectOrderBizResponse.getFifoSplit() == 2){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         fifoSplitTwoCount ++; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     }else if(collectOrderBizResponse.getFifoSplit() == 3){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         fifoSplitThreeCount ++; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 codeCount++; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             // 计算采购率和销售率
 |  |  |  |             // 计算采购率和销售率
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             BigDecimal buyerCountBigDecimal = BigDecimal.valueOf(buyerCount); |  |  |  | //            BigDecimal buyerCountBigDecimal = BigDecimal.valueOf(buyerCount);
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             BigDecimal buyerScanCountBigDecimal = BigDecimal.valueOf(buyerScanCount); |  |  |  | //            BigDecimal buyerScanCountBigDecimal = BigDecimal.valueOf(buyerScanCount);
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             if(buyerCountBigDecimal.equals(new BigDecimal(0))){ |  |  |  | //            if(buyerCountBigDecimal.equals(new BigDecimal(0))){
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 buyerCentage = new BigDecimal(0).setScale(2, BigDecimal.ROUND_HALF_UP); |  |  |  | //                buyerCentage = new BigDecimal(0).setScale(2, BigDecimal.ROUND_HALF_UP);
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             }else { |  |  |  | //            }else {
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 buyerCentage = buyerScanCountBigDecimal.divide(buyerCountBigDecimal,4, BigDecimal.ROUND_HALF_UP ).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP); |  |  |  | //                buyerCentage = buyerScanCountBigDecimal.divide(buyerCountBigDecimal,4, BigDecimal.ROUND_HALF_UP ).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
 | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //            }
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //            BigDecimal salesCountBigDecimal = BigDecimal.valueOf(salesCount);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //            BigDecimal salesScanCountBigDecimal = BigDecimal.valueOf(salesScanCount);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //            if(salesCountBigDecimal.equals(new BigDecimal(0))){
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //                salesCentage = new BigDecimal(0).setScale(2, BigDecimal.ROUND_HALF_UP);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //            }else {
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //                salesCentage = salesScanCountBigDecimal.divide(salesCountBigDecimal,4, BigDecimal.ROUND_HALF_UP ).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //            }
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //            codeCount = buyerScanCount + salesScanCount;
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             BigDecimal salesCountBigDecimal = BigDecimal.valueOf(salesCount); |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             BigDecimal salesScanCountBigDecimal = BigDecimal.valueOf(salesScanCount); |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             if(salesCountBigDecimal.equals(new BigDecimal(0))){ |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 salesCentage = new BigDecimal(0).setScale(2, BigDecimal.ROUND_HALF_UP); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             }else { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 salesCentage = salesScanCountBigDecimal.divide(salesCountBigDecimal,4, BigDecimal.ROUND_HALF_UP ).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             codeCount = buyerScanCount + salesScanCount; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         collectOrderUploadCountResponse.setBuyerCentage(buyerCentage); |  |  |  |         collectOrderUploadCountResponse.setBuyerCentage(buyerCentage); | 
			
		
	
		
		
			
				
					
					|  |  |  |         collectOrderUploadCountResponse.setSalesCentage(salesCentage); |  |  |  |         collectOrderUploadCountResponse.setSalesCentage(salesCentage); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         collectOrderUploadCountResponse.setBuyerScanCount(buyerScanCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         collectOrderUploadCountResponse.setSalesScanCount(salesScanCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |         collectOrderUploadCountResponse.setCodeCount(codeCount); |  |  |  |         collectOrderUploadCountResponse.setCodeCount(codeCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //        collectOrderUploadCountResponse.setCount(buyerCount+salesCount);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         collectOrderUploadCountResponse.setFifoSplitOneCount(fifoSplitOneCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         collectOrderUploadCountResponse.setFifoSplitTwoCount(fifoSplitTwoCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         collectOrderUploadCountResponse.setFifoSplitThreeCount(fifoSplitThreeCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public static void main(String[] args) { |  |  |  |     public static void main(String[] args) { | 
			
		
	
	
		
		
			
				
					|  |  | 
 |