Merge pull request 'feat/dev_251201' (#150) from feat/dev_251201 into develop
Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/150
This commit is contained in:
@@ -57,4 +57,8 @@ public class LabelWorkCoreService {
|
||||
public LabelWorkMngDetail findLabelWorkMngDetail(UUID uuid) {
|
||||
return labelWorkRepository.findLabelWorkMngDetail(uuid);
|
||||
}
|
||||
|
||||
public UUID findLastLabelWorkState() {
|
||||
return labelWorkRepository.findLastLabelWorkState();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityNotFoundException;
|
||||
import jakarta.persistence.PersistenceContext;
|
||||
import jakarta.transaction.Transactional;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.time.ZoneId;
|
||||
@@ -43,6 +44,7 @@ import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.hibernate.Session;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -106,27 +108,41 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
.execute();
|
||||
|
||||
// 라벨러 할당 테이블에 insert
|
||||
String sql =
|
||||
"""
|
||||
Session session = em.unwrap(Session.class);
|
||||
|
||||
session.doWork(
|
||||
connection -> {
|
||||
String sql =
|
||||
"""
|
||||
insert into tb_labeling_assignment
|
||||
(assignment_uid, inference_geom_uid, worker_uid,
|
||||
work_state, assign_group_id, anal_uid)
|
||||
values (?, ?, ?, ?, ?, ?)
|
||||
""";
|
||||
|
||||
for (AllocateInfoDto info : ids) {
|
||||
em.createNativeQuery(sql)
|
||||
.setParameter(1, UUID.randomUUID())
|
||||
.setParameter(2, info.getGeoUid())
|
||||
.setParameter(3, userId)
|
||||
.setParameter(4, LabelState.ASSIGNED.getId())
|
||||
.setParameter(5, info.getMapSheetNum())
|
||||
.setParameter(6, analEntity.getId())
|
||||
.executeUpdate();
|
||||
}
|
||||
try (PreparedStatement ps = connection.prepareStatement(sql)) {
|
||||
int batchSize = 0;
|
||||
|
||||
em.flush();
|
||||
em.clear();
|
||||
for (AllocateInfoDto info : ids) {
|
||||
ps.setObject(1, UUID.randomUUID());
|
||||
ps.setLong(2, info.getGeoUid());
|
||||
ps.setString(3, userId);
|
||||
ps.setString(4, LabelState.ASSIGNED.getId());
|
||||
ps.setString(5, String.valueOf(info.getMapSheetNum()));
|
||||
ps.setLong(6, analEntity.getId());
|
||||
|
||||
ps.addBatch();
|
||||
batchSize++;
|
||||
|
||||
if (batchSize % 1000 == 0) {
|
||||
ps.executeBatch();
|
||||
ps.clearBatch();
|
||||
}
|
||||
}
|
||||
|
||||
ps.executeBatch();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,4 +18,6 @@ public interface LabelWorkRepositoryCustom {
|
||||
LabelWorkMngDetail findLabelWorkMngDetail(UUID uuid);
|
||||
|
||||
Page<WorkerState> findlabelWorkStateList(LabelWorkDto.WorkerStateSearchReq searchReq);
|
||||
|
||||
UUID findLastLabelWorkState();
|
||||
}
|
||||
|
||||
@@ -212,6 +212,8 @@ public class LabelWorkRepositoryImpl extends QuerydslRepositorySupport
|
||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||
BooleanBuilder whereSubBuilder = new BooleanBuilder();
|
||||
|
||||
UUID uuid = UUID.fromString(searchReq.getUuid());
|
||||
|
||||
LocalDate threeDaysAgo = LocalDate.now().minusDays(3);
|
||||
String s3 = threeDaysAgo.format(DateTimeFormatter.ofPattern("YYYY-MM-DD"));
|
||||
|
||||
@@ -300,6 +302,12 @@ public class LabelWorkRepositoryImpl extends QuerydslRepositorySupport
|
||||
.sum()
|
||||
.as("day1AgoDoneCnt")))
|
||||
.from(labelingAssignmentEntity)
|
||||
.innerJoin(mapSheetAnalInferenceEntity)
|
||||
.on(
|
||||
mapSheetAnalInferenceEntity
|
||||
.uuid
|
||||
.eq(uuid)
|
||||
.and(labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id)))
|
||||
.innerJoin(memberEntity)
|
||||
.on(whereSubBuilder)
|
||||
.where(whereBuilder)
|
||||
@@ -312,6 +320,12 @@ public class LabelWorkRepositoryImpl extends QuerydslRepositorySupport
|
||||
queryFactory
|
||||
.select(labelingAssignmentEntity.workerUid.countDistinct())
|
||||
.from(labelingAssignmentEntity)
|
||||
.innerJoin(mapSheetAnalInferenceEntity)
|
||||
.on(
|
||||
mapSheetAnalInferenceEntity
|
||||
.uuid
|
||||
.eq(uuid)
|
||||
.and(labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id)))
|
||||
.innerJoin(memberEntity)
|
||||
.on(whereSubBuilder)
|
||||
.where(whereBuilder)
|
||||
@@ -321,6 +335,40 @@ public class LabelWorkRepositoryImpl extends QuerydslRepositorySupport
|
||||
return new PageImpl<>(foundContent, pageable, countQuery);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID findLastLabelWorkState() {
|
||||
|
||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||
|
||||
UUID uuid =
|
||||
queryFactory
|
||||
.select(mapSheetAnalInferenceEntity.uuid)
|
||||
.from(mapSheetAnalInferenceEntity)
|
||||
.innerJoin(labelingAssignmentEntity)
|
||||
.on(mapSheetAnalInferenceEntity.id.eq(labelingAssignmentEntity.analUid))
|
||||
.where(whereBuilder)
|
||||
.orderBy(
|
||||
mapSheetAnalInferenceEntity.compareYyyy.desc(),
|
||||
mapSheetAnalInferenceEntity.targetYyyy.desc(),
|
||||
mapSheetAnalInferenceEntity.stage.desc())
|
||||
.fetchFirst();
|
||||
|
||||
if (uuid == null) {
|
||||
uuid =
|
||||
queryFactory
|
||||
.select(mapSheetAnalInferenceEntity.uuid)
|
||||
.from(mapSheetAnalInferenceEntity)
|
||||
.where(whereBuilder)
|
||||
.orderBy(
|
||||
mapSheetAnalInferenceEntity.compareYyyy.desc(),
|
||||
mapSheetAnalInferenceEntity.targetYyyy.desc(),
|
||||
mapSheetAnalInferenceEntity.stage.desc())
|
||||
.fetchFirst();
|
||||
}
|
||||
|
||||
return uuid;
|
||||
}
|
||||
|
||||
/**
|
||||
* 작업배정 상세조회
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user