Min před 10 měsíci
rodič
revize
36b92827c4

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java

@@ -2758,7 +2758,7 @@ public class ReportController {
     * @Date: 2024/7/17
     */
     @RequestMapping("/transferReport")
-    public HttpRespMsg transferReport(String reportIds,@RequestParam Integer projectId,@RequestParam Integer groupId,@RequestParam Integer stageId){
+    public HttpRespMsg transferReport(String reportIds,@RequestParam Integer projectId,@RequestParam Integer groupId,Integer stageId){
         return reportService.transferReport(reportIds,projectId,groupId,stageId);
     }
 }

+ 154 - 135
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportLogController.java

@@ -9,6 +9,8 @@ import com.management.platform.mapper.*;
 import com.management.platform.service.ReportLogDetailService;
 import com.management.platform.service.ReportLogService;
 import com.management.platform.service.ReportService;
+import com.management.platform.service.WxCorpInfoService;
+import com.management.platform.service.impl.WxCorpInfoServiceImpl;
 import com.management.platform.util.ExcelUtil;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.MessageUtils;
@@ -36,6 +38,8 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Optional;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 import java.util.stream.Collectors;
 
 /**
@@ -70,6 +74,8 @@ public class ReportLogController {
     private ReportService reportService;
     @Resource
     private ReportLogDetailService reportLogDetailService;
+    @Resource
+    private WxCorpInfoService wxCorpInfoService;
 
     @RequestMapping("/get")
     public HttpRespMsg get(String creatorId, String createDate) {
@@ -183,6 +189,9 @@ public class ReportLogController {
         HttpRespMsg msg=new HttpRespMsg();
         //然后处理文件
         String fileName = multipartFile.getOriginalFilename();
+        User user = userMapper.selectById(request.getHeader("token"));
+        Integer companyId = user.getCompanyId();
+        WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new LambdaQueryWrapper<WxCorpInfo>().eq(WxCorpInfo::getCompanyId, companyId));
         DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         File file = new File(fileName == null ? "file" : fileName);
         InputStream inputStream = null;
@@ -225,154 +234,164 @@ public class ReportLogController {
                 Integer numCellValue = Integer.valueOf(numCell.getStringCellValue());
                 reportLogIds.add(numCellValue);
             }
-            List<ReportLog> reportLogList = reportLogService.list(new LambdaQueryWrapper<ReportLog>().in(ReportLog::getId, reportLogIds));
-            List<String> reportIds = reportLogList.stream().map(ReportLog::getReportIds).collect(Collectors.toList());
-            List<Integer> reportIdList =new ArrayList<>();
-            reportIds.forEach(r->{
-                String[] split = r.split(",");
-                List<Integer> reportSubIds = Arrays.asList(split).stream().map(s -> Integer.valueOf(s)).collect(Collectors.toList());
-                reportIdList.addAll(reportSubIds);
-            });
-            List<Report> reportList = reportMapper.selectList(new LambdaQueryWrapper<Report>().in(Report::getId, reportIdList));
-            StringBuilder sb=new StringBuilder();
-            List<Report> needUpdateReportList=new ArrayList<>();
-            List<ReportLog> needUpdateReportLogList=new ArrayList<>();
-            List<ReportLogDetail> needUpdateReportLogDetailList=new ArrayList<>();
-            for (int rowIndex = 0; rowIndex <= rowNum; rowIndex++) {
-                XSSFRow row = sheet.getRow(rowIndex);
-                if (row == null) {
-                    continue;
-                }
-                //跳过空行
-                if (ExcelUtil.isRowEmpty(row)) {
-                    continue;
-                }
-                XSSFCell numCell = row.getCell(0);
-                XSSFCell nameCell = row.getCell(1);
-                XSSFCell jobNumCell = row.getCell(2);
-                XSSFCell createDateCell = row.getCell(3);
-                XSSFCell createTimeCell = row.getCell(4);
-                XSSFCell projectNameCell = row.getCell(5);
-                XSSFCell projectCodeCell = row.getCell(6);
-                XSSFCell auditDateCell = row.getCell(7);
+            ExecutorService executor = Executors.newFixedThreadPool(1);
+            executor.execute(new Runnable() {
+                @Override
+                public void run() {
+                    List<ReportLog> reportLogList = reportLogService.list(new LambdaQueryWrapper<ReportLog>().select(ReportLog::getReportIds,ReportLog::getId,ReportLog::getMsg).in(ReportLog::getId, reportLogIds));
+                    List<String> reportIds = reportLogList.stream().map(ReportLog::getReportIds).collect(Collectors.toList());
+                    List<Integer> reportIdList =new ArrayList<>();
+                    reportIds.forEach(r->{
+                        String[] split = r.split(",");
+                        List<Integer> reportSubIds = Arrays.asList(split).stream().map(s -> Integer.valueOf(s)).collect(Collectors.toList());
+                        reportIdList.addAll(reportSubIds);
+                    });
+                    List<Report> reportList = reportMapper.selectList(new LambdaQueryWrapper<Report>().in(Report::getId, reportIdList));
+                    List<ReportLogDetail> allReportLogDetails = reportLogDetailService.list(new LambdaQueryWrapper<ReportLogDetail>().select(ReportLogDetail::getMsg,ReportLogDetail::getId).in(ReportLogDetail::getReportId, reportIdList));
+                    StringBuilder sb=new StringBuilder();
+                    List<Report> needUpdateReportList=new ArrayList<>();
+                    List<ReportLog> needUpdateReportLogList=new ArrayList<>();
+                    List<ReportLogDetail> needUpdateReportLogDetailList=new ArrayList<>();
+                    for (int rowIndex = 0; rowIndex <= rowNum; rowIndex++) {
+                        XSSFRow row = sheet.getRow(rowIndex);
+                        if (row == null) {
+                            continue;
+                        }
+                        //跳过空行
+                        if (ExcelUtil.isRowEmpty(row)) {
+                            continue;
+                        }
+                        XSSFCell numCell = row.getCell(0);
+                        XSSFCell nameCell = row.getCell(1);
+                        XSSFCell jobNumCell = row.getCell(2);
+                        XSSFCell createDateCell = row.getCell(3);
+                        XSSFCell createTimeCell = row.getCell(4);
+                        XSSFCell projectNameCell = row.getCell(5);
+                        XSSFCell projectCodeCell = row.getCell(6);
+                        XSSFCell auditDateCell = row.getCell(7);
 
-                if (numCell != null) {
-                    String code = numCell.getStringCellValue().trim().replaceAll("\\u00a0", "");
-                    if ((code.equals("编号(不可随意修改)")||(code.equals("编号(不可随意修改)")) && rowIndex == 0)){
-                        //跳过第一行标题
-                        continue;
-                    }
-                }
+                        if (numCell != null) {
+                            String code = numCell.getStringCellValue().trim().replaceAll("\\u00a0", "");
+                            if ((code.equals("编号(不可随意修改)")||(code.equals("编号(不可随意修改)")) && rowIndex == 0)){
+                                //跳过第一行标题
+                                continue;
+                            }
+                        }
 
-                if (numCell != null)numCell.setCellType(CellType.STRING);
-                if (nameCell != null)nameCell.setCellType(CellType.STRING);
-                if (jobNumCell != null)jobNumCell.setCellType(CellType.STRING);
-                if (createDateCell != null)createDateCell.setCellType(CellType.STRING);
-                if (createTimeCell != null)createTimeCell.setCellType(CellType.STRING);
-                if (projectNameCell != null)projectNameCell.setCellType(CellType.STRING);
-                if (projectCodeCell != null)projectCodeCell.setCellType(CellType.STRING);
-                if (auditDateCell != null)auditDateCell.setCellType(CellType.STRING);
+                        if (numCell != null)numCell.setCellType(CellType.STRING);
+                        if (nameCell != null)nameCell.setCellType(CellType.STRING);
+                        if (jobNumCell != null)jobNumCell.setCellType(CellType.STRING);
+                        if (createDateCell != null)createDateCell.setCellType(CellType.STRING);
+                        if (createTimeCell != null)createTimeCell.setCellType(CellType.STRING);
+                        if (projectNameCell != null)projectNameCell.setCellType(CellType.STRING);
+                        if (projectCodeCell != null)projectCodeCell.setCellType(CellType.STRING);
+                        if (auditDateCell != null)auditDateCell.setCellType(CellType.STRING);
 
-                Integer numCellValue = Integer.valueOf(numCell.getStringCellValue());
-                String nameCellValue = nameCell.getStringCellValue();
-                String jobNumCellValue =jobNumCell.getStringCellValue();
-                String createDateCellValue = createDateCell.getStringCellValue();
-                String createTimeCellValue = createTimeCell.getStringCellValue();
-                String projectNameCellValue = projectNameCell.getStringCellValue();
-                String projectCodeCellValue = projectCodeCell.getStringCellValue();
-                String auditDateCellValue = auditDateCell.getStringCellValue();
+                        Integer numCellValue = Integer.valueOf(numCell.getStringCellValue());
+                        String nameCellValue = nameCell.getStringCellValue();
+                        String jobNumCellValue =jobNumCell.getStringCellValue();
+                        String createDateCellValue = createDateCell.getStringCellValue();
+                        String createTimeCellValue = createTimeCell.getStringCellValue();
+                        String projectNameCellValue = projectNameCell.getStringCellValue();
+                        String projectCodeCellValue = projectCodeCell.getStringCellValue();
+                        String auditDateCellValue = auditDateCell.getStringCellValue();
 
 
-                Optional<ReportLog> first = reportLogList.stream().filter(r -> r.getId().equals(numCellValue)).findFirst();
-                if(first.isPresent()){
-                    ReportLog reportLog = first.get();
-                    String reportIdSplit = reportLog.getReportIds();
-                    List<Integer> ids = Arrays.asList(reportIdSplit.split(",")).stream().map(s -> Integer.valueOf(s)).collect(Collectors.toList());
-                    List<Report> reports = reportList.stream().filter(r -> ids.contains(r.getId())).collect(Collectors.toList());
-                    LocalDateTime auditDateTime = null;
-                    LocalDateTime createTimeTime = null;
-                    if(auditDateCellValue!=null&&!StringUtils.isEmpty(auditDateCellValue)){
-                        try {
-                            auditDateTime = LocalDateTime.parse(auditDateCellValue, df);
-                        }catch (Exception e){
-                            msg.setError("第"+row+"行审核时间格式错误,请检查审核时间数据");
-                            return msg;
-                        }
-                        String creatorId = reports.get(0).getCreatorId();
-                        if(reportLog.getMsg().contains("审核通过了")){
-                            reportLog.setOperateDate(auditDateTime);
-                            needUpdateReportLogList.add(reportLog);
-                        }
-                        LocalDateTime finalAuditDateTime = auditDateTime;
-                        reports.forEach(r->{
-                            r.setProjectAuditTime(finalAuditDateTime);
-                        });
-                        List<Integer> details = reports.stream().map(Report::getId).distinct().collect(Collectors.toList());
-                        List<ReportLogDetail> reportLogDetails = reportLogDetailService.list(new LambdaQueryWrapper<ReportLogDetail>().in(ReportLogDetail::getReportId, details));
-                        reportLogDetails.forEach(r->{
+                        Optional<ReportLog> first = reportLogList.stream().filter(r -> r.getId().equals(numCellValue)).findFirst();
+                        if(first.isPresent()){
+                            ReportLog reportLog = first.get();
+                            String reportIdSplit = reportLog.getReportIds();
+                            List<Integer> ids = Arrays.asList(reportIdSplit.split(",")).stream().map(s -> Integer.valueOf(s)).collect(Collectors.toList());
+                            List<Report> reports = reportList.stream().filter(r -> ids.contains(r.getId())).collect(Collectors.toList());
+                            LocalDateTime auditDateTime = null;
+                            LocalDateTime createTimeTime = null;
+                            if(auditDateCellValue!=null&&!StringUtils.isEmpty(auditDateCellValue)){
+                                try {
+                                    auditDateTime = LocalDateTime.parse(auditDateCellValue, df);
+                                }catch (Exception e){
+                                    new Exception("第"+row+"行审核时间格式错误,请检查审核时间数据");
+                                }
+                                String creatorId = reports.get(0).getCreatorId();
+                                if(reportLog.getMsg().contains("审核通过了")){
+                                    reportLog.setOperateDate(auditDateTime);
+                                    needUpdateReportLogList.add(reportLog);
+                                }
+                                LocalDateTime finalAuditDateTime = auditDateTime;
+                                reports.forEach(r->{
+                                    r.setProjectAuditTime(finalAuditDateTime);
+                                });
+                                List<Integer> details = reports.stream().map(Report::getId).distinct().collect(Collectors.toList());
+                                List<ReportLogDetail> reportLogDetails = allReportLogDetails.stream().filter(a -> details.contains(a.getReportId())).collect(Collectors.toList());
+                                reportLogDetails.forEach(r->{
 //                            if(r.getMsg()!=null&&r.getMsg().contains("审核通过了")&&!r.getOperatorId().equals(creatorId)){
-                            if(r.getMsg()!=null&&r.getMsg().contains("审核通过了")){
-                                r.setOperateDate(finalAuditDateTime);
-                                needUpdateReportLogDetailList.add(r);
+                                    if(r.getMsg()!=null&&r.getMsg().contains("审核通过了")){
+                                        r.setOperateDate(finalAuditDateTime);
+                                        needUpdateReportLogDetailList.add(r);
+                                    }
+                                });
+                                needUpdateReportList.addAll(reports);
                             }
-                        });
-                        needUpdateReportList.addAll(reports);
-                    }
-                    if(createTimeCellValue!=null&&!StringUtils.isEmpty(createTimeCellValue)){
-                        try {
-                            createTimeTime = LocalDateTime.parse(createTimeCellValue, df);
-                        }catch (Exception e){
-                            msg.setError("第"+row+"行填报时间格式错误,请检查审核时间数据");
-                            return msg;
-                        }
-                        String creatorId = reports.get(0).getCreatorId();
-                        Integer id = reports.get(0).getId();
-                        List<ReportLog> list = reportLogService.list(new LambdaQueryWrapper<ReportLog>().apply("FIND_IN_SET(" + id + ",report_ids)"));
-                        List<ReportLog> reportLogs = list.stream().filter(l -> l.getMsg().contains("提交了")).collect(Collectors.toList());
-                        LocalDateTime finalCreateTimeTime1 = createTimeTime;
-                        reportLogs.forEach(r->{
-                            if(creatorId.equals(r.getOperatorId())){
-                                r.setOperateDate(finalCreateTimeTime1);
-                                needUpdateReportLogList.add(r);
-                            }
-                        });
-                        LocalDateTime finalCreateTimeTime = createTimeTime;
-                        reports.forEach(r->{
-                            r.setCreateTime(finalCreateTimeTime);
-                        });
-                        List<Integer> details = reports.stream().map(Report::getId).distinct().collect(Collectors.toList());
-                        List<ReportLogDetail> reportLogDetails = reportLogDetailService.list(new LambdaQueryWrapper<ReportLogDetail>().in(ReportLogDetail::getReportId, details));
-                        reportLogDetails.forEach(r->{
+                            if(createTimeCellValue!=null&&!StringUtils.isEmpty(createTimeCellValue)){
+                                try {
+                                    createTimeTime = LocalDateTime.parse(createTimeCellValue, df);
+                                }catch (Exception e){
+                                    new Exception("第"+row+"行填报时间格式错误,请检查审核时间数据");
+                                }
+                                String creatorId = reports.get(0).getCreatorId();
+                                Integer id = reports.get(0).getId();
+                                List<ReportLog> list = reportLogService.list(new LambdaQueryWrapper<ReportLog>().apply("FIND_IN_SET(" + id + ",report_ids)"));
+                                List<ReportLog> reportLogs = list.stream().filter(l -> l.getMsg().contains("提交了")).collect(Collectors.toList());
+                                LocalDateTime finalCreateTimeTime1 = createTimeTime;
+                                reportLogs.forEach(r->{
+                                    if(creatorId.equals(r.getOperatorId())){
+                                        r.setOperateDate(finalCreateTimeTime1);
+                                        needUpdateReportLogList.add(r);
+                                    }
+                                });
+                                LocalDateTime finalCreateTimeTime = createTimeTime;
+                                reports.forEach(r->{
+                                    r.setCreateTime(finalCreateTimeTime);
+                                });
+                                List<Integer> details = reports.stream().map(Report::getId).distinct().collect(Collectors.toList());
+                                List<ReportLogDetail> reportLogDetails = allReportLogDetails.stream().filter(a -> details.contains(a.getReportId())).collect(Collectors.toList());
+                                reportLogDetails.forEach(r->{
 //                            if(r.getMsg()!=null&&r.getMsg().contains("提交了")&&r.getOperatorId().equals(creatorId)){
-                            if(r.getMsg()!=null&&r.getMsg().contains("提交了")){
-                                r.setOperateDate(finalCreateTimeTime1);
-                                needUpdateReportLogDetailList.add(r);
+                                    if(r.getMsg()!=null&&r.getMsg().contains("提交了")){
+                                        r.setOperateDate(finalCreateTimeTime1);
+                                        needUpdateReportLogDetailList.add(r);
+                                    }
+                                });
+                                needUpdateReportList.addAll(reports);
                             }
-                        });
-                        needUpdateReportList.addAll(reports);
+                        }else {
+                            if(sb.toString().length()==0){
+                                sb.append(numCell);
+                            }else {
+                                sb.append(","+numCell);
+                            }
+                        }
                     }
-                }else {
-                    if(sb.toString().length()==0){
-                        sb.append(numCell);
+                    if(needUpdateReportList.size()>0){
+                        reportService.updateBatchById(needUpdateReportList);
+                    }
+                    if(needUpdateReportLogList.size()>0){
+                        reportLogService.updateBatchById(needUpdateReportLogList);
+                    }
+                    if(needUpdateReportLogDetailList.size()>0){
+                        reportLogDetailService.updateBatchById(needUpdateReportLogDetailList);
+                    }
+                    String msgStr="";
+                    if(sb.length()>0){
+                        msgStr="更新完成,其中编号["+sb.toString()+"]的填报数据不存在";
                     }else {
-                        sb.append(","+numCell);
+                        msgStr="更新完成";
+                    }
+                    if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                        wxCorpInfoService.sendWXCorpMsg(wxCorpInfo, user.getCorpwxUserid(),msgStr, null, WxCorpInfoServiceImpl.TEXT_CARD_MSG_REPORT_IMPORT);
                     }
                 }
-            }
-            if(needUpdateReportList.size()>0){
-                reportService.updateBatchById(needUpdateReportList);
-            }
-            if(needUpdateReportLogList.size()>0){
-                reportLogService.updateBatchById(needUpdateReportLogList);
-            }
-            if(needUpdateReportLogDetailList.size()>0){
-                reportLogDetailService.updateBatchById(needUpdateReportLogDetailList);
-            }
-            if(sb.length()>0){
-                msg.setMsg("更新完成,其中编号["+sb.toString()+"]的填报数据不存在");
-            }else {
-                msg.setMsg("更新完成");
-            }
+            });
+            msg.setMsg("正在导入审核修改...请稍后查看");
         }catch (FileNotFoundException e) {
             e.printStackTrace();
         } catch (IOException e) {

+ 3 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Report.java

@@ -1,6 +1,8 @@
 package com.management.platform.entity;
 
 import java.math.BigDecimal;
+
+import com.baomidou.mybatisplus.annotation.FieldStrategy;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import java.time.LocalDate;
@@ -159,7 +161,7 @@ public class Report extends Model<Report> {
     /**
      * 阶段/岗位/工序
      */
-    @TableField("stage")
+    @TableField(value = "stage",updateStrategy = FieldStrategy.IGNORED)
     private String stage;
 
 

+ 1 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -13363,6 +13363,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         targetGroupNameList.add("研发部电气调试验收");
         List<TaskGroup> taskGroupList = taskGroupMapper.selectList(new LambdaQueryWrapper<TaskGroup>().in(TaskGroup::getName, targetGroupNameList).inSql(TaskGroup::getProjectId, "select id from project where company_id=" + companyId));
         List<Integer> projectIds = taskGroupList.stream().map(TaskGroup::getProjectId).distinct().collect(Collectors.toList());
+        projectIds.add(-1);
         if(pageIndex==null&&pageSize==null){
             pageIndex=-1;
             pageSize=-1;

+ 4 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -9671,7 +9671,10 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         if(!StringUtils.isEmpty(reportIds)){
             List<String> reportIdList = Arrays.asList(reportIds.split(","));
             List<Report> transferReportList=new ArrayList<>();
-            String stagesName = stagesMapper.selectById(stageId).getStagesName();
+            String stagesName=null;
+            if(stageId!=null){
+                stagesName = stagesMapper.selectById(stageId).getStagesName();
+            }
             for (String reportIdStr : reportIdList) {
                 Integer reportId = Integer.valueOf(reportIdStr);
                 Report report = new Report();

+ 1 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/WxCorpInfoServiceImpl.java

@@ -102,6 +102,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
     public static final int TEXT_CARD_MSG_REPORT_DENY = 10;//日报驳回
     public static final int TEXT_CARD_MSG_REPORT_AGREE = 11; //日报审核通过
     public static final int TEXT_CARD_MSG_REPORT_ABNOEMAL = 12;//日报驳回
+    public static final int TEXT_CARD_MSG_REPORT_IMPORT = 13;//日报导入审核
     public static final int TEXT_CARD_MSG_EXPENSE_AGREE = 21;//费用报销审核通过
     public static final int TEXT_CARD_MSG_EXPENSE_DENY = 22;//费用报销审核驳回