wwh hai 1 ano
pai
achega
4944fb0f24

+ 10 - 0
huimv-admin/src/main/java/com/huimv/admin/controller/ProdProductionController.java

@@ -49,4 +49,14 @@ public class ProdProductionController {
     public Result addProd(HttpServletRequest httpServletRequest, @RequestBody ProdProduction prodProduction) {
         return prodProductionService.addProd(httpServletRequest,prodProduction);
     }
+
+    @RequestMapping("/listScreenProd")
+    public Result listScreenProd(HttpServletRequest httpServletRequest, @RequestBody Map<String, String> paramsMap) {
+        return prodProductionService.listScreenProd(httpServletRequest,paramsMap);
+    }
+
+    @RequestMapping("/addScreenProd")
+    public Result addScreenProd(HttpServletRequest httpServletRequest, @RequestBody Map<String, String> paramsMap) {
+        return prodProductionService.addScreenProd(httpServletRequest,paramsMap);
+    }
 }

+ 5 - 0
huimv-admin/src/main/java/com/huimv/admin/service/IProdProductionService.java

@@ -23,4 +23,9 @@ public interface IProdProductionService extends IService<ProdProduction> {
     Result listProd(HttpServletRequest httpServletRequest, Map<String,String> paramsMap);
 
     Result addProd(HttpServletRequest httpServletRequest, ProdProduction prodProduction);
+
+    //大屏专用
+    Result listScreenProd(HttpServletRequest httpServletRequest, Map<String,String> paramsMap);
+
+    Result addScreenProd(HttpServletRequest httpServletRequest, Map<String,String> paramsMap);
 }

+ 137 - 0
huimv-admin/src/main/java/com/huimv/admin/service/impl/ProdProductionServiceImpl.java

@@ -1,5 +1,7 @@
 package com.huimv.admin.service.impl;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.huimv.admin.common.utils.Result;
 import com.huimv.admin.common.utils.ResultCode;
@@ -88,5 +90,140 @@ public class ProdProductionServiceImpl extends ServiceImpl<ProdProductionMapper,
         return new Result(ResultCode.SUCCESS,"添加成功");
     }
 
+    @Override
+    public Result listScreenProd(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
+        String farmId = paramsMap.get("farmId");
+        QueryWrapper<ProdProduction> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("farm_id", farmId);
+        queryWrapper.orderByDesc("creat_time").last(" limit 1");
+        ProdProduction prodProduction = productionMapper.selectOne(queryWrapper);
+        JSONArray jsonArray = new JSONArray();
+        if ("".equals(prodProduction.getOther1()) || null == prodProduction.getOther1()) {
+            for (int i = 0; i < 4; i++) {
+                JSONObject jsonObject = new JSONObject();
+                if (i == 0) {
+                    jsonObject.put("name", "产房成活率");
+                    jsonObject.put("value", prodProduction.getCfchl());
+                    jsonObject.put("unit", "%");
+                }
+                if (i == 1) {
+                    jsonObject.put("name", "保育成活率");
+                    jsonObject.put("value",prodProduction.getBychl());
+                    jsonObject.put("unit", "%");
+                }
+                if (i == 2) {
+                    jsonObject.put("name", "育肥成活率");
+                    jsonObject.put("value",prodProduction.getYfchl());
+                    jsonObject.put("unit", "%");
+                }
+                if (i == 3) {
+                    jsonObject.put("name", "肥猪成活率");
+                    jsonObject.put("value",prodProduction.getFzchl());
+                    jsonObject.put("unit", "%");
+                }
+                jsonArray.add(jsonObject);
+            }
+        } else {
+            String[] split = prodProduction.getOther1().split(",");
+            for (String s : split) {
+                JSONObject jsonObject = new JSONObject();
+                if ("1".equals(s)) {
+                    jsonObject.put("name", "产房成活率");
+                    jsonObject.put("value", prodProduction.getCfchl());
+                    jsonObject.put("unit", "%");
+                }
+                if ("2".equals(s)) {
+                    jsonObject.put("name", "保育成活率");
+                    jsonObject.put("value",prodProduction.getBychl());
+                    jsonObject.put("unit", "%");
+                }
+                if ("3".equals(s)) {
+                    jsonObject.put("name", "育肥成活率");
+                    jsonObject.put("value",prodProduction.getYfchl());
+                    jsonObject.put("unit", "%");
+                }
+                if ("4".equals(s)) {
+                    jsonObject.put("name", "肥猪成活率");
+                    jsonObject.put("value",prodProduction.getFzchl());
+                    jsonObject.put("unit", "%");
+                }
+                if ("5".equals(s)) {
+                    jsonObject.put("name", "每日喂料量");
+                    jsonObject.put("value",prodProduction.getMrwll());
+                    jsonObject.put("unit", "kg");
+                }
+                if ("6".equals(s)) {
+                    jsonObject.put("name", "日增重");
+                    jsonObject.put("value",prodProduction.getRzz());
+                    jsonObject.put("unit", "kg");
+                }
+                if ("7".equals(s)) {
+                    jsonObject.put("name", "7日断配率");
+                    jsonObject.put("value",prodProduction.getQrdpl());
+                    jsonObject.put("unit", "%");
+                }
+                if ("8".equals(s)) {
+                    jsonObject.put("name", "配种分娩率");
+                    jsonObject.put("value",prodProduction.getPzfml());
+                    jsonObject.put("unit", "%");
+                }
+                if ("9".equals(s)) {
+                    jsonObject.put("name", "平均窝产仔数");
+                    jsonObject.put("value",prodProduction.getPjwczs());
+                    jsonObject.put("unit", "只");
+                }
+                if ("10".equals(s)) {
+                    jsonObject.put("name", "平均窝产活仔数");
+                    jsonObject.put("value",prodProduction.getPjwchzs());
+                    jsonObject.put("unit", "只");
+                }
+                if ("11".equals(s)) {
+                    jsonObject.put("name", "平均窝产正常仔数");
+                    jsonObject.put("value",prodProduction.getPjwczczs());
+                    jsonObject.put("unit", "只");
+                }
+                if ("12".equals(s)) {
+                    jsonObject.put("name", "窝断奶仔猪数");
+                    jsonObject.put("value",prodProduction.getWdnzzs());
+                    jsonObject.put("unit", "只");
+                }
+                if ("13".equals(s)) {
+                    jsonObject.put("name", "平均窝断奶窝重");
+                    jsonObject.put("value",prodProduction.getPjwdnz());
+                    jsonObject.put("unit", "kg");
+                }
+                if ("14".equals(s)) {
+                    jsonObject.put("name", "非生产天数");
+                    jsonObject.put("value",prodProduction.getFccts());
+                    jsonObject.put("unit", "天");
+                }
+                if ("15".equals(s)) {
+                    jsonObject.put("name", "年产窝数");
+                    jsonObject.put("value",prodProduction.getScws());
+                    jsonObject.put("unit", "只");
+                }
+                if ("16".equals(s)) {
+                    jsonObject.put("name", "PSY");
+                    jsonObject.put("value",prodProduction.getPsy());
+                }
+                jsonArray.add(jsonObject);
+            }
+        }
+        return new Result(ResultCode.SUCCESS,jsonArray);
+    }
+
+    @Override
+    public Result addScreenProd(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
+        String farmId = paramsMap.get("farmId");
+        String other1 = paramsMap.get("other1");
+        QueryWrapper<ProdProduction> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("farm_id", farmId);
+        queryWrapper.orderByDesc("creat_time").last(" limit 1");
+        ProdProduction prodProduction = productionMapper.selectOne(queryWrapper);
+        prodProduction.setOther1(other1);
+        productionMapper.updateById(prodProduction);
+        return new Result(10000, "修改成功!", true);
+    }
+
 }