|
@@ -1,31 +1,27 @@
|
|
|
package com.management.platform.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.management.platform.entity.*;
|
|
|
import com.management.platform.mapper.*;
|
|
|
import com.management.platform.service.ReportService;
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.management.platform.service.TimeCalculationService;
|
|
|
import com.management.platform.util.HttpRespMsg;
|
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.sql.Timestamp;
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDate;
|
|
|
-import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.time.format.DateTimeParseException;
|
|
|
import java.util.*;
|
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
-
|
|
|
/**
|
|
|
* <p>
|
|
|
* 服务实现类
|
|
@@ -252,8 +248,10 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
httpRespMsg.setError("操作失败");
|
|
|
}
|
|
|
} else {
|
|
|
- if (reportMapper.updateById(report) == 0) {
|
|
|
- httpRespMsg.setError("操作失败");
|
|
|
+ if (reportMapper.selectById(report.getId()).getState() != 1) {
|
|
|
+ if (reportMapper.updateById(report) == 0) {
|
|
|
+ httpRespMsg.setError("操作失败");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -269,4 +267,58 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
+
|
|
|
+ //获取未经审核的报告列表
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg getUncensoredList(HttpServletRequest request) {
|
|
|
+ HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
+ try {
|
|
|
+ Integer companyId = userMapper.selectById(request.getHeader("Token")).getCompanyId();
|
|
|
+ httpRespMsg.data = reportMapper.getUncensoredList(companyId);
|
|
|
+ } catch (NullPointerException e) {
|
|
|
+ httpRespMsg.setError("验证失败");
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+
|
|
|
+ //审核通过
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg approveReport(Integer id, HttpServletRequest request) {
|
|
|
+ HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
+ try {
|
|
|
+ User user = userMapper.selectById(request.getHeader("Token"));
|
|
|
+ Report report = reportMapper.selectById(id);
|
|
|
+ Project project = projectMapper.selectById(report.getProjectId());
|
|
|
+ if (user.getRole() == 0 || !project.getCompanyId().equals(user.getCompanyId())) {
|
|
|
+ httpRespMsg.setError("无修改权限");
|
|
|
+ } else {
|
|
|
+ reportMapper.updateById(report.setState(1));
|
|
|
+ }
|
|
|
+ } catch (NullPointerException e) {
|
|
|
+ httpRespMsg.setError("验证失败");
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+
|
|
|
+ //审核未通过 以及 撤销审核
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg denyReport(Integer id, HttpServletRequest request) {
|
|
|
+ HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
+ try {
|
|
|
+ User user = userMapper.selectById(request.getHeader("Token"));
|
|
|
+ Report report = reportMapper.selectById(id);
|
|
|
+ Project project = projectMapper.selectById(report.getProjectId());
|
|
|
+ if (user.getRole() == 0 || !project.getCompanyId().equals(user.getCompanyId())) {
|
|
|
+ httpRespMsg.setError("无修改权限");
|
|
|
+ } else {
|
|
|
+ reportMapper.updateById(report.setState(2));
|
|
|
+ }
|
|
|
+ } catch (NullPointerException e) {
|
|
|
+ httpRespMsg.setError("验证失败");
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
}
|