Commit 4403e831 authored by wujipeng's avatar wujipeng
Browse files

解析画布边文件上传excel内容-优化

parent dc1f6b4b
......@@ -28,10 +28,9 @@ public class AnalysisController {
@ApiOperation("解析画布边文件上传excel内容")
@PostMapping("/canvas")
public Result<?> canvas(@RequestParam(value = "files") MultipartFile[] files,
@RequestParam(value = "templateId") Integer templateId,
@RequestParam(value = "caseId") String caseId,
@RequestParam(value = "folderName", required = false) String folderName) {
return analysisService.canvas(files,templateId,caseId,folderName);
return analysisService.canvas(files,caseId,folderName);
}
@ApiOperation("解析模板表头")
......
......@@ -36,4 +36,8 @@ public class CaseEntity {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@TableField("last_update_time")
private Date lastUpdateTime;
@TableField("template_id")
@ApiModelProperty(value = "模板id")
private String templateId;
}
......@@ -19,7 +19,7 @@ public interface AnalysisService {
* @param files
* @return
*/
Result<?> canvas(MultipartFile[] files,Integer templateId,String caseId,String folderName);
Result<?> canvas(MultipartFile[] files,String caseId,String folderName);
/**
* 读取模板文件
......
......@@ -2,10 +2,7 @@ package com.platform.service.impl;
import com.alibaba.fastjson.JSON;
import com.platform.exception.BusinessException;
import com.platform.model.entity.ExcelDataEntity;
import com.platform.model.entity.ExcelTemplateEntity;
import com.platform.model.entity.UserAccountEntity;
import com.platform.model.entity.UserEntity;
import com.platform.model.entity.*;
import com.platform.model.resp.Result;
import com.platform.model.vo.FileUploadVO;
import com.platform.model.vo.TableHeaderVO;
......@@ -52,13 +49,20 @@ public class AnalysisServiceImpl implements AnalysisService {
private UserService userService;
@Resource
private UserAccountService userAccountService;
@Resource
private CaseService caseService;
private static final String[] EXCEL_EXTENSIONS = {".xlsx", ".xls"};
@Override
@Transactional
public Result<?> canvas(MultipartFile[] files, Integer templateId, String caseId, String folderName) {
public Result<?> canvas(MultipartFile[] files, String caseId, String folderName) {
//查询模板
CaseEntity caseEntity = caseService.getById(caseId);
String templateId = caseEntity.getTemplateId();
if(StringUtils.isEmpty(templateId)){
throw new BusinessException("案件未绑定模板");
}
ExcelTemplateEntity ExcelTemplate = excelTemplateService.getById(templateId);
String json = ExcelTemplate.getJson();
List<TableHeaderVO> tableHeaderList = JSON.parseArray(json, TableHeaderVO.class);
......
......@@ -27,6 +27,9 @@
<if test="lastUpdateTime != null">
last_update_time = #{lastUpdateTime},
</if>
<if test="templateId != null">
template_id = #{templateId},
</if>
</set>
where id = #{id}
</update>
......@@ -45,7 +48,8 @@
case_code,
create_by,
create_time,
last_update_time
last_update_time,
template_id
from `case`
<where>
<if test="caseCode != null and caseCode != ''">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment