فهرست منبع

项目导出修改
项目完成度修改

yurk 3 سال پیش
والد
کامیت
e870ee8c1f

+ 260 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ProjectController.java

@@ -1,9 +1,17 @@
 package com.management.platform.controller;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.management.platform.entity.Company;
 import com.management.platform.entity.Project;
+import com.management.platform.entity.ProviderCategory;
+import com.management.platform.mapper.CompanyMapper;
+import com.management.platform.mapper.ProviderCategoryMapper;
 import com.management.platform.service.ProjectService;
 import com.management.platform.util.HttpRespMsg;
+import org.apache.poi.hssf.usermodel.*;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddressList;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.util.StringUtils;
@@ -14,10 +22,13 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import java.io.File;
+import java.io.FileOutputStream;
 import java.time.LocalDate;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -36,6 +47,10 @@ public class ProjectController {
     private String path;
     @Resource
     private HttpServletRequest request;
+    @Resource
+    private CompanyMapper companyMapper;
+    @Resource
+    private ProviderCategoryMapper providerCategoryMapper;
 
     /**
      * 获取我参与的全部项目的负责人列表
@@ -528,5 +543,250 @@ public class ProjectController {
         httpRespMsg.setError("更新失败");
         return httpRespMsg;
     }
+    @RequestMapping("/getTemplate")
+    public HttpRespMsg getTemplate(Integer companyId){
+        HttpRespMsg msg = new HttpRespMsg();
+        List<String> heads = new ArrayList<>();
+        Company company = companyMapper.selectById(companyId);
+        List<ProviderCategory> providerCategoryList = providerCategoryMapper.selectList(new QueryWrapper<ProviderCategory>().eq("company_id", companyId));
+        List<String> collect = providerCategoryList.stream().distinct().map(pc -> pc.getProviderCategoryName()).collect(Collectors.toList());
+        heads.add("项目编号");
+        heads.add("项目分类");
+        heads.add("是否为公共项目");
+        heads.add("项目名称");
+        heads.add("子项目(多个用,隔开)");
+        heads.add("参与人");
+        heads.add("主要负责人");
+        heads.add("级别");
+        if(company.getPackageCustomer()==1){
+            heads.add("客户");
+        }
+        if(company.getPackageProvider()==1){
+            for (String s : collect) {
+                heads.add(s);
+            }
+        }
+        heads.add("开始日期");
+        heads.add("截止日期");
+        heads.add("合同金额");
+        List<List<String>> allList = new ArrayList<>();
+        allList.add(heads);
+        String title = company.getCompanyName()+"_项目导入模板";
+        /*msg.data = ExcelUtil.exportGeneralExcelByTitleAndList(fileName, allList, path);*/
+        String result="系统提示:Excel文件导出成功!";
+        String fileName= title+".xls";
+        try {
+//            response.reset();
+//            response.setHeader("Content-disposition",
+//                "attachment;filename="+ URLEncoder.encode(fileName, "UTF-8"));
+//            //设置文件头编码格式
+//            response.setContentType("APPLICATION/OCTET-STREAM;charset=UTF-8");//设置类型
+//            response.setHeader("Cache-Control","no-cache");//设置头
+//            response.setDateHeader("Expires", 0);//设置日期头
+            // 创建工作簿
+            HSSFWorkbook workBook = new HSSFWorkbook();
+            // 创建工作类
+            HSSFSheet sheet = workBook.createSheet();
+            //设置首行冻结
+            sheet.createFreezePane(0, 1);
+            sheet.setDefaultColumnWidth(16);
+            //设置字体样式
+            HSSFFont headFont = workBook.createFont();
+            headFont.setBold(true);
+            headFont.setFontHeightInPoints((short) 10);
+            headFont.setFontName("黑体");
+
+            HSSFFont titleFont = workBook.createFont();
+            titleFont.setBold(true);
+            titleFont.setFontHeightInPoints((short) 10);
+            titleFont.setFontName("黑体");
+
+            HSSFFont font = workBook.createFont();
+            font.setFontHeightInPoints((short) 10);
+            font.setFontName("宋体");
+
+            //设置单元格样式
+            CellStyle headStyle = workBook.createCellStyle();
+            headStyle.setFont(headFont);
+            headStyle.setAlignment(HorizontalAlignment.CENTER);
+            headStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
+            headStyle.setWrapText(true);
+            headStyle.setBorderBottom(BorderStyle.THIN); //下边框
+            headStyle.setBorderLeft(BorderStyle.THIN);//左边框
+            headStyle.setBorderTop(BorderStyle.THIN);//上边框
+            headStyle.setBorderRight(BorderStyle.THIN);//右边框
+
+            String color = "c0c0c0";    //此处得到的color为16进制的字符串
+            //转为RGB码
+            int r = Integer.parseInt((color.substring(0,2)),16);   //转为16进制
+            int g = Integer.parseInt((color.substring(2,4)),16);
+            int b = Integer.parseInt((color.substring(4,6)),16);
+
+            //自定义cell颜色
+            HSSFPalette palette = workBook.getCustomPalette();
+            //这里的9是索引
+            palette.setColorAtIndex((short)9, (byte) r, (byte) g, (byte) b);
+
+            CellStyle titleStyle = workBook.createCellStyle();
+            titleStyle.setFont(titleFont);
+            titleStyle.setAlignment(HorizontalAlignment.CENTER);
+            titleStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
+            titleStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);  //填充单元格
+            titleStyle.setFillForegroundColor((short)9);    //填色
+            titleStyle.setWrapText(true);
+            titleStyle.setBorderBottom(BorderStyle.THIN); //下边框
+            titleStyle.setBorderLeft(BorderStyle.THIN);//左边框
+            titleStyle.setBorderTop(BorderStyle.THIN);//上边框
+            titleStyle.setBorderRight(BorderStyle.THIN);//右边框
+
+            CellStyle cellStyle = workBook.createCellStyle();
+            cellStyle.setFont(font);
+            cellStyle.setAlignment(HorizontalAlignment.CENTER);
+            cellStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
+            cellStyle.setWrapText(true);
+            cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
+            cellStyle.setBorderLeft(BorderStyle.THIN);//左边框
+            cellStyle.setBorderTop(BorderStyle.THIN);//上边框
+            cellStyle.setBorderRight(BorderStyle.THIN);//右边框
+
+            if(allList.size() > 0) {
+                //标题(如果需要在EXCEL内容最上面加标题,请打开下面的注释,修改start)
+                /*
+                HSSFRow titleRow = sheet.createRow(0);
+                titleRow.setHeightInPoints(30);
+                HSSFCell titleCell = titleRow.createCell(0);
+                titleCell.setCellStyle(headStyle);
+                titleCell.setCellValue(title);
+                //合并单元格
+                CellRangeAddress cellRangeAddress = new CellRangeAddress(0,0,0, list.get(0).size() - 1);
+                //加入合并单元格对象
+                sheet.addMergedRegion(cellRangeAddress);
+                //使用RegionUtil类为合并后的单元格添加边框
+			    RegionUtil.setBorderBottom(BorderStyle.THIN, cellRangeAddress, sheet); // 下边框
+                RegionUtil.setBorderLeft(BorderStyle.THIN, cellRangeAddress, sheet); // 左边框
+                RegionUtil.setBorderRight(BorderStyle.THIN, cellRangeAddress, sheet); // 有边框
+                RegionUtil.setBorderTop(BorderStyle.THIN, cellRangeAddress, sheet); // 上边框
+                */
+                int start = 0;
+                for(List<String> rowList : allList) {
+                    HSSFRow row = sheet.createRow(start);
+                    row.setHeightInPoints(24);
+                    for(int i = 0; i < rowList.size(); i++) {
+                        HSSFCell cell = row.createCell(i);
+                        ClientAnchor anchor = new HSSFClientAnchor();
+                        if(start == 0) {
+                            cell.setCellStyle(titleStyle);
+                            // 关键修改
+                            anchor.setDx1(0);
+                            anchor.setDx2(0);
+                            anchor.setDy1(0);
+                            anchor.setDy2(0);
+                            anchor.setCol1(cell.getColumnIndex());
+                            anchor.setRow1(cell.getRowIndex());
+                            anchor.setCol2(cell.getColumnIndex() + 5);
+                            anchor.setRow2(cell.getRowIndex() + 6);
+                            // 结束
+                            Drawing drawing = sheet.createDrawingPatriarch();
+                            Comment comment = null;
+                            String[] textList=null;
+                            DVConstraint constraint =null;
+                            CellRangeAddressList regions =null;
+                            HSSFDataValidation data_validation_list =null;
+                            switch (rowList.get(i)){
+                                case "是否为公共项目":
+                                    // 加载下拉列表内容
+                                    textList= new String[]{"是", "否"};
+                                    constraint = DVConstraint
+                                            .createExplicitListConstraint(textList);
+                                    // 设置数据有效性加载在哪个单元格上,四个参数分别是:起始行、终止行、起始列、终止列
+                                    regions = new CellRangeAddressList(1,
+                                            1000, i, i);
+                                    // 数据有效性对象
+                                    data_validation_list = new HSSFDataValidation(
+                                            regions, constraint);
+                                    sheet.addValidationData(data_validation_list);
+                                    comment = drawing.createCellComment(anchor);
+                                    // 输入批注信息
+                                    comment.setString(new HSSFRichTextString("是否为公共项目\n" +
+                                            "是:公共项目\n" +
+                                            "否:普通项目"));
+                                    cell.setCellComment(comment);
+                                    break;
+                                case "级别":
+                                    // 加载下拉列表内容
+                                    textList= new String[]{"正常", "紧急","重要","重要且紧急"};
+                                    constraint = DVConstraint
+                                            .createExplicitListConstraint(textList);
+                                    // 设置数据有效性加载在哪个单元格上,四个参数分别是:起始行、终止行、起始列、终止列
+                                    regions = new CellRangeAddressList(1,
+                                            1000, i, i);
+                                    // 数据有效性对象
+                                    data_validation_list = new HSSFDataValidation(
+                                            regions, constraint);
+                                    sheet.addValidationData(data_validation_list);
+                                    break;
+                                case "项目名称":
+                                    comment = drawing.createCellComment(anchor);
+                                    // 输入批注信息
+                                    comment.setString(new HSSFRichTextString("项目名称必填"));
+                                    cell.setCellComment(comment);
+                                    break;
+                                case "参与人":
+                                    comment = drawing.createCellComment(anchor);
+                                    // 输入批注信息
+                                    comment.setString(new HSSFRichTextString("多个参与人使用中文逗号(,)隔开"));
+                                    cell.setCellComment(comment);
+                                    break;
+                                case "主要负责人":
+                                    comment = drawing.createCellComment(anchor);
+                                    // 输入批注信息
+                                    comment.setString(new HSSFRichTextString("负责人需存在于参与人中"));
+                                    cell.setCellComment(comment);
+                                    break;
+                                case "开始日期":
+                                case "截止日期":
+                                    // 输入批注信息
+                                    comment = drawing.createCellComment(anchor);
+                                    // 输入批注信息
+                                    comment.setString(new HSSFRichTextString("日期格式:yyyy-MM-dd\n" +
+                                            "例如: 2021-01-01"));
+                                    cell.setCellComment(comment);
+                                    break;
+
+                            }
+                        }else {
+                            cell.setCellStyle(cellStyle);
+                        }
+                        cell.setCellValue(rowList.get(i));
+                    }
+                    start++;
+                }
+            }
+            //用于非传统ajax;
+//            String headStr = "attachment; filename=\"" + fileName + "\"";
+//            response.setContentType("APPLICATION/OCTET-STREAM");//返回格式为流
+//            response.setHeader("Content-Disposition", headStr);
+//            //普通下载不需要以上三行,注掉即可
+//            OutputStream os = response.getOutputStream();//在线下载
+            File dir = null;
+            dir = new File(path);
+            // D://cloud/upload 文件上传后所存储的位置,部署到服务器上时配置服务器地址即可
+            if (!dir.exists()) {
+                dir.mkdirs();
+            }
+            FileOutputStream os = new FileOutputStream(path+fileName);//保存到本地
+            workBook.write(os);
+            os.flush();
+            os.close();
+        }catch(Exception e) {
+            System.out.println(result);
+            e.printStackTrace();
+            msg.setError("已存在模板名称为["+fileName+"]的文件,请删除后重新下载");
+            return msg;
+        }
+        msg.data= "/upload/"+fileName;
+        return msg;
+//        return "";
+    }
 }
 

+ 14 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TaskController.java

@@ -237,7 +237,7 @@ public class TaskController {
     private void updateProjectProgress(Integer projectId) {
         //更新项目完成度
         //只有第一级任务才更新项目进度, 非已撤销状态的
-        List<Task> all = taskMapper.simpleList(new QueryWrapper<Task>().eq("project_id", projectId).isNull("parent_tid").ne("task_status", 2));
+        List<Task> all = taskMapper.simpleList(new QueryWrapper<Task>().eq("project_id", projectId).isNull("parent_tid").ne("task_status", 2).eq("task_type",1));
 
         if (all.size() > 0) {
             long running = all.stream().filter(a -> a.getTaskStatus() == 1).count();
@@ -302,8 +302,8 @@ public class TaskController {
         Task item = taskService.getById(task.getId());
         if (item.getParentTid() == null) {
             //只有第一级任务才更新项目进度, 非已撤销状态的
-            long allProjectTaskCount =  taskService.count(new QueryWrapper<Task>().eq("project_id", item.getProjectId()).isNull("parent_tid").ne("task_status", 2));
-            long finishTaskCount = taskService.count(new QueryWrapper<Task>().eq("project_id", item.getProjectId()).isNull("parent_tid").eq("task_status", 1));
+            long allProjectTaskCount =  taskService.count(new QueryWrapper<Task>().eq("project_id", item.getProjectId()).isNull("parent_tid").ne("task_status", 2).eq("task_type",1));
+            long finishTaskCount = taskService.count(new QueryWrapper<Task>().eq("project_id", item.getProjectId()).isNull("parent_tid").eq("task_status", 1).eq("task_type",1));
             if (allProjectTaskCount > 0) {
                 int progress = ((int) finishTaskCount) * 100 / (int)allProjectTaskCount;
                 Project project = new Project();
@@ -702,7 +702,7 @@ public class TaskController {
      * @return
      */
     @RequestMapping("/listByPage")
-    public HttpRespMsg listByPage(Integer status, Integer viewId, Integer pageIndex, Integer pageSize,Integer type) {
+    public HttpRespMsg listByPage(Integer status, Integer viewId, Integer pageIndex, Integer pageSize,Integer type,Integer dateType,String startDate,String endDate) {
         HttpRespMsg msg = new HttpRespMsg();
         String userId = request.getHeader("Token");
         User user = userMapper.selectById(userId);
@@ -721,6 +721,16 @@ public class TaskController {
         if(type!=null){
             queryWrapper.eq("task_type",type);
         }
+        if(dateType!=null){
+            switch (dateType){
+                case 0:
+                    queryWrapper.ge("start_date",startDate).le("start_date",endDate);
+                    break;
+                case 1:
+                    queryWrapper.ge("task.end_date",startDate).le("task.end_date",endDate);
+                    break;
+            }
+        }
 //        else if (viewId == 3) {
 //            //今天的任务
 //            queryWrapper.eq("end_date", LocalDate.now());

+ 449 - 168
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -15,6 +15,10 @@ import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.ListUtil;
 import com.management.platform.util.WorkDayCalculateUtils;
 import org.apache.poi.EncryptedDocumentException;
+import org.apache.poi.hssf.usermodel.HSSFCell;
+import org.apache.poi.hssf.usermodel.HSSFRow;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.ss.usermodel.CellType;
 import org.apache.poi.xssf.usermodel.XSSFCell;
@@ -2219,195 +2223,470 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
             }
             inputStream.close();
             outputStream.close();
-            //然后解析表格
-            XSSFWorkbook workbook = new XSSFWorkbook(file);
-            //我们只需要第一个sheet
-            XSSFSheet sheet = workbook.getSheetAt(0);
-            //获取全部人员
-            List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", user.getCompanyId()));
-            List<Project> projectList = new ArrayList<Project>();
-            //由于第一行需要指明列对应的标题
-            int rowNum = sheet.getLastRowNum();
-
-            HashMap<String, Integer> projectLevelMap = new HashMap<>();
-            projectLevelMap.put("正常", 1);
-            projectLevelMap.put("紧急", 2);
-            projectLevelMap.put("重要", 3);
-            projectLevelMap.put("重要且紧急", 4);
-            projectLevelMap.put("低风险", 5);
-            projectLevelMap.put("中风险", 6);
-            projectLevelMap.put("高风险", 7);
-            List<String> existCodeList = new ArrayList<>();
-            int importCount = 0;
-            for (int rowIndex = 0; rowIndex <= rowNum; rowIndex++) {
-                XSSFRow row = sheet.getRow(rowIndex);
-                if (row == null) {
-                    continue;
-                }
-                //跳过空行
-                if (ExcelUtil.isRowEmpty(row)) {
-                    continue;
-                }
-                //项目编号	项目名称 参与人 负责人 级别 开始日期 截止日期 合同金额
-                XSSFCell codeCell = row.getCell(0);
-                XSSFCell categoryCell = row.getCell(1);
-                XSSFCell isPublicCell = row.getCell(2);
-                XSSFCell nameCell = row.getCell(3);
-                XSSFCell subNameCell = row.getCell(4);
-                XSSFCell participatorCell = row.getCell(5);
-                XSSFCell inchargerCell = row.getCell(6);
-                XSSFCell levelCell = row.getCell(7);
-                XSSFCell startDateCell = row.getCell(8);
-                XSSFCell endDateCell = row.getCell(9);
-                XSSFCell amountCell = row.getCell(10);
-
-
-                if (codeCell != null)codeCell.setCellType(CellType.STRING);
-                if (nameCell != null)nameCell.setCellType(CellType.STRING);
-                if (categoryCell != null)categoryCell.setCellType(CellType.STRING);
-                if (isPublicCell != null)isPublicCell.setCellType(CellType.STRING);
-                if (subNameCell != null)subNameCell.setCellType(CellType.STRING);
-                if (participatorCell != null)participatorCell.setCellType(CellType.STRING);
-                if (inchargerCell != null)inchargerCell.setCellType(CellType.STRING);
-                if (levelCell != null)levelCell.setCellType(CellType.STRING);
-                if (startDateCell != null)startDateCell.setCellType(CellType.NUMERIC);
-                if (endDateCell != null)endDateCell.setCellType(CellType.NUMERIC);
-                if (amountCell != null)amountCell.setCellType(CellType.STRING);
-                if (nameCell == null) {//项目名称为空的直接跳过
-                    throw new Exception("项目名称不能为空");
-                }
-                Project project = new Project();
-                if (codeCell != null) {
-                    String code = codeCell.getStringCellValue().trim().replaceAll("\\u00a0", "");
-                    if (code.equals("项目编号") && rowIndex == 0) {
-                        //检查是否有子项目列
-                        if (!subNameCell.getStringCellValue().trim().startsWith("子项目")) {
-                            throw new Exception("缺少子项目列,请下载最新模板");
-                        }
-                        //跳过第一行标题
+            if(fileName.endsWith(".xlsx")){
+                //然后解析表格
+                XSSFWorkbook workbook = new XSSFWorkbook(file);
+                //我们只需要第一个sheet
+                XSSFSheet sheet = workbook.getSheetAt(0);
+                //获取全部人员
+                List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", user.getCompanyId()));
+                //获取全部供货商分类列表
+                List<ProviderCategory> providerCategoryList = providerCategoryMapper.selectList(new QueryWrapper<ProviderCategory>().eq("company_id", user.getCompanyId()));
+                Company company = companyMapper.selectById(user.getCompanyId());
+                //获取全部客户
+                List<CustomerInfo> customerInfoList = customerInfoMapper.selectList(new QueryWrapper<CustomerInfo>().eq("company_id", user.getCompanyId()));
+                //获取全部供货商
+                List<ProviderInfo> providerInfoList = providerInfoMapper.selectList(new QueryWrapper<ProviderInfo>().eq("company_id", user.getCompanyId()));
+                List<Project> projectList = new ArrayList<Project>();
+                //由于第一行需要指明列对应的标题
+                int rowNum = sheet.getLastRowNum();
+                HashMap<String, Integer> projectLevelMap = new HashMap<>();
+                projectLevelMap.put("正常", 1);
+                projectLevelMap.put("紧急", 2);
+                projectLevelMap.put("重要", 3);
+                projectLevelMap.put("重要且紧急", 4);
+                projectLevelMap.put("低风险", 5);
+                projectLevelMap.put("中风险", 6);
+                projectLevelMap.put("高风险", 7);
+                List<String> existCodeList = new ArrayList<>();
+                int importCount = 0;
+                for (int rowIndex = 0; rowIndex <= rowNum; rowIndex++) {
+                    XSSFRow row = sheet.getRow(rowIndex);
+                    if (row == null) {
                         continue;
                     }
-                    //检查项目是否存在
-                    List<ProjectCategory> projectCategoryList = projectCategoryMapper.selectList(new QueryWrapper<ProjectCategory>().eq("company_id", user.getCompanyId()));
-                    if (categoryCell != null && !StringUtils.isEmpty(categoryCell.getStringCellValue())) {
-                        Optional<ProjectCategory> category = projectCategoryList.stream().filter(pc -> pc.getName().equals(categoryCell.getStringCellValue())).findFirst();
-                        if(!category.isPresent()){
-                            throw  new Exception("项目分类["+categoryCell.getStringCellValue()+"]不存在");
+                    //跳过空行
+                    if (ExcelUtil.isRowEmpty(row)) {
+                        continue;
+                    }
+                    //项目编号	项目名称 参与人 负责人 级别 开始日期 截止日期 合同金额
+                    XSSFCell codeCell = row.getCell(0);
+                    XSSFCell categoryCell = row.getCell(1);
+                    XSSFCell isPublicCell = row.getCell(2);
+                    XSSFCell nameCell = row.getCell(3);
+                    XSSFCell subNameCell = row.getCell(4);
+                    XSSFCell participatorCell = row.getCell(5);
+                    XSSFCell inchargerCell = row.getCell(6);
+                    XSSFCell levelCell = row.getCell(7);
+                    XSSFCell startDateCell = row.getCell(8);
+                    XSSFCell endDateCell = row.getCell(9);
+                    XSSFCell amountCell = row.getCell(10);
+
+
+                    if (codeCell != null)codeCell.setCellType(CellType.STRING);
+                    if (nameCell != null)nameCell.setCellType(CellType.STRING);
+                    if (categoryCell != null)categoryCell.setCellType(CellType.STRING);
+                    if (isPublicCell != null)isPublicCell.setCellType(CellType.STRING);
+                    if (subNameCell != null)subNameCell.setCellType(CellType.STRING);
+                    if (participatorCell != null)participatorCell.setCellType(CellType.STRING);
+                    if (inchargerCell != null)inchargerCell.setCellType(CellType.STRING);
+                    if (levelCell != null)levelCell.setCellType(CellType.STRING);
+                    if (startDateCell != null)startDateCell.setCellType(CellType.NUMERIC);
+                    if (endDateCell != null)endDateCell.setCellType(CellType.NUMERIC);
+                    if (amountCell != null)amountCell.setCellType(CellType.STRING);
+                    if (nameCell == null) {//项目名称为空的直接跳过
+                        throw new Exception("项目名称不能为空");
+                    }
+                    Project project = new Project();
+                    if (codeCell != null) {
+                        String code = codeCell.getStringCellValue().trim().replaceAll("\\u00a0", "");
+                        if (code.equals("项目编号") && rowIndex == 0) {
+                            //检查是否有子项目列
+                            if (!subNameCell.getStringCellValue().trim().startsWith("子项目")) {
+                                throw new Exception("缺少子项目列,请下载最新模板");
+                            }
+                            //跳过第一行标题
+                            continue;
+                        }
+                        //检查项目是否存在
+                        List<ProjectCategory> projectCategoryList = projectCategoryMapper.selectList(new QueryWrapper<ProjectCategory>().eq("company_id", user.getCompanyId()));
+                        if (categoryCell != null && !StringUtils.isEmpty(categoryCell.getStringCellValue())) {
+                            Optional<ProjectCategory> category = projectCategoryList.stream().filter(pc -> pc.getName().equals(categoryCell.getStringCellValue())).findFirst();
+                            if(!category.isPresent()){
+                                throw  new Exception("项目分类["+categoryCell.getStringCellValue()+"]不存在");
+                            }
+                            project.setCategory(category.get().getId());
+                            project.setCategoryName(categoryCell.getStringCellValue());
+                        }
+                        //检查编号是否已经存在
+                        if (!StringUtils.isEmpty(code)) {
+                            int cnt = projectMapper.selectCount(new QueryWrapper<Project>().eq("project_code", code).eq("company_id", user.getCompanyId()));
+                            if (cnt > 0) {
+//                            throw new Exception("项目编号存在重复: " + code);
+                                existCodeList.add(code);
+                                //跳过编号重复的数据
+                                continue;
+                            }
+                        }
+                        project.setProjectCode(code);
+                    }
+                    String name = nameCell.getStringCellValue().trim().replaceAll("\\u00a0", "");
+                    project.setCompanyId(user.getCompanyId());
+                    project.setCreatorId(userId);
+                    project.setCreatorName(user.getName());
+                    project.setProjectName(name);
+
+                    //处理人员
+                    if (inchargerCell != null) {
+                        String inchargerName = inchargerCell.getStringCellValue().trim();
+                        if (!StringUtils.isEmpty(inchargerName)) {
+                            Optional<User> first = userList.stream().filter(u -> u.getName().equals(inchargerName)).findFirst();
+                            if (first.isPresent()) {
+                                project.setInchargerId(first.get().getId());
+                                project.setInchargerName(inchargerName);
+                            } else {
+                                throw new Exception("项目负责人["+inchargerName+"]不存在");
+                            }
                         }
-                        project.setCategory(category.get().getId());
-                        project.setCategoryName(categoryCell.getStringCellValue());
                     }
 
 
-                    //检查编号是否已经存在
-                    if (!StringUtils.isEmpty(code)) {
-                        int cnt = projectMapper.selectCount(new QueryWrapper<Project>().eq("project_code", code).eq("company_id", user.getCompanyId()));
-                        if (cnt > 0) {
-//                            throw new Exception("项目编号存在重复: " + code);
-                            existCodeList.add(code);
-                            //跳过编号重复的数据
-                            continue;
+                    if (levelCell != null) {
+                        String levelStr = levelCell.getStringCellValue();
+                        if (!StringUtils.isEmpty(levelStr)) {
+                            project.setLevel(projectLevelMap.get(levelStr));
                         }
                     }
-                    project.setProjectCode(code);
-                }
-                String name = nameCell.getStringCellValue().trim().replaceAll("\\u00a0", "");
-                project.setCompanyId(user.getCompanyId());
-                project.setCreatorId(userId);
-                project.setCreatorName(user.getName());
-                project.setProjectName(name);
-
-                //处理人员
-                if (inchargerCell != null) {
-                    String inchargerName = inchargerCell.getStringCellValue().trim();
-                    if (!StringUtils.isEmpty(inchargerName)) {
-                        Optional<User> first = userList.stream().filter(u -> u.getName().equals(inchargerName)).findFirst();
-                        if (first.isPresent()) {
-                            project.setInchargerId(first.get().getId());
-                            project.setInchargerName(inchargerName);
-                        } else {
-                            throw new Exception("项目负责人["+inchargerName+"]不存在");
+                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+                    if (startDateCell !=null && !StringUtils.isEmpty(startDateCell.getDateCellValue())) {
+                        project.setPlanStartDate(LocalDate.parse(sdf.format(startDateCell.getDateCellValue()), DateTimeFormatter.ofPattern("yyyy-MM-dd")));
+                    }
+                    if (endDateCell !=null && !StringUtils.isEmpty(endDateCell.getDateCellValue())) {
+                        project.setPlanEndDate(LocalDate.parse(sdf.format(endDateCell.getDateCellValue()), DateTimeFormatter.ofPattern("yyyy-MM-dd")));
+                    }
+                    if (amountCell !=null && !StringUtils.isEmpty(amountCell.getStringCellValue())) {
+                        project.setContractAmount(Double.parseDouble(amountCell.getStringCellValue()));
+                    }
+                    if (isPublicCell != null && !StringUtils.isEmpty(isPublicCell.getStringCellValue())) {
+                        project.setIsPublic("是".equals(isPublicCell.getStringCellValue())?1:0);
+                    }
+                    if(projectMapper.insert(project)>0){
+                        ProjectAuditor projectAuditor=new ProjectAuditor();
+                        projectAuditor.setAuditorId(project.getInchargerId());
+                        projectAuditor.setAuditorName(project.getInchargerName());
+                        projectAuditor.setProjectId(project.getId());
+                        projectAuditorMapper.insert(projectAuditor);
+                    }
+                    importCount++;
+                    //处理子项目
+                    if (subNameCell != null) {
+                        //兼容中英文逗号
+                        String[] subNames = subNameCell.getStringCellValue().trim().split(",|\\,");
+                        if (subNames != null) {
+                            for (String s : subNames) {
+                                if (!StringUtils.isEmpty(s)) {
+                                    SubProject sp = new SubProject();
+                                    sp.setName(s);
+                                    sp.setProjectId(project.getId());
+                                    subProjectMapper.insert(sp);
+                                }
+                            }
                         }
                     }
-                }
-
-
-                if (levelCell != null) {
-                    String levelStr = levelCell.getStringCellValue();
-                    if (!StringUtils.isEmpty(levelStr)) {
-                        project.setLevel(projectLevelMap.get(levelStr));
+                    //参与人
+                    if (participatorCell != null) {
+                        String part = participatorCell.getStringCellValue().trim();
+                        //将项目负责人也添加到参与人当中来
+                        String incharger = inchargerCell.getStringCellValue().trim();
+                        if (!StringUtils.isEmpty(part)) {
+                            String[] partSplit = part.split("\\,|\\,");
+                            if(!StringUtils.isEmpty(incharger)){
+                                String[] inchargerSplit = incharger.split("\\,|\\,");
+                                int strLen1 = partSplit.length;// 保存第一个数组长度
+                                int strLen2 = inchargerSplit.length;
+                                partSplit=Arrays.copyOf(partSplit, strLen1+strLen2);
+                                System.arraycopy(inchargerSplit, 0, partSplit, strLen1, strLen2);
+                            }
+                            for (String str : partSplit) {
+                                Participation p = new Participation();
+                                Optional<User> first = userList.stream().filter(u -> u.getName().equals(str)).findFirst();
+                                if (first.isPresent()) {
+                                    p.setUserId(first.get().getId());
+                                    p.setProjectId(project.getId());
+                                    participationMapper.insert(p);
+                                } else {
+                                    projectMapper.deleteById(project.getId());
+                                    throw new Exception("参与人["+str+"]不存在");
+                                }
+                            }
+                        }
                     }
                 }
-
-                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-                if (startDateCell !=null && !StringUtils.isEmpty(startDateCell.getDateCellValue())) {
-                    project.setPlanStartDate(LocalDate.parse(sdf.format(startDateCell.getDateCellValue()), DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-                }
-                if (endDateCell !=null && !StringUtils.isEmpty(endDateCell.getDateCellValue())) {
-                    project.setPlanEndDate(LocalDate.parse(sdf.format(endDateCell.getDateCellValue()), DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-                }
-                if (amountCell !=null && !StringUtils.isEmpty(amountCell.getStringCellValue())) {
-                    project.setContractAmount(Double.parseDouble(amountCell.getStringCellValue()));
-                }
-                if (isPublicCell != null && !StringUtils.isEmpty(isPublicCell.getStringCellValue())) {
-                    project.setIsPublic("是".equals(isPublicCell.getStringCellValue())?1:0);
-                }
-                if(projectMapper.insert(project)>0){
-                    ProjectAuditor projectAuditor=new ProjectAuditor();
-                    projectAuditor.setAuditorId(project.getInchargerId());
-                    projectAuditor.setAuditorName(project.getInchargerName());
-                    projectAuditor.setProjectId(project.getId());
-                    projectAuditorMapper.insert(projectAuditor);
-                }
-                importCount++;
-                //处理子项目
-                if (subNameCell != null) {
-                    //兼容中英文逗号
-                    String[] subNames = subNameCell.getStringCellValue().trim().split(",|\\,");
-                    if (subNames != null) {
-                        for (String s : subNames) {
-                            if (!StringUtils.isEmpty(s)) {
-                                SubProject sp = new SubProject();
-                                sp.setName(s);
-                                sp.setProjectId(project.getId());
-                                subProjectMapper.insert(sp);
+                msg.data = "成功导入"+importCount+"条数据。";
+                if (existCodeList.size() > 0) {
+                    String collect = existCodeList.stream().collect(Collectors.joining(","));
+                    msg.data += "自动跳过"+existCodeList.size()+"条已存在项目编码:"+collect;
+                }
+            }else if(fileName.endsWith(".xls")){
+                //然后解析表格
+                HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(file));
+                //我们只需要第一个sheet
+                HSSFSheet sheet = workbook.getSheetAt(0);
+                //获取全部人员
+                List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", user.getCompanyId()));
+                //获取全部供货商分类列表
+                List<ProviderCategory> providerCategoryList = providerCategoryMapper.selectList(new QueryWrapper<ProviderCategory>().eq("company_id", user.getCompanyId()));
+                Company company = companyMapper.selectById(user.getCompanyId());
+                //获取全部客户
+                List<CustomerInfo> customerInfoList = customerInfoMapper.selectList(new QueryWrapper<CustomerInfo>().eq("company_id", user.getCompanyId()));
+                //获取全部供货商
+                List<ProviderInfo> providerInfoList = providerInfoMapper.selectList(new QueryWrapper<ProviderInfo>().eq("company_id", user.getCompanyId()));
+                List<Project> projectList = new ArrayList<Project>();
+                //由于第一行需要指明列对应的标题
+                int rowNum = sheet.getLastRowNum();
+                HashMap<String, Integer> projectLevelMap = new HashMap<>();
+                projectLevelMap.put("正常", 1);
+                projectLevelMap.put("紧急", 2);
+                projectLevelMap.put("重要", 3);
+                projectLevelMap.put("重要且紧急", 4);
+                projectLevelMap.put("低风险", 5);
+                projectLevelMap.put("中风险", 6);
+                projectLevelMap.put("高风险", 7);
+                List<String> existCodeList = new ArrayList<>();
+                int importCount = 0;
+                for (int rowIndex = 0; rowIndex <= rowNum; rowIndex++) {
+                    HSSFRow row = sheet.getRow(rowIndex);
+                    if (row == null) {
+                        continue;
+                    }
+                    //跳过空行
+                    if (ExcelUtil.isRowEmpty(row)) {
+                        continue;
+                    }
+                    //项目编号	项目名称 参与人 负责人 级别 开始日期 截止日期 合同金额
+                    HSSFCell codeCell = row.getCell(0);
+                    HSSFCell categoryCell = row.getCell(1);
+                    HSSFCell isPublicCell = row.getCell(2);
+                    HSSFCell nameCell = row.getCell(3);
+                    HSSFCell subNameCell = row.getCell(4);
+                    HSSFCell participatorCell = row.getCell(5);
+                    HSSFCell inchargerCell = row.getCell(6);
+                    HSSFCell levelCell = row.getCell(7);
+                    HSSFCell customerCell=null;
+                    int i=0;
+                    int k=0;
+                    if(company.getPackageCustomer()==1){
+                        customerCell=row.getCell(8);
+                        i++;
+                    }
+                    if(company.getPackageProvider()==1){
+                        for (int j = 0; j < providerCategoryList.size(); j++) {
+                            if(company.getPackageProvider()==1){
+                                k++;
                             }
                         }
                     }
-                }
-                //参与人
-                if (participatorCell != null) {
-                    String part = participatorCell.getStringCellValue().trim();
-                    //将项目负责人也添加到参与人当中来
-                    String incharger = inchargerCell.getStringCellValue().trim();
-                    if (!StringUtils.isEmpty(part)) {
-                        String[] partSplit = part.split("\\,|\\,");
-                        if(!StringUtils.isEmpty(incharger)){
-                            String[] inchargerSplit = incharger.split("\\,|\\,");
-                            int strLen1 = partSplit.length;// 保存第一个数组长度
-                            int strLen2 = inchargerSplit.length;
-                            partSplit=Arrays.copyOf(partSplit, strLen1+strLen2);
-                            System.arraycopy(inchargerSplit, 0, partSplit, strLen1, strLen2);
+                    HSSFCell startDateCell = row.getCell(8+i+k);
+                    HSSFCell endDateCell = row.getCell(9+i+k);
+                    HSSFCell amountCell = row.getCell(10+i+k);
+
+
+                    if (codeCell != null)codeCell.setCellType(CellType.STRING);
+                    if (nameCell != null)nameCell.setCellType(CellType.STRING);
+                    if (categoryCell != null)categoryCell.setCellType(CellType.STRING);
+                    if (isPublicCell != null)isPublicCell.setCellType(CellType.STRING);
+                    if (subNameCell != null)subNameCell.setCellType(CellType.STRING);
+                    if (participatorCell != null)participatorCell.setCellType(CellType.STRING);
+                    if (inchargerCell != null)inchargerCell.setCellType(CellType.STRING);
+                    if (levelCell != null)levelCell.setCellType(CellType.STRING);
+                    if (customerCell != null)customerCell.setCellType(CellType.STRING);
+                    /*if (startDateCell != null)startDateCell.setCellType(CellType.NUMERIC);
+                    if (endDateCell != null)endDateCell.setCellType(CellType.NUMERIC);*/
+                    if (amountCell != null)amountCell.setCellType(CellType.STRING);
+                    if (nameCell == null) {//项目名称为空的直接跳过
+                        throw new Exception("项目名称不能为空");
+                    }
+                    Project project = new Project();
+                    if (codeCell != null) {
+                        String code = codeCell.getStringCellValue().trim().replaceAll("\\u00a0", "");
+                        if (code.equals("项目编号") && rowIndex == 0) {
+                            //检查是否有子项目列
+                            if (!subNameCell.getStringCellValue().trim().startsWith("子项目")) {
+                                throw new Exception("缺少子项目列,请下载最新模板");
+                            }
+                            //跳过第一行标题
+                            continue;
+                        }
+                        //检查项目是否存在
+                        List<ProjectCategory> projectCategoryList = projectCategoryMapper.selectList(new QueryWrapper<ProjectCategory>().eq("company_id", user.getCompanyId()));
+                        if (categoryCell != null && !StringUtils.isEmpty(categoryCell.getStringCellValue())) {
+                            Optional<ProjectCategory> category = projectCategoryList.stream().filter(pc -> pc.getName().equals(categoryCell.getStringCellValue())).findFirst();
+                            if(!category.isPresent()){
+                                throw  new Exception("项目分类["+categoryCell.getStringCellValue()+"]不存在");
+                            }
+                            project.setCategory(category.get().getId());
+                            project.setCategoryName(categoryCell.getStringCellValue());
+                        }
+                        //检查编号是否已经存在
+                        if (!StringUtils.isEmpty(code)) {
+                            int cnt = projectMapper.selectCount(new QueryWrapper<Project>().eq("project_code", code).eq("company_id", user.getCompanyId()));
+                            if (cnt > 0) {
+//                            throw new Exception("项目编号存在重复: " + code);
+                                existCodeList.add(code);
+                                //跳过编号重复的数据
+                                continue;
+                            }
                         }
-                        for (String str : partSplit) {
-                            Participation p = new Participation();
-                            Optional<User> first = userList.stream().filter(u -> u.getName().equals(str)).findFirst();
+                        project.setProjectCode(code);
+                    }
+                    String name = nameCell.getStringCellValue().trim().replaceAll("\\u00a0", "");
+                    project.setCompanyId(user.getCompanyId());
+                    project.setCreatorId(userId);
+                    project.setCreatorName(user.getName());
+                    project.setProjectName(name);
+
+                    //处理人员
+                    if (inchargerCell != null) {
+                        String inchargerName = inchargerCell.getStringCellValue().trim();
+                        if (!StringUtils.isEmpty(inchargerName)) {
+                            Optional<User> first = userList.stream().filter(u -> u.getName().equals(inchargerName)).findFirst();
                             if (first.isPresent()) {
-                                p.setUserId(first.get().getId());
-                                p.setProjectId(project.getId());
-                                participationMapper.insert(p);
+                                project.setInchargerId(first.get().getId());
+                                project.setInchargerName(inchargerName);
                             } else {
-                                projectMapper.deleteById(project.getId());
-                                throw new Exception("参与人["+str+"]不存在");
+                                throw new Exception("项目负责人["+inchargerName+"]不存在");
+                            }
+                        }
+                    }
+
+
+                    if (levelCell != null) {
+                        String levelStr = levelCell.getStringCellValue();
+                        if (!StringUtils.isEmpty(levelStr)) {
+                            project.setLevel(projectLevelMap.get(levelStr));
+                        }
+                    }
+                    if(customerCell!=null){
+                        String cellStringCellValue = customerCell.getStringCellValue();
+                        if(!StringUtils.isEmpty(cellStringCellValue)){
+                            Optional<CustomerInfo> first = customerInfoList.stream().filter(ci -> ci.getCustomerName().equals(cellStringCellValue)).findFirst();
+                            if(!first.isPresent()){
+                                msg.setError("客户["+cellStringCellValue+"]不存在");
+                                return msg;
+                            }else {
+                                project.setCustomerId(first.get().getId());
+                                project.setCustomerName(first.get().getCustomerName());
+                            }
+                        }
+                    }
+                    if(company.getPackageProvider()==1){
+                        String nameString = "";
+                        String idString = "";
+                        HSSFCell providerCell;
+                        for (int j = 0; j < providerCategoryList.size(); j++) {
+                            String nameSb = "";
+                            String idSb = "";
+                            providerCell=row.getCell(8+i);
+                            HSSFCell cell = row.getCell(10);
+                            if(providerCell!=null){
+                                providerCell.setCellType(CellType.STRING);
+                                String stringCellValue = providerCell.getStringCellValue();
+                                if(!StringUtils.isEmpty(stringCellValue)){
+                                    String[] split = stringCellValue.split(",");
+                                    for (int i1 = 0; i1 < split.length; i1++) {
+                                        int finalJ = j;
+                                        int finalI = i1;
+                                        Optional<ProviderInfo> first = providerInfoList.stream().filter(pd -> pd.getProviderName().equals(split[finalI])&&pd.getProviderCategoryId().equals(providerCategoryList.get(finalJ).getId())).findFirst();
+                                        if(!first.isPresent()){
+                                            msg.setError("供应商["+split[i1]+"]在供应商分类["+providerCategoryList.get(j).getProviderCategoryName()+"]不存在");
+                                            return msg;
+                                        }else {
+                                            if(i1==split.length-1){
+                                                nameSb+=first.get().getProviderName();
+                                                idSb+=first.get().getId();
+                                            }else {
+                                                nameSb+=first.get().getProviderName()+",";
+                                                idSb+=first.get().getId()+",";
+                                            }
+                                        }
+                                    }
+                                }
+                                i++;
+                            }else {
+                                i++;
+                                continue;
+                            }
+                            if(j==providerCategoryList.size()-1){
+                                nameString+=nameSb;
+                                idString+=idSb;
+                            }else {
+                                nameString+=nameSb+",";
+                                idString+=idSb+",";
+                            }
+                        }
+                        project.setProviderIds(idString);
+                        project.setProviderNames(nameString);
+                    }
+                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+                    if (startDateCell !=null && !StringUtils.isEmpty(startDateCell.getDateCellValue())) {
+                        project.setPlanStartDate(LocalDate.parse(sdf.format(startDateCell.getDateCellValue()), DateTimeFormatter.ofPattern("yyyy-MM-dd")));
+                    }
+                    if (endDateCell !=null && !StringUtils.isEmpty(endDateCell.getDateCellValue())) {
+                        project.setPlanEndDate(LocalDate.parse(sdf.format(endDateCell.getDateCellValue()), DateTimeFormatter.ofPattern("yyyy-MM-dd")));
+                    }
+                    if (amountCell !=null && !StringUtils.isEmpty(amountCell.getStringCellValue())) {
+                        project.setContractAmount(Double.parseDouble(amountCell.getStringCellValue()));
+                    }
+                    if (isPublicCell != null && !StringUtils.isEmpty(isPublicCell.getStringCellValue())) {
+                        project.setIsPublic("是".equals(isPublicCell.getStringCellValue())?1:0);
+                    }
+                    if(projectMapper.insert(project)>0){
+                        ProjectAuditor projectAuditor=new ProjectAuditor();
+                        projectAuditor.setAuditorId(project.getInchargerId());
+                        projectAuditor.setAuditorName(project.getInchargerName());
+                        projectAuditor.setProjectId(project.getId());
+                        projectAuditorMapper.insert(projectAuditor);
+                    }
+                    importCount++;
+                    //处理子项目
+                    if (subNameCell != null) {
+                        //兼容中英文逗号
+                        String[] subNames = subNameCell.getStringCellValue().trim().split(",|\\,");
+                        if (subNames != null) {
+                            for (String s : subNames) {
+                                if (!StringUtils.isEmpty(s)) {
+                                    SubProject sp = new SubProject();
+                                    sp.setName(s);
+                                    sp.setProjectId(project.getId());
+                                    subProjectMapper.insert(sp);
+                                }
+                            }
+                        }
+                    }
+                    //参与人
+                    if (participatorCell != null) {
+                        String part = participatorCell.getStringCellValue().trim();
+                        //将项目负责人也添加到参与人当中来
+                        String incharger = inchargerCell.getStringCellValue().trim();
+                        if (!StringUtils.isEmpty(part)) {
+                            String[] partSplit = part.split("\\,|\\,");
+                            if(!StringUtils.isEmpty(incharger)){
+                                String[] inchargerSplit = incharger.split("\\,|\\,");
+                                int strLen1 = partSplit.length;// 保存第一个数组长度
+                                int strLen2 = inchargerSplit.length;
+                                partSplit=Arrays.copyOf(partSplit, strLen1+strLen2);
+                                System.arraycopy(inchargerSplit, 0, partSplit, strLen1, strLen2);
+                            }
+                            for (String str : partSplit) {
+                                Participation p = new Participation();
+                                Optional<User> first = userList.stream().filter(u -> u.getName().equals(str)).findFirst();
+                                if (first.isPresent()) {
+                                    p.setUserId(first.get().getId());
+                                    p.setProjectId(project.getId());
+                                    participationMapper.insert(p);
+                                } else {
+                                    projectMapper.deleteById(project.getId());
+                                    throw new Exception("参与人["+str+"]不存在");
+                                }
                             }
                         }
                     }
                 }
-            }
-            msg.data = "成功导入"+importCount+"条数据。";
-            if (existCodeList.size() > 0) {
-                String collect = existCodeList.stream().collect(Collectors.joining(","));
-                msg.data += "自动跳过"+existCodeList.size()+"条已存在项目编码:"+collect;
+                msg.data = "成功导入"+importCount+"条数据。";
+                if (existCodeList.size() > 0) {
+                    String collect = existCodeList.stream().collect(Collectors.joining(","));
+                    msg.data += "自动跳过"+existCodeList.size()+"条已存在项目编码:"+collect;
+                }
             }
         } catch (IOException e) {
             e.printStackTrace();
@@ -2491,9 +2770,11 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 headList.add(s);
             }
         }
+        if(company.getPackageCustomer()==1){
+            headList.add("客户");
+        }
         if (company.getPackageProject() == 1) {
             //项目管理专业版以上的,导出的数据更全面
-            headList.add("客户");
             headList.add("项目级别");
             headList.add("合同金额");
         }