|
|
@@ -10,6 +10,7 @@ import com.ruoyi.common.exception.ServiceException;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
|
|
+import com.ruoyi.common.utils.file.FileUtils;
|
|
|
import com.ruoyi.common.utils.file.MimeTypeUtils;
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
import com.ruoyi.project.bo.*;
|
|
|
@@ -22,6 +23,8 @@ import com.ruoyi.project.service.ProjectStaffService;
|
|
|
import com.ruoyi.project.service.ProjectTaskService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import org.apache.http.HttpStatus;
|
|
|
+import org.springframework.http.MediaType;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
@@ -496,4 +499,26 @@ public class ProjectTaskController extends BaseController {
|
|
|
List<Map<Integer,String >> list = util.importMapExcel(file.getInputStream(),0);
|
|
|
return success(projectStaffRecordService.importClockData(list));
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 考勤打卡导入模版
|
|
|
+ */
|
|
|
+ @PostMapping("/importClockDataTemplate")
|
|
|
+ @Log(title = "项目管理", businessType = BusinessType.IMPORT)
|
|
|
+ @ApiOperation("考勤打卡导入模版")
|
|
|
+ public void importClockDataTemplate(HttpServletResponse response){
|
|
|
+ try
|
|
|
+ {
|
|
|
+ String realFileName = System.currentTimeMillis() + "_考勤模版".substring("考勤模版".indexOf("_") + 1);
|
|
|
+ String filePath = RuoYiConfig.getDownloadPath() + "考勤模版.xlsx";
|
|
|
+ response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
|
|
+ FileUtils.setAttachmentResponseHeader(response, realFileName);
|
|
|
+ FileUtils.writeBytes(filePath, response.getOutputStream());
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ throw new ServiceException("下载文件失败", HttpStatus.SC_BAD_REQUEST);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|