数据转换1.0
This commit is contained in:
@ -1,37 +1,19 @@
|
|||||||
package org.dromara.transferData.controller;
|
package org.dromara.transferData.controller;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import jakarta.activation.MimetypesFileTypeMap;
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.common.core.domain.R;
|
|
||||||
import org.dromara.contractor.domain.vo.constructionuser.SubConstructionUserVo;
|
|
||||||
import org.dromara.project.domain.BusAttendanceRule;
|
import org.dromara.project.domain.BusAttendanceRule;
|
||||||
import org.dromara.project.domain.vo.BusAttendanceRuleVo;
|
|
||||||
import org.dromara.transferData.domain.ConstructionUserCopy;
|
import org.dromara.transferData.domain.ConstructionUserCopy;
|
||||||
import org.dromara.transferData.domain.OldAttendance;
|
import org.dromara.transferData.domain.OldAttendance;
|
||||||
import org.dromara.transferData.mapper.TransferDataMapper;
|
import org.dromara.transferData.mapper.TransferDataMapper;
|
||||||
import org.dromara.contractor.service.ISubConstructionUserService;
|
|
||||||
import org.dromara.project.domain.BusAttendance;
|
import org.dromara.project.domain.BusAttendance;
|
||||||
import org.dromara.project.service.IBusAttendanceRuleService;
|
import org.dromara.project.service.IBusAttendanceRuleService;
|
||||||
import org.dromara.project.service.IBusAttendanceService;
|
|
||||||
import org.dromara.system.domain.vo.SysOssVo;
|
|
||||||
import org.dromara.system.service.ISysOssService;
|
|
||||||
import org.dromara.transferData.service.TransferDataService;
|
import org.dromara.transferData.service.TransferDataService;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.net.URI;
|
|
||||||
import java.net.http.HttpClient;
|
|
||||||
import java.net.http.HttpResponse;
|
|
||||||
import java.net.http.HttpRequest;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
@ -42,7 +24,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@ -58,6 +39,7 @@ public class TransferDataController {
|
|||||||
private TransferDataService transferDataService;
|
private TransferDataService transferDataService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 两个候选基础URL
|
// 两个候选基础URL
|
||||||
private static final String[] BASE_URLS = {
|
private static final String[] BASE_URLS = {
|
||||||
"http://xny.yj-3d.com:7464",
|
"http://xny.yj-3d.com:7464",
|
||||||
@ -169,6 +151,10 @@ public class TransferDataController {
|
|||||||
// attendanceService.saveBatch(arrs);
|
// attendanceService.saveBatch(arrs);
|
||||||
|
|
||||||
// transferDataMapper.saveBatchCopy(arrs);
|
// transferDataMapper.saveBatchCopy(arrs);
|
||||||
|
//更新施工人员图片
|
||||||
|
transferDataService.renYuan();
|
||||||
|
//更新附件图片
|
||||||
|
transferDataService.renYuanFuJiang();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,9 @@ import jakarta.annotation.Resource;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.SerializationUtils;
|
import org.apache.commons.lang3.SerializationUtils;
|
||||||
import org.dromara.common.core.service.OssService;
|
import org.dromara.common.core.service.OssService;
|
||||||
|
import org.dromara.contractor.domain.SubConstructionUser;
|
||||||
|
import org.dromara.contractor.domain.SubConstructionUserFile;
|
||||||
|
import org.dromara.contractor.service.ISubConstructionUserFileService;
|
||||||
import org.dromara.contractor.service.ISubConstructionUserService;
|
import org.dromara.contractor.service.ISubConstructionUserService;
|
||||||
import org.dromara.project.domain.BusAttendance;
|
import org.dromara.project.domain.BusAttendance;
|
||||||
import org.dromara.project.service.IBusAttendanceRuleService;
|
import org.dromara.project.service.IBusAttendanceRuleService;
|
||||||
@ -22,6 +25,7 @@ import java.net.http.HttpRequest;
|
|||||||
import java.net.http.HttpResponse;
|
import java.net.http.HttpResponse;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
@ -178,9 +182,64 @@ public class TransferDataService {
|
|||||||
attendance.setFacePic("");
|
attendance.setFacePic("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ISubConstructionUserService constructionUserService;
|
||||||
|
@Resource
|
||||||
|
private ISubConstructionUserFileService constructionUserFileService;
|
||||||
|
|
||||||
|
public boolean renYuan() {
|
||||||
|
ArrayList<SubConstructionUser> objects = new ArrayList<>();
|
||||||
|
//获取到施工人员信息,然后处理图片
|
||||||
|
List<SubConstructionUser> list1 = constructionUserService.list();
|
||||||
|
for (SubConstructionUser subConstructionUser : list1) {
|
||||||
|
if(subConstructionUser.getFacePic()!=null){
|
||||||
|
Long l = handleSinglePhoto1(subConstructionUser.getFacePic());
|
||||||
|
subConstructionUser.setFacePic(l==null?"":l.toString());
|
||||||
|
}
|
||||||
|
if(subConstructionUser.getSfzFrontPic()!=null){
|
||||||
|
Long l = handleSinglePhoto1(subConstructionUser.getSfzFrontPic());
|
||||||
|
subConstructionUser.setSfzFrontPic(l==null?"":l.toString());
|
||||||
|
}
|
||||||
|
if(subConstructionUser.getSfzBackPic()!=null){
|
||||||
|
Long l = handleSinglePhoto1(subConstructionUser.getSfzBackPic());
|
||||||
|
subConstructionUser.setSfzBackPic(l==null?"":l.toString());
|
||||||
|
}
|
||||||
|
if(subConstructionUser.getYhkPic()!=null){
|
||||||
|
Long l = handleSinglePhoto1(subConstructionUser.getYhkPic());
|
||||||
|
subConstructionUser.setYhkPic(l==null?"":l.toString());
|
||||||
|
}
|
||||||
|
objects.add(subConstructionUser);
|
||||||
|
}
|
||||||
|
//更新数据
|
||||||
|
constructionUserService.updateBatchById(objects);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean renYuanFuJiang() {
|
||||||
|
ArrayList<SubConstructionUserFile> objects = new ArrayList<>();
|
||||||
|
//获取到施工人员信息,然后处理图片
|
||||||
|
List<SubConstructionUserFile> list1 = constructionUserFileService.list();
|
||||||
|
for (SubConstructionUserFile subConstructionUser : list1) {
|
||||||
|
String path = subConstructionUser.getPath();
|
||||||
|
if (path != null && !path.isEmpty()) {
|
||||||
|
String[] split = path.split(",");
|
||||||
|
for (String s : split) {
|
||||||
|
Long l = handleSinglePhoto1(s);
|
||||||
|
if(l!=null){
|
||||||
|
subConstructionUser.setPath(subConstructionUser.getPath().replace(s,l.toString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
objects.add(subConstructionUser);
|
||||||
|
}
|
||||||
|
//更新数据
|
||||||
|
constructionUserFileService.updateBatchById(objects);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private Long handleSinglePhoto1(String facePicRelativePath) {
|
private Long handleSinglePhoto1(String facePicRelativePath) {
|
||||||
|
|
||||||
if (facePicRelativePath == null || facePicRelativePath.isEmpty()) {
|
if (facePicRelativePath == null || facePicRelativePath.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user