|
@@ -1,6 +1,7 @@
|
|
|
package com.huimv.management.controller;
|
|
|
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
+import java.text.NumberFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
import com.huimv.management.entity.UnitEntity;
|
|
@@ -152,6 +153,13 @@ public class YearPigBaseController {
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
+ //批量出栏
|
|
|
+ @RequestMapping("/suchApp")
|
|
|
+ public R suchApp(@RequestBody Integer[] ids){
|
|
|
+ yearPigBaseService.suchApp(ids);
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+
|
|
|
//认养未认养比例
|
|
|
@RequestMapping("/outAndInProportion")
|
|
|
public R outAndInProportion(Integer formFarmId){
|
|
@@ -159,13 +167,18 @@ public class YearPigBaseController {
|
|
|
Integer adopted = yearPigBaseService.findByFosterStatus(1,formFarmId);
|
|
|
//未认养
|
|
|
Integer notAdopted = yearPigBaseService.findByFosterStatus(0,formFarmId);
|
|
|
- Map<String,Integer> resultMap = new HashMap<String,Integer>();
|
|
|
+ Map resultMap = new HashMap();
|
|
|
resultMap.put("adopted",adopted);
|
|
|
resultMap.put("notAdopted",notAdopted);
|
|
|
Integer total = notAdopted + adopted;
|
|
|
resultMap.put("total",total);
|
|
|
+ NumberFormat numberFormat = NumberFormat.getInstance();
|
|
|
+ numberFormat.setMaximumFractionDigits(2);
|
|
|
+ String adoptedPercent =numberFormat.format((float)adopted/(float)total*100);
|
|
|
+ String notAdoptedPercent =numberFormat.format((float)notAdopted/(float)total*100);
|
|
|
|
|
|
-
|
|
|
+ resultMap.put("adoptedPercent",adoptedPercent+"%");
|
|
|
+ resultMap.put("notAdoptedPercent",notAdoptedPercent+"%");
|
|
|
|
|
|
return R.ok().put("data",resultMap);
|
|
|
}
|