|
@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.huimv.cattle.mapper.SysRegionCounTownVillMapper;
|
|
import com.huimv.cattle.pojo.ProductionCapacity;
|
|
import com.huimv.cattle.pojo.ProductionCapacity;
|
|
import com.huimv.cattle.mapper.ProductionCapacityMapper;
|
|
import com.huimv.cattle.mapper.ProductionCapacityMapper;
|
|
import com.huimv.cattle.pojo.SubsidyCount;
|
|
import com.huimv.cattle.pojo.SubsidyCount;
|
|
@@ -33,6 +34,8 @@ import java.util.*;
|
|
public class ProductionCapacityServiceImpl extends ServiceImpl<ProductionCapacityMapper, ProductionCapacity> implements ProductionCapacityService {
|
|
public class ProductionCapacityServiceImpl extends ServiceImpl<ProductionCapacityMapper, ProductionCapacity> implements ProductionCapacityService {
|
|
@Autowired
|
|
@Autowired
|
|
private ProductionCapacityMapper productionCapacityMapper;
|
|
private ProductionCapacityMapper productionCapacityMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private SysRegionCounTownVillMapper sysRegionCounTownVillMapper;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private DateUtil dateUtil;
|
|
private DateUtil dateUtil;
|
|
@@ -91,6 +94,31 @@ public class ProductionCapacityServiceImpl extends ServiceImpl<ProductionCapacit
|
|
return new Result(ResultCode.SUCCESS);
|
|
return new Result(ResultCode.SUCCESS);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public Result getProductionCapacityScreen(HttpServletRequest request, Map<String, String> paramsMap) {
|
|
|
|
+ String farmCode = paramsMap.get("farmCode");
|
|
|
|
+ if (StringUtils.isBlank(farmCode)) {
|
|
|
|
+ farmCode = TokenSign.getFarmCode(request);
|
|
|
|
+ }
|
|
|
|
+ String[] city = sysRegionCounTownVillMapper.listSub(farmCode).split(",");
|
|
|
|
+ String yearNum = paramsMap.get("yearNum");
|
|
|
|
+ QueryWrapper<ProductionCapacity> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ if (StringUtils.isNotBlank(yearNum)) {
|
|
|
|
+ queryWrapper.between("year", Integer.valueOf(dateUtil.getThisYear()) - Integer.valueOf(yearNum), Integer.valueOf(dateUtil.getThisYear()));
|
|
|
|
+ // queryWrapper.last("LIMIT "+yearNum);
|
|
|
|
+ }
|
|
|
|
+ queryWrapper.orderByDesc("year");
|
|
|
|
+ List<ProductionCapacity> productionCapacities = productionCapacityMapper.getProductionCapacityScreen(city,queryWrapper);
|
|
|
|
+ if (ObjectUtil.isEmpty(productionCapacities)) {
|
|
|
|
+ ProductionCapacity productionCapacity1 = new ProductionCapacity();
|
|
|
|
+ productionCapacity1.setYear(Integer.valueOf(dateUtil.getThisYear()));
|
|
|
|
+ productionCapacity1.setFarmCode(farmCode);
|
|
|
|
+ productionCapacities.add(productionCapacity1);
|
|
|
|
+ productionCapacityMapper.insert(productionCapacity1);
|
|
|
|
+ }
|
|
|
|
+ return new Result(ResultCode.SUCCESS, productionCapacities);
|
|
|
|
+ }
|
|
|
|
+
|
|
private Boolean checkRepeat(List<ProductionCapacity> list) {
|
|
private Boolean checkRepeat(List<ProductionCapacity> list) {
|
|
List<Integer> collectionOptionList = new ArrayList<>();
|
|
List<Integer> collectionOptionList = new ArrayList<>();
|
|
for (ProductionCapacity a : list) {
|
|
for (ProductionCapacity a : list) {
|