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

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

parent dc1f6b4b
...@@ -28,10 +28,9 @@ public class AnalysisController { ...@@ -28,10 +28,9 @@ public class AnalysisController {
@ApiOperation("解析画布边文件上传excel内容") @ApiOperation("解析画布边文件上传excel内容")
@PostMapping("/canvas") @PostMapping("/canvas")
public Result<?> canvas(@RequestParam(value = "files") MultipartFile[] files, public Result<?> canvas(@RequestParam(value = "files") MultipartFile[] files,
@RequestParam(value = "templateId") Integer templateId,
@RequestParam(value = "caseId") String caseId, @RequestParam(value = "caseId") String caseId,
@RequestParam(value = "folderName", required = false) String folderName) { @RequestParam(value = "folderName", required = false) String folderName) {
return analysisService.canvas(files,templateId,caseId,folderName); return analysisService.canvas(files,caseId,folderName);
} }
@ApiOperation("解析模板表头") @ApiOperation("解析模板表头")
......
...@@ -36,4 +36,8 @@ public class CaseEntity { ...@@ -36,4 +36,8 @@ public class CaseEntity {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@TableField("last_update_time") @TableField("last_update_time")
private Date lastUpdateTime; private Date lastUpdateTime;
@TableField("template_id")
@ApiModelProperty(value = "模板id")
private String templateId;
} }
...@@ -19,7 +19,7 @@ public interface AnalysisService { ...@@ -19,7 +19,7 @@ public interface AnalysisService {
* @param files * @param files
* @return * @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; ...@@ -2,10 +2,7 @@ package com.platform.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.platform.exception.BusinessException; import com.platform.exception.BusinessException;
import com.platform.model.entity.ExcelDataEntity; import com.platform.model.entity.*;
import com.platform.model.entity.ExcelTemplateEntity;
import com.platform.model.entity.UserAccountEntity;
import com.platform.model.entity.UserEntity;
import com.platform.model.resp.Result; import com.platform.model.resp.Result;
import com.platform.model.vo.FileUploadVO; import com.platform.model.vo.FileUploadVO;
import com.platform.model.vo.TableHeaderVO; import com.platform.model.vo.TableHeaderVO;
...@@ -52,13 +49,20 @@ public class AnalysisServiceImpl implements AnalysisService { ...@@ -52,13 +49,20 @@ public class AnalysisServiceImpl implements AnalysisService {
private UserService userService; private UserService userService;
@Resource @Resource
private UserAccountService userAccountService; private UserAccountService userAccountService;
@Resource
private CaseService caseService;
private static final String[] EXCEL_EXTENSIONS = {".xlsx", ".xls"}; private static final String[] EXCEL_EXTENSIONS = {".xlsx", ".xls"};
@Override @Override
@Transactional @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); ExcelTemplateEntity ExcelTemplate = excelTemplateService.getById(templateId);
String json = ExcelTemplate.getJson(); String json = ExcelTemplate.getJson();
List<TableHeaderVO> tableHeaderList = JSON.parseArray(json, TableHeaderVO.class); List<TableHeaderVO> tableHeaderList = JSON.parseArray(json, TableHeaderVO.class);
......
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
<if test="lastUpdateTime != null"> <if test="lastUpdateTime != null">
last_update_time = #{lastUpdateTime}, last_update_time = #{lastUpdateTime},
</if> </if>
<if test="templateId != null">
template_id = #{templateId},
</if>
</set> </set>
where id = #{id} where id = #{id}
</update> </update>
...@@ -45,7 +48,8 @@ ...@@ -45,7 +48,8 @@
case_code, case_code,
create_by, create_by,
create_time, create_time,
last_update_time last_update_time,
template_id
from `case` from `case`
<where> <where>
<if test="caseCode != null and caseCode != ''"> <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