//package com.huimv.admin.timer;
//
//import cn.hutool.core.util.ObjectUtil;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.huimv.admin.entity.BasePigpen;
//import com.huimv.admin.entity.EnergyData;
//import com.huimv.admin.entity.ProdStock;
//import com.huimv.admin.mapper.BaseFarmMapper;
//import com.huimv.admin.mapper.BasePigpenMapper;
//import com.huimv.admin.mapper.EnergyDataMapper;
//import com.huimv.admin.mapper.ProdStockMapper;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.scheduling.annotation.EnableScheduling;
//import org.springframework.scheduling.annotation.Scheduled;
//
//import java.math.BigDecimal;
//import java.math.RoundingMode;
//import java.util.Date;
//
//@Configuration
//@EnableScheduling
//public class EnergyFeedTimer {
//    @Autowired
//    private BasePigpenMapper basePigpenMapper;
//    @Autowired
//    private EnergyDataMapper energyDataMapper;
//    @Autowired
//    private ProdStockMapper prodStockMapper;
//    //华统料塔
////    @Scheduled(cron = "0 0 * * * ? ")
////    private void action(){
////        BigDecimal feedConsume;
////        BasePigpen basePigpen = basePigpenMapper.selectOne(new QueryWrapper<BasePigpen>().lambda()
////                .eq(BasePigpen::getFType, 3)
////                .eq(BasePigpen::getFarmId, 26).last("Limit 1"));
////        if (ObjectUtil.isNotEmpty(basePigpen)){
////            EnergyData energyData = new EnergyData();
////            ProdStock prodStock = prodStockMapper.selectOne(new QueryWrapper<ProdStock>().lambda()
////                    .eq(ProdStock::getFarmId, 26)
////                    .eq(ProdStock::getDisplayType, 0).orderByDesc(ProdStock::getCreatTime).last("LIMIT 1"));
////            if (ObjectUtil.isNotEmpty(prodStock)){
////                feedConsume = BigDecimal.valueOf((800*2.5)*prodStock.getZcl()/1000/12);
////                feedConsume = feedConsume.setScale(2, RoundingMode.UP);
////                energyData.setFeedValue(feedConsume.toString());
////                energyData.setFarmId(26);
////                energyData.setCreateDate(new Date());
////                energyData.setDisplayType(1);
////                energyData.setUnitId(basePigpen.getId());
////                energyData.setUnitName(basePigpen.getBuildName());
////                energyDataMapper.insert(energyData);
////            }
////
////        }
////    }
//    //景宏料塔
//}
