|
@@ -1,31 +1,39 @@
|
|
|
package org.jeecg.modules.smscheck.controller;
|
|
package org.jeecg.modules.smscheck.controller;
|
|
|
|
|
|
|
|
-import cn.hutool.core.lang.Dict;
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
|
|
+
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.apache.commons.beanutils.PropertyUtils;
|
|
|
|
|
+import org.apache.poi.ss.formula.functions.T;
|
|
|
|
|
+import org.apache.shiro.SecurityUtils;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.aspect.annotation.PermissionData;
|
|
import org.jeecg.common.aspect.annotation.PermissionData;
|
|
|
-import org.jeecg.common.constant.CommonConstant;
|
|
|
|
|
|
|
+
|
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
|
-import org.jeecg.common.system.query.QueryGenerator;
|
|
|
|
|
-import org.jeecg.modules.smscheck.entity.SmsCheckCustomerInfo;
|
|
|
|
|
|
|
+import org.jeecg.common.system.vo.LoginUser;
|
|
|
|
|
+import org.jeecg.common.util.oConvertUtils;
|
|
|
import org.jeecg.modules.smscheck.entity.SmsStatisticsCheckVo;
|
|
import org.jeecg.modules.smscheck.entity.SmsStatisticsCheckVo;
|
|
|
-import org.jeecg.modules.smscheck.service.ISmsCheckCustomerInfoService;
|
|
|
|
|
import org.jeecg.modules.smscheck.service.SmsCheckStatisticsService;
|
|
import org.jeecg.modules.smscheck.service.SmsCheckStatisticsService;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
|
|
|
+import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
|
|
|
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
+import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
+import java.lang.reflect.InvocationTargetException;
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @Author: Syze
|
|
* @Author: Syze
|
|
@@ -36,16 +44,16 @@ import java.util.Map;
|
|
|
@RestController
|
|
@RestController
|
|
|
@RequestMapping("/smsCheck/statistics")
|
|
@RequestMapping("/smsCheck/statistics")
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
-public class SmsCheckStatisticsController extends JeecgController<SmsCheckCustomerInfo, ISmsCheckCustomerInfoService> {
|
|
|
|
|
|
|
+public class SmsCheckStatisticsController extends JeecgController<SmsStatisticsCheckVo, SmsCheckStatisticsService> {
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
|
private SmsCheckStatisticsService smsCheckStatisticsService;
|
|
private SmsCheckStatisticsService smsCheckStatisticsService;
|
|
|
-
|
|
|
|
|
|
|
+ @Value("${jeecg.path.upload}")
|
|
|
|
|
+ private String upLoadPath;
|
|
|
/**
|
|
/**
|
|
|
* 分页列表查询
|
|
* 分页列表查询
|
|
|
*
|
|
*
|
|
|
- * @param smsStatisticsCheckVo
|
|
|
|
|
* @param pageNo 页码
|
|
* @param pageNo 页码
|
|
|
* @param pageSize 每页条数
|
|
* @param pageSize 每页条数
|
|
|
* @param request 请求
|
|
* @param request 请求
|
|
@@ -54,14 +62,24 @@ public class SmsCheckStatisticsController extends JeecgController<SmsCheckCustom
|
|
|
@ApiOperation(value = "稽核统计-分页列表查询", notes = "稽核统计-分页列表查询")
|
|
@ApiOperation(value = "稽核统计-分页列表查询", notes = "稽核统计-分页列表查询")
|
|
|
@GetMapping(value = "/list")
|
|
@GetMapping(value = "/list")
|
|
|
@PermissionData(pageComponent = "statistics/SmsCheckStatistics")
|
|
@PermissionData(pageComponent = "statistics/SmsCheckStatistics")
|
|
|
- public Result< Map<String, Object>> queryPageList(SmsStatisticsCheckVo smsStatisticsCheckVo,
|
|
|
|
|
|
|
+ public Result< Map<String, Object>> queryPageList(
|
|
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
HttpServletRequest request ) {
|
|
HttpServletRequest request ) {
|
|
|
Page<SmsStatisticsCheckVo> page = new Page<>(pageNo, pageSize);
|
|
Page<SmsStatisticsCheckVo> page = new Page<>(pageNo, pageSize);
|
|
|
- String infoId = request.getParameterMap().get("infoId")==null?"": Arrays.toString(request.getParameterMap().get("infoId")).replace("[", "").replace("]", "");
|
|
|
|
|
- String endDate = request.getParameterMap().get("endDate")==null?"": Arrays.toString(request.getParameterMap().get("endDate")).replace("[", "").replace("]", "");
|
|
|
|
|
- String startDate = request.getParameterMap().get("startDate")==null?"": Arrays.toString(request.getParameterMap().get("startDate")).replace("[", "").replace("]", "");
|
|
|
|
|
|
|
+ String infoId = request.getParameterMap().get("infoId")==null?"": Arrays.toString(request.getParameterMap().get("infoId")).replace("[", "").replace("]", "").replace("*", "");
|
|
|
|
|
+ String endDate = request.getParameterMap().get("endDate")==null?"": Arrays.toString(request.getParameterMap().get("endDate")).replace("[", "").replace("]", "").replace("*", "");
|
|
|
|
|
+ String startDate = request.getParameterMap().get("startDate")==null?"": Arrays.toString(request.getParameterMap().get("startDate")).replace("[", "").replace("]", "").replace("*", "");
|
|
|
|
|
+ String taskType = request.getParameterMap().get("taskType")==null?"": Arrays.toString(request.getParameterMap().get("taskType")).replace("[", "").replace("]", "").replace("*", "");
|
|
|
|
|
+ String customerNo = request.getParameterMap().get("customerNo")==null?"": Arrays.toString(request.getParameterMap().get("customerNo")).replace("[", "").replace("]", "").replace("*", "");
|
|
|
|
|
+ String customerName = request.getParameterMap().get("customerName")==null?"": Arrays.toString(request.getParameterMap().get("customerName")).replace("[", "").replace("]", "").replace("*", "");
|
|
|
|
|
+ String taskName = request.getParameterMap().get("taskName")==null?"": Arrays.toString(request.getParameterMap().get("taskName")).replace("[", "").replace("]", "").replace("*", "");
|
|
|
|
|
+
|
|
|
|
|
+ SmsStatisticsCheckVo smsStatisticsCheckVo=new SmsStatisticsCheckVo();
|
|
|
|
|
+ smsStatisticsCheckVo.setType(taskType);
|
|
|
|
|
+ smsStatisticsCheckVo.setCustomerName(customerName);
|
|
|
|
|
+ smsStatisticsCheckVo.setCustomerNo(customerNo);
|
|
|
|
|
+ smsStatisticsCheckVo.setTaskName(taskName);
|
|
|
Map<String, Object> stringObjectMap = smsCheckStatisticsService.smsCheckStatisticsList(smsStatisticsCheckVo, page,startDate,endDate,infoId);
|
|
Map<String, Object> stringObjectMap = smsCheckStatisticsService.smsCheckStatisticsList(smsStatisticsCheckVo, page,startDate,endDate,infoId);
|
|
|
return Result.OK(stringObjectMap);
|
|
return Result.OK(stringObjectMap);
|
|
|
}
|
|
}
|
|
@@ -76,14 +94,98 @@ public class SmsCheckStatisticsController extends JeecgController<SmsCheckCustom
|
|
|
@GetMapping(value = "/count")
|
|
@GetMapping(value = "/count")
|
|
|
@PermissionData(pageComponent = "statistics/SmsCheckStatistics")
|
|
@PermissionData(pageComponent = "statistics/SmsCheckStatistics")
|
|
|
public Result<Map<String, Object>> count( HttpServletRequest request) {
|
|
public Result<Map<String, Object>> count( HttpServletRequest request) {
|
|
|
- String infoId = request.getParameterMap().get("infoId")==null?"": Arrays.toString(request.getParameterMap().get("infoId")).replace("[", "").replace("]", "");
|
|
|
|
|
- String endDate = request.getParameterMap().get("endDate")==null?"": Arrays.toString(request.getParameterMap().get("endDate")).replace("[", "").replace("]", "");
|
|
|
|
|
- String startDate = request.getParameterMap().get("startDate")==null?"": Arrays.toString(request.getParameterMap().get("startDate")).replace("[", "").replace("]", "");
|
|
|
|
|
- String type = request.getParameterMap().get("type")==null?"": Arrays.toString(request.getParameterMap().get("type")).replace("[", "").replace("]", "");
|
|
|
|
|
- Map<String, Object> stringObjectMap = smsCheckStatisticsService.statisticsCountListByType(type, startDate, endDate,infoId);
|
|
|
|
|
|
|
+ String infoId = request.getParameterMap().get("infoId")==null?"": Arrays.toString(request.getParameterMap().get("infoId")).replace("[", "").replace("]", "").replace("*", "");
|
|
|
|
|
+ String endDate = request.getParameterMap().get("endDate")==null?"": Arrays.toString(request.getParameterMap().get("endDate")).replace("[", "").replace("]", "").replace("*", "");
|
|
|
|
|
+ String startDate = request.getParameterMap().get("startDate")==null?"": Arrays.toString(request.getParameterMap().get("startDate")).replace("[", "").replace("]", "").replace("*", "");
|
|
|
|
|
+ String taskType = request.getParameterMap().get("taskType")==null?"": Arrays.toString(request.getParameterMap().get("taskType")).replace("[", "").replace("]", "").replace("*", "");
|
|
|
|
|
+ String customerNo = request.getParameterMap().get("customerNo")==null?"": Arrays.toString(request.getParameterMap().get("customerNo")).replace("[", "").replace("]", "").replace("*", "");
|
|
|
|
|
+ String customerName = request.getParameterMap().get("customerName")==null?"": Arrays.toString(request.getParameterMap().get("customerName")).replace("[", "").replace("]", "").replace("*", "");
|
|
|
|
|
+ String taskName = request.getParameterMap().get("taskName")==null?"": Arrays.toString(request.getParameterMap().get("taskName")).replace("[", "").replace("]", "").replace("*", "");
|
|
|
|
|
+
|
|
|
|
|
+ SmsStatisticsCheckVo smsStatisticsCheckVo=new SmsStatisticsCheckVo();
|
|
|
|
|
+ smsStatisticsCheckVo.setCustomerName(customerName);
|
|
|
|
|
+ smsStatisticsCheckVo.setCustomerNo(customerNo);
|
|
|
|
|
+ smsStatisticsCheckVo.setTaskName(taskName);
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Object> stringObjectMap = smsCheckStatisticsService.statisticsCountListByType(taskType, startDate, endDate,infoId,smsStatisticsCheckVo);
|
|
|
|
|
|
|
|
return Result.OK(stringObjectMap);
|
|
return Result.OK(stringObjectMap);
|
|
|
}
|
|
}
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 导出excel
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param request 请求
|
|
|
|
|
+ * @param smsCheckTask 对象
|
|
|
|
|
+ * @return excel文件
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/exportXls")
|
|
|
|
|
+ public ModelAndView exportXls(HttpServletRequest request, SmsStatisticsCheckVo smsCheckTask) throws Exception {
|
|
|
|
|
+ String title ="稽核统计";
|
|
|
|
|
+ // Step.1 组装查询条件
|
|
|
|
|
+ String infoId = request.getParameterMap().get("infoId")==null?"": Arrays.toString(request.getParameterMap().get("infoId")).replace("[", "").replace("]", "").replace("*", "");
|
|
|
|
|
+ String endDate = request.getParameterMap().get("endDate")==null?"": Arrays.toString(request.getParameterMap().get("endDate")).replace("[", "").replace("]", "").replace("*", "");
|
|
|
|
|
+ String startDate = request.getParameterMap().get("startDate")==null?"": Arrays.toString(request.getParameterMap().get("startDate")).replace("[", "").replace("]", "").replace("*", "");
|
|
|
|
|
+ String taskType = request.getParameterMap().get("taskType")==null?"": Arrays.toString(request.getParameterMap().get("taskType")).replace("[", "").replace("]", "").replace("*", "");
|
|
|
|
|
+ String customerNo = request.getParameterMap().get("customerNo")==null?"": Arrays.toString(request.getParameterMap().get("customerNo")).replace("[", "").replace("]", "").replace("*", "");
|
|
|
|
|
+ String customerName = request.getParameterMap().get("customerName")==null?"": Arrays.toString(request.getParameterMap().get("customerName")).replace("[", "").replace("]", "").replace("*", "");
|
|
|
|
|
+ String taskName = request.getParameterMap().get("taskName")==null?"": Arrays.toString(request.getParameterMap().get("taskName")).replace("[", "").replace("]", "").replace("*", "");
|
|
|
|
|
+
|
|
|
|
|
+ SmsStatisticsCheckVo smsStatisticsCheckVo=new SmsStatisticsCheckVo();
|
|
|
|
|
+ smsStatisticsCheckVo.setCustomerName(customerName);
|
|
|
|
|
+ smsStatisticsCheckVo.setCustomerNo(customerNo);
|
|
|
|
|
+ smsStatisticsCheckVo.setTaskName(taskName);
|
|
|
|
|
+ smsStatisticsCheckVo.setType(taskType);
|
|
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
|
|
|
|
|
|
+ long totalNum = (long) smsCheckStatisticsService.statisticsCountListByType(null,endDate,startDate,infoId,smsStatisticsCheckVo).get("totalNum");
|
|
|
|
|
+ Page<SmsStatisticsCheckVo> page = new Page<>(1, totalNum);
|
|
|
|
|
|
|
|
|
|
+ // Step.2 获取导出数据
|
|
|
|
|
+ List<T> records = (List<T>) smsCheckStatisticsService.smsCheckStatisticsList(smsStatisticsCheckVo, page, startDate, endDate, infoId).get("records");
|
|
|
|
|
+ List<T> exportList = new ArrayList<>();
|
|
|
|
|
+
|
|
|
|
|
+ // 过滤选中数据
|
|
|
|
|
+ String selections = request.getParameter("selections");
|
|
|
|
|
+ if (oConvertUtils.isNotEmpty(selections)) {
|
|
|
|
|
+ List<String> selectionList = Arrays.asList(selections.split(","));
|
|
|
|
|
+ for (String s : selectionList) {
|
|
|
|
|
+ for (int i = 0; i < records.size(); i++) {
|
|
|
|
|
+ String id = PropertyUtils.getProperty(records.get(i), "id").toString();
|
|
|
|
|
+ if (id.equals(s)) {
|
|
|
|
|
+ exportList.add(records.get(i));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ exportList = records;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // Step.3 AutoPoi 导出Excel
|
|
|
|
|
+ ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
|
|
|
+ //此处设置的filename无效 ,前端会重更新设置一下
|
|
|
|
|
+ mv.addObject(NormalExcelConstants.FILE_NAME, title);
|
|
|
|
|
+ mv.addObject(NormalExcelConstants.CLASS, SmsStatisticsCheckVo.class);
|
|
|
|
|
+ //update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
|
|
|
|
|
+ ExportParams exportParams=new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title);
|
|
|
|
|
+ exportParams.setImageBasePath(upLoadPath);
|
|
|
|
|
+ //update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
|
|
|
|
|
+ mv.addObject(NormalExcelConstants.PARAMS,exportParams);
|
|
|
|
|
+ mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
|
|
|
|
|
+ return mv;
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取对象ID
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ private String getId(T item) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ return PropertyUtils.getProperty(item, "id").toString();
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|