shenhao 3 years ago
parent
commit
7219f4f42c
1 changed files with 68 additions and 31 deletions
  1. 68 31
      src/main/java/com/ssj/sys/controller/FxController.java

+ 68 - 31
src/main/java/com/ssj/sys/controller/FxController.java

@@ -2377,29 +2377,29 @@ public class FxController  extends BaseController {
 	        //设置样式;  
 	        XSSFCellStyle style = workbook.createCellStyle();  
 	        //设置底边框;  
-	        style.setBorderBottom(HSSFCellStyle.BORDER_THIN);  
-	        //设置底边框颜色;  
-	        style.setBottomBorderColor(HSSFColor.BLACK.index);  
-	        //设置左边框;  
-	        style.setBorderLeft(HSSFCellStyle.BORDER_THIN);  
-	        //设置左边框颜色;  
-	        style.setLeftBorderColor(HSSFColor.BLACK.index);  
-	        //设置右边框;  
-	        style.setBorderRight(HSSFCellStyle.BORDER_THIN);  
-	        //设置右边框颜色;  
-	        style.setRightBorderColor(HSSFColor.BLACK.index);  
-	        //设置顶边框;  
-	        style.setBorderTop(HSSFCellStyle.BORDER_THIN);  
-	        //设置顶边框颜色;  
-	        style.setTopBorderColor(HSSFColor.BLACK.index);  
+	        style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+	        //设置底边框颜色;
+	        style.setBottomBorderColor(HSSFColor.BLACK.index);
+	        //设置左边框;
+	        style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+	        //设置左边框颜色;
+	        style.setLeftBorderColor(HSSFColor.BLACK.index);
+	        //设置右边框;
+	        style.setBorderRight(HSSFCellStyle.BORDER_THIN);
+	        //设置右边框颜色;
+	        style.setRightBorderColor(HSSFColor.BLACK.index);
+	        //设置顶边框;
+	        style.setBorderTop(HSSFCellStyle.BORDER_THIN);
+	        //设置顶边框颜色;
+	        style.setTopBorderColor(HSSFColor.BLACK.index);
 	        //在样式用应用设置的字体;  
 	         style.setFont(font);  
 	         //设置自动换行;  
 	         style.setWrapText(false);  
 	         //设置水平对齐的样式为居中对齐;  
-	         style.setAlignment(HSSFCellStyle.ALIGN_CENTER);  
-	         //设置垂直对齐的样式为居中对齐;  
-	         style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);  
+	         style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+	         //设置垂直对齐的样式为居中对齐;
+	         style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
 	         return style;  
 	     }  
 
@@ -3890,11 +3890,21 @@ public class FxController  extends BaseController {
 	        List<Map<String, Object>> mapList=page.getContent();
 	        for (Map<String, Object> map : mapList) {
 	        	if(Integer.parseInt(map.get("cap_type").toString())==1) {
-	        		map.put("pr_1",new BigDecimal(new BigDecimal(map.get("price").toString()).doubleValue()/(Integer.parseInt(map.get("buy_month").toString())+Integer.parseInt(map.get("give_month").toString()))/Integer.parseInt(map.get("lib_service").toString())).setScale(2, RoundingMode.UP).doubleValue());
+	        	    if(Integer.parseInt(map.get("lib_service").toString())==0){
+                        map.put("pr_1","");
+                    }else{
+                        map.put("pr_1",new BigDecimal(new BigDecimal(map.get("price").toString()).doubleValue()/(Integer.parseInt(map.get("buy_month").toString())+Integer.parseInt(map.get("give_month").toString()))/Integer.parseInt(map.get("lib_service").toString())).setScale(2, RoundingMode.UP).doubleValue());
+                    }
+
 	        		map.put("pr_2",map.get("price"));
 	        		map.put("pr_3","");
 	        	}else if(Integer.parseInt(map.get("cap_type").toString())==2) {
-	        		map.put("pr_1",new BigDecimal(new BigDecimal(map.get("price").toString()).doubleValue()/(Integer.parseInt(map.get("buy_month").toString())+Integer.parseInt(map.get("give_month").toString()))/Integer.parseInt(map.get("lib_service").toString())).setScale(2, RoundingMode.UP).doubleValue());
+                    if(Integer.parseInt(map.get("lib_service").toString())==0){
+                        map.put("pr_1","");
+                    }else{
+                        map.put("pr_1",new BigDecimal(new BigDecimal(map.get("price").toString()).doubleValue()/(Integer.parseInt(map.get("buy_month").toString())+Integer.parseInt(map.get("give_month").toString()))/Integer.parseInt(map.get("lib_service").toString())).setScale(2, RoundingMode.UP).doubleValue());
+                    }
+
 	        		map.put("pr_2","");
 	        		map.put("pr_3",new BigDecimal(new BigDecimal(map.get("price").toString()).doubleValue()/(Integer.parseInt(map.get("buy_month").toString())+Integer.parseInt(map.get("give_month").toString()))).setScale(2, RoundingMode.UP).doubleValue());
 	        	}else if(Integer.parseInt(map.get("cap_type").toString())==3) {
@@ -3905,12 +3915,22 @@ public class FxController  extends BaseController {
 	        		map.put("pr_1","");
 	        		map.put("pr_2","");
 	        		map.put("pr_3",map.get("price"));
-	        	}else if(Integer.parseInt(map.get("cap_type").toString())==5) { 
-	        		map.put("pr_1", new BigDecimal(new BigDecimal(map.get("price").toString()).doubleValue()*(Integer.parseInt(map.get("buy_month").toString()))/Integer.parseInt(map.get("lib_service").toString())).setScale(2, RoundingMode.UP).doubleValue());
+	        	}else if(Integer.parseInt(map.get("cap_type").toString())==5) {
+                    if(Integer.parseInt(map.get("lib_service").toString())==0){
+                        map.put("pr_1","");
+                    }else{
+                        map.put("pr_1", new BigDecimal(new BigDecimal(map.get("price").toString()).doubleValue()*(Integer.parseInt(map.get("buy_month").toString()))/Integer.parseInt(map.get("lib_service").toString())).setScale(2, RoundingMode.UP).doubleValue());
+                    }
+
 	        		map.put("pr_2", map.get("price"));
 	        		map.put("pr_3","");
 	        	}else if(Integer.parseInt(map.get("cap_type").toString())==6) {
-	        		map.put("pr_1", new BigDecimal(new BigDecimal(map.get("price").toString()).doubleValue()/Integer.parseInt(map.get("lib_service").toString())).setScale(2, RoundingMode.UP).doubleValue());
+                    if(Integer.parseInt(map.get("lib_service").toString())==0){
+                        map.put("pr_1","");
+                    }else{
+                        map.put("pr_1", new BigDecimal(new BigDecimal(map.get("price").toString()).doubleValue()/Integer.parseInt(map.get("lib_service").toString())).setScale(2, RoundingMode.UP).doubleValue());
+                    }
+
 	        		map.put("pr_2","");
 	        		map.put("pr_3",new BigDecimal(new BigDecimal(map.get("price").toString()).doubleValue()/(Integer.parseInt(map.get("buy_month").toString()))).setScale(2, RoundingMode.UP).doubleValue());
 	        	}
@@ -4993,12 +5013,20 @@ public class FxController  extends BaseController {
         
         List<Map<String, Object>> mapList=page.getContent();
         for (Map<String, Object> map : mapList) {
-        	if(Integer.parseInt(map.get("cap_type").toString())==1) {
-        		map.put("pr_1",new BigDecimal(map.get("price").toString()).divide(new BigDecimal(map.get("buy_month").toString()).add(new BigDecimal(map.get("give_month").toString())),RoundingMode.HALF_UP).divide(new BigDecimal(map.get("lib_service").toString()),RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP).doubleValue());
+        	if(Integer.parseInt(map.get("cap_type").toString())==0) {
+        	    if(Integer.parseInt(map.get("lib_service").toString())==0){
+                    map.put("pr_1","");
+                }else{
+                    map.put("pr_1",new BigDecimal(map.get("price").toString()).divide(new BigDecimal(map.get("buy_month").toString()).add(new BigDecimal(map.get("give_month").toString())),RoundingMode.HALF_UP).divide(new BigDecimal(map.get("lib_service").toString()),RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP).doubleValue());
+                }
         		map.put("pr_2",map.get("price"));
         		map.put("pr_3","");
         	}else if(Integer.parseInt(map.get("cap_type").toString())==2) {
-        		map.put("pr_1",new BigDecimal(map.get("price").toString()).divide(new BigDecimal(map.get("buy_month").toString()).add(new BigDecimal(map.get("give_month").toString())),RoundingMode.HALF_UP).divide(new BigDecimal(map.get("lib_service").toString()),RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP).doubleValue());
+                if(Integer.parseInt(map.get("lib_service").toString())==0){
+                    map.put("pr_1","");
+                }else {
+                    map.put("pr_1", new BigDecimal(map.get("price").toString()).divide(new BigDecimal(map.get("buy_month").toString()).add(new BigDecimal(map.get("give_month").toString())), RoundingMode.HALF_UP).divide(new BigDecimal(map.get("lib_service").toString()), RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP).doubleValue());
+                }
         		map.put("pr_2","");
         		map.put("pr_3",new BigDecimal(map.get("price").toString()).divide(new BigDecimal(map.get("buy_month").toString()).add(new BigDecimal(map.get("give_month").toString())),RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP).doubleValue());
         	}else if(Integer.parseInt(map.get("cap_type").toString())==3) {
@@ -5009,13 +5037,22 @@ public class FxController  extends BaseController {
         		map.put("pr_1","");
         		map.put("pr_2","");
         		map.put("pr_3",map.get("price"));
-        	}else if(Integer.parseInt(map.get("cap_type").toString())==5) { 
-        		map.put("pr_1", new BigDecimal(map.get("price").toString()).divide(new BigDecimal(map.get("buy_month").toString())).divide(new BigDecimal(map.get("lib_service").toString()),RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP).doubleValue());
-        		map.put("pr_2", map.get("price"));
+        	}else if(Integer.parseInt(map.get("cap_type").toString())==5) {
+                if(Integer.parseInt(map.get("lib_service").toString())==0){
+                    map.put("pr_1","");
+                }else {
+                    map.put("pr_1", new BigDecimal(map.get("price").toString()).divide(new BigDecimal(map.get("buy_month").toString())).divide(new BigDecimal(map.get("lib_service").toString()), RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP).doubleValue());
+
+                }
+                map.put("pr_2", map.get("price"));
         		map.put("pr_3","");
         	}else if(Integer.parseInt(map.get("cap_type").toString())==6) {
-        		map.put("pr_1", new BigDecimal(map.get("price").toString()).divide(new BigDecimal(map.get("lib_service").toString()),RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP).doubleValue());
-        		map.put("pr_2","");
+                if(Integer.parseInt(map.get("lib_service").toString())==0){
+                    map.put("pr_1","");
+                }else {
+                    map.put("pr_1", new BigDecimal(map.get("price").toString()).divide(new BigDecimal(map.get("lib_service").toString()), RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP).doubleValue());
+                }
+                map.put("pr_2","");
         		map.put("pr_3",new BigDecimal(new BigDecimal(map.get("price").toString()).divide(new BigDecimal(map.get("buy_month").toString()),RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP).doubleValue()));
         	}
 		}