Переглянути джерело

目标管理关于年份的都修改为当前年

jiangbiao 3 роки тому
батько
коміт
44e69f4a08

+ 15 - 1
master/src/main/java/com/ruoyi/project/plant/controller/TTargetagreementController.java

@@ -3,9 +3,11 @@ package com.ruoyi.project.plant.controller;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.text.SimpleDateFormat;
+import java.util.Calendar;
 import java.util.HashMap;
 import java.util.List;
 
+import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.document.DocumentHandler;
 import com.ruoyi.common.utils.document.PDFTemplateUtil;
 import com.ruoyi.framework.config.RuoYiConfig;
@@ -26,6 +28,7 @@ import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
 import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
 import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType;
 import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -77,7 +80,18 @@ public class TTargetagreementController extends BaseController
     public TableDataInfo list(TTargetagreement tTargetagreement)
     {
         startPage();
-        List<TTargetagreement> list = tTargetagreementService.selectTTargetagreementList(tTargetagreement);
+        List<TTargetagreement> list;
+        if (StringUtils.isEmpty(tTargetagreement.getYear())) {
+            Calendar calendar = Calendar.getInstance();
+            tTargetagreement.setYear(String.valueOf(calendar.get(Calendar.YEAR)));
+            list = tTargetagreementService.selectTTargetagreementList(tTargetagreement);
+            if (CollectionUtils.isEmpty(list)){
+                tTargetagreement.setYear(String.valueOf(calendar.get(Calendar.YEAR)-1));
+                list = tTargetagreementService.selectTTargetagreementList(tTargetagreement);
+            }
+        } else {
+            list = tTargetagreementService.selectTTargetagreementList(tTargetagreement);
+        }
         List<SysDictData> partnersDict = iSysDictTypeService.selectDictDataByType("PARTNERS");
         for (TTargetagreement t : list) {
             List<TTargetyardstick> tTargetyardsticks = tTargetyardstickService.selectTTargetyardstickByAgreementId(t.getId());

+ 13 - 1
master/src/main/java/com/ruoyi/project/plant/controller/TTargetlistController.java

@@ -66,7 +66,19 @@ public class TTargetlistController extends BaseController
     @GetMapping("/list")
     public AjaxResult list(TTargetlist tTargetlist)
     {
-        List<TTargetlist> list = tTargetlistService.selectTTargetlistList(tTargetlist);
+
+        List<TTargetlist> list;
+        if (StringUtils.isEmpty(tTargetlist.getYear())) {
+            Calendar calendar = Calendar.getInstance();
+            tTargetlist.setYear(String.valueOf(calendar.get(Calendar.YEAR)));
+            list = tTargetlistService.selectTTargetlistList(tTargetlist);
+            if (CollectionUtils.isEmpty(list)) {
+                tTargetlist.setYear(String.valueOf(calendar.get(Calendar.YEAR)-1));
+                list = tTargetlistService.selectTTargetlistList(tTargetlist);
+            }
+        } else {
+            list = tTargetlistService.selectTTargetlistList(tTargetlist);
+        }
         return AjaxResult.success(list);
     }
 

+ 16 - 5
master/src/main/java/com/ruoyi/project/plant/controller/TTargetreviewController.java

@@ -3,12 +3,10 @@ package com.ruoyi.project.plant.controller;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
+import java.util.*;
 
 import com.alibaba.fastjson.JSON;
+import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.document.DocumentHandler;
 import com.ruoyi.common.utils.document.PDFTemplateUtil;
 import com.ruoyi.common.utils.file.ExcelUtils;
@@ -22,6 +20,7 @@ import com.ruoyi.project.system.domain.SysDictData;
 import com.ruoyi.project.system.service.ISysDeptService;
 import com.ruoyi.project.system.service.ISysDictTypeService;
 import freemarker.template.Template;
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.poi.ss.usermodel.*;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -72,7 +71,19 @@ public class TTargetreviewController extends BaseController
     public TableDataInfo list(TTargetreview tTargetreview)
     {
         startPage();
-        List<TTargetreview> list = tTargetreviewService.selectTTargetreviewList(tTargetreview);
+
+        List<TTargetreview> list;
+        if (tTargetreview.getYear()== null) {
+            Calendar calendar = Calendar.getInstance();
+            tTargetreview.setYear(Long.valueOf(calendar.get(Calendar.YEAR)));
+            list = tTargetreviewService.selectTTargetreviewList(tTargetreview);
+            if (CollectionUtils.isEmpty(list)){
+                tTargetreview.setYear(Long.valueOf(calendar.get(Calendar.YEAR)-1));
+                list = tTargetreviewService.selectTTargetreviewList(tTargetreview);
+            }
+        } else {
+            list = tTargetreviewService.selectTTargetreviewList(tTargetreview);
+        }
         for (TTargetreview t : list) {
             if (t.getPrincipal() != null) {
                 String[] principal = t.getPrincipal().split(",");