|
@@ -4,9 +4,12 @@ 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.pojo.DataSource;
|
|
|
import com.huimv.cattle.pojo.Insure;
|
|
|
import com.huimv.cattle.pojo.VaccineDelivery;
|
|
|
import com.huimv.cattle.pojo.vo.InsureVo;
|
|
|
+import com.huimv.cattle.service.DataSourceService;
|
|
|
import com.huimv.cattle.service.InsureService;
|
|
|
import com.huimv.cattle.utils.FarmCodeUtils;
|
|
|
import com.huimv.common.utils.Result;
|
|
@@ -34,6 +37,10 @@ import java.util.Map;
|
|
|
public class InsureController {
|
|
|
@Autowired
|
|
|
private InsureService insureService;
|
|
|
+ @Autowired
|
|
|
+ private DataSourceService dataSourceService;
|
|
|
+ @Autowired
|
|
|
+ private SysRegionCounTownVillMapper sysRegionCounTownVillMapper;
|
|
|
|
|
|
@PostMapping("/saveInsure")
|
|
|
public Result add(@RequestBody Insure insure , HttpServletRequest request){
|
|
@@ -66,5 +73,23 @@ public class InsureController {
|
|
|
return new Result(ResultCode.SUCCESS,list);
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/getInsureScreen")
|
|
|
+ public Result getInsureScreen(@RequestBody Insure insure, HttpServletRequest request){
|
|
|
+ String farmCode = FarmCodeUtils.getFarmCode(insure.getFarmCode(), request);
|
|
|
+ DataSource dataSource = dataSourceService.getDataSourceStatus();
|
|
|
+ if (dataSource.getDsStatus() == 1 && dataSource.getViewType() == 3){
|
|
|
+ String[] city = sysRegionCounTownVillMapper.listSub(farmCode).split(",");
|
|
|
+ List<Insure> list = insureService.list(new QueryWrapper<Insure>().in("farm_code", city).orderByDesc("insurance_time"));
|
|
|
+ return new Result(ResultCode.SUCCESS,list);
|
|
|
+ }else {
|
|
|
+ List<Insure> list = insureService.list(new QueryWrapper<Insure>().eq("farm_code",farmCode).orderByDesc("insurance_time"));
|
|
|
+ if (ObjectUtil.isEmpty(list)){
|
|
|
+ return new Result(ResultCode.SUCCESS,new ArrayList<>());
|
|
|
+ }
|
|
|
+ return new Result(ResultCode.SUCCESS,list);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|