循环插入excel某一列,以及多列之和

package com.xinda.service.impl;

import cn.hutool.core.io.FileUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xinda.entity.BigScreenTop;
import com.xinda.entity.CdwtVo;
import com.xinda.entity.EmsEt;
import com.xinda.mapper.EmsEtMapper;
import com.xinda.service.IEmsEtService;
import com.xinda.service.IEnterpriseAnalysisService;
import com.xinda.utils.TimeUtil;
import com.xinda.utils.UtilsClass;
import net.sf.saxon.functions.Put;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.*;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;


@Service
public class EmsEtServiceImpl extends ServiceImpl<EmsEtMapper, EmsEt> implements IEmsEtService {

    @Autowired
    private EmsEtMapper emsEtMapper;

    @Autowired
    private IEnterpriseAnalysisService enterpriseAnalysisService;

   

    @Override
    public void importExcell(MultipartFile excelFile, HttpServletRequest request) {
        if (excelFile == null || excelFile.getSize() == 0) {
            log.error("文件上传错误,重新上传");
        }
        String filename = excelFile.getOriginalFilename();
        if (!(filename.endsWith(".xls") || filename.endsWith(".xlsx"))) {
            log.error("文件上传格式错误,请重新上传");
        }

        List<EmsEt> list = null;
        try {
//            if (filename.endsWith(".xls")){
//                list = readXLS(excelFile);
//            }else {
            list = readXLSX(excelFile);
//            }
        } catch (IOException | ParseException e) {
            e.printStackTrace();
            log.error("文件内容读取失败,请重试");
        }
        for (EmsEt etList : list) {
            String longitude = etList.getLongitude();
            String latitude = etList.getLatitude();
            String name = etList.getName();
            Integer et;
            et = emsEtMapper.selectJW(longitude, latitude, name);
            if (null != et) {
                //修改
                etList.setId(et);
                emsEtMapper.updateById(etList);
            } else {//查不到
                emsEtMapper.insert(etList);
            }

        }

    }

    @Override
    public void download(HttpServletRequest request, HttpServletResponse response) {
        //拿到服务器路径
        StringBuffer requestURL = request.getRequestURL();
        HttpSession session = request.getSession();
        ServletContext servletContext = session.getServletContext();
        String realPath = servletContext.getRealPath("\\");
        String path = (new File(realPath)).getParent();
        String uuid = UUID.randomUUID().toString();
        String names = "企业信息.xlsx";
//        String names = uuid + fileName; //新的文件名
        File file = new File(path + "/file/");
        if (!file.exists()) { //如果不存在
            file.mkdirs(); //创建目录
        }
        File tempFile = new File(file + names);
        try {
            //创建文件
            //写入到file文件中
            List<EmsEt> imsCategories = emsEtMapper.list();
            for (EmsEt ss : imsCategories) {
                String status = ss.getStatus();
                if (null != status && "1".equals(status)) {
                    status = "已完成";
                } else {
                    status = "未完成";
                }
//                Double money = ss.getMoney();
//                Double balanceofFinanceLease = ss.getBalanceofFinanceLease();
//                balanceofFinanceLease= balanceofFinanceLease*10000;
//                money=money*10000;
//                ss.setMoney(money);
//                ss.setBalanceofFinanceLease(balanceofFinanceLease);
                ss.setStatus(status);
            }
            EasyExcel.write(tempFile, EmsEt.class).sheet(names).doWrite(imsCategories);

            response.setContentType("application/vnd.ms-excel");
            //字符编码
            response.setCharacterEncoding("utf-8");
            //设置响应头
            response.setHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(names, "UTF-8"));
            response.setHeader("Access-Control-Allow-Origin", "*");
            response.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE");
            response.setHeader("Access-Control-Allow-Headers", "Content-Type");

            InputStream inputStream = new FileInputStream(tempFile);
            OutputStream os = response.getOutputStream();
            byte[] b = new byte[2048];
            int length;
            while ((length = inputStream.read(b)) > 0) {
                os.write(b, 0, length);
            }
            // os.write(FileUtils.readFileToByteArray(tempFile));
            os.flush();
            os.close();
            inputStream.close();

        } catch (FileNotFoundException e) {
            e.printStackTrace();

        } catch (IOException e) {
            e.printStackTrace();
        }

    }

    


    @Override
    public List<EmsEt> timePopupWindow(Integer timeType, String industry, String status) {
        List<EmsEt> emsEtList = new ArrayList<>();
        String startTime = TimeUtil.getTimeStrByTimeTypeAndOffset(timeType, 0);
        String endTime = TimeUtil.getTimeStrByTimeTypeAndOffset(timeType, 0);
        List<EmsEt> etList = emsEtMapper.timePopupWindow(industry, status);
        if (null != timeType && timeType == 0) {
            String startTimes = TimeUtil.getTimeStrByTimeTypeAndOffset(timeType, -1);
            String endTimes = TimeUtil.getTimeStrByTimeTypeAndOffset(timeType, -1);
            for (EmsEt ls : etList) {
                Integer id = ls.getId();
                Double totalUsage = enterpriseAnalysisService.getTotalUsage(id, startTimes, endTimes, timeType);
                String coxunt = emsEtMapper.coxunt(ls.getId(), startTimes);
                ls.setTotalUsage(totalUsage);
                ls.setEarlyWarning(coxunt);
                emsEtList.add(ls);
            }
        } else {
            for (EmsEt ls : etList) {
                Integer id = ls.getId();
                Double totalUsage = enterpriseAnalysisService.getTotalUsage(id, startTime, endTime, timeType);
                String coxunt = emsEtMapper.coxunt(ls.getId(), startTime);
                ls.setTotalUsage(totalUsage);
                ls.setEarlyWarning(coxunt);
                emsEtList.add(ls);
            }
        }
        return emsEtList;
    }

    @Override
    public List<BigScreenTop> listActivities(String name, String address) {
        return emsEtMapper.listActivities(name, address);
    }



    @Override
    public Object test(HttpServletRequest request) {
        List<CdwtVo> sele = emsEtMapper.sele();
           emsEtMapper.INSTORaLL(sele);
        return sele;
    }



    /* //查入多列之和的全部数据
    @Override
    public Object test(HttpServletRequest request) {
        // Map<Object, Object> map = AllList();
        TreeMap<Object, Object> map2 = rowVla(2);
        TreeMap<Object, Object> map3 = rowVla(3);
        TreeMap<Object, Object> map4 = rowVla(4);
        ArrayList<Object> objects = new ArrayList<>();
        //Set<Map.Entry<Object, Object>> entries2 = map2.entrySet();//此行可省略,直接将map.entrySet()写在for-each循环的条件中
        //Set<Map.Entry<Object, Object>> entries3 = map3.entrySet();//此行可省略,直接将map.entrySet()写在for-each循环的条件中
       // Set<Map.Entry<Object, Object>> entries4 = map4.entrySet();//此行可省略,直接将map.entrySet()写在for-each循环的条件中
        map2.forEach((key, value) -> {
            CdwtVo vo = new CdwtVo();
            BigDecimal map2Value = new BigDecimal(String.valueOf(map2.get(key)));
            BigDecimal map3Value = new BigDecimal(String.valueOf(map3.get(key)));
            BigDecimal map4Value = new BigDecimal(String.valueOf(map4.get(key)));
            String s = key.toString();
            String substring = s.substring(0, 10);
            String replace = substring.replace("-", "/");
            vo.setDataTime(replace);
            String s1 = String.valueOf(map2Value.add(map3Value).add(map4Value));
            vo.setDataValue(s1);
            vo.setMsId("1009310");
            emsEtMapper.insert(replace,s1);
            //System.out.println("包含" + entry.getKey() + "+" + entry.getValue());
            objects.add(vo);
        });
        return objects;
    }
*/
    private Map<String, BigDecimal> sumValueByTime(Map<Object, Object> list, String timeType) {
        Map<String, BigDecimal> result = new LinkedHashMap<String, BigDecimal>();//result size = 0 key = 2021-01 value = 998
        int subLength = getSubLength(timeType);
        //遍历集合进行加法操作
        list.forEach((key, value) -> {//key = 2021-01 value = 998
            String resultKey = String.valueOf(key).substring(0, subLength);
            BigDecimal resultValue = result.get(resultKey) == null ? BigDecimal.ZERO : result.get(resultKey);
            resultValue = resultValue.add(new BigDecimal(String.valueOf(value)));
            result.put(resultKey, resultValue);
        });
        return result;
    }

    private  int   getSubLength(String timeType) {
        if ("0".equals(timeType))
            return 10;
        else if ("1".equals(timeType))
            return 7;
        else if ("".equals(timeType))
            return 4;
        else
           return 0;
    }

    /* //插入每一列的数据
    @Override
    public Object test(HttpServletRequest request) {

       // Map<Object, Object> map = AllList();
        TreeMap<Object, Object> map = rowVla(3);
        ArrayList<Object> objects = new ArrayList<>();
        Set<Map.Entry<Object, Object>> entries = map.entrySet();//此行可省略,直接将map.entrySet()写在for-each循环的条件中
        for(Map.Entry<Object, Object> entry:entries){
            CdwtVo vo=new CdwtVo();
            String s = entry.getKey().toString();
            String substring = s.substring(0,10);
            String  replace= substring.replace("-", "/");//excel导入处理好的时间
            //continue;
            //CdwtVo cdwt = emsEtMapper.cdwt();//2021/10/13
            String dataTime = "2021/09/30";
            int c=  replace.compareTo(dataTime);
            boolean b = replace.compareTo(dataTime)>=0;
            if(b){
               vo.setDataTime(replace);
               vo.setDataValue(entry.getValue().toString());
               vo.setMsId("HD_HD72_350_P1");
                System.out.println("包含"+entry.getKey()+"+"+entry.getValue());
            }
             objects.add(vo);
        }

        return objects;
    }
     */

    //list 去重
    public static List ridRepeat1(List<Object> list) {
        List<Object> newList = new ArrayList<>();
        list.forEach(str -> {
            if (!newList.contains(str)) {
                newList.add(str);
            }
        });
        return newList;
    }


    public static <T> List<T> merge(List<T> list1, List<T> list2) {
        List<T> list = new ArrayList<>();
        Stream.of(list1, list2).forEach(list::addAll);

        return list;
    }


    private static TreeMap<Object, Object> rowVla(int row) {
        String filepath = "C:\\Users\\Administrator\\Desktop\\附件一:用水21-22.xlsx";
        //InputStream inputStream = file.getInputStream();
        // Workbook Workbook = new XSSFWorkbook(inputStream);
        //  String fileName = file.getOriginalFilename();

        // 2.应用HUtool ExcelUtil获取ExcelReader指定输入流和sheet
        // ExcelReader excelReader = ExcelUtil.getReader(inputStream, "导入材料清单");
        // 可以加上表头验证
        // 3.读取第二行到最后一行数据
        ExcelReader excelReader = ExcelUtil.getReader(FileUtil.file(filepath));
        List<List<Object>> read = excelReader.read(2, excelReader.getRowCount());//所有
        // List<Object> ss= excelReader.readRow(0); //一行
        TreeMap<Object, Object> map = new TreeMap<>();
        for (List<Object> objects : read) {
            map.put(objects.get(0), objects.get(row));
        }

        // ExcelReader reader0 = ExcelUtil.getReader(ResourceUtil.getStream(inputStream.toString()));

        //通过sheet编号获取
        //ExcelReader reader1 = ExcelUtil.getReader(FileUtil.file(filepath), 0);
        //通过sheet名获取
        // ExcelReader   reader2 = ExcelUtil.getReader(FileUtil.file(filepath), "101");
        return map;

    }


    /**
     * 文件上传
     *
     * @param file
     * @param request
     * @return
     */
    @Override
    public JSONObject uploadFile(MultipartFile file, HttpServletRequest request) throws Exception {

        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
            MultipartFile files = entity.getValue();// 获取上传文件对象
            ImportParams params = new ImportParams();
            params.setTitleRows(2);
            params.setHeadRows(1);
            params.setNeedSave(true);
            List<Object> list = ExcelImportUtil.importExcel(file.getInputStream(), null, params);

        }

        //获取文件名称
        String fileName = file.getOriginalFilename();
        //获取文件存放路径
        //路径
        //String path = request.getSession().getServletContext().getRealPath("").concat("/uploadFile");
        //服务器项目路径
        String path = (new File(request.getSession().getServletContext().getRealPath("\\"))).getParent() + "\\file";
        //本地路径
        //String path=this.getClass().getResource("/").getPath().replaceFirst("/", "");  +/file
        File files = new File(path); //判断路径
        //将上传的文件存储到file目录中
        // String path = getUploadPath(fileName,request);
        //上传文件
        File targetFile = new File(files, fileName);
        if (!targetFile.exists()) {
            targetFile.mkdirs();
        }
        //保存
        try {
            file.transferTo(targetFile);
        } catch (Exception e) {
            e.printStackTrace();
            return new JSONObject(fileName);
        }
        //logger.info(fileName+"文件上传成功");
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("key", "true");
        jsonObject.put("name", fileName);
        jsonObject.put("path", path + "\\" + fileName);
        return jsonObject;
    }


    public static boolean isEmptyCell(Cell cell) {
        if (cell == null || cell.getCellType().equals(CellType.BLANK)) {
            return true;
        }
        return false;
    }


    public List<EmsEt> readXLSX(MultipartFile file) throws IOException, ParseException {
        ArrayList<EmsEt> list = new ArrayList<>();

        InputStream inputStream = file.getInputStream();
        Workbook Workbook = new XSSFWorkbook(inputStream);

        Sheet sheet = Workbook.getSheetAt(0);
        int lastRowNum = sheet.getLastRowNum();
        for (int rowNum = 1; rowNum <= lastRowNum; rowNum++) {
            Row row = sheet.getRow(rowNum);
            if (row != null) {
                EmsEt et = new EmsEt();
                //使用了getStringCellValue()方法来获取值,POI会判断单元格的类型,如果非字符串类型就会抛出上面的异常。
                //所以先使用setCellType()方法先将该单元格的类型设置为STRING
                //然后poi会根据字符串读取它
                DataFormatter dataFormatter = new DataFormatter();
                String value1 = dataFormatter.formatCellValue(row.getCell(1));
                String value2 = dataFormatter.formatCellValue(row.getCell(2));
                String value3 = dataFormatter.formatCellValue(row.getCell(3));
                String value4 = dataFormatter.formatCellValue(row.getCell(4));
                String value5 = dataFormatter.formatCellValue(row.getCell(5));
                row.getCell(5).setCellType(CellType.STRING);
                String value6 = dataFormatter.formatCellValue(row.getCell(6));
                String value7 = dataFormatter.formatCellValue(row.getCell(7));
                String value8 = dataFormatter.formatCellValue(row.getCell(8));
                String value9 = dataFormatter.formatCellValue(row.getCell(9));
                String value10 = dataFormatter.formatCellValue(row.getCell(10));
                String value11 = dataFormatter.formatCellValue(row.getCell(11));
                String value12 = dataFormatter.formatCellValue(row.getCell(12));
                String value13 = dataFormatter.formatCellValue(row.getCell(13));

                if (!row.getCell(0).getStringCellValue().isEmpty()) {
                    et.setName(row.getCell(0).getStringCellValue());
                } else {
                    et.setName(null);
                }
                if (!value1.isEmpty()) {
                    et.setLongitude(value1);
                } else {
                    et.setLongitude(null);
                }
                if (!value2.isEmpty()) {
                    et.setLatitude(value2);
                } else {
                    et.setLatitude(null);
                }
                if (!value3.isEmpty()) {
                    if (value3.equals("已完成")) {
                        et.setStatus("1");
                    } else {
                        et.setStatus("2");
                    }
                    // et.setStatus(row.getCell(3).getStringCellValue());
                } else {
                    et.setStatus(null);
                }
                if (!value4.isEmpty()) {
                    et.setMoney(Double.valueOf(value4));
                } else {
                    et.setMoney(null);
                }
                if (!row.getCell(5).getStringCellValue().isEmpty()) {
                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:MM:SS");
                    Date javaDate = HSSFDateUtil.getJavaDate(Double.valueOf(row.getCell(5).getStringCellValue()));
                    et.setContractStartTime(javaDate);
                } else {
                    et.setContractStartTime(null);
                }
                if (!value6.isEmpty()) {
                    Integer aDouble = Double.valueOf(String.valueOf(value6)).intValue();
                    et.setContractTerm(aDouble);
                } else {
                    et.setContractTerm(null);
                }
                if (!value7.isEmpty()) {
                    et.setAddress(value7);
                } else {
                    et.setAddress(null);
                }
                if (!value8.isEmpty()) {
                    et.setProjectContent(value8);
                } else {
                    et.setProjectContent(null);
                }
                if (!value9.isEmpty()) {

                    et.setBalanceofFinanceLease(Double.valueOf(value9));
                } else {
                    et.setBalanceofFinanceLease(null);
                }
                if (!value10.isEmpty()) {
                    et.setIndustryInvolved(value10);
                } else {
                    et.setIndustryInvolved(null);
                }
                if (!value11.isEmpty()) {
                    et.setAccountManager(value11);
                } else {
                    et.setAccountManager(null);
                }

                if (!value12.isEmpty()) {
                    Integer aDouble = Double.valueOf(String.valueOf(value12)).intValue();
                    et.setPhotovoltaicInstalledCapacity(aDouble);
                } else {
                    et.setPhotovoltaicInstalledCapacity(null);
                }

                if (!value13.isEmpty()) {
                    Integer aDouble = Double.valueOf(String.valueOf(value13)).intValue();
                    et.setEnergyStorageCapacity(aDouble);
                } else {
                    et.setEnergyStorageCapacity(null);
                }

                Cell cell = row.getCell(14);
                if (cell == null)
                    log.error("第" + rowNum + "行,第14列数据为null");
//
                list.add(et);
            }
        }
        return list;
    }


}

package com.xinda.service;

import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xinda.entity.BigScreenTop;
import com.xinda.entity.CdwtVo;
import com.xinda.entity.EmsEt;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.List;
import java.util.Map;


public interface IEmsEtService extends IService<EmsEt> {



    void  importExcell(MultipartFile excelFile, HttpServletRequest request);

     Object  test( HttpServletRequest request);
    JSONObject uploadFile(MultipartFile file, HttpServletRequest request) throws Exception;

    void download( HttpServletRequest request, HttpServletResponse response);

   

 
 




}

package com.xinda.controller;

import java.io.File;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.hutool.json.JSONObject;
import com.xinda.entity.BigScreenTop;
import com.xinda.entity.EmsEtTree;
import com.xinda.service.IEmsEtService;
import com.xinda.vo.QOQVO;
import org.apache.poi.ss.formula.functions.T;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import com.xinda.entity.EmsEt;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;

import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;

import static java.math.BigDecimal.ROUND_HALF_UP;

/**
 * @Description: 企业表
 * @Author: jeecg-boot
 * @Date:   2022-05-18
 * @Version: V1.0
 */
@Api(tags="企业表")
@RestController
@RequestMapping("/xinda/emsEt")
@Slf4j
public class EmsEtController extends JeecgController<EmsEt, IEmsEtService> {
   @Autowired
   private IEmsEtService emsEtService;
   
   
    /**
    * 导出excel
    *
    * @param request
    * @param emsEt
    */
    @RequestMapping(value = "/exportXls")
    public ModelAndView exportXls(HttpServletRequest request, EmsEt emsEt) {
        return super.exportXls(request, emsEt, EmsEt.class, "企业表");
    }

    /**
      * 通过excel导入数据
    *
    * @param request
    * @param response
    * @return
    */
    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
        return super.importExcel(request, response, EmsEt.class);
    }

    @AutoLog(value = "上传")
    @ApiOperation("上传")
    @PostMapping(value = "/importExcell",consumes = {MediaType.MULTIPART_FORM_DATA_VALUE})
    public Result<?> importExcell(@RequestParam("excelFile")MultipartFile multipartFile, HttpServletRequest request){
       emsEtService.importExcell(multipartFile,request);
       return  Result.OK("导入成功");
    }

   @AutoLog(value = "测试")
   @ApiOperation("测试")
   @PostMapping(value = "/test")
   public Result<?> test(HttpServletRequest request){
      Object test = emsEtService.test(request);
      return  Result.OK(test);
   }

   @AutoLog(value = "上传3")
   @ApiOperation(value="上传3", notes="上传3")
   @PostMapping(value = "/upload",consumes = {MediaType.MULTIPART_FORM_DATA_VALUE})
   //@ResponseBody
   public JSONObject upload(@RequestParam(value = "file") MultipartFile file, HttpServletRequest request) throws Exception {
      //fileOperation = new FileOperatzion();
      //返回文件后的文件路径
      return emsEtService.uploadFile(file,request);
   }




    @AutoLog(value = "导出下载")
    @ApiOperation(value="导出下载", notes="导出下载")
    @GetMapping(value = "/downloadOut",produces = {"application/vnd.ms-excel;charset=UTF-8"})
    public void downloadOut(
          HttpServletRequest request,HttpServletResponse response)  {
        emsEtService.download(request,response);
    }


    @AutoLog(value = "路径截取")
    @ApiOperation(value="路径截取", notes="路径截取")
    @GetMapping(value = "/put")
    public Result<?> put(HttpServletRequest request,HttpServletResponse response) {
       StringBuffer requestURL = request.getRequestURL();
       String substring = requestURL.substring(0, requestURL.length() - 3);
       String b = "downloadOut";
       substring = substring + b;
       return Result.OK(substring);
    }


   


}

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>jeecg-boot-parent</artifactId>
        <groupId>org.jeecgframework.boot</groupId>
        <version>2.4.2</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>ems-module-api</artifactId>
    <properties>
        <revision>3.1.0</revision>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.jeecgframework.boot</groupId>
            <artifactId>jeecg-boot-base-core</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>poi-ooxml-schemas</artifactId>
                    <groupId>org.apache.poi</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>poi-ooxml</artifactId>
                    <groupId>org.apache.poi</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>poi</artifactId>
                    <groupId>org.apache.poi</groupId>
                </exclusion>
            </exclusions>
        </dependency>


        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper-spring-boot-starter</artifactId>
            <version>1.3.0</version>
        </dependency>

        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>easyexcel</artifactId>
            <version>${revision}</version>
        </dependency>

        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>easyexcel-core</artifactId>
            <version>${revision}</version>
        </dependency>

        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>easyexcel-support</artifactId>
            <version>${revision}</version>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-jdk15on</artifactId>
            <version>1.68</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-jdk15on</artifactId>
            <version>1.68</version>
            <scope>compile</scope>
        </dependency>

    </dependencies>


</project>

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值