任务进度甘特图部分导入导出
This commit is contained in:
parent
e59b0fd066
commit
5f83c2696e
@ -1,5 +1,6 @@
|
||||
package com.zhgd.xmgl.modules.quality.entity.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ -7,17 +8,30 @@ public class QualityInspectionRecordTotalVo {
|
||||
|
||||
private Integer verificationNum;
|
||||
private Double rectificationRatio;
|
||||
@ApiModelProperty("已闭合")
|
||||
private Integer closeNum;
|
||||
private Integer reviewNum;
|
||||
private Integer investigateNum;
|
||||
@ApiModelProperty("超期未关闭")
|
||||
private Integer overdueNotCloseNum;
|
||||
private Integer rectificationNum;
|
||||
private Integer ybUrgentLevelNum;
|
||||
private Integer yzUrgentLevelNum;
|
||||
@ApiModelProperty("总数")
|
||||
private String totalNum;
|
||||
private Double completeRatio;
|
||||
private Integer jyUrgentLevelNum;
|
||||
private Integer overdueRectificationNum;
|
||||
@ApiModelProperty("未闭合")
|
||||
private Integer notCloseNum;
|
||||
@ApiModelProperty("今日较昨日总数")
|
||||
private Integer totalNumDifferYesterday;
|
||||
@ApiModelProperty("今日较昨日超期未关闭")
|
||||
private Integer overdueNotCloseNumDifferYesterday;
|
||||
@ApiModelProperty("今日较昨日已闭合")
|
||||
private Integer closeNumDifferYesterday;
|
||||
@ApiModelProperty("今日较昨日未闭合")
|
||||
private Integer notCloseNumDifferYesterday;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.zhgd.xmgl.modules.quality.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@ -22,6 +23,7 @@ import com.zhgd.xmgl.modules.quality.mapper.QualityInspectionRecordMapper;
|
||||
import com.zhgd.xmgl.modules.quality.mapper.QualityRectifyRecordMapper;
|
||||
import com.zhgd.xmgl.modules.quality.mapper.QualityRegionMapper;
|
||||
import com.zhgd.xmgl.modules.quality.service.IQualityInspectionRecordService;
|
||||
import com.zhgd.xmgl.util.DateUtil;
|
||||
import com.zhgd.xmgl.util.JxlExcelUtils;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
@ -112,6 +114,7 @@ public class QualityInspectionRecordServiceImpl extends ServiceImpl<QualityInspe
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
map.put("recordType", "1");
|
||||
QualityInspectionRecordTotalVo total = qualityInspectionRecordMapper.selectQualityInspectionRecordPageTotal(map);
|
||||
setDifferYesterday(map, total);
|
||||
List<Map<String, Object>> monthList = qualityInspectionRecordMapper.selectQualityInspectionRecordCountByDay(map);
|
||||
List<String> dayList = getDayList();
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
@ -138,6 +141,23 @@ public class QualityInspectionRecordServiceImpl extends ServiceImpl<QualityInspe
|
||||
return data;
|
||||
}
|
||||
|
||||
private void setDifferYesterday(Map<String, Object> map, QualityInspectionRecordTotalVo total) {
|
||||
Date date = new Date();
|
||||
map.put("inspectStartTime", DateUtil.today());
|
||||
map.put("inspectEndTime", DateUtil.format(DateUtil.endOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"));
|
||||
QualityInspectionRecordTotalVo todayTotal = qualityInspectionRecordMapper.selectQualityInspectionRecordPageTotal(map);
|
||||
DateTime d = DateUtil.offsetDay(date, -1);
|
||||
map.put("inspectStartTime", DateUtil.format(d, "yyyy-MM-dd"));
|
||||
map.put("inspectEndTime", DateUtil.format(DateUtil.endOfDay(d), "yyyy-MM-dd HH:mm:ss"));
|
||||
QualityInspectionRecordTotalVo yesterdayTotal = qualityInspectionRecordMapper.selectQualityInspectionRecordPageTotal(map);
|
||||
total.setTotalNumDifferYesterday(Integer.parseInt(todayTotal.getTotalNum()) - Integer.parseInt(yesterdayTotal.getTotalNum()));
|
||||
total.setCloseNumDifferYesterday(todayTotal.getCloseNum() - yesterdayTotal.getCloseNum());
|
||||
total.setNotCloseNumDifferYesterday(todayTotal.getNotCloseNum() - yesterdayTotal.getNotCloseNum());
|
||||
total.setOverdueNotCloseNumDifferYesterday(todayTotal.getOverdueNotCloseNum() - yesterdayTotal.getOverdueNotCloseNum());
|
||||
map.put("inspectStartTime", null);
|
||||
map.put("inspectEndTime", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> selectDangerTypeQualityCount(Map<String, Object> map) {
|
||||
Map<String, Object> data = new HashMap<>(1);
|
||||
|
||||
@ -184,19 +184,20 @@ public class TaskProgressController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入mpp文件解析对应的数据(增量覆盖)
|
||||
* 导入mpp文件解析对应的数据
|
||||
*
|
||||
* @param mppFile
|
||||
* @return 删除结果
|
||||
*/
|
||||
@PostMapping(value = "/importData")
|
||||
@ApiOperation(value = "导入mpp文件解析对应的数据(增量覆盖)")
|
||||
@ApiOperation(value = "导入mpp文件解析对应的数据")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "mppUrl", value = "mpp甘特图文件路径", dataType = "string", dataTypeClass = String.class, required = true, paramType = "query"),
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", dataType = "string", dataTypeClass = String.class, required = true, paramType = "query"),
|
||||
@ApiImplicitParam(name = "type", value = "导入方式:1覆盖更新(复制)2根据名称替换更新", dataType = "integer", required = true, paramType = "query"),
|
||||
})
|
||||
public Result importData(@RequestParam(value = "mppFile") MultipartFile mppFile, String projectSn, Long createUserId) {
|
||||
taskProgressService.importData(mppFile, projectSn, createUserId);
|
||||
public Result importData(@RequestParam(value = "mppFile") MultipartFile mppFile, String projectSn, Integer type) {
|
||||
taskProgressService.importData(mppFile, projectSn, type);
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
package com.zhgd.xmgl.modules.taskprogress.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.jeecg.common.util.oConvertUtils;
|
||||
import com.zhgd.xmgl.modules.taskprogress.entity.TaskProgress;
|
||||
import com.zhgd.xmgl.modules.taskprogress.entity.TaskProgressMaterialRel;
|
||||
import com.zhgd.xmgl.modules.taskprogress.service.ITaskProgressMaterialRelService;
|
||||
@ -16,18 +14,13 @@ import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@ -167,31 +160,28 @@ public class TaskProgressMaterialRelController {
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@ApiOperation(value = "导出excel任务进度甘特图-材料类型-关联信息", notes = "导出excel任务进度甘特图-材料类型-关联信息", httpMethod = "POST")
|
||||
@ApiOperation(value = "导出excel任务进度甘特图-计划材料工程", notes = "导出excel任务进度甘特图-计划材料工程", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "type", value = "类型:1下载模板2导出", paramType = "query", required = true, dataType = "Integer"),
|
||||
})
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
|
||||
// Step.1 组装查询条件
|
||||
QueryWrapper<TaskProgressMaterialRel> queryWrapper = null;
|
||||
try {
|
||||
String paramsStr = request.getParameter("paramsStr");
|
||||
if (oConvertUtils.isNotEmpty(paramsStr)) {
|
||||
String deString = URLDecoder.decode(paramsStr, "UTF-8");
|
||||
TaskProgressMaterialRel taskProgressMaterialRel = JSON.parseObject(deString, TaskProgressMaterialRel.class);
|
||||
queryWrapper = QueryGenerator.initQueryWrapper(taskProgressMaterialRel, request.getParameterMap());
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
public void exportXls(HttpServletRequest request, @ApiIgnore @RequestBody HashMap<String, Object> paramMap, HttpServletResponse response) {
|
||||
taskProgressMaterialRelService.exportXls(request, paramMap, response);
|
||||
}
|
||||
|
||||
//Step.2 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
List<TaskProgressMaterialRel> pageList = taskProgressMaterialRelService.list(queryWrapper);
|
||||
//导出文件名称
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "任务进度甘特图-材料类型-关联列表");
|
||||
mv.addObject(NormalExcelConstants.CLASS, TaskProgressMaterialRel.class);
|
||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("任务进度甘特图-材料类型-关联列表数据", "导出人:Jeecg", "导出信息"));
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
||||
return mv;
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "通过excel导入任务进度甘特图-计划材料工程", notes = "通过excel导入任务进度甘特图-计划材料工程", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = true, dataType = "String"),
|
||||
})
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(MultipartFile file, @ApiIgnore @RequestParam HashMap<String, Object> paramMap) {
|
||||
return taskProgressMaterialRelService.importExcel(file, paramMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -39,13 +39,11 @@ public class TaskProgressMaterialRel implements Serializable {
|
||||
/**
|
||||
* taskProgressMaterialTypeId
|
||||
*/
|
||||
@Excel(name = "taskProgressMaterialTypeId", width = 15)
|
||||
@ApiModelProperty(value = "taskProgressMaterialTypeId")
|
||||
private java.lang.Long taskProgressMaterialTypeId;
|
||||
/**
|
||||
* taskProgressContentId
|
||||
*/
|
||||
@Excel(name = "taskProgressContentId", width = 15)
|
||||
@ApiModelProperty(value = "taskProgressContentId")
|
||||
private java.lang.Long taskProgressContentId;
|
||||
/**
|
||||
|
||||
@ -1,10 +1,14 @@
|
||||
package com.zhgd.xmgl.modules.taskprogress.service;
|
||||
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.xmgl.modules.taskprogress.entity.TaskProgress;
|
||||
import com.zhgd.xmgl.modules.taskprogress.entity.TaskProgressMaterialRel;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@ -19,4 +23,8 @@ public interface ITaskProgressMaterialRelService extends IService<TaskProgressMa
|
||||
List<TaskProgressMaterialRel> queryDetailList(HashMap<String, Object> paramMap);
|
||||
|
||||
List<TaskProgress> queryTreeList(HashMap<String, Object> paramMap);
|
||||
|
||||
void exportXls(HttpServletRequest request, HashMap<String, Object> paramMap, HttpServletResponse response);
|
||||
|
||||
Result<?> importExcel(MultipartFile file, HashMap<String, Object> paramMap);
|
||||
}
|
||||
|
||||
@ -22,5 +22,5 @@ public interface ITaskProgressService extends IService<TaskProgress> {
|
||||
|
||||
void delete(HashMap<String, Object> map);
|
||||
|
||||
void importData(MultipartFile mppFile, String projectSn, Long createUserId);
|
||||
void importData(MultipartFile mppFile, String projectSn, Integer createUserId);
|
||||
}
|
||||
|
||||
@ -1,21 +1,35 @@
|
||||
package com.zhgd.xmgl.modules.taskprogress.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.xmgl.modules.taskprogress.entity.TaskProgress;
|
||||
import com.zhgd.xmgl.modules.taskprogress.entity.TaskProgressMaterialRel;
|
||||
import com.zhgd.xmgl.modules.taskprogress.entity.TaskProgressMaterialType;
|
||||
import com.zhgd.xmgl.modules.taskprogress.mapper.TaskProgressMapper;
|
||||
import com.zhgd.xmgl.modules.taskprogress.mapper.TaskProgressMaterialRelMapper;
|
||||
import com.zhgd.xmgl.modules.taskprogress.mapper.TaskProgressMaterialTypeMapper;
|
||||
import com.zhgd.xmgl.modules.taskprogress.service.ITaskProgressMaterialRelService;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.jeecgframework.poi.excel.ExcelExportUtil;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -33,6 +47,8 @@ public class TaskProgressMaterialRelServiceImpl extends ServiceImpl<TaskProgress
|
||||
TaskProgressMapper taskProgressMapper;
|
||||
@Autowired
|
||||
TaskProgressServiceImpl taskProgressService;
|
||||
@Autowired
|
||||
TaskProgressMaterialTypeMapper taskProgressMaterialTypeMapper;
|
||||
|
||||
@Override
|
||||
public List<TaskProgressMaterialRel> queryDetailList(HashMap<String, Object> paramMap) {
|
||||
@ -55,4 +71,140 @@ public class TaskProgressMaterialRelServiceImpl extends ServiceImpl<TaskProgress
|
||||
Map<Long, List<TaskProgress>> parentIdTaskListMap = progressTaskList.stream().collect(Collectors.groupingBy(TaskProgress::getParentId));
|
||||
return taskProgressService.getChild(parentIdTaskListMap, 0L);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportXls(HttpServletRequest request, HashMap<String, Object> paramMap, HttpServletResponse response) {
|
||||
String projectSn = MapUtils.getString(paramMap, "projectSn");
|
||||
Integer type = MapUtils.getInteger(paramMap, "type");
|
||||
List<TaskProgress> taskProgresses = queryTreeList(paramMap);
|
||||
String plan = "计划情况";
|
||||
String actual = "实际情况";
|
||||
// 树形转为list
|
||||
List<TaskProgress> result = new ArrayList<>();
|
||||
for (TaskProgress taskProgress : taskProgresses) {
|
||||
this.recursionTreeToList(result, taskProgress, null);
|
||||
}
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
entityList.add(new ExcelExportEntity("id", "id"));
|
||||
entityList.add(new ExcelExportEntity("父级id", "pid"));
|
||||
entityList.add(new ExcelExportEntity("分部分项工程名称", "taskName"));
|
||||
List<TaskProgressMaterialType> taskProgressMaterialRels = taskProgressMaterialTypeMapper.selectList(new LambdaQueryWrapper<TaskProgressMaterialType>()
|
||||
.eq(TaskProgressMaterialType::getProjectSn, projectSn));
|
||||
String p = "p";
|
||||
String a = "a";
|
||||
for (TaskProgressMaterialType rel : taskProgressMaterialRels) {
|
||||
entityList.add(new ExcelExportEntity(rel.getName(), p + rel.getId() + "", true));
|
||||
}
|
||||
for (TaskProgressMaterialType rel : taskProgressMaterialRels) {
|
||||
entityList.add(new ExcelExportEntity(rel.getName(), a + rel.getId() + "", true));
|
||||
}
|
||||
List<String> pids = taskProgressMaterialRels.stream().map(o -> p + o.getId() + "").collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(pids)) {
|
||||
throw new OpenAlertException("请先添加材料类型");
|
||||
}
|
||||
List<String> aids = taskProgressMaterialRels.stream().map(o -> p + o.getId() + "").collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(aids)) {
|
||||
throw new OpenAlertException("请先添加材料类型");
|
||||
}
|
||||
|
||||
//合并表头
|
||||
ExcelExportEntity e4 = new ExcelExportEntity(plan, "plan", true);
|
||||
//还需要设置一个子表头key的集合
|
||||
e4.setSubColumnList(pids);
|
||||
entityList.add(e4);
|
||||
ExcelExportEntity e5 = new ExcelExportEntity(actual, "actual", true);
|
||||
//还需要设置一个子表头key的集合
|
||||
e5.setSubColumnList(aids);
|
||||
entityList.add(e5);
|
||||
|
||||
List<Map<Object, String>> list = new ArrayList<>();
|
||||
Map<Object, String> map;
|
||||
for (TaskProgress taskProgress : result) {
|
||||
List<TaskProgressMaterialRel> relList = taskProgress.getRelList();
|
||||
map = new HashMap<>();
|
||||
map.put("id", String.valueOf(taskProgress.getId()));
|
||||
map.put("pid", String.valueOf(taskProgress.getParentId()));
|
||||
map.put("taskName", taskProgress.getTaskName());
|
||||
if (CollUtil.isNotEmpty(relList) && Objects.equals(type, 2)) {
|
||||
for (TaskProgressMaterialRel rel : relList) {
|
||||
map.put(p + rel.getTaskProgressMaterialTypeId() + "", rel.getPlanUsage() + "");
|
||||
map.put(a + rel.getTaskProgressMaterialTypeId() + "", rel.getActualUsage() + "");
|
||||
}
|
||||
}
|
||||
list.add(map);
|
||||
}
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, list);
|
||||
try {
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result importExcel(MultipartFile file, HashMap<String, Object> paramMap) {
|
||||
String projectSn = MapUtils.getString(paramMap, "projectSn");
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(0);
|
||||
params.setHeadRows(1);
|
||||
try {
|
||||
List<Map<String, String>> mapList = ExcelImportUtil.importExcel(file.getInputStream(), Map.class, params);
|
||||
String plan = "计划情况_";
|
||||
String actual = "实际情况_";
|
||||
for (Map<String, String> m : mapList) {
|
||||
Set<String> keys = m.keySet();
|
||||
for (String key : keys) {
|
||||
if (StringUtils.startsWith(key, plan)) {
|
||||
String trueKey;
|
||||
if (StringUtils.startsWith(key, plan)) {
|
||||
trueKey = StringUtils.substringAfterLast(key, plan);
|
||||
} else {
|
||||
trueKey = StringUtils.substringAfterLast(actual, plan);
|
||||
}
|
||||
TaskProgressMaterialType type = taskProgressMaterialTypeMapper.selectOne(new LambdaQueryWrapper<TaskProgressMaterialType>()
|
||||
.eq(TaskProgressMaterialType::getName, trueKey)
|
||||
.eq(TaskProgressMaterialType::getProjectSn, projectSn));
|
||||
if (type == null) {
|
||||
throw new OpenAlertException("材料类型不存在");
|
||||
}
|
||||
TaskProgressMaterialRel rel = new TaskProgressMaterialRel();
|
||||
rel.setTaskProgressId(MapUtils.getLong(m, "id"));
|
||||
rel.setTaskProgressMaterialTypeId(type.getId());
|
||||
rel.setPlanUsage(MapUtils.getDouble(m, plan + trueKey));
|
||||
rel.setActualUsage(MapUtils.getDouble(m, actual + trueKey));
|
||||
taskProgressMaterialRelMapper.insert(rel);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return Result.ok("文件导入成功!");
|
||||
} catch (Exception e) {
|
||||
log.error("err:" + e);
|
||||
return Result.error("文件导入失败!");
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归把传过来的tree转为list
|
||||
*
|
||||
* @param result 结果集
|
||||
* @param root 当前对象
|
||||
* @param parentNode 没有传Null
|
||||
*/
|
||||
private void recursionTreeToList(List<TaskProgress> result, TaskProgress root, TaskProgress parentNode) {
|
||||
result.add(root);
|
||||
if (CollectionUtils.isEmpty(root.getChildren())) {
|
||||
return;
|
||||
}
|
||||
for (TaskProgress child : root.getChildren()) {
|
||||
this.recursionTreeToList(result, child, root);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ public class TaskProgressServiceImpl extends ServiceImpl<TaskProgressMapper, Tas
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importData(MultipartFile mppFile, String projectSn, Long createUserId) {
|
||||
public void importData(MultipartFile mppFile, String projectSn, Integer type) {
|
||||
//log.info("用户id:{},执行上传mpp文件操作", createUserId);
|
||||
//List<TaskProgress> progressTasks = taskProgressMapper.selectList(Wrappers.lambdaQuery(TaskProgress.class).eq(TaskProgress::getProjectSn, projectSn));
|
||||
//log.info("原progressTasks:{}", JSON.toJSONString(progressTasks));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user