bug修复
This commit is contained in:
parent
0475466f76
commit
89db063ade
@ -1,6 +1,7 @@
|
||||
package com.zhgd.xmgl.modules.worker.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
@ -21,6 +22,10 @@ import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@ -641,5 +646,15 @@ public class WorkerInfoController {
|
||||
return Result.success(workerInfoService.countEntryAndExitNum(map));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量人员图片导入", notes = "批量人员图片导入")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "file", value = "导入zip文件", paramType = "query", required = true, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/uploadWorkerInfoImgs")
|
||||
public Result uploadWorkerInfoImgs(MultipartFile file, String projectSn) throws IOException {
|
||||
workerInfoService.uploadWorkerInfoImgs(file, projectSn);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ import com.zhgd.xmgl.modules.worker.entity.vo.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -126,4 +127,6 @@ public interface IWorkerInfoService extends IService<WorkerInfo> {
|
||||
String getWorkerInfoByDev(GetWorkerInfoByDevDto dto);
|
||||
|
||||
CountEntryAndExitNumVo countEntryAndExitNum(Map<String, Object> map);
|
||||
|
||||
void uploadWorkerInfoImgs(MultipartFile file, String projectSn) throws IOException;
|
||||
}
|
||||
|
||||
@ -7,8 +7,10 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import cn.hutool.poi.excel.ExcelWriter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -56,6 +58,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -1977,6 +1980,17 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
|
||||
return baseMapper.countEntryAndExitNum(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadWorkerInfoImgs(MultipartFile file, String projectSn) throws IOException {
|
||||
InputStream is = file.getInputStream();
|
||||
String folder = basePath + "/" + IdUtil.simpleUUID();
|
||||
new File(folder).mkdirs();
|
||||
String zipPath = folder + "/" + IdUtil.simpleUUID() + ".zip";
|
||||
String unzipPath = folder + "/" + IdUtil.simpleUUID();
|
||||
file.transferTo(new File(zipPath));
|
||||
File file1 = ZipUtil.unzip(zipPath, unzipPath);
|
||||
|
||||
}
|
||||
|
||||
private void addDatas(List<WorkerInfo> infos, String del, ArrayList<GetWorkerInfoByDevVo.Worker> datas) {
|
||||
for (WorkerInfo workerInfo : infos) {
|
||||
|
||||
@ -1,6 +1,16 @@
|
||||
package com.zhgd.xmgl.util;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
public class PathUtil {
|
||||
|
||||
private static String basePath;
|
||||
|
||||
@Value("${basePath}")
|
||||
public void setBasePath(String basePath) {
|
||||
basePath = basePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除多余的斜杠
|
||||
*
|
||||
@ -18,4 +28,8 @@ public class PathUtil {
|
||||
System.out.println(reviseSlash("http://192.168.34.221:19111/xmgl//weight/weighInfo/getNewestWeighInfo"));
|
||||
System.out.println(reviseSlash("http://192.168.34.221:9111/image//65e5733735f013f4cc322278.jpg"));
|
||||
}
|
||||
|
||||
public static String getBasePath() {
|
||||
return basePath;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user