|
|
@@ -14,10 +14,7 @@ import com.huimv.guowei.admin.common.utils.Result;
|
|
|
import com.huimv.guowei.admin.common.utils.ResultCode;
|
|
|
import com.huimv.guowei.admin.common.utils.UploadImage;
|
|
|
import com.huimv.guowei.admin.entity.*;
|
|
|
-import com.huimv.guowei.admin.entity.vo.BaseDuckInfoImportData;
|
|
|
-import com.huimv.guowei.admin.entity.vo.BaseDuckInfoVo;
|
|
|
-import com.huimv.guowei.admin.entity.vo.EnvMoveCallVo;
|
|
|
-import com.huimv.guowei.admin.entity.vo.EnvRegularCallFeedingVo;
|
|
|
+import com.huimv.guowei.admin.entity.vo.*;
|
|
|
import com.huimv.guowei.admin.mapper.*;
|
|
|
import com.huimv.guowei.admin.service.IBaseDuckInfoService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
@@ -399,26 +396,58 @@ public class BaseDuckInfoServiceImpl extends ServiceImpl<BaseDuckInfoMapper, Bas
|
|
|
for (EnvRegularCallFeeding feeding : feedings) {
|
|
|
count = count + feeding.getDuckWeight();
|
|
|
}
|
|
|
- QueryWrapper<EnvRegularCallEgg> queryWrapper3 = new QueryWrapper<>();
|
|
|
- queryWrapper3.eq("chi_num", baseDuckInfo.getChiNum()).
|
|
|
- between(StringUtils.isNotBlank(startTime), "call_date", startTime+" 00:00:00", endTime+" 23:59:59");
|
|
|
- List<EnvRegularCallEgg> eggs = eggMapper.selectList(queryWrapper3);//产蛋
|
|
|
- double count1 = 0;
|
|
|
- Integer eggNum = 0;
|
|
|
- double avgWeight = 0;
|
|
|
- for (EnvRegularCallEgg egg : eggs) {
|
|
|
- count1 = count1 + egg.getDuckWeight();
|
|
|
- eggNum = eggNum + egg.getEggNum();
|
|
|
- if (baseDuckInfo.getDayAge() > 298) {
|
|
|
- avgWeight = egg.getDuckWeight();
|
|
|
+
|
|
|
+ Date resultDate = null;
|
|
|
+ int totalEgg = 0;
|
|
|
+ Date duckBirthday = baseDuckInfo.getDuckBirthday();
|
|
|
+ DateTime date = DateUtil.offsetDay(duckBirthday, 298);
|
|
|
+ Date dateTime = new Date(date.getTime());
|
|
|
+ List<EnvRegularCallEgg> envRegularCallEggs = eggMapper.selectList(new QueryWrapper<EnvRegularCallEgg>().lambda()
|
|
|
+ .eq(EnvRegularCallEgg::getDuckNum,baseDuckInfo.getDuckNum())
|
|
|
+ .ge(EnvRegularCallEgg::getCallDate, dateTime));
|
|
|
+ if (ObjectUtil.isNotEmpty(envRegularCallEggs)){
|
|
|
+ for (EnvRegularCallEgg envRegularCallEgg : envRegularCallEggs) {
|
|
|
+ totalEgg += envRegularCallEgg.getEggNum();
|
|
|
+ if (totalEgg > 3){
|
|
|
+ resultDate = envRegularCallEgg.getCallDate();
|
|
|
+ System.out.println("满足日龄的日期为:"+ resultDate);
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
printEntrty.setBaseDuckInfo(baseDuckInfo);
|
|
|
- printEntrty.setEggNum(String.valueOf(eggNum));
|
|
|
printEntrty.setFeeding(def.format(count));
|
|
|
- printEntrty.setEgging(def.format(count1));
|
|
|
- printEntrty.setAvgWeiht(def.format(avgWeight));
|
|
|
+ Date endDate = new SimpleDateFormat("yyyy-MM-dd").parse(endTime);
|
|
|
+ Date startDate = new SimpleDateFormat("yyyy-MM-dd").parse(startTime);
|
|
|
+ System.out.println("开始时间:" + startDate);
|
|
|
+ System.out.println("结束时间:" + endDate);
|
|
|
+ System.out.println("满足日龄日期:" + dateTime);
|
|
|
+ if (ObjectUtil.isNotEmpty(resultDate)){
|
|
|
+ if (resultDate.after(endDate)){
|
|
|
+ System.out.println("满足日龄在结束日期之后");
|
|
|
+ printEntrty.setEggNum("0");
|
|
|
+ printEntrty.setEgging("0");
|
|
|
+ printEntrty.setAvgWeiht("0");
|
|
|
+ }else {
|
|
|
+ EggVo eggVo = new EggVo();
|
|
|
+ if (resultDate.before(startDate)){
|
|
|
+ System.out.println("满足日龄在开始日期之前");
|
|
|
+ eggVo = eggMapper.print(baseDuckInfo.getDuckNum(),startDate,endDate);
|
|
|
+ }else {
|
|
|
+ System.out.println("满足日龄在开始日期之后");
|
|
|
+ eggVo = eggMapper.print(baseDuckInfo.getDuckNum(),resultDate,endDate);
|
|
|
+ }
|
|
|
+ printEntrty.setEggNum(eggVo.getTotalEgg());
|
|
|
+ printEntrty.setEgging(eggVo.getTotalWeight());
|
|
|
+ printEntrty.setAvgWeiht(eggVo.getAvgWeight());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ System.out.println("日龄不满足");
|
|
|
+ printEntrty.setEggNum("0");
|
|
|
+ printEntrty.setEgging("0");
|
|
|
+ printEntrty.setAvgWeiht("0");
|
|
|
+ }
|
|
|
+
|
|
|
printEntrty.setEnvMoveCalls(envMoveCalls);
|
|
|
list.add(printEntrty);
|
|
|
}
|