| 
					
				 | 
			
			
				@@ -1162,7 +1162,7 @@ public class OrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String[] header = new String[]{"订单号", "操作店员", "购买类型", "订单业务类型", "订单状态", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 "付款状态", "sku", "商品名称", "数量", "实际支付", /*"订单总价",*/ "下单时间", "付款时间", "零售价", "优惠金额", "成交价"}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<Map<String, Object>> list = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<Map<String, Object>> list = new LinkedList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (orderEntityList != null && orderEntityList.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (OrderEntity orderEntity : orderEntityList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 LinkedHashMap<String, Object> map = new LinkedHashMap<>(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1202,8 +1202,9 @@ public class OrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<OrderEntity> masterOrderEntityList = orderService.queryMasterExportOffilineOrderList(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String[] headerMaster = new String[]{"订单号", "操作店员", "购买类型", "订单业务类型", "订单状态", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 "付款状态", "实际支付", "订单总价", "下单时间", "付款时间"}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<Map<String, Object>> listMaster = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<Map<String, Object>> listMaster = new LinkedList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (masterOrderEntityList != null && masterOrderEntityList.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (OrderEntity orderEntity : masterOrderEntityList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 LinkedHashMap<String, Object> map = new LinkedHashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 // 订单业务类型 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1288,6 +1289,7 @@ public class OrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @RequestMapping(value = "exportSystemFormat") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public R exportSystemFormat(@RequestParam Map<String, Object> params, HttpServletResponse response, HttpServletRequest request) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", "thirdPartyMerchCode"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         params = ParamUtils.setTimeMap(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         params.put("isOnfiilineOrder", Dict.isOnfflineOrder.item_1.getItem()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1301,20 +1303,22 @@ public class OrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 "GP ¥","GP %","Product Category","Supplier Name","Transaction Type","Sale Return Type","Remark"}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         LinkedHashMap<String, Object> headerMap = initHeaderMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<Map<String, Object>> list = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<Map<String, Object>> list = new LinkedList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         list.add(headerMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (systemFormatList != null && systemFormatList.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (SystemFormatDto systemFormat : systemFormatList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                LinkedHashMap<String, Object> map = new LinkedHashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                LinkedHashMap<String, Object> map = new LinkedHashMap<>(32); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (Objects.nonNull(systemFormat.getTaxRate()) && Objects.nonNull(systemFormat.getTotalSalesInclTax())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     // 设置综合税额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    systemFormat.setTaxAmount(new BigDecimal(systemFormat.getTotalSalesInclTax()).multiply(new BigDecimal(systemFormat.getTaxRate())).setScale(2,BigDecimal.ROUND_HALF_UP).toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BigDecimal totalSalesIncTax = new BigDecimal(systemFormat.getTotalSalesInclTax()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BigDecimal taxRate = new BigDecimal(systemFormat.getTaxRate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    systemFormat.setTaxAmount(totalSalesIncTax.multiply(taxRate).setScale(2,BigDecimal.ROUND_HALF_UP).toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     // 设置商品销售额(税前) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    systemFormat.setSales(new BigDecimal(systemFormat.getTotalSalesInclTax()).subtract(new BigDecimal(systemFormat.getTaxAmount())).setScale(2,BigDecimal.ROUND_HALF_UP).toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BigDecimal taxAmount = new BigDecimal(systemFormat.getTaxAmount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    systemFormat.setSales(totalSalesIncTax.subtract(taxAmount).setScale(2,BigDecimal.ROUND_HALF_UP).toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     // 设置实际销售额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    systemFormat.setCurrentPrice(new BigDecimal(systemFormat.getTotalSalesInclTax()).divide(new BigDecimal(systemFormat.getUnitSold()),2,BigDecimal.ROUND_HALF_UP).setScale(2,BigDecimal.ROUND_HALF_UP).toEngineeringString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BigDecimal unitSold = new BigDecimal(systemFormat.getUnitSold()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    systemFormat.setCurrentPrice(totalSalesIncTax.divide(unitSold,2,BigDecimal.ROUND_HALF_UP).setScale(2,BigDecimal.ROUND_HALF_UP).toEngineeringString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (Dict.orderStatus.item_401.getItem().equals(systemFormat.getOrderStatus())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         systemFormat.setUnitSold("-"+systemFormat.getUnitSold()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         systemFormat.setSales("-"+systemFormat.getSales()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1325,15 +1329,27 @@ public class OrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (Objects.nonNull(systemFormat.getCurrentPrice()) && Objects.nonNull(systemFormat.getEdlp())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     // 设置扣率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    systemFormat.setDeductionRate(new BigDecimal(1).subtract(new BigDecimal(systemFormat.getCurrentPrice()).divide(new BigDecimal(systemFormat.getEdlp()),2,BigDecimal.ROUND_HALF_UP).setScale(2,BigDecimal.ROUND_HALF_UP)).toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BigDecimal edlp = new BigDecimal(systemFormat.getEdlp()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BigDecimal currentPrice = new BigDecimal(systemFormat.getCurrentPrice()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!"0".equals(systemFormat.getEdlp())  && edlp.compareTo(BigDecimal.ZERO)!=0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        systemFormat.setDeductionRate(new BigDecimal(1).subtract(currentPrice.divide(edlp, 4, BigDecimal.ROUND_HALF_UP)).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP).toString()+"%"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (Objects.nonNull(systemFormat.getCostPrice())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         // 设置GP ¥ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        systemFormat.setGp1(new BigDecimal(systemFormat.getCurrentPrice()).subtract(new BigDecimal(systemFormat.getCostPrice())).setScale(4,BigDecimal.ROUND_HALF_UP).toEngineeringString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        systemFormat.setGp1(currentPrice.subtract(new BigDecimal(systemFormat.getCostPrice())).setScale(2,BigDecimal.ROUND_HALF_UP).toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         // 设置GP % 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        systemFormat.setGp2(new BigDecimal(systemFormat.getGp1()).divide(new BigDecimal(systemFormat.getCurrentPrice()),4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(4,BigDecimal.ROUND_HALF_UP).toString()+"%"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (!"0".equals(systemFormat.getCurrentPrice()) && StringUtils.isNotEmpty(systemFormat.getCurrentPrice()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                && currentPrice.compareTo(BigDecimal.ZERO)!=0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            BigDecimal gp1 = new BigDecimal(systemFormat.getGp1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            systemFormat.setGp2(gp1.divide(currentPrice, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP).toString() + "%"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (Dict.orderStatus.item_401.getItem().equals(systemFormat.getOrderStatus())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            systemFormat.setGp1("-"+systemFormat.getGp1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            systemFormat.setGp2("-"+systemFormat.getGp2()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (!systemFormat.getGp1().contains("-")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                systemFormat.setGp1("-" + systemFormat.getGp1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (StringUtils.isNotEmpty(systemFormat.getGp2()) && !systemFormat.getGp2().contains("-")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                systemFormat.setGp2("-" + systemFormat.getGp2()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1382,6 +1398,7 @@ public class OrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 list.add(map); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // =================================================System Format导出结束===================================== 
			 |