|
@@ -1,14 +1,16 @@
|
|
|
package com.huimv.production.service.impl;
|
|
|
|
|
|
+import com.huimv.production.domain.MLaborRoomHeatEntity;
|
|
|
import com.huimv.production.domain.MSowChildbirthRecordEntity;
|
|
|
-import com.huimv.production.repo.MSowChildbirthRecordEntityRepo;
|
|
|
+import com.huimv.production.domain.MSowEntity;
|
|
|
+import com.huimv.production.repo.*;
|
|
|
import com.huimv.production.result.Result;
|
|
|
import com.huimv.production.service.MSowChildbirthRecordService;
|
|
|
import com.huimv.production.service.MSowService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* @Project : huimv.shiwan
|
|
@@ -22,6 +24,8 @@ public class MSowChildbitrhRecordServiceImpl implements MSowChildbirthRecordServ
|
|
|
@Autowired
|
|
|
private MSowChildbirthRecordEntityRepo childcareEntityRepo;
|
|
|
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public Result add(MSowChildbirthRecordEntity childcareEntity) {
|
|
|
if (childcareEntity == null){
|
|
@@ -73,5 +77,182 @@ public class MSowChildbitrhRecordServiceImpl implements MSowChildbirthRecordServ
|
|
|
return new Result(10001,"查询失败",null);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result findAllByLaborRoomState(Integer laborRoomState) {
|
|
|
+
|
|
|
+ List<MSowChildbirthRecordEntity> allByLaborRoomState = childcareEntityRepo.findAllByLaborRoomState(laborRoomState);
|
|
|
+
|
|
|
+ List list = new ArrayList();
|
|
|
+ switch (laborRoomState){
|
|
|
+ case 0:
|
|
|
+ for (MSowChildbirthRecordEntity record : allByLaborRoomState) {
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put("roomNo",record.getRoomCode());
|
|
|
+ map.put("roomState","空闲");
|
|
|
+ map.put("id",record.getId());
|
|
|
+ list.add(map);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ for (MSowChildbirthRecordEntity record : allByLaborRoomState) {
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put("roomNo",record.getRoomCode());
|
|
|
+ map.put("sowCode",record.getSowCode());
|
|
|
+ map.put("roomState","待产");
|
|
|
+ map.put("conceptionDate",record.getConceptionDate());
|
|
|
+ map.put("intoRoomDate",record.getIntoRoomDate());
|
|
|
+ map.put("id",record.getId());
|
|
|
+ list.add(map);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ for (MSowChildbirthRecordEntity record : allByLaborRoomState) {
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put("roomNo",record.getRoomCode());
|
|
|
+ map.put("sowCode",record.getSowCode());
|
|
|
+ map.put("birthState",record.getBirthState());
|
|
|
+ map.put("conceptionDate",record.getConceptionDate());
|
|
|
+ map.put("intoRoomDate",record.getIntoRoomDate());
|
|
|
+ map.put("id",record.getId());
|
|
|
+// map.put("")
|
|
|
+ list.add(map);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ for (MSowChildbirthRecordEntity record : allByLaborRoomState) {
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put("roomNo",record.getRoomCode());
|
|
|
+ map.put("sowCode",record.getSowCode());
|
|
|
+ map.put("state","哺乳");
|
|
|
+ map.put("conceptionDate",record.getConceptionDate());
|
|
|
+ map.put("intoRoomDate",record.getIntoRoomDate());
|
|
|
+ map.put("finishDate",record.getFinishDate());
|
|
|
+ map.put("id",record.getId());
|
|
|
+ list.add(map);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ for (MSowChildbirthRecordEntity record : allByLaborRoomState) {
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put("roomNo",record.getRoomCode());
|
|
|
+ map.put("sowCode",record.getSowCode());
|
|
|
+ map.put("state","断奶");
|
|
|
+ map.put("days",record.getDays());
|
|
|
+ map.put("quantity",record.getQuantity());
|
|
|
+ map.put("incubatorHeat",record.getIncubatorHeat());
|
|
|
+ map.put("id",record.getId());
|
|
|
+ list.add(map);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return new Result(10000,"成功",list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MLaborRoomHeatEntityRepo roomRepo;
|
|
|
+ @Autowired
|
|
|
+ private MSowAnimalHeatEntityRepo sowRepo;
|
|
|
+ @Autowired
|
|
|
+ private MIncubatorHeatEntityRepo boxRepo;
|
|
|
+ @Autowired
|
|
|
+ private MChildbirthProgressEntityRepo progressEntityRepo;
|
|
|
+ @Autowired
|
|
|
+ private MFeedDetailEntityRepo detailEntityRepo;
|
|
|
+ @Autowired
|
|
|
+ private MPigletHealthCountEntityRepo countEntityRepo;
|
|
|
+ @Autowired
|
|
|
+ private MSowEntityRepo sowEntityRepo;
|
|
|
+ @Autowired
|
|
|
+ private MSowCopulationEntityRepo sowCopulationEntityRepo;
|
|
|
+ @Autowired
|
|
|
+ private MSowPregnancyTestEntityRepo testEntityRepo;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result findById(Integer id) {
|
|
|
+
|
|
|
+ MSowChildbirthRecordEntity record = childcareEntityRepo.findById(id).get();
|
|
|
+ Map endMap = new HashMap();
|
|
|
+
|
|
|
+ endMap.put("sowNo",record.getSowCode());
|
|
|
+ endMap.put("age",record.getAge());
|
|
|
+ endMap.put("birthNo",record.getBirthNo());
|
|
|
+ endMap.put("quantity",record.getQuantity());
|
|
|
+ //母猪信息
|
|
|
+ endMap.put("sow",sowEntityRepo.findBySowCode(record.getSowCode()));
|
|
|
+ //配种信息
|
|
|
+ endMap.put("sowCopulationEntityRepo",sowCopulationEntityRepo.findAllBySowCode(record.getSowCode()));
|
|
|
+ //娠检信息
|
|
|
+ endMap.put("pregnancy",testEntityRepo.findAllBySowCode(record.getSowCode()));
|
|
|
+ //产仔分布图
|
|
|
+ endMap.put("littlePig",countEntityRepo.findAllBySowCode(Integer.parseInt(record.getSowCode())));
|
|
|
+
|
|
|
+
|
|
|
+ endMap.put("day",record.getDays());
|
|
|
+ endMap.put("total",record.getTotal());
|
|
|
+ endMap.put("boyPig",record.getBoarPigletTotal());
|
|
|
+ endMap.put("girlPig",record.getSowPigletTotal());
|
|
|
+ switch (record.getLaborRoomState()){
|
|
|
+ case 1:
|
|
|
+ //产房温度
|
|
|
+ List<MLaborRoomHeatEntity> allByRoomCode = roomRepo.findAllByRoomCode(record.getRoomCode());
|
|
|
+ endMap.put("roomHeat",allByRoomCode);
|
|
|
+ /* List list = new ArrayList();
|
|
|
+ for (MLaborRoomHeatEntity roomHeat : allByRoomCode) {
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put("time",roomHeat.getDate());
|
|
|
+ map.put("heat",roomHeat.getDate());
|
|
|
+ list.add(map);
|
|
|
+ }
|
|
|
+ endMap.put("roomHeat",list);*/
|
|
|
+ //母猪温度
|
|
|
+ List allByLocationId = sowRepo.findAllByLocationId(Integer.parseInt(record.getSowCode()));
|
|
|
+ endMap.put("sowHeat",allByLocationId);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+
|
|
|
+
|
|
|
+ //产房温度
|
|
|
+ endMap.put("roomHeat",roomRepo.findAllByRoomCode(record.getRoomCode()));
|
|
|
+ //母猪温度
|
|
|
+ endMap.put("sowHeat",sowRepo.findAllByLocationId(Integer.parseInt(record.getSowCode())));
|
|
|
+ //保温箱温度
|
|
|
+ endMap.put("boxHeat",boxRepo.findAllByRoomCode(record.getRoomCode()));
|
|
|
+ //产仔进度图
|
|
|
+ endMap.put("progress",progressEntityRepo.findAllByRoomCode(record.getRoomCode()));
|
|
|
+
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ endMap.put("startTime",record.getFirstDate());
|
|
|
+ endMap.put("endTime",record.getFinishDate());
|
|
|
+ endMap.put("total",record.getTotal());
|
|
|
+ endMap.put("weight",record.getAverageWeight());
|
|
|
+ //产房温度
|
|
|
+ endMap.put("roomHeat",roomRepo.findAllByRoomCode(record.getRoomCode()));
|
|
|
+ //母猪温度
|
|
|
+ endMap.put("sowHeat",sowRepo.findAllByLocationId(Integer.parseInt(record.getSowCode())));
|
|
|
+ //保温箱温度
|
|
|
+ endMap.put("boxHeat",boxRepo.findAllByRoomCode(record.getRoomCode()));
|
|
|
+ //智能饲喂
|
|
|
+ endMap.put("eat",detailEntityRepo.findAllByRoomCode(record.getRoomCode()));
|
|
|
+// //猪仔分布图
|
|
|
+// endMap.put("littlePig",countEntityRepo.findAllByRoomCode(record.getRoomCode()));
|
|
|
+
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ endMap.put("startTime",record.getFirstDate());
|
|
|
+ endMap.put("endTime",record.getFinishDate());
|
|
|
+ endMap.put("total",record.getTotal());
|
|
|
+ endMap.put("weight",record.getAverageWeight());
|
|
|
+ //保温箱温度
|
|
|
+ endMap.put("boxHeat",boxRepo.findAllByRoomCode(record.getRoomCode()));
|
|
|
+// //猪仔分布图
|
|
|
+// endMap.put("littlePig",countEntityRepo.findAllByRoomCode(record.getRoomCode()));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return new Result(10000,"成功",endMap);
|
|
|
+ }
|
|
|
+
|
|
|
}
|