|
@@ -4,9 +4,13 @@ package com.huimv.cattle.controller;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.huimv.cattle.mapper.SysRegionCounTownVillMapper;
|
|
|
+import com.huimv.cattle.mapper.VaccineDeliveryMapper;
|
|
|
+import com.huimv.cattle.pojo.DataSource;
|
|
|
import com.huimv.cattle.pojo.FarmStockRank;
|
|
|
import com.huimv.cattle.pojo.VaccineDelivery;
|
|
|
import com.huimv.cattle.pojo.vo.VaccineDeliveryVo;
|
|
|
+import com.huimv.cattle.service.DataSourceService;
|
|
|
import com.huimv.cattle.service.VaccineDeliveryService;
|
|
|
import com.huimv.cattle.utils.FarmCodeUtils;
|
|
|
import com.huimv.common.utils.Result;
|
|
@@ -36,6 +40,12 @@ import java.util.Map;
|
|
|
public class VaccineDeliveryController {
|
|
|
@Autowired
|
|
|
private VaccineDeliveryService vaccineDeliveryService;
|
|
|
+ @Autowired
|
|
|
+ private DataSourceService dataSourceService;
|
|
|
+ @Autowired
|
|
|
+ private SysRegionCounTownVillMapper sysRegionCounTownVillMapper;
|
|
|
+ @Autowired
|
|
|
+ private VaccineDeliveryMapper vaccineDeliveryMapper;
|
|
|
|
|
|
@PostMapping("/saveVaccineDelivery")
|
|
|
@Transactional
|
|
@@ -81,8 +91,35 @@ public class VaccineDeliveryController {
|
|
|
yearNum ="0";
|
|
|
}
|
|
|
int year = DateUtil.year(new Date());
|
|
|
- List<VaccineDelivery> list = vaccineDeliveryService.list(new QueryWrapper<VaccineDelivery>().eq("farm_code",farmCode).ge("year", (year - Integer.parseInt(yearNum))));
|
|
|
+ List<VaccineDelivery> list = vaccineDeliveryService.list(new QueryWrapper<VaccineDelivery>()
|
|
|
+ .eq("farm_code",farmCode)
|
|
|
+ .ge("year", (year - Integer.parseInt(yearNum))));
|
|
|
return new Result(ResultCode.SUCCESS,list);
|
|
|
}
|
|
|
+
|
|
|
+ @PostMapping("/getVaccineDeliveryScreen")
|
|
|
+ public Result getVaccineDeliveryScreen(@RequestBody Map<String,String> paramMap, HttpServletRequest request){
|
|
|
+ String yearNum = paramMap.get("yearNum");
|
|
|
+ String farmCode = FarmCodeUtils.getFarmCode(paramMap.get("farmCode"), request);
|
|
|
+ if (StringUtils.isBlank(yearNum)){
|
|
|
+ yearNum ="0";
|
|
|
+ }
|
|
|
+ int year = DateUtil.year(new Date());
|
|
|
+ DataSource dataSource = dataSourceService.getDataSourceStatus();
|
|
|
+
|
|
|
+ if (dataSource.getDsStatus() == 1 && dataSource.getViewType() == 3){
|
|
|
+ String[] city = sysRegionCounTownVillMapper.listSub(farmCode).split(",");
|
|
|
+ QueryWrapper<VaccineDelivery> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.ge("year", (year - Integer.parseInt(yearNum))).orderByDesc("year").in("farm_code",city).groupBy("year");
|
|
|
+ List<VaccineDelivery> list = vaccineDeliveryMapper.getVaccineDeliveryScreen(queryWrapper);
|
|
|
+ return new Result(ResultCode.SUCCESS,list);
|
|
|
+ }else {
|
|
|
+ List<VaccineDelivery> list = vaccineDeliveryService.list(new QueryWrapper<VaccineDelivery>()
|
|
|
+ .eq("farm_code",farmCode)
|
|
|
+ .ge("year", (year - Integer.parseInt(yearNum))));
|
|
|
+ return new Result(ResultCode.SUCCESS,list);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|