| | |
| | | package com.ruoyi.manage.service.impl; |
| | | |
| | | import cn.hutool.core.lang.UUID; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | import com.deepoove.poi.XWPFTemplate; |
| | | import com.deepoove.poi.config.Configure; |
| | | import com.deepoove.poi.config.ConfigureBuilder; |
| | | |
| | | |
| | | |
| | | import com.deepoove.poi.data.*; |
| | | import com.deepoove.poi.data.style.*; |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.manage.mapper.ManageRecordCancelMapper; |
| | | |
| | | import com.ruoyi.manage.pojo.ManageRecordCancel; |
| | | |
| | | import com.ruoyi.manage.service.ManageRecordCancelService; |
| | | |
| | | import com.ruoyi.system.mapper.UserMapper; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.apache.poi.ss.usermodel.BorderStyle; |
| | | import org.apache.poi.ss.usermodel.CellStyle; |
| | | import org.apache.poi.ss.usermodel.TableStyle; |
| | | import org.apache.poi.xwpf.usermodel.*; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | * 作废文件销魂记录 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 芯导软件(江苏)有限公司 |
| | | * @author |
| | | * @since 2024-11-13 01:27:22 |
| | | */ |
| | | @Service |
| | |
| | | @Resource |
| | | private ManageRecordCancelMapper manageRecordCancelMapper; |
| | | |
| | | |
| | | |
| | | |
| | | @Value("${wordUrl}") |
| | | private String wordUrl; |
| | |
| | | private UserMapper userMapper; |
| | | |
| | | @Override |
| | | public Map<String, Object> pageManageRecordCancel(Page page, ManageRecordCancel manageRecordCancel) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("head", PrintChina.printChina(ManageRecordCancel.class)); |
| | | map.put("body", manageRecordCancelMapper.pageManageRecordCancel(page, QueryWrappers.queryWrappers(manageRecordCancel))); |
| | | return map; |
| | | public IPage<ManageRecordCancel> pageManageRecordCancel(Page page, ManageRecordCancel manageRecordCancel) { |
| | | return manageRecordCancelMapper.pageManageRecordCancel(page, QueryWrappers.queryWrappers(manageRecordCancel)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | OutputStream outputStream = new FileOutputStream(file); |
| | | IOUtils.copy(inputStream, outputStream); |
| | | url = file.getAbsolutePath(); |
| | | inputStream.close(); |
| | | outputStream.close(); |
| | | } catch (FileNotFoundException e) { |
| | | throw new ErrorException("找不到模板文件"); |
| | | } catch (IOException e) { |
| | |
| | | for (int i = 1; i < rows.size(); i++) { // 从第二行开始,跳过表头 |
| | | XWPFTableRow row = rows.get(i); |
| | | if (row.getTableCells().size() != 10) { |
| | | System.out.println("行 " + (i + 1) + " 的列数不匹配,跳过该行"); |
| | | continue; |
| | | } |
| | | if (ObjectUtils.isNotEmpty(row.getCell(1).getText())) { |
| | |
| | | } |
| | | } |
| | | } |
| | | if(CollectionUtils.isEmpty(manageRecordCancelList)){ |
| | | throw new RuntimeException("导入模板有误"); |
| | | } |
| | | saveOrUpdateBatch(manageRecordCancelList); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |