Sfoglia il codice sorgente

统计列表导出开发

anderx 2 anni fa
parent
commit
a471d82d91

+ 18 - 1
src/main/java/com/goafanti/expenseAccount/controller/ExpenseAccountController.java

@@ -4,18 +4,23 @@ import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.CertifyApiController;
 import com.goafanti.common.utils.ParamUtils;
+import com.goafanti.common.utils.excel.NewExcelUtil;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.expenseAccount.bo.InputExpenseAccount;
 import com.goafanti.expenseAccount.bo.InputExpenseAccountDetails;
 import com.goafanti.expenseAccount.bo.InputPageListBo;
+import com.goafanti.expenseAccount.bo.OutExpenseAccountStatistics;
 import com.goafanti.expenseAccount.service.ExpenseAccountService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.validation.BindingResult;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 @RestController
 @RequestMapping("/api/admin/expenseAccount")
 public class ExpenseAccountController extends CertifyApiController {
@@ -23,6 +28,9 @@ public class ExpenseAccountController extends CertifyApiController {
     @Autowired
     private ExpenseAccountService expenseAccountService;
 
+    @Value(value = "${upload.path}")
+    private final String	uploadPath			= null;
+
     /**
      * 新增私有报销帐号
      * @param in
@@ -199,6 +207,13 @@ public class ExpenseAccountController extends CertifyApiController {
         return res;
     }
 
+    @RequestMapping(value = "/statistics/evict",method = RequestMethod.GET)
+    public Result statisticsEvict(String name,String depId,String startTime,String endTime){
+        Result res=new Result();
+        expenseAccountService.statisticsEvict(  name, depId, startTime, endTime);
+        return res.data(1);
+    }
+
 
     /**
      * 获取后台统计数据
@@ -206,7 +221,9 @@ public class ExpenseAccountController extends CertifyApiController {
      */
     @RequestMapping(value = "/statistics/export",method = RequestMethod.GET)
     public Result statisticsExport(String name,String depId,String startTime,String endTime){
-        return expenseAccountService.statisticsExport( name, depId, startTime, endTime);
+        List<OutExpenseAccountStatistics> list = expenseAccountService.statistics( name,  depId,  startTime,  endTime);
+        NewExcelUtil<OutExpenseAccountStatistics> newExcelUtil=new NewExcelUtil<>(OutExpenseAccountStatistics.class);
+        return newExcelUtil.exportExcel(list,"报销统计",uploadPath);
     }
 
 

+ 3 - 3
src/main/java/com/goafanti/expenseAccount/service/ExpenseAccountService.java

@@ -1,6 +1,5 @@
 package com.goafanti.expenseAccount.service;
 
-import com.goafanti.common.bo.Result;
 import com.goafanti.expenseAccount.bo.*;
 
 import java.util.List;
@@ -32,7 +31,8 @@ public interface ExpenseAccountService {
 
     List<OutExpenseAccount> selectDebitOrder(String depId);
 
-    Object statistics(String name,String depId,String startTime,String endTime);
+    List<OutExpenseAccountStatistics> statistics(String name,String depId,String startTime,String endTime);
 
-    Result statisticsExport(String name, String depId, String startTime, String endTime);
+
+    void statisticsEvict(String name, String depId, String startTime, String endTime);
 }

+ 10 - 9
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -3,7 +3,6 @@ package com.goafanti.expenseAccount.service.impl;
 import com.goafanti.admin.bo.AdminListBo;
 import com.goafanti.common.bo.AdminNoticeBo;
 import com.goafanti.common.bo.EmailBo;
-import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.*;
 import com.goafanti.common.enums.NoticeStatus;
@@ -12,15 +11,15 @@ import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.*;
 import com.goafanti.common.utils.AsyncUtils;
 import com.goafanti.common.utils.DateUtils;
+import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.common.utils.WeChatUtils;
-import com.goafanti.common.utils.excel.NewExcelUtil;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.expenseAccount.Enums.EAProcessStatus;
 import com.goafanti.expenseAccount.bo.*;
 import com.goafanti.expenseAccount.service.ExpenseAccountService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
@@ -48,8 +47,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
     @Autowired
     private ExpenseAccountExamineMapper expenseAccountExamineMapper;
 
-    @Value(value = "${upload.path}")
-    private final String	uploadPath			= null;
+
 
 
 
@@ -670,9 +668,12 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
     }
 
     @Override
-    public Result statisticsExport(String name, String depId, String startTime, String endTime) {
-        List<OutExpenseAccountStatistics> list = statistics( name,  depId,  startTime,  endTime);
-        NewExcelUtil<OutExpenseAccountStatistics> newExcelUtil=new NewExcelUtil<>(OutExpenseAccountStatistics.class);
-        return newExcelUtil.exportExcel(list,"报销统计",uploadPath);
+    @CacheEvict(value = "expenseAccountStatistics#300", key = "'page:'+#name+',depId'+#depId+',startTime'+#startTime+',endTime'+#endTime")
+    public void statisticsEvict(String name, String depId, String startTime, String endTime) {
+        LoggerUtils.debug(getClass(), "报销统计清楚缓存。");
     }
+
+
+
+
 }