This commit is contained in:
2025-09-20 19:59:35 +08:00
parent 5f8d494154
commit 7fdd75da1f
5 changed files with 103 additions and 75 deletions

View File

@ -39,6 +39,8 @@ public interface IHseSafetyInspectionService extends IService<HseSafetyInspectio
*/ */
TableDataInfo<HseSafetyInspectionVo> queryPageList(HseSafetyInspectionQueryReq req, PageQuery pageQuery); TableDataInfo<HseSafetyInspectionVo> queryPageList(HseSafetyInspectionQueryReq req, PageQuery pageQuery);
TableDataInfo<HseSafetyInspectionVo> queryPageListWeb(HseSafetyInspectionQueryReq req, PageQuery pageQuery);
/** /**
* 查询符合条件的安全巡检工单列表 * 查询符合条件的安全巡检工单列表
* *

View File

@ -141,6 +141,24 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
return TableDataInfo.build(this.getVoPage(result)); return TableDataInfo.build(this.getVoPage(result));
} }
@Override
public TableDataInfo<HseSafetyInspectionVo> queryPageListWeb(HseSafetyInspectionQueryReq req, PageQuery pageQuery) {
LambdaQueryWrapper<HseSafetyInspection> lqw = this.buildQueryWrapper(req);
Long userId = LoginHelper.getUserId();
// if (userId != null) {
// BusProjectTeamMember one = projectTeamMemberService.lambdaQuery()
// .eq(BusProjectTeamMember::getMemberId, userId)
// .eq(BusProjectTeamMember::getPostId, "0")
// .last("limit 1")
// .one();
// if (one != null) {
// lqw.eq(HseSafetyInspection::getCorrectorId, userId);
// }
// }
Page<HseSafetyInspection> result = this.page(pageQuery.build(), lqw);
return TableDataInfo.build(this.getVoPage(result));
}
/** /**
* 查询符合条件的安全巡检工单列表 * 查询符合条件的安全巡检工单列表
* *

View File

@ -148,7 +148,7 @@ public class TransferDataController {
busAttendance.setHandle("5".equals(oldAttendance.getIsPinch())?"1":"0"); busAttendance.setHandle("5".equals(oldAttendance.getIsPinch())?"1":"0");
} }
arrs.add(busAttendance); arrs.add(busAttendance);
if(arrs.size() >= 1000){ if(arrs.size() >= 500){
List<BusAttendance> batchList = new ArrayList<>(arrs); List<BusAttendance> batchList = new ArrayList<>(arrs);
// 提交异步任务:处理照片 + 批量保存 // 提交异步任务:处理照片 + 批量保存
transferDataService.handlePhotoAndSaveBatch(batchList); transferDataService.handlePhotoAndSaveBatch(batchList);
@ -199,7 +199,7 @@ public class TransferDataController {
@GetMapping("/handleFile") @GetMapping("/handleFile")
private void handleFile() { private void handleFile() {
transferDataService.handleFile(); transferDataService.handleFile();
} }

View File

@ -13,7 +13,8 @@ import java.util.List;
public interface TransferDataMapper { public interface TransferDataMapper {
@DS("slave")
@DS("slave1")
@Select("select * from bus_attendance where project_id in (59,60)") @Select("select * from bus_attendance where project_id in (59,60)")
List<OldAttendance> getData(); List<OldAttendance> getData();
@ -22,7 +23,7 @@ public interface TransferDataMapper {
List<User> getUserList(); List<User> getUserList();
@Select("select id,sys_user_id,project_id,user_name from sub_construction_user_copy1 where go_openid = #{openId}") @Select("select id,sys_user_id,project_id,user_name from sub_construction_user where go_openid = #{openId}")
ConstructionUserCopy getConstructionUserCopy(@Param("openId") String openId); ConstructionUserCopy getConstructionUserCopy(@Param("openId") String openId);
@ -43,8 +44,8 @@ public interface TransferDataMapper {
int saveBatchCopy(@Param("list") List<BusAttendance> busAttendanceList); int saveBatchCopy(@Param("list") List<BusAttendance> busAttendanceList);
@Select("select id,go_id,sfz_front_pic,sfz_back_pic,yhk_pic,special_work_pic from sub_construction_user " +
"where go_id between 107 and 893 order by go_id") @Select("select id,go_id,sfz_front_pic,sfz_back_pic,yhk_pic,special_work_pic from sub_construction_user")
List<ConstructionUserNew> getConstructionUserList(); List<ConstructionUserNew> getConstructionUserList();

View File

@ -47,6 +47,10 @@ import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.concurrent.Semaphore; import java.util.concurrent.Semaphore;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static kotlin.reflect.jvm.internal.impl.builtins.StandardNames.FqNames.list; import static kotlin.reflect.jvm.internal.impl.builtins.StandardNames.FqNames.list;
@ -83,8 +87,8 @@ public class TransferDataService {
// 两个候选基础URL // 两个候选基础URL
private static final String[] BASE_URLS = { private static final String[] BASE_URLS = {
"http://xny.yj-3d.com:7464", "http://192.168.110.2:7464",
"http://xny.yj-3d.com:7363" "http://192.168.110.2:7363"
}; };
/** /**
@ -227,18 +231,18 @@ public class TransferDataService {
Long l = handleSinglePhoto1(subConstructionUser.getFacePic()); Long l = handleSinglePhoto1(subConstructionUser.getFacePic());
subConstructionUser.setFacePic(l == null ? "" : l.toString()); subConstructionUser.setFacePic(l == null ? "" : l.toString());
} }
if (subConstructionUser.getSfzFrontPic() != null) { // if (subConstructionUser.getSfzFrontPic() != null) {
Long l = handleSinglePhoto1(subConstructionUser.getSfzFrontPic()); // Long l = handleSinglePhoto1(subConstructionUser.getSfzFrontPic());
subConstructionUser.setSfzFrontPic(l == null ? "" : l.toString()); // subConstructionUser.setSfzFrontPic(l == null ? "" : l.toString());
} // }
if (subConstructionUser.getSfzBackPic() != null) { // if (subConstructionUser.getSfzBackPic() != null) {
Long l = handleSinglePhoto1(subConstructionUser.getSfzBackPic()); // Long l = handleSinglePhoto1(subConstructionUser.getSfzBackPic());
subConstructionUser.setSfzBackPic(l == null ? "" : l.toString()); // subConstructionUser.setSfzBackPic(l == null ? "" : l.toString());
} // }
if (subConstructionUser.getYhkPic() != null) { // if (subConstructionUser.getYhkPic() != null) {
Long l = handleSinglePhoto1(subConstructionUser.getYhkPic()); // Long l = handleSinglePhoto1(subConstructionUser.getYhkPic());
subConstructionUser.setYhkPic(l == null ? "" : l.toString()); // subConstructionUser.setYhkPic(l == null ? "" : l.toString());
} // }
objects.add(subConstructionUser); objects.add(subConstructionUser);
} }
//更新数据 //更新数据
@ -334,61 +338,62 @@ public class TransferDataService {
public void handleFile() { public void handleFile() {
List<ConstructionUserNew> constructionUserList = transferDataMapper.getConstructionUserList(); // List<ConstructionUserNew> constructionUserList = transferDataMapper.getConstructionUserList();
log.info("开始处理特殊图片,一共{}条数据", constructionUserList.size()); // log.info("开始处理特殊图片,一共{}条数据", constructionUserList.size());
List<Long> list1 = constructionUserList.stream().map(ConstructionUserNew::getGoId).toList(); // List<Long> list1 = constructionUserList.stream().map(ConstructionUserNew::getGoId).toList();
//zmkgprod // //zmkgprod
List<OldFile> oldFileList1 = transferDataMapper.getOldFileList1(list1); // List<OldFile> oldFileList1 = transferDataMapper.getOldFileList1(list1);
// 将 oldFileList1 转换为 Map<Long, Map<String, String>> 结构 // // 将 oldFileList1 转换为 Map<Long, Map<String, String>> 结构
Map<Long, Map<String, String>> resultMap1 = oldFileList1.stream() // Map<Long, Map<String, String>> resultMap1 = oldFileList1.stream()
.collect(Collectors.groupingBy( // .collect(Collectors.groupingBy(
OldFile::getUserId, // OldFile::getUserId,
Collectors.toMap( // Collectors.toMap(
OldFile::getUserImgType, // OldFile::getUserImgType,
OldFile::getPath, // OldFile::getPath,
(existing, replacement) -> replacement // 如果有重复的 key保留后面的值 // (existing, replacement) -> replacement // 如果有重复的 key保留后面的值
) // )
)); // ));
//zmkgc // //zmkgc
List<OldFile> oldFileList = transferDataMapper.getOldFileList(list1); // List<OldFile> oldFileList = transferDataMapper.getOldFileList(list1);
//
// 将 oldFileList1 转换为 Map<Long, Map<String, String>> 结构 // // 将 oldFileList1 转换为 Map<Long, Map<String, String>> 结构
Map<Long, Map<String, String>> resultMap = oldFileList.stream() // Map<Long, Map<String, String>> resultMap = oldFileList.stream()
.collect(Collectors.groupingBy( // .collect(Collectors.groupingBy(
OldFile::getUserId, // OldFile::getUserId,
Collectors.toMap( // Collectors.toMap(
OldFile::getUserImgType, // OldFile::getUserImgType,
OldFile::getPath, // OldFile::getPath,
(existing, replacement) -> replacement // 如果有重复的 key保留后面的值 // (existing, replacement) -> replacement // 如果有重复的 key保留后面的值
) // )
)); // ));
//本地文件 // //本地文件
//
//身份证(正面),0 // //身份证(正面),0
//身份证(反面),1 // //身份证(反面),1
//银行卡,2 // //银行卡,2
//特种作业证,3 // //特种作业证,3
//合同,4 // //合同,4
//体检报告,5 // //体检报告,5
//安全责任书,6 // //安全责任书,6
//岗位危险告知书,7 // //岗位危险告知书,7
//安全技术交底,8 // //安全技术交底,8
//三级安全教育,10 // //三级安全教育,10
//
for (ConstructionUserNew constructionUser : constructionUserList) { // for (ConstructionUserNew constructionUser : constructionUserList) {
Long goId = constructionUser.getGoId(); // log.info("处理特殊图片goId={}", constructionUser.getGoId());
Map<String, String> map = resultMap1.get(goId); // Long goId = constructionUser.getGoId();
if (map != null) { // Map<String, String> map = resultMap1.get(goId);
handle0to3(map, constructionUser); // if (map != null) {
handle4to10(map, goId); // handle0to3(map, constructionUser);
} // handle4to10(map, goId);
// }
Map<String, String> map1 = resultMap.get(goId); //
if (map1 != null) { // Map<String, String> map1 = resultMap.get(goId);
handle0to3(map1, constructionUser); // if (map1 != null) {
handle4to10(map1, goId); // handle0to3(map1, constructionUser);
} // handle4to10(map1, goId);
} // }
// }
} }
@ -426,6 +431,7 @@ public class TransferDataService {
SubConstructionUser constructionUser1 = BeanUtil.copyProperties(constructionUser, SubConstructionUser.class); SubConstructionUser constructionUser1 = BeanUtil.copyProperties(constructionUser, SubConstructionUser.class);
log.info("开始修改数据id{}", constructionUser1.getId()); log.info("开始修改数据id{}", constructionUser1.getId());
log.info("修改施工人员数据Id={}", constructionUser1.getId());
constructionUserService.updateById(constructionUser1); constructionUserService.updateById(constructionUser1);
} }
@ -450,6 +456,7 @@ public class TransferDataService {
} }
} }
// log.info("开始修改附件,数量:{}", list1.size()); // log.info("开始修改附件,数量:{}", list1.size());
log.info("修改附件数据,数量={}", list1.size());
constructionUserFileService.updateBatchById(list1); constructionUserFileService.updateBatchById(list1);
} }