|
@@ -5,13 +5,17 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.huimv.management.entity.YearPigBaseEntity;
|
|
|
+import com.huimv.management.entity.vo.CountOut;
|
|
|
import com.huimv.management.entity.vo.DrinkingWaterVo;
|
|
|
import com.huimv.management.entity.vo.PigBaseVo;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.apache.commons.beanutils.BeanUtils;
|
|
|
|
|
|
+import java.lang.reflect.InvocationTargetException;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -147,15 +151,14 @@ public class YearPigBaseServiceImpl extends ServiceImpl<YearPigBaseDao, YearPigB
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public Map<String ,Object> queryPageByRelationship(Map<String, Object> params) {
|
|
|
+ public Map<String ,Object> queryPageByRelationship(Map<String, Object> params) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
String eartag_no = (String) params.get("eartag");
|
|
|
System.out.println(eartag_no);
|
|
|
YearPigBaseEntity self = baseMapper.selectOne(Wrappers.<YearPigBaseEntity>lambdaQuery().eq(YearPigBaseEntity::getEartag, eartag_no));
|
|
|
System.out.println(self);
|
|
|
- result.put("self", self );
|
|
|
-
|
|
|
+ // result.put("self", self );
|
|
|
|
|
|
System.out.println("父亲ID"+self.getFatherEartag()); System.out.println("母亲ID"+self.getMotherEartag());
|
|
|
String math = self.getMotherEartag();
|
|
@@ -164,22 +167,67 @@ public class YearPigBaseServiceImpl extends ServiceImpl<YearPigBaseDao, YearPigB
|
|
|
YearPigBaseEntity mother = self.getMotherEartag() == null ? null : baseMapper.selectOne(Wrappers.<YearPigBaseEntity>lambdaQuery().eq(YearPigBaseEntity::getEartag, math));
|
|
|
|
|
|
|
|
|
-
|
|
|
//父亲父母
|
|
|
- result.put("father", father);
|
|
|
- result.put("mother", mother);
|
|
|
+ // result.put("father", father);
|
|
|
+ // result.put("mother", mother);
|
|
|
YearPigBaseEntity fathermother = father == null ? null : baseMapper.selectOne(Wrappers.<YearPigBaseEntity>lambdaQuery().eq(YearPigBaseEntity::getEartag, father.getFatherEartag()));
|
|
|
YearPigBaseEntity fatherfather = father == null ? null : baseMapper.selectOne(Wrappers.<YearPigBaseEntity>lambdaQuery().eq(YearPigBaseEntity::getEartag, father.getMotherEartag()));
|
|
|
- result.put("fathermother", fathermother);
|
|
|
- result.put("fatherfather", fatherfather);
|
|
|
+ // result.put("fathermother", fathermother);
|
|
|
+ // result.put("fatherfather", fatherfather);
|
|
|
//母亲父母
|
|
|
YearPigBaseEntity mothermother = mother == null ? null : baseMapper.selectOne(Wrappers.<YearPigBaseEntity>lambdaQuery().eq(YearPigBaseEntity::getEartag, mother.getFatherEartag()));
|
|
|
YearPigBaseEntity motherfather = mother == null ? null : baseMapper.selectOne(Wrappers.<YearPigBaseEntity>lambdaQuery().eq(YearPigBaseEntity::getEartag, mother.getMotherEartag()));
|
|
|
- result.put("mothermother", mothermother);
|
|
|
- result.put("motherfather", motherfather);
|
|
|
-
|
|
|
-
|
|
|
+ // result.put("mothermother", mothermother);
|
|
|
+ // result.put("motherfather", motherfather);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Object[] intArr = new Object[7];
|
|
|
+ Map<String, String> selfmap = BeanUtils.describe(self);
|
|
|
+ selfmap.put("name","self");
|
|
|
+ Map<String, String> fathermap = BeanUtils.describe(father);
|
|
|
+ fathermap.put("name","father");
|
|
|
+ Map<String, String> mothermap = BeanUtils.describe(mother);
|
|
|
+ mothermap.put("name","mother");
|
|
|
+ Map<String, String> fathermothermap = BeanUtils.describe(fathermother);
|
|
|
+ fathermothermap.put("name","fathermother");
|
|
|
+ Map<String, String> fatherfatherself = BeanUtils.describe(fatherfather);
|
|
|
+ fatherfatherself.put("name","fatherfather");
|
|
|
+ Map<String, String> mothermotherself = BeanUtils.describe(mothermother);
|
|
|
+ mothermotherself.put("name","mothermother");
|
|
|
+ Map<String, String> motherfatherself = BeanUtils.describe(motherfather);
|
|
|
+ motherfatherself.put("name","motherfather");
|
|
|
+
|
|
|
+
|
|
|
+ intArr[0] = selfmap;
|
|
|
+ intArr[1] = fathermap;
|
|
|
+ intArr[2] = mothermap;
|
|
|
+ intArr[3] = fathermothermap;
|
|
|
+ intArr[4] = fatherfatherself;
|
|
|
+ intArr[5] = mothermotherself;
|
|
|
+ intArr[6] = motherfatherself;
|
|
|
+
|
|
|
+ result.put("value",intArr);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void suchStatistics(String startTime, String endTime, Integer farmId) {
|
|
|
+ QueryWrapper<YearPigBaseEntity> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.eq("farm_id", farmId);
|
|
|
+
|
|
|
+ //开始时间
|
|
|
+ if (StringUtils.isNotEmpty(startTime)) {
|
|
|
+ wrapper.ge("out_fence_time", startTime);
|
|
|
+ }
|
|
|
+ //开始时间
|
|
|
+ if (StringUtils.isNotEmpty(endTime)) {
|
|
|
+ wrapper.le("out_fence_time", endTime);
|
|
|
+ }
|
|
|
+ wrapper.apply("deleted = 0 AND out_fence_status = 1 ");
|
|
|
+
|
|
|
+ List<CountOut> endList = pigBaseDao.suchStatistics(farmId,wrapper);
|
|
|
+ System.out.println(endList);
|
|
|
+ }
|
|
|
}
|