瀏覽代碼

金猪售猪记录

523096025 3 年之前
父節點
當前提交
1649ffb313

+ 3 - 18
huimv-goldpig/huimv-goldpig-anquisition/src/main/java/com/huimv/acquisition/controller/BasePigpenController.java

@@ -57,7 +57,6 @@ public class BasePigpenController {
     @RequestMapping("/list")
     public R list(@RequestParam Map<String, Object> params){
         PageUtils page = basePigpenService.queryPage(params);
-
         return R.ok().put("page", page);
     }
 
@@ -65,8 +64,6 @@ public class BasePigpenController {
 
      /**
       * 展示牧场下面的栋的信息
-      * @param params
-      * @return
       */
      @RequestMapping("/listFarmPigPen")
      public R listPigPen(@RequestBody Map<String, Object> params){
@@ -74,7 +71,7 @@ public class BasePigpenController {
          LambdaQueryWrapper<BasePigpenEntity> wrapper = Wrappers.lambdaQuery();
          wrapper.eq(BasePigpenEntity::getFarmId,farmId).eq(BasePigpenEntity::getParentId,0);
          List<BasePigpenEntity> basePigpenEntities = basePigpenDao.selectList(wrapper);
-         return R.ok().put("page", basePigpenEntities);
+         return R.ok().put("data", basePigpenEntities);
      }
 
 
@@ -83,8 +80,6 @@ public class BasePigpenController {
 
      /**
       * 展示牧场下面的舍的信息
-      * @param params
-      * @return
       */
      @RequestMapping("/listFarmUnit")
      public R listFarmUnit(@RequestBody Map<String, Object> params){
@@ -96,7 +91,7 @@ public class BasePigpenController {
          LambdaQueryWrapper<BasePigpenEntity> wrapper = Wrappers.lambdaQuery();
          wrapper.eq(BasePigpenEntity::getParentId,penId);
          List<BasePigpenEntity> basePigpenEntities = basePigpenDao.selectList(wrapper);
-         return R.ok().put("page", basePigpenEntities);
+         return R.ok().put("data", basePigpenEntities);
      }
 
 
@@ -107,8 +102,6 @@ public class BasePigpenController {
 
      /**
       * 展示单元下面的耳标实时信息
-      * @param params
-      * @return
       */
      @RequestMapping("/listFarmUnitEartagData")
      public R listFarmUnitEartagData(@RequestBody Map<String, Object> params){
@@ -152,19 +145,11 @@ public class BasePigpenController {
          pageMap.put("limit",eartagParamVo.getLimit());
          IPage<EartagDataVo> page = eartagDataDao.pageIndex(new Query<EartagDataVo>().getPage(pageMap) ,eartagParamVo);
 
-         return R.ok().put("page", page);
+         return R.ok().put("data", page);
      }
 
 
-
-
-
-
-
      /**
-     *
-     *
-     *
      * 信息
      */
     @RequestMapping("/info/{id}")

+ 1 - 1
huimv-goldpig/huimv-goldpig-anquisition/src/main/java/com/huimv/acquisition/result/R.java

@@ -9,7 +9,7 @@ public class R extends HashMap<String, Object> {
     private static final long serialVersionUID = 1L;
 
     public R() {
-        put("code", 0);
+        put("code", 10000);
         put("msg", "success");
     }
 

+ 9 - 0
huimv-goldpig/huimv-goldpig-eartag/src/main/java/com/huimv/eartag/controller/BizSellPigApplyController.java

@@ -2,6 +2,7 @@ package com.huimv.eartag.controller;
 
 
 import com.huimv.common.utils.Result;
+import com.huimv.eartag.entity.BizSellPigApply;
 import com.huimv.eartag.service.IBizSellPigApplyService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -38,4 +39,12 @@ public class BizSellPigApplyController {
         return   iBizSellPigApplyService.sellPigRecordManage(batchNo);
     }
 
+    @PostMapping("/update")
+    public Result update(@RequestBody BizSellPigApply bizSellPigApply){
+        iBizSellPigApplyService.updateById(bizSellPigApply);
+        return  new Result(10000,"修改成功",true);
+    }
+
+
+
 }

+ 13 - 6
huimv-goldpig/huimv-goldpig-eartag/src/main/java/com/huimv/eartag/controller/BizSellPigApplyEartagController.java

@@ -6,6 +6,7 @@ import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.huimv.common.utils.Result;
+import com.huimv.common.utils.ResultCode;
 import com.huimv.eartag.entity.BizSellPigApply;
 import com.huimv.eartag.entity.BizSellPigApplyEartag;
 import com.huimv.eartag.entity.EartagRegisterEntity;
@@ -15,11 +16,7 @@ import com.huimv.eartag.service.IBizSellPigApplyEartagService;
 import com.huimv.eartag.service.IBizSellPigApplyService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -53,12 +50,16 @@ public class BizSellPigApplyEartagController {
     @Transactional
     @PostMapping("/addSellPig")
     public Result addSellPig(@RequestBody SellPig sellPig){
+        String[] eartagNos = sellPig.getEartagNos().split(",");
 
+        if (sellPig.getRealEartagNum() < eartagNos.length){
+            return new Result(10001,"手填耳标少于自动上传耳标,请检查",false);
+        }
         BizSellPigApply bizSellPigApply = new BizSellPigApply();
         BeanUtil.copyProperties(sellPig,bizSellPigApply);
 
 
-        String[] eartagNos = sellPig.getEartagNos().split(",");
+
         String bacthNo = DateUtil.format(new Date(), "yyyyMMddHHmmssSSS");
         bizSellPigApply.setBatchNo(bacthNo);
         bizSellPigApply.setSellTime(new Date());
@@ -88,6 +89,12 @@ public class BizSellPigApplyEartagController {
         return new Result(10000,"申请成功",true);
     }
 
+    @GetMapping("/listByBatch")
+    public Result listByBatch(@RequestParam(name = "batchNo") String batchNo){
+
+        return  new Result(ResultCode.SUCCESS,bizSellPigApplyEartagService.list(new QueryWrapper<BizSellPigApplyEartag>().eq("batch_no",batchNo)));
+    }
+
 
 
 }

+ 3 - 0
huimv-goldpig/huimv-goldpig-eartag/src/main/java/com/huimv/eartag/entity/vo/BizSellPigApplyVo.java

@@ -12,4 +12,7 @@ public class BizSellPigApplyVo {
     private Integer underwayNum;
     //失败数量
     private Integer failNum;
+
+    //未提交
+    private Integer uncommitted;
 }

+ 13 - 6
huimv-goldpig/huimv-goldpig-eartag/src/main/java/com/huimv/eartag/service/impl/BizSellPigApplyServiceImpl.java

@@ -42,6 +42,7 @@ public class BizSellPigApplyServiceImpl extends ServiceImpl<BizSellPigApplyMappe
 
         String current = map.get("current");
         String size =  map.get("size");
+
         Page<BizSellPigApply> bizSellPigApplyPage ;
         if (StringUtils.isBlank(current) || StringUtils.isBlank(size)){
             bizSellPigApplyPage = new Page<>(1, 10);
@@ -50,6 +51,7 @@ public class BizSellPigApplyServiceImpl extends ServiceImpl<BizSellPigApplyMappe
         }
         QueryWrapper<BizSellPigApply> wrapper = new QueryWrapper<>();
         wrapper.eq("farm_id",farmId);
+        wrapper.orderByDesc("sell_time");
         //未提交
         if ("1".equals(type)){
             wrapper.eq("record_status",0);
@@ -98,6 +100,11 @@ public class BizSellPigApplyServiceImpl extends ServiceImpl<BizSellPigApplyMappe
         wrapper.eq("record_status",1);
         bizSellPigApplyVo.setUnderwayNum(this.count(wrapper));
 
+        wrapper.clear();
+        wrapper.eq("farm_id",farmId);
+        wrapper.eq("record_status",2);
+        bizSellPigApplyVo.setUncommitted(this.count(wrapper));
+
         return new Result(ResultCode.SUCCESS,bizSellPigApplyVo);
     }
 
@@ -106,7 +113,7 @@ public class BizSellPigApplyServiceImpl extends ServiceImpl<BizSellPigApplyMappe
 
 
         Map endMap = new HashMap();
-        endMap.put("now",1);
+        endMap.put("now",0);
         List list = new ArrayList();
 
         Map map1 = new HashMap();
@@ -144,12 +151,12 @@ public class BizSellPigApplyServiceImpl extends ServiceImpl<BizSellPigApplyMappe
             map1.put("subTitle",sellTime);
             if (1 == inspecFlowStatus){
                 map2.put("subTitle",inspecTime);
-                endMap.put("now",2);
+                endMap.put("now",1);
             }
             if ( 2== inspecFlowStatus){
                 map2.put("subTitle",inspecTime);
                 map3.put("subTitle",butcherInspecTime);
-                endMap.put("now",3);
+                endMap.put("now",2);
             }
         }
         if ( 3== recordStatus){
@@ -157,19 +164,19 @@ public class BizSellPigApplyServiceImpl extends ServiceImpl<BizSellPigApplyMappe
             map2.put("subTitle",inspecTime);
             map3.put("subTitle",butcherInspecTime);
             map4.put("subTitle",butcherTime);
-            endMap.put("now",4);
+            endMap.put("now",3);
         }
         if ( 4==recordStatus){
             map1.put("subTitle",sellTime);
             map2.put("subTitle","检疫失败");
-            endMap.put("now",2);
+            endMap.put("now",1);
         }
 
         if ( 5==recordStatus){
             map1.put("subTitle",sellTime);
             map2.put("subTitle",inspecTime);
             map3.put("subTitle","屠宰检疫失败");
-            endMap.put("now",3);
+            endMap.put("now",2);
         }
         list.add(map1);
         list.add(map2);