Parcourir la source

导出报告搭建

lwhhszx il y a 1 an
Parent
commit
cb5f68dd4f

+ 8 - 0
pom.xml

@@ -239,6 +239,14 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-amqp</artifactId>
         </dependency>
+
+<!--  poi-->
+        <dependency>
+            <groupId>io.github.draco1023</groupId>
+            <artifactId>poi-tl-ext</artifactId>
+            <version>0.4.2</version>
+        </dependency>
+
     </dependencies>
 
     <build>

+ 2 - 0
src/main/java/cn/cslg/pas/Application.java

@@ -3,6 +3,7 @@ package cn.cslg.pas;
 import cn.hutool.cron.CronUtil;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.system.ApplicationHome;
 import org.springframework.cache.annotation.EnableCaching;
 
 import java.text.SimpleDateFormat;
@@ -14,6 +15,7 @@ public class Application {
 
     public static void main(String[] args) {
         SpringApplication.run(Application.class, args);
+
         System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "后台程序已启动,请运行前台");
     }
 }

+ 78 - 0
src/main/java/cn/cslg/pas/common/model/SystemMO.java

@@ -0,0 +1,78 @@
+package cn.cslg.pas.common.model;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * 报表系统数据 年月日、专案代码
+ */
+@Accessors(chain = true)
+@Data
+public class SystemMO {
+    private String year; //年
+    private String month; //月
+    private String day; //日
+    private String date; //完整日期
+    private String zadm; //专案代码
+    private String reportName;
+
+    public SystemMO() {
+    }
+
+    public SystemMO(String year, String month, String day, String zadm, String reportName) {
+        this.year = year;
+        this.month = month;
+        this.day = day;
+        this.date = year + "-" + month + "-" + day;
+        this.zadm = zadm;
+        this.reportName = reportName;
+    }
+
+//    public String getReportName() {
+//        return reportName;
+//    }
+//
+//    public void setReportName(String reportName) {
+//        this.reportName = reportName;
+//    }
+//
+//    public String getYear() {
+//        return year;
+//    }
+//
+//    public void setYear(String year) {
+//        this.year = year;
+//    }
+//
+//    public String getMonth() {
+//        return month;
+//    }
+//
+//    public void setMonth(String month) {
+//        this.month = month;
+//    }
+//
+//    public String getDay() {
+//        return day;
+//    }
+//
+//    public void setDay(String day) {
+//        this.day = day;
+//    }
+//
+//    public String getDate() {
+//        return date;
+//    }
+//
+//    public void setDate(String date) {
+//        this.date = date;
+//    }
+//
+//    public String getZadm() {
+//        return zadm;
+//    }
+//
+//    public void setZadm(String zadm) {
+//        this.zadm = zadm;
+//    }
+}

+ 40 - 1
src/main/java/cn/cslg/pas/common/utils/FileUtils.java

@@ -1,6 +1,7 @@
 package cn.cslg.pas.common.utils;
 
 
+import cn.cslg.pas.Application;
 import org.apache.commons.fileupload.FileItem;
 import org.apache.commons.fileupload.disk.DiskFileItemFactory;
 import org.springframework.boot.system.ApplicationHome;
@@ -21,7 +22,7 @@ public class FileUtils {
 
     public static String getStaticPath(String fileName) {
         //ApplicationHome类 返回target目录层级
-        ApplicationHome ah = new ApplicationHome(FileUtils.class);
+        ApplicationHome ah = new ApplicationHome(Application.class);
         //获取 applicationHome 内的路径 ...\target\classes 到这一层级下
         File file = ah.getSource();
         //获取 file的parentFile 即最后一级之前的所有层级路径(包括盘符) 这里能获得到的最终层级为  ...\target 后续用FILE_SEPARATOR(系统路径分割通配符 即 "\") 以及fileName拼接生成存放文件的目录层级 即为根目录 root
@@ -121,4 +122,42 @@ public class FileUtils {
         in.close();
         return file;
     }
+
+    public String getPath(String url) {
+        return getStaticPath(COMMON_FILE) + url;
+    }
+    public String getDirectoryName() {
+        return DateUtils.getNowTimeFormat("yyyyMMdd");
+    }
+
+    public String getSavePath(String directoryName) {
+        return getStaticPath(COMMON_FILE) + FILE_SEPARATOR + directoryName + FILE_SEPARATOR;
+    }
+    public String createDirectory() {
+        String directoryName = this.getDirectoryName();
+        String savePath = this.getSavePath(directoryName);
+        File directory = new File(savePath);
+        if (!directory.exists()) {
+            directory.mkdir();
+        }
+        return directoryName;
+    }
+
+    public static FileInputStream byteToFile(byte[] bytes, String fileName) {
+        File file = new File(fileName);
+        FileInputStream fileInputStream = null;
+        try {
+            OutputStream output = new FileOutputStream(file);
+            BufferedOutputStream bufferedOutput = new BufferedOutputStream(output);
+            bufferedOutput.write(bytes);
+            fileInputStream = new FileInputStream(file);
+            file.deleteOnExit();
+            return fileInputStream;
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return fileInputStream;
+    }
 }

+ 37 - 0
src/main/java/cn/cslg/pas/controller/ReportExportController.java

@@ -0,0 +1,37 @@
+package cn.cslg.pas.controller;
+
+import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.model.cronModel.Records;
+import cn.cslg.pas.common.model.request.StringRequest;
+import cn.cslg.pas.common.utils.Response;
+import cn.cslg.pas.factorys.businessFactory.Business;
+import cn.cslg.pas.service.ReportExportService;
+import cn.cslg.pas.service.business.CommonService;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.annotation.AccessType;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Slf4j
+@RequestMapping(Constants.API_XiaoSHI + "/reportExport")
+@RestController
+public class ReportExportController {
+    @Autowired
+    private ReportExportService reportExportService;
+    @Autowired
+    private CommonService commonService;
+    @Operation(summary = "导出报告")
+    @PostMapping("/export")
+    public Response queryPatentProject(@RequestBody StringRequest stringRequest) throws Exception {
+//        reportExportService.exportReport(1,1);
+      String a
+         =commonService.readJsonFile("event.json");
+      System.out.println(a);
+        return Response.success("records");
+    }
+
+}

+ 112 - 0
src/main/java/cn/cslg/pas/service/MailSendService.java

@@ -0,0 +1,112 @@
+package cn.cslg.pas.service;
+
+import cn.cslg.pas.common.model.cronModel.Personnel;
+import cn.cslg.pas.common.utils.RabbitMQUtils;
+import cn.cslg.pas.service.permissions.PermissionService;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+@Service
+public class MailSendService {
+    @Autowired
+    private PermissionService permissionService;
+    @Value("${PASUrl}")
+    private String url;
+    @Autowired
+    private RabbitMQUtils rabbitMQUtils;
+
+    //发送协同邮件
+    public String sendSynery(String personId, Boolean ifInner, Integer projectId, Integer taskId, Integer reportType) {
+        Map<String, Object> map = new LinkedHashMap<>();
+        map.put("title", "任务通知");
+        String name = "";
+        //判断是否为内部人员
+        if (ifInner) {
+            String res = "";
+            try {
+                res = permissionService.getPersonnelByIdsFromPCS(Arrays.asList(personId));
+            } catch (Exception e) {
+            }
+            if (!res.equals("")) {
+                map.put("template", "mail/SyneryInside.html");
+                JSONObject jsonObject = JSONObject.parseObject(res);
+                List<Personnel> personnels = JSON.parseArray(jsonObject.getString("data"), Personnel.class);
+                map.put("value1", personnels.get(0).getPersonnelName());
+                map.put("email", personnels.get(0).getPersonnelEmail());
+                map.put("img", "/logo.png");
+                map.put("value2", url + "/Incomplete?taskId=" + taskId + "&reportId=" + projectId + "&type=1" + "&reportType=" + reportType);
+            }
+        } else {
+            map.put("template", "mail/Synery.html");
+            String orgin = personId;
+            String parStr = "\\<([^}]*)\\>";
+            Pattern pattern = Pattern.compile(parStr);
+            Matcher matcher = pattern.matcher(orgin);
+            if (matcher.find()) {
+                String personName = orgin.substring(0, matcher.start());
+                String email = matcher.group(0);
+                email = email.replace("<", "");
+                email = email.replace(">", "");
+                map.put("value1", personName);
+                map.put("email", email);
+                map.put("img", "/logo.png");
+                map.put("value2", "111");
+                map.put("value3", url + "/identificationCode");
+            }
+        }
+        rabbitMQUtils.sendEmailMessage(map);
+        return name;
+    }
+
+    //发送邮件给抄送人
+    public void sentToCCMail(String personId, Boolean ifInner, String syneryName) {
+        Map<String, Object> map = new LinkedHashMap<>();
+        map.put("title", "任务通知");
+        //判断是否为内部人员
+        if (ifInner) {
+            String res = "";
+            try {
+                res = permissionService.getPersonnelByIdsFromPCS(Arrays.asList(personId));
+            } catch (Exception e) {
+            }
+            if (!res.equals("")) {
+                map.put("template", "mail/SyneryTo.html");
+                JSONObject jsonObject = JSONObject.parseObject(res);
+                List<Personnel> personnels = JSON.parseArray(jsonObject.getString("data"), Personnel.class);
+                map.put("value1", personnels.get(0).getPersonnelName());
+                map.put("email", personnels.get(0).getPersonnelEmail());
+                map.put("img", "/logo.png");
+                map.put("value2", syneryName);
+                rabbitMQUtils.sendEmailMessage(map);
+
+            }
+        } else {
+            map.put("template", "mail/Synery.html");
+            String orgin = personId;
+            String parStr = "\\<([^}]*)\\>";
+            Pattern pattern = Pattern.compile(parStr);
+            Matcher matcher = pattern.matcher(orgin);
+            if (matcher.find()) {
+                String personName = orgin.substring(0, matcher.start());
+                String email = matcher.group(0);
+                email = email.replace("<", "");
+                email = email.replace(">", "");
+                map.put("value1", syneryName);
+                map.put("email", email);
+                map.put("img", "/logo.png");
+                map.put("value2", personName);
+            }
+        }
+        rabbitMQUtils.sendEmailMessage(map);
+    }
+}

+ 229 - 0
src/main/java/cn/cslg/pas/service/ReportExportService.java

@@ -0,0 +1,229 @@
+package cn.cslg.pas.service;
+
+import cn.cslg.pas.common.model.SystemMO;
+import cn.cslg.pas.common.utils.DateUtils;
+import cn.cslg.pas.common.utils.FileUtils;
+import cn.cslg.pas.domain.business.Project;
+import cn.cslg.pas.domain.business.ReportProject;
+import cn.cslg.pas.domain.business.ReportTemple;
+import cn.cslg.pas.service.business.ReportProjectService;
+import cn.cslg.pas.service.business.TempleService;
+import cn.cslg.pas.service.common.FileManagerService;
+import cn.hutool.core.util.IdUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.deepoove.poi.XWPFTemplate;
+import com.deepoove.poi.config.Configure;
+import com.deepoove.poi.data.PictureType;
+import com.deepoove.poi.data.Pictures;
+import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
+import org.apache.commons.lang3.StringUtils;
+import org.ddr.poi.html.HtmlRenderPolicy;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.*;
+
+@Service
+public class ReportExportService {
+    @Autowired
+    private TempleService templeService;
+    @Autowired
+    private FileUtils fileUtils;
+    @Autowired
+    private ReportProjectService reportProjectService;
+    @Autowired
+    private FileManagerService fileManagerService;
+
+    /**
+     * @param reportId
+     * @param templeId
+     * @return
+     * @throws IOException
+     * @function: 导出报告
+     */
+    public String exportReport(Integer reportId, Integer templeId) throws IOException {
+        //根据模板ID获得模板
+//        ReportTemple reportTemplate = templeService.getById(templeId);
+//        //获得模板路径
+//        String filePath = fileUtils.getPath(reportTemplate.getTemplatePath());
+        //读取模板后保存生成word的地址
+        String fileName = IdUtil.simpleUUID() + ".docx";
+        String directoryName = fileUtils.createDirectory();
+        String outPath = fileUtils.getSavePath(directoryName) + fileName;
+
+        ReportProject report = reportProjectService.getById(reportId);
+        XWPFTemplate template = null;
+        template = this.avoidDesignTemplate(1);
+//        if (report.getReportType() == 0 || report.getReportType() == 2) {
+//           template = this.getstabilityTemplate(report, filePath);
+//        } else if (report.getReportType() == 3) {
+//            template = this.FTOtemplate(reportId, filePath, templeId);
+//        } else if (report.getReportType() == 4) {
+//         template = this.Torttemplate(reportId, filePath, templeId);
+//        } else if (report.getReportType() == 5) {
+//           template = this.avoidDesignTemplate(reportId, filePath);
+//        } else if (report.getReportType() == 1) {
+//          template = this.getThirdTemplate(report, filePath);
+//        }
+        // 读取模板、数据并渲染
+//         文件是否已存在,则删除
+        File file = new File(outPath);
+        if (file.exists()) {
+            file.delete();
+        }
+//      生成word保存在指定目录
+        template.writeToFile(outPath);
+        template.close();
+        //导出成功后,导出报告记录入库
+//        String url = fileUtils.getDirectory2(directoryName) + fileName;
+//        PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+//        ReportDocument reportDocument = new ReportDocument();
+//        reportDocument.setReportId(reportId);
+//        reportDocument.setFileName(fileName);
+//        reportDocument.setFilePath(url);
+//        reportDocument.setPersonId(personnelVO.getId());
+//        reportDocument.setTemplateId(reportTemplate.getId());
+//        reportDocument.setTemplateName(reportTemplate.getTemplateName());
+//        reportDocument.setPersonName(personnelVO.getName());
+//        reportDocument.insert();
+//        return Response.success(url);
+        return "";
+    }
+
+
+//    private XWPFTemplate Torttemplate(Integer reportId, String filePath, Integer templateId) throws IOException {
+//        //根据报告Id查询标的专利号
+//        ReportProject report = reportProjectService.getById(reportId);
+//        String patentNo = report.getSignPatentNo();
+////        PatentVO patentVO = new PatentVO();
+////        patentVO.setPatentNos(Arrays.asList(patentNo));
+////        //根据专利号查询专利详细信息
+////        String resBody = outInterfaceService.getPatentDTOListForRMS(patentVO);
+////        JSONObject jsonObject = JSONObject.parseObject(resBody);
+////        List<JSONObject> patentDTOS = JSON.parseArray(jsonObject.get("data").toString(), JSONObject.class);
+////        //装载单个专利的信息
+//        Map<String, Object> patentMap = new HashMap<>();
+////        JSONObject patent = patentDTOS.get(0);
+////        List<JSONObject> applicantJSONs = JSON.parseArray(patent.get("applicant").toString(), JSONObject.class);
+////        StringBuilder applicants = new StringBuilder();
+////        StringBuilder rightPerson = new StringBuilder();
+////        applicantJSONs.forEach(tem -> {
+////            if (Integer.parseInt(tem.get("dataType").toString()) == 1) {
+////                applicants.append(tem.get("name") + "\r");
+////            } else {
+////                rightPerson.append(tem.get("name") + "\r");
+////            }
+////        });
+////        //装载同族信息
+////        JSONObject familys = JSONObject.parseObject(patent.get("family").toString());
+////        List<String> patSnaps = JSON.parseArray(familys.get("patSnap").toString(), String.class);
+////        List<String> simples = JSON.parseArray(familys.get("simple").toString(), String.class);
+////        List<String> inpadocs = JSON.parseArray(familys.get("inpadoc").toString(), String.class);
+////        patSnaps.addAll(simples);
+////        patSnaps.addAll(inpadocs);
+////        String familyStr = StringUtils.join(patSnaps, ",");
+////        //装载法律状态
+////        StringBuilder affair = new StringBuilder();
+////        List<JSONObject> affaires = JSON.parseArray(patent.get("affair").toString(), JSONObject.class);
+////        affaires.forEach(item -> {
+////                    affair.append(item.get("status") + "\r");
+////                }
+////        );
+////        //同族专利
+////        patentMap.put("simpleFamilys", familyStr);
+////        //引用专利
+////        patentMap.put("quotePatents", patent.get("quote"));
+////        //申请日
+////        patentMap.put("applicationDate", patent.get("applicationDate"));
+////        //公开日
+////        patentMap.put("publicDate", patent.get("publicDate"));
+////        //专利号
+////        patentMap.put("publicNo", patent.get("publicNo"));
+////        patentMap.put("firstPublicDate", patent.get("firstPublicDate"));
+////        patentMap.put("applicant", applicants);
+////        patentMap.put("rightPerson", rightPerson);
+////        patentMap.put("affair", affair);
+////        patentMap.put("name", patent.get("name"));
+//        //图示
+//        patentMap.put("abstractPath", "");
+//        //获得专利对比记录的信息
+////        Map<String, Object> temMap = compareMessageService.queryforTemplate(patent.get("patentNo").toString(), reportId);
+////        List<CompareMessageVO> compareMessageVOS = (List<CompareMessageVO>) temMap.get("compareMessageVOs");
+//        //装载对比记录的信息
+////        patentMap.put("cM", compareMessageVOS);
+////        patentMap.put("rightNum", temMap.get("right"));
+////        patentMap.put("mainRightNum", temMap.get("mainRight"));
+//        Map<String, Object> map = new HashMap<>();
+//        String date = DateUtils.formatDate(new Date(), DateUtils.YYYY_MM_DD);
+//        String[] ds = date.split("-");
+//        map.put("sys", new SystemMO(ds[0], ds[1], ds[2], "", "reportName"));
+//        map.put("patentMap", patentMap);
+//        map.put("", patentNo);
+//        // 为表格的显示绑定行循环
+//        LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
+//        HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
+//        // 将bz设置为行循环绑定的数据源的key,即key是bz的value会在模板中的{{bz}}处进行解析
+//        Configure configure = Configure.builder().bind("cM", policy).bind("targetDescription", htmlRenderPolicy).build();
+//        XWPFTemplate template = XWPFTemplate.compile(filePath, configure).render(map);
+//        return template;
+//    }
+
+    private XWPFTemplate avoidDesignTemplate(Integer reportId) throws IOException {
+        String filePath = fileUtils.getPath("/11.docx");
+
+//        log.info("开始处理导出规避设计报告,参数为:{}, {}", reportId, filePath);
+//        Report report = reportService.getById(reportId);
+//        String signPatentNo = report.getSignPatentNo();
+//
+//        //装载标的专利信息
+//        Map<String, Object> signPatent = this.signPantentMess(report.getSignPatentNo());
+//        System.out.println(signPatent.get(""));
+//        Map<String, Object> map = new HashMap<>();
+//        //装载标的专利信息
+//        map.put("signPatent", signPatent);
+//        map.put("rights", signPatent.get("rights"));
+//        //装载公开/公告号
+//        map.put("pantentNo", signPatentNo);
+//
+//        //装载年月日
+//        String date = DateUtils.formatDate(new Date(), DateUtils.YYYY_MM_DD);
+//        String[] dates = date.split("-");
+//        SystemMO systemMO = new SystemMO()
+//                .setYear(dates[0])
+//                .setMonth(dates[1])
+//                .setDay(dates[2]);
+//        map.put("sys", systemMO);
+//
+//        //装载特征、解释、回避设计方向、回避设计总体方向
+//        List<AvoidFeaturesVO> features = avoidDesignLittleDirectionMapper.selectWholeByReportId(reportId);
+//        String wholeDirection = avoidDesignWholeDirectionMapper.selectWholeDirectionByReportId(reportId);
+//        map.put("features", features);
+//        map.put("wholeDirection", wholeDirection);
+//
+        //绑定政策(绑定集合和元素循环遍历)
+        LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
+        //把指定元素内容识别传输成html格式
+        HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
+        Configure configure = Configure.builder()
+//                .bind("signPatent.rights", policy)
+//                .bind("features", policy)
+//                .bind("explainText", htmlRenderPolicy)
+//                .bind("littleDirection", htmlRenderPolicy)
+//                .bind("wholeDirection", htmlRenderPolicy)
+                .build();
+        Map<String, Object> map = new HashMap<>();
+        byte[] bytes = fileManagerService.downloadSystemFileFromFMS("CN202022791374.3_p");
+
+
+        FileInputStream fileInputStream = FileUtils.byteToFile(bytes, "aa.png");
+        map.put("p", Pictures.ofStream(fileInputStream, PictureType.PNG)
+                .create());
+        map.put("a", "张");
+        XWPFTemplate template = XWPFTemplate.compile(filePath, configure).render(map);
+        return template;
+    }
+}

+ 12 - 1
src/main/java/cn/cslg/pas/service/business/CommonService.java

@@ -1,5 +1,6 @@
 package cn.cslg.pas.service.business;
 
+import cn.cslg.pas.Application;
 import cn.cslg.pas.common.model.common.QueryCondition;
 import cn.cslg.pas.common.model.cronModel.GroupConfig;
 import cn.cslg.pas.common.model.cronModel.SqlObject;
@@ -13,6 +14,7 @@ import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.system.ApplicationHome;
 import org.springframework.stereotype.Service;
 
 import java.io.*;
@@ -27,8 +29,11 @@ import java.util.stream.Collectors;
 @Service
 @Slf4j
 public class CommonService {
+
     @Autowired
     private EventService eventService;
+    @Autowired
+    private FileUtils fileUtils;
     /**
      * 根据获得文件json
      *
@@ -38,7 +43,13 @@ public class CommonService {
     public static String readJsonFile(String fileName) {
         String json = "";
         try {
-            File file = new File("src/main/resources/jsons/" + fileName);
+            ApplicationHome ah = new ApplicationHome(Application.class);
+            //获取 applicationHome 内的路径 ...\target\classes 到这一层级下
+            File fileTem = ah.getSource();
+            //获取 file的parentFile 即最后一级之前的所有层级路径(包括盘符) 这里能获得到的最终层级为  ...\target 后续用FILE_SEPARATOR(系统路径分割通配符 即 "\") 以及fileName拼接生成存放文件的目录层级 即为根目录 root
+            String rootPath = fileTem.getParentFile().toString() + FileUtils.FILE_SEPARATOR+"jsons/";
+//            String filePath = fileUtils.getPath("/11.docx");
+            File file = new File(rootPath + fileName);
             Reader reader = new InputStreamReader(new FileInputStream(file), "utf-8");
             int ch = 0;
             StringBuffer buffer = new StringBuffer();

+ 0 - 46
src/main/java/cn/cslg/pas/service/mailSendService.java

@@ -1,46 +0,0 @@
-package cn.cslg.pas.service;
-
-import cn.cslg.pas.common.model.cronModel.Personnel;
-import cn.cslg.pas.service.permissions.PermissionService;
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.Arrays;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-@Service
-public class mailSendService {
-    @Autowired
-    private PermissionService permissionService;
-
-    public void sendSynery(String personId, String taskName, Boolean ifInner) {
-        Map<String, Object> map = new LinkedHashMap<>();
-        map.put("title", "任务通知");
-        map.put("template", "mail/eTaskConfirm.html");
-        map.put("img", "\\src\\main\\resources\\mail\\logo.png");
-        //判断是否为内部人员
-        if (ifInner) {
-            String res = "";
-            try {
-                res = permissionService.getPersonnelByIdsFromPCS(Arrays.asList(personId));
-            } catch (Exception e) {
-            }
-            if (!res.equals("")) {
-                JSONObject jsonObject = JSONObject.parseObject(res);
-                List<Personnel> personnels = JSON.parseArray(jsonObject.getString("data"), Personnel.class);
-                map.put("value1", personnels.get(0).getPersonnelName());
-                map.put("value2", taskName);
-                map.put("email", personnels.get(0).getPersonnelEmail());
-            }
-        } else {
-
-        }
-
-
-//    mailUtils.sendEmailMessage(map);
-    }
-}

+ 0 - 1
src/main/resources/application-dev.yml

@@ -66,6 +66,5 @@ PCSUrl: http://localhost:8871
 #OPSUrl: http://192.168.1.24:5001
 OPSUrl: http://139.224.24.90:5001
 PASUrl: http://localhost:8877
-RMSUrl: http://localhost:8872
 FMSUrl: http://localhost:8801
 FileSource: 1

+ 11 - 11
src/test/java/cn/cslg/pas/service/CommonServiceTests.java

@@ -52,6 +52,11 @@ public class CommonServiceTests {
     private FileManagerService fileManagerService;
     @Autowired
     private RabbitMQUtils rabbitMQUtils;
+    @Autowired
+    private MailSendService mailSendService;
+
+    @Autowired
+    private ReportExportService reportExportService;
     @Test
     void test() throws Exception {
         String aa = permissionService.getPersonIdByNamePCS("朱", false);
@@ -132,18 +137,13 @@ public class CommonServiceTests {
         PersonAddress personAddress = AddressSplitter.splitAddress(te, "91(上海)");
         System.out.println(personAddress);
     }
-
+//李仁杰<2232723707@qq.com>"
     @Test
     public void testEmail() throws Exception{
-
-        Map<String, Object> map = new LinkedHashMap<>();
-        map.put("title", "任务通知");
-        map.put("template", "mail/eTaskConfirm.html");
-        map.put("img", "\\src\\main\\resources\\mail\\logo.png");
-        map.put("value1", "李仁杰");
-        map.put("value2", "任务1");
-        map.put("email", "2232623707@qq.com");
-        rabbitMQUtils.sendEmailMessage(map);
-Thread.sleep(10000);
+//        mailSendService.sendSynery("李仁杰<2232623707@qq.com>",false,1,1,1);
+      //  mailSendService.sentToCCMail("李仁杰<2232623707@qq.com>",false,"刘德华");
+//        mailSendService.sentToCCMail("323",true,"张学友");
+        reportExportService.exportReport(1,1);
+        Thread.sleep(10000);
     }
     }