Browse Source

两票生成月报导出修改

zhongwei
段飞宇 1 year ago
parent
commit
98655b3923
  1. 5
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketCountController.java
  2. 8
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketCountService.java
  3. 17
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketCountServiceImpl.java

5
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketCountController.java

@ -53,10 +53,11 @@ public class TicketCountController {
/** /**
* 两票统计分析导出 * 两票统计分析导出
* @param dateTime 月份
*/ */
@GetMapping("/export") @GetMapping("/export")
public R export(HttpServletResponse response) { public R export(String dateTime, HttpServletResponse response) {
ticketCountService.exportTicketCount(response); ticketCountService.exportTicketCount(dateTime,response);
return R.success("导出成功"); return R.success("导出成功");
} }

8
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketCountService.java

@ -1,15 +1,11 @@
package com.hnac.hzims.ticket.twoTicket.service; package com.hnac.hzims.ticket.twoTicket.service;
import cn.hutool.http.server.HttpServerResponse;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.ticket.twoTicket.entity.TicketCount; import com.hnac.hzims.ticket.twoTicket.entity.TicketCount;
import com.hnac.hzims.ticket.twoTicket.entity.TicketInfoDanger;
import com.hnac.hzims.ticket.twoTicket.vo.ticket.TicketCountResponseVo; import com.hnac.hzims.ticket.twoTicket.vo.ticket.TicketCountResponseVo;
import com.hnac.hzims.ticket.twoTicket.vo.ticket.TicketCountVo; import com.hnac.hzims.ticket.twoTicket.vo.ticket.TicketCountVo;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.time.YearMonth;
import java.util.List; import java.util.List;
/** /**
@ -35,7 +31,9 @@ public interface TicketCountService extends BaseService<TicketCount> {
/** /**
* 两票统计分析导出 * 两票统计分析导出
*
* @param dateTime
* @param response * @param response
*/ */
void exportTicketCount(HttpServletResponse response); void exportTicketCount(String dateTime, HttpServletResponse response);
} }

17
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketCountServiceImpl.java

@ -1,15 +1,11 @@
package com.hnac.hzims.ticket.twoTicket.service.impl; package com.hnac.hzims.ticket.twoTicket.service.impl;
import cn.hutool.http.server.HttpServerResponse;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.support.ExcelTypeEnum; import com.alibaba.excel.support.ExcelTypeEnum;
import com.alibaba.excel.write.metadata.style.WriteCellStyle; import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.metadata.style.WriteFont;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity; import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity;
import com.hnac.hzims.ticket.allTicket.service.TicketInfoEvaluateService; import com.hnac.hzims.ticket.allTicket.service.TicketInfoEvaluateService;
@ -41,9 +37,7 @@ import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
@ -158,15 +152,18 @@ public class TicketCountServiceImpl extends BaseServiceImpl<TicketCountMapper, T
/** /**
* 两票统计分析导出 * 两票统计分析导出
* *
* @param dateTime
* @param response * @param response
*/ */
@Override @Override
public void exportTicketCount(HttpServletResponse response) { public void exportTicketCount(String dateTime, HttpServletResponse response) {
String fileName = URLEncoder.encode("两票月报分析统计报表.xlsx"); String fileName = URLEncoder.encode("两票月报分析统计报表.xlsx");
response.setHeader("Content-Disposition", "attachment; filename=" + fileName); response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
response.setContentType("application/vnd.ms-excel;charset=utf-8"); response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
List<TicketCount> ticketCounts = baseMapper.selectList(null); LambdaQueryWrapper<TicketCount> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TicketCount::getDateTime, dateTime);
List<TicketCount> ticketCounts = baseMapper.selectList(queryWrapper);
List<TicketCountResponseVo> countResponseList = getTicketCountResponseList(ticketCounts); List<TicketCountResponseVo> countResponseList = getTicketCountResponseList(ticketCounts);
//导出 //导出
//内容样式策略 //内容样式策略
@ -304,7 +301,7 @@ public class TicketCountServiceImpl extends BaseServiceImpl<TicketCountMapper, T
*/ */
private List<TicketCount> getStandardTicketCountList(List<Long> createDept, List<TicketCount> items, String ticketType, String dateTime, BladeUser user) { private List<TicketCount> getStandardTicketCountList(List<Long> createDept, List<TicketCount> items, String ticketType, String dateTime, BladeUser user) {
List<StandardTicketInfoEntity> ticketInfoEntities = List<StandardTicketInfoEntity> ticketInfoEntities =
standardTicketInfoService.selectStandardTicketByDeptIdWithTicketType(createDept, ticketType,dateTime); standardTicketInfoService.selectStandardTicketByDeptIdWithTicketType(createDept, ticketType, dateTime);
if (CollectionUtils.isEmpty(ticketInfoEntities)) { if (CollectionUtils.isEmpty(ticketInfoEntities)) {
return null; return null;
} }
@ -371,7 +368,7 @@ public class TicketCountServiceImpl extends BaseServiceImpl<TicketCountMapper, T
String dateTime, String dateTime,
BladeUser user) { BladeUser user) {
List<WorkTicketInfoEntity> ticketInfoEntities = List<WorkTicketInfoEntity> ticketInfoEntities =
workTicketInfoService.selectTicketByDeptIdWithTicketType(createDept, ticketType,dateTime); workTicketInfoService.selectTicketByDeptIdWithTicketType(createDept, ticketType, dateTime);
if (CollectionUtils.isEmpty(ticketInfoEntities)) { if (CollectionUtils.isEmpty(ticketInfoEntities)) {
return null; return null;
} }

Loading…
Cancel
Save