|
@@ -1,13 +1,17 @@
|
|
|
package com.huimv.manager.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
+import com.huimv.manager.entity.vo.DailyVo;
|
|
|
import com.huimv.manager.mapper.DailyTabulateDataDao;
|
|
|
import com.huimv.manager.result.R;
|
|
|
import com.huimv.manager.result.RRException;
|
|
|
+import net.bytebuddy.implementation.bytecode.Throw;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -90,4 +94,47 @@ public class DailyTabulateDataServiceImpl extends ServiceImpl<DailyTabulateDataD
|
|
|
|
|
|
return baseMapper.selectOne(wrapper);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List countAllChange(Map<String, Object> params) {
|
|
|
+ List<DailyVo> list = new ArrayList<>();
|
|
|
+
|
|
|
+ String farmCode = (String)params.get("farmCode");
|
|
|
+ String startDate = (String)params.get("startDate");
|
|
|
+ String endDate = (String)params.get("endDate");
|
|
|
+ String type = (String)params.get("type");
|
|
|
+
|
|
|
+ if (farmCode == null){
|
|
|
+ throw new RRException("请选择牧场");
|
|
|
+ }
|
|
|
+
|
|
|
+ QueryWrapper<DailyTabulateDataEntity> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.eq("farm_code",farmCode);
|
|
|
+ wrapper.ge(StringUtils.isNotBlank(startDate),"statistic_date",startDate);
|
|
|
+ wrapper.ge(StringUtils.isNotBlank(startDate),"statistic_date",endDate);
|
|
|
+ wrapper.groupBy("ydate");
|
|
|
+ wrapper.orderByDesc("statistic_date");
|
|
|
+
|
|
|
+ if ("1".equals(type)){
|
|
|
+ if (StringUtils.isBlank(startDate) || StringUtils.isBlank(endDate)){
|
|
|
+ wrapper.last("limit 7");
|
|
|
+ }
|
|
|
+ list = baseMapper.selectDay(wrapper);
|
|
|
+ }
|
|
|
+ if ("2".equals(type)){
|
|
|
+ if (StringUtils.isBlank(startDate) || StringUtils.isBlank(endDate)){
|
|
|
+ wrapper.last("limit 6");
|
|
|
+ }
|
|
|
+ list = baseMapper.selectMonth(wrapper);
|
|
|
+ }
|
|
|
+ if ("3".equals(type)){
|
|
|
+ if (StringUtils.isBlank(startDate) || StringUtils.isBlank(endDate)){
|
|
|
+ wrapper.last("limit 5");
|
|
|
+ }
|
|
|
+ list = baseMapper.selectYear(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
}
|