|
@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.huimv.cattle.mapper.SysRegionCounTownVillMapper;
|
|
|
import com.huimv.cattle.pojo.IndustryOutput;
|
|
|
import com.huimv.cattle.pojo.SubsidyCount;
|
|
|
import com.huimv.cattle.mapper.SubsidyCountMapper;
|
|
@@ -34,6 +35,8 @@ import java.util.*;
|
|
|
public class SubsidyCountServiceImpl extends ServiceImpl<SubsidyCountMapper, SubsidyCount> implements SubsidyCountService {
|
|
|
@Autowired
|
|
|
private SubsidyCountMapper subsidyCountMapper;
|
|
|
+ @Autowired
|
|
|
+ private SysRegionCounTownVillMapper sysRegionCounTownVillMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private DateUtil dateUtil;
|
|
@@ -94,6 +97,33 @@ public class SubsidyCountServiceImpl extends ServiceImpl<SubsidyCountMapper, Sub
|
|
|
return new Result(ResultCode.SUCCESS);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Result getSubsidyCountScreen(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<SubsidyCount> queryWrapper = new QueryWrapper<SubsidyCount>();
|
|
|
+ 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<SubsidyCount> subsidyCounts = subsidyCountMapper.getSubsidyCountScreen(city,queryWrapper);
|
|
|
+ if (ObjectUtil.isEmpty(subsidyCounts)) {
|
|
|
+ SubsidyCount subsidyCount1 = new SubsidyCount();
|
|
|
+ subsidyCount1.setYear(Integer.valueOf(dateUtil.getThisYear()));
|
|
|
+ subsidyCount1.setSubsidyCount(BigDecimal.ZERO);
|
|
|
+ subsidyCount1.setFarmCode(farmCode);
|
|
|
+ subsidyCounts.add(subsidyCount1);
|
|
|
+ subsidyCountMapper.insert(subsidyCount1);
|
|
|
+ }
|
|
|
+ return new Result(ResultCode.SUCCESS, subsidyCounts);
|
|
|
+ }
|
|
|
+
|
|
|
private Boolean checkRepeat(List<SubsidyCount> list) {
|
|
|
List<Integer> collectionOptionList = new ArrayList<>();
|
|
|
for (SubsidyCount a : list) {
|