From 83520d366314d40f337f5c789f6cfeae75a51f64 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期三, 07 五月 2025 11:18:35 +0800
Subject: [PATCH] 代码初始化
---
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/InoutRecordServiceImpl.java | 388 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 387 insertions(+), 1 deletions(-)
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/InoutRecordServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/InoutRecordServiceImpl.java
index 6179758..9a268c9 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/InoutRecordServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/InoutRecordServiceImpl.java
@@ -1,8 +1,18 @@
package com.doumee.service.business.impl;
+import com.doumee.core.annotation.excel.ExcelExporter;
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.exception.BusinessException;
+import com.doumee.core.utils.Constants;
+import com.doumee.core.utils.DateUtil;
import com.doumee.core.utils.Utils;
+import com.doumee.dao.business.CategoryMapper;
import com.doumee.dao.business.InoutRecordMapper;
+import com.doumee.dao.business.dto.InParkDataDTO;
+import com.doumee.dao.business.model.Category;
import com.doumee.dao.business.model.InoutRecord;
+import com.doumee.dao.business.vo.GeneralDataVO;
+import com.doumee.dao.business.vo.InParkUserDataVO;
import com.doumee.service.business.InoutRecordService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -10,11 +20,26 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.doumee.service.business.third.model.PageData;
import com.doumee.service.business.third.model.PageWrap;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.models.auth.In;
+import org.apache.commons.lang.StringUtils;
+import org.checkerframework.checker.units.qual.C;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
-import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.net.URLEncoder;
+import java.nio.charset.Charset;
+import java.text.DecimalFormat;
+import java.time.*;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.TemporalAdjusters;
+import java.util.*;
+import java.util.stream.Collectors;
/**
* 鍑哄叆鍦轰汉娆¤溅娆℃瘡鏃ョ粺璁¤〃Service瀹炵幇
@@ -26,6 +51,9 @@
@Autowired
private InoutRecordMapper inoutRecordMapper;
+
+ @Autowired
+ private CategoryMapper categoryMapper;
@Override
public Integer create(InoutRecord inoutRecord) {
@@ -172,4 +200,362 @@
QueryWrapper<InoutRecord> wrapper = new QueryWrapper<>(inoutRecord);
return inoutRecordMapper.selectCount(wrapper);
}
+
+
+ //浜哄憳鍒嗙被 鍗曠嫭澶勭悊浜哄憳鏁版嵁 0鍔冲姟璁垮 1鏅�氳瀹� 2鍐呴儴鍛樺伐 3杞﹁締淇℃伅 4鐩稿叧鏂逛汉鍛� 5璐ц繍鍙告満
+ private static String[] userTypeList = new String[]{"","鏅�氳瀹�","鍐呴儴浜哄憳","","鐩稿叧鏂逛汉鍛�","璐ц繍鍙告満"};
+
+
+ /**
+ * 鏌ヨ鍩虹鏁版嵁
+ * @return
+ */
+ @Override
+ public InParkUserDataVO getInParkUserData(InParkDataDTO inParkDataDTO){
+ if(Objects.isNull(inParkDataDTO)
+ || Objects.isNull(inParkDataDTO.getType())
+ || Objects.isNull(inParkDataDTO.getIsGroupBy())
+ || (Objects.nonNull(inParkDataDTO.getType())&& !(Constants.equalsInteger(inParkDataDTO.getType(),Constants.ZERO) || Constants.equalsInteger(inParkDataDTO.getType(),Constants.ONE) ))
+ || (Objects.nonNull(inParkDataDTO.getIsGroupBy())&& !(Constants.equalsInteger(inParkDataDTO.getIsGroupBy(),Constants.ZERO) || Constants.equalsInteger(inParkDataDTO.getIsGroupBy(),Constants.ONE) ))
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ //鏌ヨ鏈懆鐨勫紑濮嬫棩鏈熷拰缁撴潫鏃ユ湡
+ Long weekStart = LocalDate.now().with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)).atStartOfDay(ZoneOffset.UTC).toInstant().toEpochMilli();
+ InParkUserDataVO inParkUserDataVO = new InParkUserDataVO();
+ List<InoutRecord> yearList = inoutRecordMapper.selectJoinList(InoutRecord.class,new MPJLambdaWrapper<InoutRecord>()
+ .selectAll(InoutRecord.class)
+ .eq(InoutRecord::getIsdeleted,Constants.ZERO)
+ .eq(InoutRecord::getInOrOut,Constants.ZERO)
+ .isNotNull(Constants.equalsInteger(inParkDataDTO.getType(),Constants.ZERO),InoutRecord::getCarCode)
+ .isNotNull(Constants.equalsInteger(inParkDataDTO.getType(),Constants.ONE),InoutRecord::getMemberPhone)
+ .apply(" ( DATE_FORMAT(CREATE_DATE, '%Y') = DATE_FORMAT(now(), '%Y') ) ")
+ .orderByAsc(Constants.equalsInteger(inParkDataDTO.getType(),Constants.ZERO),InoutRecord::getCarBizType)
+ .orderByAsc(Constants.equalsInteger(inParkDataDTO.getType(),Constants.ONE),InoutRecord::getMemberType)
+ );
+ List<InoutRecord> monthList = yearList.stream().filter(i->DateUtil.formatDate(i.getCreateDate(),"yyyy-MM").equals(DateUtil.formatDate(new Date(),"yyyy-MM"))).collect(Collectors.toList());
+ List<InoutRecord> weekList = yearList.stream().filter(i->i.getCreateDate().getTime()>=weekStart).collect(Collectors.toList());
+ List<InoutRecord> todayList = weekList.stream().filter(i-> DateUtil.formatDate(i.getCreateDate(),"yyyy-MM-dd").equals(DateUtil.formatDate(new Date(),"yyyy-MM-dd"))).collect(Collectors.toList());
+ List<InoutRecord> yesterdayList = yearList.stream().filter(i-> DateUtil.formatDate(i.getCreateDate(),"yyyy-MM-dd").equals(DateUtil.getBeforDay(new Date(),1))).collect(Collectors.toList());
+
+ if(Constants.equalsInteger(inParkDataDTO.getIsGroupBy(),Constants.ZERO)){
+ inParkUserDataVO.setYearTotal(yearList.size());
+ inParkUserDataVO.setMonthTotal(monthList.size());
+ inParkUserDataVO.setTodayTotal(todayList.size());
+ inParkUserDataVO.setWeekTotal(weekList.size());
+ inParkUserDataVO.setYesterdayTotal(yesterdayList.size());
+ }else{
+ yearList = this.getListByType(yearList,inParkDataDTO.getType());
+ monthList = this.getListByType(monthList,inParkDataDTO.getType());
+ weekList = this.getListByType(weekList,inParkDataDTO.getType());
+ todayList = this.getListByType(todayList,inParkDataDTO.getType());
+ yesterdayList = this.getListByType(yesterdayList,inParkDataDTO.getType());
+ inParkUserDataVO.setYearTotal(yearList.size());
+ inParkUserDataVO.setMonthTotal(monthList.size());
+ inParkUserDataVO.setTodayTotal(todayList.size());
+ inParkUserDataVO.setWeekTotal(weekList.size());
+ inParkUserDataVO.setYesterdayTotal(yesterdayList.size());
+ }
+ //澶勭悊骞村害鎶樼嚎鍥炬暟鎹�
+ List<GeneralDataVO> cumulativeDataList = new ArrayList<>();
+ for (int i = 1; i <=12 ; i++) {
+ GeneralDataVO generalDataVO = new GeneralDataVO();
+ generalDataVO.setName(Integer.toString(i));
+ generalDataVO.setTotal(yearList.stream().filter(j->Constants.equalsInteger(Integer.valueOf(generalDataVO.getName()),Integer.valueOf(DateUtil.formatDate(j.getCreateDate(),"MM")))).collect(Collectors.toList()).size());
+ generalDataVO.setName(generalDataVO.getName()+"鏈�");
+ cumulativeDataList.add(generalDataVO);
+ }
+ inParkUserDataVO.setCumulativeDataList(cumulativeDataList);
+ //澶勭悊鍒嗙被鏁版嵁
+ List<GeneralDataVO> yearSortList = new ArrayList<>();
+ if(Constants.equalsInteger(inParkDataDTO.getType(),Constants.ONE)){
+ for (int i = 0; i < userTypeList.length; i++) {
+ if(StringUtils.isBlank(userTypeList[i])){
+ continue;
+ }
+ GeneralDataVO generalDataVO = new GeneralDataVO();
+ generalDataVO.setName(userTypeList[i]);
+ int index = i;
+ generalDataVO.setTotal(yearList.stream().filter(j->Constants.equalsInteger(j.getMemberType(), index)).collect(Collectors.toList()).size());
+ yearSortList.add(generalDataVO);
+ }
+ }else{
+ List<String> categoryNameList = yearList.stream().filter(i-> StringUtils.isNotBlank(i.getCategoryName())).map(i->i.getCategoryName()).collect(Collectors.toList());
+ if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(categoryNameList)){
+ Set<String> setList = new HashSet<>(categoryNameList);
+ for (String categoryName:setList) {
+ GeneralDataVO generalDataVO = new GeneralDataVO();
+ generalDataVO.setName(categoryName);
+ generalDataVO.setTotal(yearList.stream().filter(j->StringUtils.isNotBlank(j.getCategoryName())&&j.getCategoryName().equals(categoryName)).collect(Collectors.toList()).size());
+ yearSortList.add(generalDataVO);
+ }
+ }
+ }
+ if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(yearSortList)){
+ Collections.sort(yearSortList, new Comparator<GeneralDataVO>() {
+ @Override
+ public int compare(GeneralDataVO o1, GeneralDataVO o2) {
+ // 杩斿洖鍊间负int绫诲瀷锛屽ぇ浜�0琛ㄧず姝e簭锛屽皬浜�0琛ㄧず閫嗗簭
+ return o2.getTotal() - o1.getTotal();
+ }
+ });
+ inParkUserDataVO.setYearSortList(yearSortList);
+ }
+ return inParkUserDataVO;
+ }
+
+
+ /**
+ * 鏌ヨ鍗犳瘮鏁版嵁
+ * @return
+ */
+ @Override
+ public List<GeneralDataVO> getRataList(InParkDataDTO inParkDataDTO){
+ if(Objects.isNull(inParkDataDTO)
+ || Objects.isNull(inParkDataDTO.getType())
+ || Objects.isNull(inParkDataDTO.getIsGroupBy())
+ || StringUtils.isBlank(inParkDataDTO.getDateStr())
+ || (Objects.nonNull(inParkDataDTO.getType())&& !(Constants.equalsInteger(inParkDataDTO.getType(),Constants.ZERO) || Constants.equalsInteger(inParkDataDTO.getType(),Constants.ONE) ))
+ || (Objects.nonNull(inParkDataDTO.getIsGroupBy())&& !(Constants.equalsInteger(inParkDataDTO.getIsGroupBy(),Constants.ZERO) || Constants.equalsInteger(inParkDataDTO.getIsGroupBy(),Constants.ONE) ))
+ || !( Constants.equalsInteger(inParkDataDTO.getDateStr().length(),4) || Constants.equalsInteger(inParkDataDTO.getDateStr().length(),7) )
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ List<GeneralDataVO> rataList = new ArrayList<>();
+ List<InoutRecord> yearList = inoutRecordMapper.selectJoinList(InoutRecord.class,new MPJLambdaWrapper<InoutRecord>()
+ .selectAll(InoutRecord.class)
+ .eq(InoutRecord::getIsdeleted,Constants.ZERO)
+ .eq(InoutRecord::getInOrOut,Constants.ZERO)
+ .isNotNull(Constants.equalsInteger(inParkDataDTO.getType(),Constants.ZERO),InoutRecord::getCarCode)
+ .isNotNull(Constants.equalsInteger(inParkDataDTO.getType(),Constants.ONE),InoutRecord::getMemberPhone)
+ .apply(Constants.equalsInteger(inParkDataDTO.getDateStr().length(),4)," ( DATE_FORMAT(CREATE_DATE, '%Y') = '"+inParkDataDTO.getDateStr()+"' ) ")
+ .apply(Constants.equalsInteger(inParkDataDTO.getDateStr().length(),7)," ( DATE_FORMAT(CREATE_DATE, '%Y-%m') = '"+inParkDataDTO.getDateStr()+"' ) ")
+ );
+ if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(yearList)){
+ return rataList;
+ }
+ if(Constants.equalsInteger(inParkDataDTO.getIsGroupBy(),Constants.ONE)){
+ yearList = this.getListByType(yearList,inParkDataDTO.getType());
+ }
+
+ if(Constants.equalsInteger(inParkDataDTO.getType(),Constants.ONE)){
+ for (int i = 0; i < userTypeList.length; i++) {
+ if(StringUtils.isBlank(userTypeList[i])){
+ continue;
+ }
+ GeneralDataVO generalDataVO = new GeneralDataVO();
+ generalDataVO.setName(userTypeList[i]);
+ int index = i;
+ generalDataVO.setTotal(yearList.stream().filter(j->Constants.equalsInteger(j.getMemberType(), index)).collect(Collectors.toList()).size());
+ generalDataVO.setRata(new BigDecimal(generalDataVO.getTotal().toString()).divide(new BigDecimal(yearList.size()+""),2,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
+ rataList.add(generalDataVO);
+ }
+ }else{
+ List<String> categoryNameList = yearList.stream().filter(i-> StringUtils.isNotBlank(i.getCategoryParentName()))
+ .map(i->i.getCategoryParentName()).collect(Collectors.toList());
+ if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(categoryNameList)){
+ Set<String> setList = new HashSet<>(categoryNameList);
+ for (String categoryName:setList) {
+ GeneralDataVO generalDataVO = new GeneralDataVO();
+ generalDataVO.setName(categoryName);
+ generalDataVO.setTotal(yearList.stream().filter(j->StringUtils.isNotBlank(j.getCategoryParentName())&&j.getCategoryName().equals(categoryName)).collect(Collectors.toList()).size());
+ generalDataVO.setRata(new BigDecimal(generalDataVO.getTotal().toString()).divide(new BigDecimal(yearList.size()+""),2,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
+ rataList.add(generalDataVO);
+ }
+ }
+ }
+ return rataList;
+ }
+
+ @Override
+ public List<List<String>> getReportList(InParkDataDTO inParkDataDTO){
+ if(Objects.isNull(inParkDataDTO)
+ || Objects.isNull(inParkDataDTO.getType())
+ || Objects.isNull(inParkDataDTO.getIsGroupBy())
+ || StringUtils.isBlank(inParkDataDTO.getDateStr())
+ || (Objects.nonNull(inParkDataDTO.getType())&& !(Constants.equalsInteger(inParkDataDTO.getType(),Constants.ZERO) || Constants.equalsInteger(inParkDataDTO.getType(),Constants.ONE) ))
+ || (Objects.nonNull(inParkDataDTO.getIsGroupBy())&& !(Constants.equalsInteger(inParkDataDTO.getIsGroupBy(),Constants.ZERO) || Constants.equalsInteger(inParkDataDTO.getIsGroupBy(),Constants.ONE) ))
+ || !( Constants.equalsInteger(inParkDataDTO.getDateStr().length(),4) || Constants.equalsInteger(inParkDataDTO.getDateStr().length(),7) )
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ List<InoutRecord> allList = inoutRecordMapper.selectJoinList(InoutRecord.class,new MPJLambdaWrapper<InoutRecord>()
+ .selectAll(InoutRecord.class)
+ .eq(InoutRecord::getIsdeleted,Constants.ZERO)
+ .eq(InoutRecord::getInOrOut,Constants.ZERO)
+ .isNotNull(Constants.equalsInteger(inParkDataDTO.getType(),Constants.ZERO),InoutRecord::getCarCode)
+ .isNotNull(Constants.equalsInteger(inParkDataDTO.getType(),Constants.ONE),InoutRecord::getMemberPhone)
+ .apply(Constants.equalsInteger(inParkDataDTO.getDateStr().length(),4)," ( DATE_FORMAT(CREATE_DATE, '%Y') = '"+inParkDataDTO.getDateStr()+"' ) ")
+ .apply(Constants.equalsInteger(inParkDataDTO.getDateStr().length(),7)," ( DATE_FORMAT(CREATE_DATE, '%Y-%m') = '"+inParkDataDTO.getDateStr()+"' ) ")
+ );
+ List<List<String>> resultList = new ArrayList<>();
+ if(CollectionUtils.isEmpty(allList)){
+ return resultList;
+ }
+ if(Constants.equalsInteger(inParkDataDTO.getIsGroupBy(),Constants.ONE)){
+ allList = this.getListByType(allList,inParkDataDTO.getType());
+ }
+
+ List<String> dateList = new ArrayList<>();
+ //骞翠唤
+ if(Constants.equalsInteger(inParkDataDTO.getDateStr().length(),4)){
+ Integer maxMonth = 12;
+ if(Constants.equalsInteger(DateUtil.getNowYearNum(),Integer.valueOf(inParkDataDTO.getDateStr()))){
+ maxMonth = DateUtil.getNowMonthNum();
+ }
+ for (int i = maxMonth; i >0 ; i--) {
+ dateList.add(DateUtil.getNowYearNum()+"-"+ StringUtils.leftPad(i+"",2,"0"));
+ }
+ }else {
+ //鏃ユ湡
+ Integer year = Integer.valueOf(inParkDataDTO.getDateStr().substring(0,4));
+ Integer month = Integer.valueOf(inParkDataDTO.getDateStr().substring(5,7));
+ Integer today = DateUtil.getNowDayNum();
+ YearMonth yearMonth = YearMonth.of(year, month);
+ // 鑾峰彇璇ユ湀鐨勬渶鍚庝竴澶�
+ LocalDate lastDayDate = yearMonth.atEndOfMonth();
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd");
+ Integer lastDay = Integer.valueOf(lastDayDate.format(formatter));
+ if(Constants.equalsInteger(year,DateUtil.getNowYearNum()) && Constants.equalsInteger(month,DateUtil.getNowMonthNum())){
+ if(today < lastDay){
+ lastDay = today;
+ }
+ }
+ for (int i = lastDay; i > 0 ; i--) {
+ dateList.add(year + "-" + StringUtils.leftPad(month.toString(),2,"0") + "-" + StringUtils.leftPad(Integer.toString(i),2,"0"));
+ }
+ }
+ return this.dealResultData(allList,dateList,inParkDataDTO.getType(),inParkDataDTO.getDateStr());
+ }
+
+
+ public List<List<String>> dealResultData(List<InoutRecord> allList,List<String> dataList ,Integer type,String dateStr){
+ List<List<String>> resultList = new ArrayList<>();
+ List<String> totalString = new ArrayList<>();
+ totalString.add("鏃ユ湡");
+ if(Constants.equalsInteger(type,Constants.ZERO)){
+ List<String> categoryNameList = allList.stream().filter(j-> StringUtils.isNotBlank(j.getCategoryName())).map(j->j.getCategoryName()).collect(Collectors.toList());
+ if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(categoryNameList)){
+ return resultList;
+ }
+ Set<String> setList = new HashSet<>(categoryNameList);
+ for (String categoryName:setList) {
+ totalString.add(categoryName);
+ }
+ totalString.add("鍚堣");
+ resultList.add(totalString);
+ for (String str:dataList) {
+ Integer total = 0;
+ List<String> dataChildList = new ArrayList<>();
+ dataChildList.add(str);
+ for (String categoryName:setList) {
+ if(Constants.equalsInteger(dateStr.length(),4)){
+ Integer childNum = allList.stream().filter(i->categoryName.equals(i.getCategoryName())
+ && DateUtil.formatDate(i.getCreateDate(),"yyyy-MM").equals(str)).collect(Collectors.toList()).size();
+ dataChildList.add(
+ Integer.toString(childNum)
+ );
+ total = total + childNum;
+ }else if(Constants.equalsInteger(dateStr.length(),7)){
+ Integer childNum = allList.stream().filter(i->categoryName.equals(i.getCategoryName())
+ &&DateUtil.formatDate(i.getCreateDate(),"yyyy-MM-dd").equals(str)).collect(Collectors.toList()).size();
+ dataChildList.add(
+ Integer.toString(childNum)
+ );
+ total = total + childNum;
+ }
+ }
+ dataChildList.add(Integer.toString(total));
+ resultList.add(dataChildList);
+ }
+ }else{
+ for (int j = 0; j < userTypeList.length; j++) {
+ if(StringUtils.isBlank(userTypeList[j])){
+ continue;
+ }
+ totalString.add(userTypeList[j]);
+ }
+ totalString.add("鍚堣");
+ resultList.add(totalString);
+ for (String str:dataList) {
+ Integer total = 0;
+ List<String> dataChildList = new ArrayList<>();
+ dataChildList.add(str);
+ for (int i = 0; i < userTypeList.length; i++) {
+ String typeName = userTypeList[i];
+ if(StringUtils.isBlank(typeName)){
+ continue;
+ }
+ int finalI = i;
+ if(Constants.equalsInteger(dateStr.length(),4)){
+ Integer childNum = allList.stream().filter(j->Constants.equalsInteger(j.getMemberType(), finalI)
+ && DateUtil.formatDate(j.getCreateDate(),"yyyy-MM").equals(str)).collect(Collectors.toList()).size();
+ dataChildList.add(
+ Integer.toString(childNum)
+ );
+ total = total + childNum;
+ }else if(Constants.equalsInteger(dateStr.length(),7)){
+ Integer childNum = allList.stream().filter(j->Constants.equalsInteger(j.getMemberType(), finalI)
+ &&DateUtil.formatDate(j.getCreateDate(),"yyyy-MM-dd").equals(str)).collect(Collectors.toList()).size();
+ dataChildList.add(
+ Integer.toString(childNum)
+ );
+ total = total + childNum;
+ }
+ }
+ dataChildList.add(Integer.toString(total));
+ resultList.add(dataChildList);
+ }
+ }
+ return resultList;
+ }
+
+
+
+
+
+
+ public List<InoutRecord> getListByType(List<InoutRecord> list,Integer type){
+ return Constants.equalsInteger(type,Constants.ONE)?this.getDataByMemberPhoneSize(list):this.getDataByCarCodeSize(list);
+ }
+
+
+ public List<InoutRecord> getDataByMemberPhoneSize(List<InoutRecord> list){
+ Map<String, InoutRecord> uniqueByMemberPhone = list.stream()
+ .collect(Collectors.toMap(
+ InoutRecord::getMemberPhone,
+ person -> person,
+ (existing, replacement) -> existing
+ ));
+ List<InoutRecord> uniqueList = new ArrayList<>(uniqueByMemberPhone.values());
+ return uniqueList;
+ }
+
+ public List<InoutRecord> getDataByCarCodeSize(List<InoutRecord> list){
+ Map<String, InoutRecord> uniqueByCarCode = list.stream()
+ .collect(Collectors.toMap(
+ InoutRecord::getCarCode,
+ person -> person,
+ (existing, replacement) -> existing
+ ));
+ List<InoutRecord> uniqueList = new ArrayList<>(uniqueByCarCode.values());
+ return uniqueList;
+ }
+
+
+ @Override
+ public void excel(InParkDataDTO inParkDataDTO, HttpServletResponse response){
+ List<List<String>> data = this.getReportList(inParkDataDTO);
+ try {
+ String fileName = Constants.equalsInteger(inParkDataDTO.getType(),Constants.ZERO)?"鍏ュ洯杞﹁締缁熻琛╛":"鍏ュ洯浜哄憳缁熻琛╛"+System.currentTimeMillis();
+ String encodeFileName = URLEncoder.encode(fileName, Charset.forName("UTF-8").toString()) + ".xlsx";
+ response.setHeader("Content-Disposition","attachment;filename=" + encodeFileName);
+ response.setContentType("application/octet-stream");
+ response.setHeader("eva-opera-type", "download");
+ response.setHeader("eva-download-filename", encodeFileName);
+ ExcelExporter.exportList(data, fileName, response.getOutputStream());
+ } catch (IOException e) {
+ throw new BusinessException(ResponseStatus.EXPORT_EXCEL_ERROR, e);
+ }
+ }
}
--
Gitblit v1.9.3