|
@@ -33,7 +33,6 @@ import java.util.ArrayList;
|
|
|
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;
|
|
|
import com.huimv.common.utils.PageUtils;
|
|
@@ -85,59 +84,60 @@ public class YearPigBaseServiceImpl extends ServiceImpl<YearPigBaseDao, YearPigB
|
|
|
//耳标
|
|
|
String eartag = (String) params.get("eartag");
|
|
|
if (StringUtils.isNotEmpty(eartag)) {
|
|
|
- queryWrapper.like("base.eartag", eartag);
|
|
|
+ queryWrapper.like("base.eartag",eartag);
|
|
|
}
|
|
|
|
|
|
//性别
|
|
|
String sex = (String) params.get("sex");
|
|
|
if (StringUtils.isNotEmpty(sex)) {
|
|
|
- queryWrapper.eq("base.sex", sex);
|
|
|
+ queryWrapper.eq("base.sex",sex);
|
|
|
}
|
|
|
|
|
|
//品种
|
|
|
String breed = (String) params.get("breed");
|
|
|
if (StringUtils.isNotEmpty(breed)) {
|
|
|
- queryWrapper.eq("base.breed", breed);
|
|
|
+ queryWrapper.eq("base.breed",breed);
|
|
|
}
|
|
|
|
|
|
//健康状态
|
|
|
String healthStatus = (String) params.get("healthStatus");
|
|
|
if (StringUtils.isNotEmpty(healthStatus)) {
|
|
|
- queryWrapper.eq("base.health_status", Integer.parseInt(healthStatus));
|
|
|
+ queryWrapper.eq("base.health_status",Integer.parseInt(healthStatus));
|
|
|
}
|
|
|
|
|
|
//养殖状态
|
|
|
String outFenceStatus = (String) params.get("outFenceStatus");
|
|
|
if (StringUtils.isNotEmpty(outFenceStatus)) {
|
|
|
- queryWrapper.eq("base.out_fence_status", Integer.parseInt(outFenceStatus));
|
|
|
+ queryWrapper.eq("base.out_fence_status",Integer.parseInt(outFenceStatus));
|
|
|
}
|
|
|
|
|
|
//栏期
|
|
|
String periodId = (String) params.get("periodId");
|
|
|
if (StringUtils.isNotEmpty(periodId)) {
|
|
|
- queryWrapper.eq("base.period_id", Integer.parseInt(periodId));
|
|
|
+ queryWrapper.eq("base.period_id",Integer.parseInt(periodId));
|
|
|
}
|
|
|
|
|
|
//栋舍
|
|
|
String pigstyId = (String) params.get("pigstyId");
|
|
|
if (StringUtils.isNotEmpty(pigstyId)) {
|
|
|
- queryWrapper.eq("base.pigsty_id", Integer.parseInt(pigstyId));
|
|
|
+ queryWrapper.eq("base.pigsty_id",Integer.parseInt(pigstyId));
|
|
|
}
|
|
|
//单元
|
|
|
String unitId = (String) params.get("unitId");
|
|
|
if (StringUtils.isNotEmpty(unitId)) {
|
|
|
- queryWrapper.eq("base.unit_id", Integer.parseInt(unitId));
|
|
|
+ queryWrapper.eq("base.unit_id",Integer.parseInt(unitId));
|
|
|
}
|
|
|
|
|
|
//牧场
|
|
|
String farmId = (String) params.get("formFarmId");
|
|
|
if (StringUtils.isNotEmpty(farmId)) {
|
|
|
- queryWrapper.eq("base.farm_id", Integer.parseInt(farmId));
|
|
|
+ queryWrapper.eq("base.farm_id",Integer.parseInt(farmId));
|
|
|
}
|
|
|
//排除逻辑删除
|
|
|
queryWrapper.apply(" base.deleted = 0 AND pigsty.deleted = 0 AND period.deleted = 0");
|
|
|
|
|
|
- IPage<PigBaseVo> page = pigBaseDao.list(new Query<>().getPage(params), queryWrapper);
|
|
|
+ IPage<PigBaseVo> page = pigBaseDao.list(new Query<>().getPage(params),queryWrapper);
|
|
|
+
|
|
|
|
|
|
|
|
|
return new PageUtils(page);
|
|
@@ -145,10 +145,10 @@ public class YearPigBaseServiceImpl extends ServiceImpl<YearPigBaseDao, YearPigB
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public void batchLairage(String[] eartags, Integer periodId) {
|
|
|
+ public void batchLairage(String[] eartags,Integer periodId) {
|
|
|
for (String eartag : eartags) {
|
|
|
UpdateWrapper<YearPigBaseEntity> updateWrapper = new UpdateWrapper<YearPigBaseEntity>();
|
|
|
- updateWrapper.eq("eartag", eartag).set("period_id", periodId);
|
|
|
+ updateWrapper.eq("eartag",eartag).set("period_id",periodId);
|
|
|
update(updateWrapper);
|
|
|
}
|
|
|
}
|
|
@@ -161,60 +161,61 @@ public class YearPigBaseServiceImpl extends ServiceImpl<YearPigBaseDao, YearPigB
|
|
|
@Override
|
|
|
public Integer findByoutFenceStatus(int i, Integer farmId) {
|
|
|
LambdaQueryWrapper<YearPigBaseEntity> wrapper = Wrappers.lambdaQuery();
|
|
|
- wrapper.eq(YearPigBaseEntity::getFarmId, farmId);
|
|
|
- wrapper.eq(YearPigBaseEntity::getOutFenceStatus, i);
|
|
|
+ wrapper.eq(YearPigBaseEntity::getFarmId,farmId);
|
|
|
+ wrapper.eq(YearPigBaseEntity::getOutFenceStatus,i);
|
|
|
Integer integer = pigBaseDao.selectCount(wrapper);
|
|
|
return integer;
|
|
|
}
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, Object> queryPageByRelationship(Map<String, Object> params) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
|
|
|
+ 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));
|
|
|
+ YearPigBaseEntity self = baseMapper.selectOne(Wrappers.<YearPigBaseEntity>lambdaQuery().eq(YearPigBaseEntity::getEartag, eartag_no));
|
|
|
System.out.println(self);
|
|
|
// result.put("self", self );
|
|
|
|
|
|
- System.out.println("父亲ID" + self.getFatherEartag());
|
|
|
- System.out.println("母亲ID" + self.getMotherEartag());
|
|
|
+ System.out.println("父亲ID"+self.getFatherEartag()); System.out.println("母亲ID"+self.getMotherEartag());
|
|
|
String math = self.getMotherEartag();
|
|
|
|
|
|
- YearPigBaseEntity father = self.getFatherEartag() == null ? null : baseMapper.selectOne(Wrappers.<YearPigBaseEntity>lambdaQuery().eq(YearPigBaseEntity::getEartag, self.getFatherEartag()));
|
|
|
- YearPigBaseEntity mother = self.getMotherEartag() == null ? null : baseMapper.selectOne(Wrappers.<YearPigBaseEntity>lambdaQuery().eq(YearPigBaseEntity::getEartag, math));
|
|
|
+ YearPigBaseEntity father = self.getFatherEartag() == null ? null : baseMapper.selectOne(Wrappers.<YearPigBaseEntity>lambdaQuery().eq(YearPigBaseEntity::getEartag, self.getFatherEartag()));
|
|
|
+ YearPigBaseEntity mother = self.getMotherEartag() == null ? null : baseMapper.selectOne(Wrappers.<YearPigBaseEntity>lambdaQuery().eq(YearPigBaseEntity::getEartag, math));
|
|
|
|
|
|
|
|
|
//父亲父母
|
|
|
// 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()));
|
|
|
+ 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);
|
|
|
//母亲父母
|
|
|
- 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()));
|
|
|
+ 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);
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
Object[] intArr = new Object[7];
|
|
|
Map<String, String> selfmap = BeanUtils.describe(self);
|
|
|
- selfmap.put("name", "self");
|
|
|
+ selfmap.put("name","self");
|
|
|
Map<String, String> fathermap = BeanUtils.describe(father);
|
|
|
- fathermap.put("name", "father");
|
|
|
+ fathermap.put("name","father");
|
|
|
Map<String, String> mothermap = BeanUtils.describe(mother);
|
|
|
- mothermap.put("name", "mother");
|
|
|
+ mothermap.put("name","mother");
|
|
|
Map<String, String> fathermothermap = BeanUtils.describe(fathermother);
|
|
|
- fathermothermap.put("name", "fathermother");
|
|
|
+ fathermothermap.put("name","fathermother");
|
|
|
Map<String, String> fatherfatherself = BeanUtils.describe(fatherfather);
|
|
|
- fatherfatherself.put("name", "fatherfather");
|
|
|
+ fatherfatherself.put("name","fatherfather");
|
|
|
Map<String, String> mothermotherself = BeanUtils.describe(mothermother);
|
|
|
- mothermotherself.put("name", "mothermother");
|
|
|
+ mothermotherself.put("name","mothermother");
|
|
|
Map<String, String> motherfatherself = BeanUtils.describe(motherfather);
|
|
|
- motherfatherself.put("name", "motherfather");
|
|
|
+ motherfatherself.put("name","motherfather");
|
|
|
|
|
|
|
|
|
intArr[0] = selfmap;
|
|
@@ -225,12 +226,12 @@ public class YearPigBaseServiceImpl extends ServiceImpl<YearPigBaseDao, YearPigB
|
|
|
intArr[5] = mothermotherself;
|
|
|
intArr[6] = motherfatherself;
|
|
|
|
|
|
- result.put("value", intArr);
|
|
|
- return result;
|
|
|
+ result.put("value",intArr);
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void suchStatistics(String startTime, String endTime, Integer farmId) {
|
|
|
+ public List<CountOut> suchStatistics(String startTime, String endTime, Integer farmId) {
|
|
|
QueryWrapper<YearPigBaseEntity> wrapper = new QueryWrapper<>();
|
|
|
wrapper.eq("farm_id", farmId);
|
|
|
|
|
@@ -244,8 +245,28 @@ public class YearPigBaseServiceImpl extends ServiceImpl<YearPigBaseDao, YearPigB
|
|
|
}
|
|
|
wrapper.apply("deleted = 0 AND out_fence_status = 1 ");
|
|
|
|
|
|
- List<CountOut> endList = pigBaseDao.suchStatistics(farmId, wrapper);
|
|
|
- System.out.println(endList);
|
|
|
+ List<CountOut> endList = pigBaseDao.suchStatistics(farmId,wrapper);
|
|
|
+ return endList;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<CountOut> suchStatisteicsMonth(String startTime, String endTime, int 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.suchStatisticsMonth(farmId,wrapper);
|
|
|
+ return endList;
|
|
|
}
|
|
|
|
|
|
@Autowired
|
|
@@ -322,4 +343,6 @@ public class YearPigBaseServiceImpl extends ServiceImpl<YearPigBaseDao, YearPigB
|
|
|
}
|
|
|
transferPeriodLogDao.batchInsert(logEntityList);
|
|
|
}
|
|
|
+
|
|
|
+ }
|
|
|
}
|