260728_01_ENH: SID String으로 교체 #8

Merged
gitadmin merged 1 commits from feature-sid-convert-varchar into develop 2026-07-28 11:36:00 +09:00
56 changed files with 338 additions and 285 deletions

View File

@@ -31,7 +31,7 @@ public class ListCallHistController {
@PutMapping("/{prjctIdx}/{sid}/call-start") @PutMapping("/{prjctIdx}/{sid}/call-start")
public ListCallHistDto callStart( public ListCallHistDto callStart(
@PathVariable Long prjctIdx, @PathVariable Long prjctIdx,
@PathVariable Integer sid, @PathVariable String sid,
@Valid @RequestBody ListCallStartRequestDto request, @Valid @RequestBody ListCallStartRequestDto request,
RequestUserContext ctx RequestUserContext ctx
) { ) {
@@ -51,7 +51,7 @@ public class ListCallHistController {
@PutMapping("/{prjctIdx}/{sid}/call-close") @PutMapping("/{prjctIdx}/{sid}/call-close")
public ListCallHistDto callClose( public ListCallHistDto callClose(
@PathVariable Long prjctIdx, @PathVariable Long prjctIdx,
@PathVariable Integer sid, @PathVariable String sid,
@Valid @RequestBody ListCallCloseRequestDto request, @Valid @RequestBody ListCallCloseRequestDto request,
RequestUserContext ctx RequestUserContext ctx
) { ) {

View File

@@ -70,7 +70,7 @@ public class ListController {
@GetMapping("/search-sid/{prjctIdx}/{sid}") @GetMapping("/search-sid/{prjctIdx}/{sid}")
public ListSearchWithFullResultDto searchListWithSid( public ListSearchWithFullResultDto searchListWithSid(
@PathVariable Long prjctIdx, @PathVariable Long prjctIdx,
@PathVariable Integer sid @PathVariable String sid
) { ) {
return listSearchService.searchListWithSid(prjctIdx, sid); return listSearchService.searchListWithSid(prjctIdx, sid);
} }
@@ -171,7 +171,7 @@ public class ListController {
@PostMapping(value = "/item-file/upload/{prjctIdx}/{sid}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @PostMapping(value = "/item-file/upload/{prjctIdx}/{sid}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public void uploadItemFile( public void uploadItemFile(
@PathVariable Long prjctIdx, @PathVariable Long prjctIdx,
@PathVariable Integer sid, @PathVariable String sid,
@RequestParam Map<String, MultipartFile> files, @RequestParam Map<String, MultipartFile> files,
RequestUserContext ctx RequestUserContext ctx
) { ) {
@@ -203,7 +203,7 @@ public class ListController {
@GetMapping("/item-file/download/{prjctIdx}/{sid}/{listHderId}") @GetMapping("/item-file/download/{prjctIdx}/{sid}/{listHderId}")
public ResponseEntity<byte[]> downloadOneItemFile( public ResponseEntity<byte[]> downloadOneItemFile(
@PathVariable Long prjctIdx, @PathVariable Long prjctIdx,
@PathVariable Integer sid, @PathVariable String sid,
@PathVariable Integer listHderId @PathVariable Integer listHderId
) { ) {
getProjectOrThrow(prjctIdx); getProjectOrThrow(prjctIdx);

View File

@@ -46,7 +46,7 @@ public class ListHistoryController {
@GetMapping("/event/{prjctIdx}/{sid}") @GetMapping("/event/{prjctIdx}/{sid}")
public List<ListEventHistoryDto> findListEventHistories( public List<ListEventHistoryDto> findListEventHistories(
@PathVariable Long prjctIdx, @PathVariable Long prjctIdx,
@PathVariable Integer sid @PathVariable String sid
) { ) {
return listHistoryQueryService.findEventHistories(prjctIdx, sid); return listHistoryQueryService.findEventHistories(prjctIdx, sid);
} }
@@ -55,7 +55,7 @@ public class ListHistoryController {
@GetMapping("/update/{prjctIdx}/{sid}") @GetMapping("/update/{prjctIdx}/{sid}")
public List<ListUpdateHistoryDto> findListUpdateHistories( public List<ListUpdateHistoryDto> findListUpdateHistories(
@PathVariable Long prjctIdx, @PathVariable Long prjctIdx,
@PathVariable Integer sid @PathVariable String sid
) { ) {
return listHistoryQueryService.findUpdateHistories(prjctIdx, sid); return listHistoryQueryService.findUpdateHistories(prjctIdx, sid);
} }

View File

@@ -49,7 +49,7 @@ public class ReserveController {
@GetMapping("/{prjctIdx}/sid/{sid}") @GetMapping("/{prjctIdx}/sid/{sid}")
public List<ListReserveDto> findBySid( public List<ListReserveDto> findBySid(
@PathVariable Long prjctIdx, @PathVariable Long prjctIdx,
@PathVariable Integer sid @PathVariable String sid
) { ) {
return reserveService.findBySid(prjctIdx, sid); return reserveService.findBySid(prjctIdx, sid);
} }

View File

@@ -17,7 +17,7 @@ public class ListCallHistDto {
@Schema(description = "prjctIdx") @Schema(description = "prjctIdx")
private Long prjctIdx; private Long prjctIdx;
@Schema(description = "sid") @Schema(description = "sid")
private Integer sid; private String sid;
@Schema(description = "listHderId") @Schema(description = "listHderId")
private Integer listHderId; private Integer listHderId;
@Schema(description = "destNum") @Schema(description = "destNum")

View File

@@ -24,7 +24,7 @@ public class ListEventHistFromSurveyDto {
@NotNull @NotNull
@Schema(description = "리스트 고유번호") @Schema(description = "리스트 고유번호")
private Integer sid; private String sid;
@NotNull @NotNull
@Valid @Valid

View File

@@ -21,7 +21,7 @@ public class ListEventHistInsertRequestDto {
@NotNull @NotNull
@Schema(description = "리스트 고유 번호") @Schema(description = "리스트 고유 번호")
private Integer sid; private String sid;
@NotNull @NotNull
@Schema(description = "결과 코드 타입") @Schema(description = "결과 코드 타입")

View File

@@ -20,7 +20,7 @@ public class ListEventHistoryDto {
@Schema(description = "prjctSurveyIdx") @Schema(description = "prjctSurveyIdx")
private Long prjctSurveyIdx; private Long prjctSurveyIdx;
@Schema(description = "sid") @Schema(description = "sid")
private Integer sid; private String sid;
@Schema(description = "resultCd") @Schema(description = "resultCd")
private Integer resultCd; private Integer resultCd;
@Schema(description = "metaData") @Schema(description = "metaData")

View File

@@ -58,7 +58,7 @@ public class ListFilterDto {
@Schema(description = "기타 항목 필터 조건") @Schema(description = "기타 항목 필터 조건")
private List<@Valid ListOtherItemFilterConditionDto> otherItemConditions; private List<@Valid ListOtherItemFilterConditionDto> otherItemConditions;
public static ListFilterDto onlyOneSid(Integer sid) { public static ListFilterDto onlyOneSid(String sid) {
return ListFilterDto.builder() return ListFilterDto.builder()
.sidSet(Set.of(String.valueOf(sid))) .sidSet(Set.of(String.valueOf(sid)))
.listUseSet(Set.of()) .listUseSet(Set.of())

View File

@@ -26,7 +26,7 @@ public class ListSearchBaseDto {
private Long prjctIdx; private Long prjctIdx;
@Schema(description = "SID") @Schema(description = "SID")
private Integer sid; private String sid;
@Schema(description = "사용 여부") @Schema(description = "사용 여부")
private ListIsUse use; private ListIsUse use;

View File

@@ -17,7 +17,7 @@ public class ListUpdateHistoryDto {
@Schema(description = "prjctIdx") @Schema(description = "prjctIdx")
private Long prjctIdx; private Long prjctIdx;
@Schema(description = "sid") @Schema(description = "sid")
private Integer sid; private String sid;
@Schema(description = "listHderId") @Schema(description = "listHderId")
private Integer listHderId; private Integer listHderId;
@Schema(description = "beforeVal") @Schema(description = "beforeVal")

View File

@@ -28,7 +28,7 @@ public class MessageSendSingleRequestDto {
@NotNull @NotNull
@Schema(description = "sid") @Schema(description = "sid")
private Integer sid; private String sid;
@NotEmpty @NotEmpty
@Schema(description = "destHeaderIds") @Schema(description = "destHeaderIds")

View File

@@ -17,7 +17,7 @@ public class ListReserveDto {
@Schema(description = "prjctIdx") @Schema(description = "prjctIdx")
private Long prjctIdx; private Long prjctIdx;
@Schema(description = "sid") @Schema(description = "sid")
private Integer sid; private String sid;
@Schema(description = "memo") @Schema(description = "memo")
private String memo; private String memo;
@Schema(description = "cnfirm") @Schema(description = "cnfirm")

View File

@@ -21,7 +21,7 @@ public class ListReserveRequestDto {
@NotNull @NotNull
@Schema(description = "sid") @Schema(description = "sid")
private Integer sid; private String sid;
@NotBlank @NotBlank
@Schema(description = "userId") @Schema(description = "userId")

View File

@@ -29,7 +29,7 @@ public class TListAssignCmpnEntity {
@NotNull @NotNull
@Column(name = "sid", nullable = false) @Column(name = "sid", nullable = false)
private Integer sid; private String sid;
@Size(max = 32) @Size(max = 32)
@Column(name = "cmpn_id", length = 32) @Column(name = "cmpn_id", length = 32)

View File

@@ -29,7 +29,7 @@ public class TListAssignUserEntity {
@NotNull @NotNull
@Column(name = "sid", nullable = false) @Column(name = "sid", nullable = false)
private Integer sid; private String sid;
@Size(max = 32) @Size(max = 32)
@Column(name = "user_id", length = 32) @Column(name = "user_id", length = 32)

View File

@@ -44,7 +44,7 @@ public class TListCallHistEntity {
@NotNull @NotNull
@Column(name = "sid", nullable = false) @Column(name = "sid", nullable = false)
private Integer sid; private String sid;
@NotNull @NotNull
@Column(name = "list_hder_id", nullable = false) @Column(name = "list_hder_id", nullable = false)
@@ -126,7 +126,7 @@ public class TListCallHistEntity {
public static TListCallHistEntity from( public static TListCallHistEntity from(
Long prjctIdx, Long prjctIdx,
Integer sid, String sid,
ListCallCloseRequestDto request, ListCallCloseRequestDto request,
String regUser, String regUser,
LocalDateTime regDt LocalDateTime regDt

View File

@@ -8,6 +8,7 @@ import jakarta.persistence.Entity;
import jakarta.persistence.Table; import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;
import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@@ -53,11 +54,17 @@ public class TListEntity {
@Column(name = "mod_dt", insertable = false) @Column(name = "mod_dt", insertable = false)
private LocalDateTime modDt; private LocalDateTime modDt;
@Column(name = "sid_sort_type", insertable = false, updatable = false)
private Integer sidSortType;
@Column(name = "sid_sort_number", precision = 32, scale = 0, insertable = false, updatable = false)
private BigDecimal sidSortNumber;
public Long getPrjctIdx() { public Long getPrjctIdx() {
return id.getPrjctIdx(); return id.getPrjctIdx();
} }
public Integer getSid() { public String getSid() {
return id.getSid(); return id.getSid();
} }
} }

View File

@@ -48,7 +48,7 @@ public class TListEventHistEntity {
@NotNull @NotNull
@Column(name = "sid", nullable = false) @Column(name = "sid", nullable = false)
private Integer sid; private String sid;
@NotNull @NotNull
@Column(name = "result_cd", nullable = false) @Column(name = "result_cd", nullable = false)

View File

@@ -29,7 +29,7 @@ public class TListEventLatestEntity {
@NotNull @NotNull
@Column(name = "sid", nullable = false) @Column(name = "sid", nullable = false)
private Integer sid; private String sid;
@NotNull @NotNull
@Column(name = "event_ty", nullable = false) @Column(name = "event_ty", nullable = false)

View File

@@ -49,11 +49,11 @@ public class TListItemEntity {
return id.getPrjctIdx(); return id.getPrjctIdx();
} }
public Integer getSid() { public String getSid() {
return id.getSid(); return id.getSid();
} }
public Integer getListHderId() { public Integer getListHderId() {
return id.getListHderId(); return id.getListHderId();
} }
} }

View File

@@ -54,7 +54,7 @@ public class TListItemFileEntity {
return id.getPrjctIdx(); return id.getPrjctIdx();
} }
public Integer getSid() { public String getSid() {
return id.getSid(); return id.getSid();
} }
@@ -64,7 +64,7 @@ public class TListItemFileEntity {
public static TListItemFileEntity create( public static TListItemFileEntity create(
Long prjctIdx, Long prjctIdx,
Integer sid, String sid,
Integer listHderId, Integer listHderId,
String fileNm, String fileNm,
Integer fileSize, Integer fileSize,

View File

@@ -29,7 +29,7 @@ public class TListResveEntity {
@NotNull @NotNull
@Column(name = "sid", nullable = false) @Column(name = "sid", nullable = false)
private Integer sid; private String sid;
@Size(max = 2048) @Size(max = 2048)
@NotNull @NotNull
@@ -60,4 +60,4 @@ public class TListResveEntity {
@Column(name = "reg_dt", nullable = false) @Column(name = "reg_dt", nullable = false)
private LocalDateTime regDt; private LocalDateTime regDt;
} }

View File

@@ -30,7 +30,7 @@ public class TListUpdateHistEntity {
@NotNull @NotNull
@Column(name = "sid", nullable = false) @Column(name = "sid", nullable = false)
private Integer sid; private String sid;
@NotNull @NotNull
@Column(name = "list_hder_id", nullable = false) @Column(name = "list_hder_id", nullable = false)
@@ -56,4 +56,4 @@ public class TListUpdateHistEntity {
@Column(name = "reg_dt", nullable = false) @Column(name = "reg_dt", nullable = false)
private LocalDateTime regDt; private LocalDateTime regDt;
} }

View File

@@ -22,6 +22,6 @@ public class TListEntityId implements Serializable {
@NotNull @NotNull
@Column(name = "sid", nullable = false) @Column(name = "sid", nullable = false)
private Integer sid; private String sid;
} }

View File

@@ -22,7 +22,7 @@ public class TListEventLatestEntityId implements Serializable {
@NotNull @NotNull
@Column(name = "sid", nullable = false) @Column(name = "sid", nullable = false)
private Integer sid; private String sid;
@NotNull @NotNull
@Column(name = "event_ty", nullable = false) @Column(name = "event_ty", nullable = false)

View File

@@ -22,10 +22,10 @@ public class TListItemEntityId implements Serializable {
@NotNull @NotNull
@Column(name = "sid", nullable = false) @Column(name = "sid", nullable = false)
private Integer sid; private String sid;
@NotNull @NotNull
@Column(name = "list_hder_id", nullable = false) @Column(name = "list_hder_id", nullable = false)
private Integer listHderId; private Integer listHderId;
} }

View File

@@ -22,13 +22,13 @@ public class TListItemFileEntityId implements Serializable {
@NotNull @NotNull
@Column(name = "sid", nullable = false) @Column(name = "sid", nullable = false)
private Integer sid; private String sid;
@NotNull @NotNull
@Column(name = "list_hder_id", nullable = false) @Column(name = "list_hder_id", nullable = false)
private Integer listHderId; private Integer listHderId;
public static TListItemFileEntityId create(Long prjctIdx, Integer sid, Integer listHderId) { public static TListItemFileEntityId create(Long prjctIdx, String sid, Integer listHderId) {
TListItemFileEntityId id = new TListItemFileEntityId(); TListItemFileEntityId id = new TListItemFileEntityId();
id.setPrjctIdx(prjctIdx); id.setPrjctIdx(prjctIdx);
id.setSid(sid); id.setSid(sid);

View File

@@ -20,9 +20,9 @@ public class ListAssignJdbcSupport {
private final JdbcTemplate jdbcTemplate; private final JdbcTemplate jdbcTemplate;
public int deleteCmpnAssign(Long prjctIdx, Collection<Integer> sids, int chunkSize) { public int deleteCmpnAssign(Long prjctIdx, Collection<String> sids, int chunkSize) {
int total = 0; int total = 0;
for (List<Integer> sub : chunkSids(sids, chunkSize)) { for (List<String> sub : chunkSids(sids, chunkSize)) {
total += updateWithSidIn( total += updateWithSidIn(
"delete from t_list_assign_cmpn where prjct_idx = ? and sid in (", "delete from t_list_assign_cmpn where prjct_idx = ? and sid in (",
prjctIdx, prjctIdx,
@@ -32,9 +32,9 @@ public class ListAssignJdbcSupport {
return total; return total;
} }
public int deleteUserAssign(Long prjctIdx, Short assignRole, Collection<Integer> sids, int chunkSize) { public int deleteUserAssign(Long prjctIdx, Short assignRole, Collection<String> sids, int chunkSize) {
int total = 0; int total = 0;
for (List<Integer> sub : chunkSids(sids, chunkSize)) { for (List<String> sub : chunkSids(sids, chunkSize)) {
String sql = "delete from t_list_assign_user where prjct_idx = ? and assign_role = ? and sid in (" String sql = "delete from t_list_assign_user where prjct_idx = ? and assign_role = ? and sid in ("
+ createInSql(sub) + ")"; + createInSql(sub) + ")";
List<Object> args = new ArrayList<>(); List<Object> args = new ArrayList<>();
@@ -48,7 +48,7 @@ public class ListAssignJdbcSupport {
public void batchInsertCmpnAssign( public void batchInsertCmpnAssign(
Long prjctIdx, Long prjctIdx,
Collection<Integer> sids, Collection<String> sids,
String cmpnId, String cmpnId,
String regUser, String regUser,
LocalDateTime regDt, LocalDateTime regDt,
@@ -64,12 +64,12 @@ public class ListAssignJdbcSupport {
) values (?, ?, ?, ?, ?) ) values (?, ?, ?, ?, ?)
"""; """;
for (List<Integer> sub : chunkSids(sids, chunkSize)) { for (List<String> sub : chunkSids(sids, chunkSize)) {
jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() { jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
@Override @Override
public void setValues(@NonNull PreparedStatement ps, int index) throws SQLException { public void setValues(@NonNull PreparedStatement ps, int index) throws SQLException {
ps.setLong(1, prjctIdx); ps.setLong(1, prjctIdx);
ps.setInt(2, sub.get(index)); ps.setString(2, sub.get(index));
ps.setString(3, cmpnId); ps.setString(3, cmpnId);
ps.setString(4, regUser); ps.setString(4, regUser);
ps.setTimestamp(5, Timestamp.valueOf(regDt)); ps.setTimestamp(5, Timestamp.valueOf(regDt));
@@ -85,7 +85,7 @@ public class ListAssignJdbcSupport {
public void batchInsertUserAssign( public void batchInsertUserAssign(
Long prjctIdx, Long prjctIdx,
Collection<Integer> sids, Collection<String> sids,
String userId, String userId,
Short assignRole, Short assignRole,
String regUser, String regUser,
@@ -103,12 +103,12 @@ public class ListAssignJdbcSupport {
) values (?, ?, ?, ?, ?, ?) ) values (?, ?, ?, ?, ?, ?)
"""; """;
for (List<Integer> sub : chunkSids(sids, chunkSize)) { for (List<String> sub : chunkSids(sids, chunkSize)) {
jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() { jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
@Override @Override
public void setValues(@NonNull PreparedStatement ps, int index) throws SQLException { public void setValues(@NonNull PreparedStatement ps, int index) throws SQLException {
ps.setLong(1, prjctIdx); ps.setLong(1, prjctIdx);
ps.setInt(2, sub.get(index)); ps.setString(2, sub.get(index));
ps.setString(3, userId); ps.setString(3, userId);
ps.setShort(4, assignRole); ps.setShort(4, assignRole);
ps.setString(5, regUser); ps.setString(5, regUser);
@@ -123,9 +123,9 @@ public class ListAssignJdbcSupport {
} }
} }
public int transferReservationUser(Long prjctIdx, Collection<Integer> sids, String resveUser, int chunkSize) { public int transferReservationUser(Long prjctIdx, Collection<String> sids, String resveUser, int chunkSize) {
int total = 0; int total = 0;
for (List<Integer> sub : chunkSids(sids, chunkSize)) { for (List<String> sub : chunkSids(sids, chunkSize)) {
String sql = "update t_list_resve set resve_user = ? where prjct_idx = ? and sid in (" String sql = "update t_list_resve set resve_user = ? where prjct_idx = ? and sid in ("
+ createInSql(sub) + ")"; + createInSql(sub) + ")";
List<Object> args = new ArrayList<>(); List<Object> args = new ArrayList<>();
@@ -137,7 +137,7 @@ public class ListAssignJdbcSupport {
return total; return total;
} }
private int updateWithSidIn(String sqlPrefix, Long prjctIdx, List<Integer> sids) { private int updateWithSidIn(String sqlPrefix, Long prjctIdx, List<String> sids) {
String sql = sqlPrefix + createInSql(sids) + ")"; String sql = sqlPrefix + createInSql(sids) + ")";
List<Object> args = new ArrayList<>(); List<Object> args = new ArrayList<>();
args.add(prjctIdx); args.add(prjctIdx);
@@ -145,7 +145,7 @@ public class ListAssignJdbcSupport {
return jdbcTemplate.update(sql, args.toArray()); return jdbcTemplate.update(sql, args.toArray());
} }
private List<List<Integer>> chunkSids(Collection<Integer> sids, int chunkSize) { private List<List<String>> chunkSids(Collection<String> sids, int chunkSize) {
if (sids == null || sids.isEmpty()) { if (sids == null || sids.isEmpty()) {
return List.of(); return List.of();
} }
@@ -153,15 +153,15 @@ public class ListAssignJdbcSupport {
throw new IllegalArgumentException("chunkSize must be greater than 0"); throw new IllegalArgumentException("chunkSize must be greater than 0");
} }
List<Integer> sidList = sids instanceof List<Integer> list ? list : new ArrayList<>(sids); List<String> sidList = sids instanceof List<String> list ? list : new ArrayList<>(sids);
List<List<Integer>> chunks = new ArrayList<>(); List<List<String>> chunks = new ArrayList<>();
for (int i = 0; i < sidList.size(); i += chunkSize) { for (int i = 0; i < sidList.size(); i += chunkSize) {
chunks.add(sidList.subList(i, Math.min(sidList.size(), i + chunkSize))); chunks.add(sidList.subList(i, Math.min(sidList.size(), i + chunkSize)));
} }
return chunks; return chunks;
} }
private String createInSql(List<Integer> sids) { private String createInSql(List<String> sids) {
StringJoiner joiner = new StringJoiner(","); StringJoiner joiner = new StringJoiner(",");
for (int i = 0; i < sids.size(); i++) { for (int i = 0; i < sids.size(); i++) {
joiner.add("?"); joiner.add("?");

View File

@@ -16,7 +16,7 @@ public class ListCallHistJdbcSupport {
public void upsertCallHistory( public void upsertCallHistory(
Long prjctIdx, Long prjctIdx,
Integer sid, String sid,
ListCallStartRequestDto request, ListCallStartRequestDto request,
CallStatus callStatus, CallStatus callStatus,
String regUser, String regUser,
@@ -95,4 +95,3 @@ public class ListCallHistJdbcSupport {
return value == null ? "" : value; return value == null ? "" : value;
} }
} }

View File

@@ -17,7 +17,7 @@ public class ListResetJdbcSupport {
private final EntityManager entityManager; private final EntityManager entityManager;
public DeleteCounts deleteHistories(Long prjctIdx, Collection<Integer> sids, int chunkSize) { public DeleteCounts deleteHistories(Long prjctIdx, Collection<String> sids, int chunkSize) {
if (sids == null || sids.isEmpty()) { if (sids == null || sids.isEmpty()) {
return DeleteCounts.empty(); return DeleteCounts.empty();
} }
@@ -41,7 +41,7 @@ public class ListResetJdbcSupport {
public DeleteCounts deleteListData( public DeleteCounts deleteListData(
Long prjctIdx, Long prjctIdx,
Collection<Integer> sids, Collection<String> sids,
boolean includeFile, boolean includeFile,
boolean includeResve, boolean includeResve,
int chunkSize int chunkSize
@@ -76,19 +76,19 @@ public class ListResetJdbcSupport {
} }
} }
private void prepareTempSids(Collection<Integer> sids, int chunkSize) { private void prepareTempSids(Collection<String> sids, int chunkSize) {
dropTempSids(); dropTempSids();
entityManager.createNativeQuery( entityManager.createNativeQuery(
"create temporary table " + TEMP_SID_TABLE + " (sid int not null primary key) engine=memory" "create temporary table " + TEMP_SID_TABLE + " (sid varchar(32) not null primary key) engine=memory"
).executeUpdate(); ).executeUpdate();
List<Integer> sidList = new ArrayList<>(sids); List<String> sidList = new ArrayList<>(sids);
for (List<Integer> sub : chunkSids(sidList, chunkSize)) { for (List<String> sub : chunkSids(sidList, chunkSize)) {
insertTempSids(sub); insertTempSids(sub);
} }
} }
private void insertTempSids(List<Integer> sids) { private void insertTempSids(List<String> sids) {
if (sids.isEmpty()) { if (sids.isEmpty()) {
return; return;
} }
@@ -116,7 +116,7 @@ public class ListResetJdbcSupport {
entityManager.createNativeQuery("drop temporary table if exists " + TEMP_SID_TABLE).executeUpdate(); entityManager.createNativeQuery("drop temporary table if exists " + TEMP_SID_TABLE).executeUpdate();
} }
private List<List<Integer>> chunkSids(Collection<Integer> sids, int chunkSize) { private List<List<String>> chunkSids(Collection<String> sids, int chunkSize) {
if (sids == null || sids.isEmpty()) { if (sids == null || sids.isEmpty()) {
return List.of(); return List.of();
} }
@@ -124,15 +124,15 @@ public class ListResetJdbcSupport {
throw new IllegalArgumentException("chunkSize must be greater than 0"); throw new IllegalArgumentException("chunkSize must be greater than 0");
} }
List<Integer> sidList = new ArrayList<>(sids); List<String> sidList = new ArrayList<>(sids);
List<List<Integer>> chunks = new ArrayList<>(); List<List<String>> chunks = new ArrayList<>();
for (int i = 0; i < sidList.size(); i += chunkSize) { for (int i = 0; i < sidList.size(); i += chunkSize) {
chunks.add(sidList.subList(i, Math.min(sidList.size(), i + chunkSize))); chunks.add(sidList.subList(i, Math.min(sidList.size(), i + chunkSize)));
} }
return chunks; return chunks;
} }
private String createValuesSql(List<Integer> sids) { private String createValuesSql(List<String> sids) {
StringJoiner joiner = new StringJoiner(","); StringJoiner joiner = new StringJoiner(",");
for (int i = 0; i < sids.size(); i++) { for (int i = 0; i < sids.size(); i++) {
joiner.add("(:sid" + i + ")"); joiner.add("(:sid" + i + ")");

View File

@@ -42,7 +42,7 @@ public class ListUpdateJdbcSupport {
public void setValues(@NonNull PreparedStatement ps, int index) throws SQLException { public void setValues(@NonNull PreparedStatement ps, int index) throws SQLException {
UpdateHistRow row = sub.get(index); UpdateHistRow row = sub.get(index);
ps.setLong(1, row.prjctIdx()); ps.setLong(1, row.prjctIdx());
ps.setInt(2, row.sid()); ps.setString(2, row.sid());
ps.setInt(3, row.listHderId()); ps.setInt(3, row.listHderId());
ps.setString(4, row.beforeVal()); ps.setString(4, row.beforeVal());
ps.setString(5, row.afterVal()); ps.setString(5, row.afterVal());
@@ -79,7 +79,7 @@ public class ListUpdateJdbcSupport {
ps.setString(3, row.modUser()); ps.setString(3, row.modUser());
ps.setTimestamp(4, Timestamp.valueOf(row.modDt())); ps.setTimestamp(4, Timestamp.valueOf(row.modDt()));
ps.setLong(5, row.prjctIdx()); ps.setLong(5, row.prjctIdx());
ps.setInt(6, row.sid()); ps.setString(6, row.sid());
}); });
} }
@@ -103,7 +103,7 @@ public class ListUpdateJdbcSupport {
ps.setString(2, row.modUser()); ps.setString(2, row.modUser());
ps.setTimestamp(3, Timestamp.valueOf(row.modDt())); ps.setTimestamp(3, Timestamp.valueOf(row.modDt()));
ps.setLong(4, row.prjctIdx()); ps.setLong(4, row.prjctIdx());
ps.setInt(5, row.sid()); ps.setString(5, row.sid());
ps.setInt(6, row.listHderId()); ps.setInt(6, row.listHderId());
}); });
} }
@@ -126,7 +126,7 @@ public class ListUpdateJdbcSupport {
batchUpdate(rows, batchSize, sql, (ps, row) -> { batchUpdate(rows, batchSize, sql, (ps, row) -> {
ps.setLong(1, row.prjctIdx()); ps.setLong(1, row.prjctIdx());
ps.setInt(2, row.sid()); ps.setString(2, row.sid());
ps.setInt(3, row.listHderId()); ps.setInt(3, row.listHderId());
ps.setString(4, row.listItemVal()); ps.setString(4, row.listItemVal());
ps.setString(5, row.regUser()); ps.setString(5, row.regUser());
@@ -148,7 +148,7 @@ public class ListUpdateJdbcSupport {
batchUpdate(rows, batchSize, sql, (ps, row) -> { batchUpdate(rows, batchSize, sql, (ps, row) -> {
ps.setLong(1, row.prjctIdx()); ps.setLong(1, row.prjctIdx());
ps.setInt(2, row.sid()); ps.setString(2, row.sid());
ps.setInt(3, row.listHderId()); ps.setInt(3, row.listHderId());
}); });
} }
@@ -174,7 +174,7 @@ public class ListUpdateJdbcSupport {
batchUpdate(rows, batchSize, sql, (ps, row) -> { batchUpdate(rows, batchSize, sql, (ps, row) -> {
ps.setShort(1, row.eventTy()); ps.setShort(1, row.eventTy());
ps.setLong(2, row.prjctIdx()); ps.setLong(2, row.prjctIdx());
ps.setInt(3, row.sid()); ps.setString(3, row.sid());
ps.setInt(4, row.resultCd()); ps.setInt(4, row.resultCd());
if (row.metaData() == null) { if (row.metaData() == null) {
ps.setNull(5, Types.VARCHAR); ps.setNull(5, Types.VARCHAR);
@@ -211,7 +211,7 @@ public class ListUpdateJdbcSupport {
public record UpdateHistRow( public record UpdateHistRow(
Long prjctIdx, Long prjctIdx,
Integer sid, String sid,
Integer listHderId, Integer listHderId,
String beforeVal, String beforeVal,
String afterVal, String afterVal,
@@ -221,7 +221,7 @@ public class ListUpdateJdbcSupport {
public record ListUpdateRow( public record ListUpdateRow(
Long prjctIdx, Long prjctIdx,
Integer sid, String sid,
Short isUse, Short isUse,
String memo, String memo,
String modUser, String modUser,
@@ -230,7 +230,7 @@ public class ListUpdateJdbcSupport {
public record ListItemUpdateRow( public record ListItemUpdateRow(
Long prjctIdx, Long prjctIdx,
Integer sid, String sid,
Integer listHderId, Integer listHderId,
String listItemVal, String listItemVal,
String modUser, String modUser,
@@ -239,7 +239,7 @@ public class ListUpdateJdbcSupport {
public record ListItemInsertRow( public record ListItemInsertRow(
Long prjctIdx, Long prjctIdx,
Integer sid, String sid,
Integer listHderId, Integer listHderId,
String listItemVal, String listItemVal,
String regUser, String regUser,
@@ -248,14 +248,14 @@ public class ListUpdateJdbcSupport {
public record ListItemDeleteRow( public record ListItemDeleteRow(
Long prjctIdx, Long prjctIdx,
Integer sid, String sid,
Integer listHderId Integer listHderId
) {} ) {}
public record ListEventHistInsertRow( public record ListEventHistInsertRow(
Short eventTy, Short eventTy,
Long prjctIdx, Long prjctIdx,
Integer sid, String sid,
Integer resultCd, Integer resultCd,
String metaData, String metaData,
String memo, String memo,

View File

@@ -54,7 +54,7 @@ public class ListUploadJdbcSupport {
ps.setString(1, r.listUploadLogId()); ps.setString(1, r.listUploadLogId());
ps.setLong(2, r.prjctIdx()); ps.setLong(2, r.prjctIdx());
ps.setInt(3, r.rowNo()); ps.setInt(3, r.rowNo());
ps.setInt(4, r.sid()); ps.setString(4, r.sid());
ps.setInt(5, r.listHderId()); ps.setInt(5, r.listHderId());
ps.setShort(6, r.specificType()); ps.setShort(6, r.specificType());
setNullableString(ps, 7, r.rawVal()); setNullableString(ps, 7, r.rawVal());
@@ -159,7 +159,7 @@ public class ListUploadJdbcSupport {
public void setValues(@NonNull PreparedStatement ps, int index) throws SQLException { public void setValues(@NonNull PreparedStatement ps, int index) throws SQLException {
ListRowInsert r = sub.get(index); ListRowInsert r = sub.get(index);
ps.setLong(1, r.prjctIdx()); ps.setLong(1, r.prjctIdx());
ps.setInt(2, r.sid()); ps.setString(2, r.sid());
ps.setString(3, r.listUploadLogId()); ps.setString(3, r.listUploadLogId());
ps.setShort(4, r.isUse()); ps.setShort(4, r.isUse());
setNullableString(ps, 5, r.memo()); setNullableString(ps, 5, r.memo());
@@ -198,7 +198,7 @@ public class ListUploadJdbcSupport {
public void setValues(@NonNull PreparedStatement ps, int index) throws SQLException { public void setValues(@NonNull PreparedStatement ps, int index) throws SQLException {
ListItemRowInsert r = sub.get(index); ListItemRowInsert r = sub.get(index);
ps.setLong(1, r.prjctIdx()); ps.setLong(1, r.prjctIdx());
ps.setInt(2, r.sid()); ps.setString(2, r.sid());
ps.setInt(3, r.listHderId()); ps.setInt(3, r.listHderId());
setNullableString(ps, 4, r.listItemVal()); setNullableString(ps, 4, r.listItemVal());
ps.setString(5, r.regUser()); ps.setString(5, r.regUser());
@@ -236,7 +236,7 @@ public class ListUploadJdbcSupport {
public void setValues(@NonNull PreparedStatement ps, int index) throws SQLException { public void setValues(@NonNull PreparedStatement ps, int index) throws SQLException {
ListAssignRowInsert r = sub.get(index); ListAssignRowInsert r = sub.get(index);
ps.setLong(1, r.prjctIdx()); ps.setLong(1, r.prjctIdx());
ps.setInt(2, r.sid()); ps.setString(2, r.sid());
ps.setString(3, r.userId()); ps.setString(3, r.userId());
ps.setShort(4, r.assignRole()); ps.setShort(4, r.assignRole());
ps.setString(5, r.regUser()); ps.setString(5, r.regUser());
@@ -273,7 +273,7 @@ public class ListUploadJdbcSupport {
public void setValues(@NonNull PreparedStatement ps, int index) throws SQLException { public void setValues(@NonNull PreparedStatement ps, int index) throws SQLException {
ListAssignCmpnRowInsert r = sub.get(index); ListAssignCmpnRowInsert r = sub.get(index);
ps.setLong(1, r.prjctIdx()); ps.setLong(1, r.prjctIdx());
ps.setInt(2, r.sid()); ps.setString(2, r.sid());
ps.setString(3, r.cmpnId()); ps.setString(3, r.cmpnId());
ps.setString(4, r.regUser()); ps.setString(4, r.regUser());
ps.setTimestamp(5, Timestamp.valueOf(r.regDt())); ps.setTimestamp(5, Timestamp.valueOf(r.regDt()));
@@ -299,7 +299,7 @@ public class ListUploadJdbcSupport {
String listUploadLogId, String listUploadLogId,
Long prjctIdx, Long prjctIdx,
int rowNo, int rowNo,
int sid, String sid,
int listHderId, int listHderId,
short specificType, short specificType,
String rawVal, String rawVal,
@@ -314,7 +314,7 @@ public class ListUploadJdbcSupport {
public record ListRowInsert( public record ListRowInsert(
Long prjctIdx, Long prjctIdx,
int sid, String sid,
String listUploadLogId, String listUploadLogId,
short isUse, short isUse,
String memo, String memo,
@@ -324,7 +324,7 @@ public class ListUploadJdbcSupport {
public record ListItemRowInsert( public record ListItemRowInsert(
Long prjctIdx, Long prjctIdx,
int sid, String sid,
int listHderId, int listHderId,
String listItemVal, String listItemVal,
String regUser, String regUser,
@@ -333,7 +333,7 @@ public class ListUploadJdbcSupport {
public record ListAssignRowInsert( public record ListAssignRowInsert(
Long prjctIdx, Long prjctIdx,
int sid, String sid,
String userId, String userId,
short assignRole, short assignRole,
String regUser, String regUser,
@@ -342,7 +342,7 @@ public class ListUploadJdbcSupport {
public record ListAssignCmpnRowInsert( public record ListAssignCmpnRowInsert(
Long prjctIdx, Long prjctIdx,
int sid, String sid,
String cmpnId, String cmpnId,
String regUser, String regUser,
LocalDateTime regDt LocalDateTime regDt

View File

@@ -11,7 +11,7 @@ public interface ListAssignCmpnRepository extends JpaRepository<TListAssignCmpnE
long deleteByCmpnId(String cmpnId); long deleteByCmpnId(String cmpnId);
boolean existsByPrjctIdxAndSidAndCmpnId(Long prjctIdx, Integer sid, String cmpnId); boolean existsByPrjctIdxAndSidAndCmpnId(Long prjctIdx, String sid, String cmpnId);
@Modifying(clearAutomatically = true, flushAutomatically = true) @Modifying(clearAutomatically = true, flushAutomatically = true)
@Query(""" @Query("""
@@ -26,7 +26,7 @@ public interface ListAssignCmpnRepository extends JpaRepository<TListAssignCmpnE
where a.prjctIdx = :prjctIdx where a.prjctIdx = :prjctIdx
and a.sid in :sids and a.sid in :sids
""") """)
int deleteWithPrjctIdxAndSids(Long prjctIdx, Collection<Integer> sids); int deleteWithPrjctIdxAndSids(Long prjctIdx, Collection<String> sids);
@Modifying(clearAutomatically = true, flushAutomatically = true) @Modifying(clearAutomatically = true, flushAutomatically = true)
@Query(""" @Query("""
@@ -43,5 +43,5 @@ public interface ListAssignCmpnRepository extends JpaRepository<TListAssignCmpnE
and a.sid in :sids and a.sid in :sids
order by a.sid asc, a.listAssignIdx asc order by a.sid asc, a.listAssignIdx asc
""") """)
List<TListAssignCmpnEntity> findByPrjctIdxAndSidIn(Long prjctIdx, Collection<Integer> sids); List<TListAssignCmpnEntity> findByPrjctIdxAndSidIn(Long prjctIdx, Collection<String> sids);
} }

View File

@@ -11,7 +11,7 @@ public interface ListAssignUserRepository extends JpaRepository<TListAssignUserE
long deleteByUserId(String userId); long deleteByUserId(String userId);
boolean existsByPrjctIdxAndSidAndUserId(Long prjctIdx, Integer sid, String userId); boolean existsByPrjctIdxAndSidAndUserId(Long prjctIdx, String sid, String userId);
@Modifying(clearAutomatically = true, flushAutomatically = true) @Modifying(clearAutomatically = true, flushAutomatically = true)
@Query(""" @Query("""
@@ -26,7 +26,7 @@ public interface ListAssignUserRepository extends JpaRepository<TListAssignUserE
where a.prjctIdx = :prjctIdx where a.prjctIdx = :prjctIdx
and a.sid in :sids and a.sid in :sids
""") """)
int deleteWithPrjctIdxAndSids(Long prjctIdx, Collection<Integer> sids); int deleteWithPrjctIdxAndSids(Long prjctIdx, Collection<String> sids);
@Modifying(clearAutomatically = true, flushAutomatically = true) @Modifying(clearAutomatically = true, flushAutomatically = true)
@Query(""" @Query("""
@@ -38,7 +38,7 @@ public interface ListAssignUserRepository extends JpaRepository<TListAssignUserE
int deleteByPrjctIdxAndAssignRoleAndSidIn( int deleteByPrjctIdxAndAssignRoleAndSidIn(
Long prjctIdx, Long prjctIdx,
Short assignRole, Short assignRole,
Collection<Integer> sids Collection<String> sids
); );
@Query(""" @Query("""
@@ -48,7 +48,7 @@ public interface ListAssignUserRepository extends JpaRepository<TListAssignUserE
and a.sid in :sids and a.sid in :sids
order by a.sid asc, a.listAssignIdx asc order by a.sid asc, a.listAssignIdx asc
""") """)
List<TListAssignUserEntity> findByPrjctIdxAndSidIn(Long prjctIdx, Collection<Integer> sids); List<TListAssignUserEntity> findByPrjctIdxAndSidIn(Long prjctIdx, Collection<String> sids);
@Modifying(clearAutomatically = true, flushAutomatically = true) @Modifying(clearAutomatically = true, flushAutomatically = true)
@Query(""" @Query("""

View File

@@ -11,7 +11,7 @@ public interface ListEventHistRepository extends JpaRepository<TListEventHistEnt
List<TListEventHistEntity> findByPrjctIdxAndSidOrderByRegDtDescListEventHistIdxDesc( List<TListEventHistEntity> findByPrjctIdxAndSidOrderByRegDtDescListEventHistIdxDesc(
Long prjctIdx, Long prjctIdx,
Integer sid String sid
); );
@Query(""" @Query("""
@@ -28,7 +28,7 @@ public interface ListEventHistRepository extends JpaRepository<TListEventHistEnt
""") """)
List<TListEventHistEntity> findLatestListByEventTyFromLatest( List<TListEventHistEntity> findLatestListByEventTyFromLatest(
Long prjctIdx, Long prjctIdx,
List<Integer> sids List<String> sids
); );
@Query(""" @Query("""
@@ -43,7 +43,7 @@ public interface ListEventHistRepository extends JpaRepository<TListEventHistEnt
""") """)
List<TListEventHistEntity> findDownloadHistories( List<TListEventHistEntity> findDownloadHistories(
Long prjctIdx, Long prjctIdx,
Collection<Integer> sids, Collection<String> sids,
Collection<Short> eventTypes, Collection<Short> eventTypes,
LocalDateTime startDate, LocalDateTime startDate,
LocalDateTime endDate LocalDateTime endDate
@@ -67,7 +67,7 @@ public interface ListEventHistRepository extends JpaRepository<TListEventHistEnt
""") """)
List<TListEventHistEntity> findLatestDownloadHistories( List<TListEventHistEntity> findLatestDownloadHistories(
Long prjctIdx, Long prjctIdx,
Collection<Integer> sids, Collection<String> sids,
Collection<Short> eventTypes, Collection<Short> eventTypes,
LocalDateTime startDate, LocalDateTime startDate,
LocalDateTime endDate LocalDateTime endDate
@@ -88,7 +88,7 @@ public interface ListEventHistRepository extends JpaRepository<TListEventHistEnt
""") """)
List<TListEventHistEntity> findLatestDownloadHistoriesFromLatest( List<TListEventHistEntity> findLatestDownloadHistoriesFromLatest(
Long prjctIdx, Long prjctIdx,
Collection<Integer> sids, Collection<String> sids,
Collection<Short> eventTypes Collection<Short> eventTypes
); );
@@ -104,7 +104,7 @@ public interface ListEventHistRepository extends JpaRepository<TListEventHistEnt
""") """)
List<EventHistoryCountProjection> findDownloadHistoryCounts( List<EventHistoryCountProjection> findDownloadHistoryCounts(
Long prjctIdx, Long prjctIdx,
Collection<Integer> sids, Collection<String> sids,
Collection<Short> eventTypes, Collection<Short> eventTypes,
LocalDateTime startDate, LocalDateTime startDate,
LocalDateTime endDate LocalDateTime endDate
@@ -123,17 +123,17 @@ public interface ListEventHistRepository extends JpaRepository<TListEventHistEnt
""") """)
List<EventTypeHistoryCountProjection> findHistoryCountsByEventType( List<EventTypeHistoryCountProjection> findHistoryCountsByEventType(
Long prjctIdx, Long prjctIdx,
Collection<Integer> sids, Collection<String> sids,
Collection<Short> eventTypes Collection<Short> eventTypes
); );
interface EventHistoryCountProjection { interface EventHistoryCountProjection {
Integer getSid(); String getSid();
Long getHistoryCount(); Long getHistoryCount();
} }
interface EventTypeHistoryCountProjection { interface EventTypeHistoryCountProjection {
Integer getSid(); String getSid();
Short getEventTy(); Short getEventTy();
Long getPrjctSurveyIdx(); Long getPrjctSurveyIdx();
Long getHistoryCount(); Long getHistoryCount();

View File

@@ -12,7 +12,7 @@ public interface ListItemFileRepository extends JpaRepository<TListItemFileEntit
List<TListItemFileEntity> findByIdPrjctIdxAndIdSidInAndIdListHderIdInOrderByIdSidAscIdListHderIdAsc( List<TListItemFileEntity> findByIdPrjctIdxAndIdSidInAndIdListHderIdInOrderByIdSidAscIdListHderIdAsc(
Long prjctIdx, Long prjctIdx,
Collection<Integer> sids, Collection<String> sids,
Collection<Integer> listHderIds Collection<Integer> listHderIds
); );
@@ -31,6 +31,6 @@ public interface ListItemFileRepository extends JpaRepository<TListItemFileEntit
""") """)
int deleteWithPrjctIdxAndSids( int deleteWithPrjctIdxAndSids(
Long prjctIdx, Long prjctIdx,
Collection<Integer> sids Collection<String> sids
); );
} }

View File

@@ -33,7 +33,7 @@ public interface ListItemRepository extends JpaRepository<TListItemEntity, TList
""") """)
int deleteByPrjctIdxAndSids( int deleteByPrjctIdxAndSids(
Long prjctIdx, Long prjctIdx,
Collection<Integer> sids Collection<String> sids
); );
@Modifying(clearAutomatically = true, flushAutomatically = true) @Modifying(clearAutomatically = true, flushAutomatically = true)
@@ -45,7 +45,7 @@ public interface ListItemRepository extends JpaRepository<TListItemEntity, TList
""") """)
int deleteByPrjctIdxAndSidsExceptHeaderIds( int deleteByPrjctIdxAndSidsExceptHeaderIds(
Long prjctIdx, Long prjctIdx,
Collection<Integer> sids, Collection<String> sids,
Collection<Integer> rejectHeaderIds Collection<Integer> rejectHeaderIds
); );
@@ -58,12 +58,12 @@ public interface ListItemRepository extends JpaRepository<TListItemEntity, TList
""") """)
List<TListItemEntity> findByIdPrjctIdxAndIdSidIn( List<TListItemEntity> findByIdPrjctIdxAndIdSidIn(
Long prjctIdx, Long prjctIdx,
Set<Integer> sids Set<String> sids
); );
List<TListItemEntity> findByIdPrjctIdxAndIdSidInAndIdListHderIdIn( List<TListItemEntity> findByIdPrjctIdxAndIdSidInAndIdListHderIdIn(
Long prjctIdx, Long prjctIdx,
Set<Integer> sids, Set<String> sids,
Collection<Integer> listHderIds Collection<Integer> listHderIds
); );

View File

@@ -11,21 +11,21 @@ public interface ListQueryRepository {
List<TListEntity> findAllListEntities(Long prjctIdx, List<Integer> emailTelnumHeaderIds, ListFilterDto listFilter); List<TListEntity> findAllListEntities(Long prjctIdx, List<Integer> emailTelnumHeaderIds, ListFilterDto listFilter);
List<Integer> findAllSids(Long prjctIdx, List<Integer> emailTelnumHeaderIds, ListFilterDto listFilter); List<String> findAllSids(Long prjctIdx, List<Integer> emailTelnumHeaderIds, ListFilterDto listFilter);
List<TListEntity> findChunkedListEntities( List<TListEntity> findChunkedListEntities(
Long prjctIdx, Long prjctIdx,
List<Integer> emailTelnumHeaderIds, List<Integer> emailTelnumHeaderIds,
ListFilterDto listFilter, ListFilterDto listFilter,
Integer lastSid, String lastSid,
int limit int limit
); );
List<Integer> findChunkedSids( List<String> findChunkedSids(
Long prjctIdx, Long prjctIdx,
List<Integer> emailTelnumHeaderIds, List<Integer> emailTelnumHeaderIds,
ListFilterDto listFilter, ListFilterDto listFilter,
Integer lastSid, String lastSid,
int limit int limit
); );
} }

View File

@@ -32,6 +32,7 @@ import com.querydsl.core.types.dsl.StringPath;
import com.querydsl.jpa.impl.JPAQuery; import com.querydsl.jpa.impl.JPAQuery;
import com.querydsl.jpa.JPAExpressions; import com.querydsl.jpa.JPAExpressions;
import com.querydsl.jpa.impl.JPAQueryFactory; import com.querydsl.jpa.impl.JPAQueryFactory;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@@ -81,14 +82,14 @@ public class ListQueryRepositoryImpl implements ListQueryRepository {
QTListEntity list = QTListEntity.tListEntity; QTListEntity list = QTListEntity.tListEntity;
BooleanBuilder predicate = buildListFilterPredicate(prjctIdx, exactMatchHeaderIds, listFilter, list); BooleanBuilder predicate = buildListFilterPredicate(prjctIdx, exactMatchHeaderIds, listFilter, list);
return jpaQueryFactory.selectFrom(list) JPAQuery<TListEntity> query = jpaQueryFactory.selectFrom(list)
.where(predicate) .where(predicate);
.orderBy(list.id.sid.asc()) orderByNaturalSid(query, list, Order.ASC);
.fetch(); return query.fetch();
} }
@Override @Override
public List<Integer> findAllSids( public List<String> findAllSids(
Long prjctIdx, Long prjctIdx,
List<Integer> exactMatchHeaderIds, List<Integer> exactMatchHeaderIds,
ListFilterDto listFilter ListFilterDto listFilter
@@ -96,11 +97,11 @@ public class ListQueryRepositoryImpl implements ListQueryRepository {
QTListEntity list = QTListEntity.tListEntity; QTListEntity list = QTListEntity.tListEntity;
BooleanBuilder predicate = buildListFilterPredicate(prjctIdx, exactMatchHeaderIds, listFilter, list); BooleanBuilder predicate = buildListFilterPredicate(prjctIdx, exactMatchHeaderIds, listFilter, list);
return jpaQueryFactory.select(list.id.sid) JPAQuery<String> query = jpaQueryFactory.select(list.id.sid)
.from(list) .from(list)
.where(predicate) .where(predicate);
.orderBy(list.id.sid.asc()) orderByNaturalSid(query, list, Order.ASC);
.fetch(); return query.fetch();
} }
@Override @Override
@@ -108,44 +109,73 @@ public class ListQueryRepositoryImpl implements ListQueryRepository {
Long prjctIdx, Long prjctIdx,
List<Integer> exactMatchHeaderIds, List<Integer> exactMatchHeaderIds,
ListFilterDto listFilter, ListFilterDto listFilter,
Integer lastSid, String lastSid,
int limit int limit
) { ) {
QTListEntity list = QTListEntity.tListEntity; QTListEntity list = QTListEntity.tListEntity;
BooleanBuilder predicate = buildListFilterPredicate(prjctIdx, exactMatchHeaderIds, listFilter, list); BooleanBuilder predicate = buildListFilterPredicate(prjctIdx, exactMatchHeaderIds, listFilter, list);
if (lastSid != null) { if (lastSid != null) {
predicate.and(list.id.sid.gt(lastSid)); predicate.and(toAfterSidSortCursorPredicate(prjctIdx, list, lastSid));
} }
return jpaQueryFactory.selectFrom(list) JPAQuery<TListEntity> query = jpaQueryFactory.selectFrom(list)
.where(predicate) .where(predicate);
.orderBy(list.id.sid.asc()) orderByNaturalSid(query, list, Order.ASC);
return query
.limit(limit) .limit(limit)
.fetch(); .fetch();
} }
@Override @Override
public List<Integer> findChunkedSids( public List<String> findChunkedSids(
Long prjctIdx, Long prjctIdx,
List<Integer> exactMatchHeaderIds, List<Integer> exactMatchHeaderIds,
ListFilterDto listFilter, ListFilterDto listFilter,
Integer lastSid, String lastSid,
int limit int limit
) { ) {
QTListEntity list = QTListEntity.tListEntity; QTListEntity list = QTListEntity.tListEntity;
BooleanBuilder predicate = buildListFilterPredicate(prjctIdx, exactMatchHeaderIds, listFilter, list); BooleanBuilder predicate = buildListFilterPredicate(prjctIdx, exactMatchHeaderIds, listFilter, list);
if (lastSid != null) { if (lastSid != null) {
predicate.and(list.id.sid.gt(lastSid)); predicate.and(toAfterSidSortCursorPredicate(prjctIdx, list, lastSid));
} }
return jpaQueryFactory.select(list.id.sid) JPAQuery<String> query = jpaQueryFactory.select(list.id.sid)
.from(list) .from(list)
.where(predicate) .where(predicate);
.orderBy(list.id.sid.asc()) orderByNaturalSid(query, list, Order.ASC);
return query
.limit(limit) .limit(limit)
.fetch(); .fetch();
} }
private BooleanBuilder toAfterSidSortCursorPredicate(Long prjctIdx, QTListEntity list, String lastSid) {
QTListEntity cursor = new QTListEntity("sid_sort_cursor");
TListEntity cursorRow = jpaQueryFactory.selectFrom(cursor)
.where(
cursor.id.prjctIdx.eq(prjctIdx),
cursor.id.sid.eq(lastSid)
)
.fetchOne();
if (cursorRow == null || cursorRow.getSidSortType() == null) {
return new BooleanBuilder(list.id.sid.gt(lastSid));
}
Integer sortType = cursorRow.getSidSortType();
BigDecimal sortNumber = cursorRow.getSidSortNumber();
BooleanBuilder after = new BooleanBuilder()
.or(list.sidSortType.gt(sortType));
if (sortNumber == null) {
return after.or(list.sidSortType.eq(sortType).and(list.id.sid.gt(lastSid)));
}
return after
.or(list.sidSortType.eq(sortType).and(list.sidSortNumber.gt(sortNumber)))
.or(list.sidSortType.eq(sortType).and(list.sidSortNumber.eq(sortNumber)).and(list.id.sid.gt(lastSid)));
}
private BooleanBuilder buildListFilterPredicate( private BooleanBuilder buildListFilterPredicate(
Long prjctIdx, Long prjctIdx,
List<Integer> exactMatchHeaderIds, List<Integer> exactMatchHeaderIds,
@@ -180,7 +210,7 @@ public class ListQueryRepositoryImpl implements ListQueryRepository {
private void appendSidPredicates(BooleanBuilder predicate, QTListEntity list, Set<String> sidSet) { private void appendSidPredicates(BooleanBuilder predicate, QTListEntity list, Set<String> sidSet) {
BooleanBuilder sidPredicate = new BooleanBuilder(); BooleanBuilder sidPredicate = new BooleanBuilder();
Set<Integer> sidNumbers = new LinkedHashSet<>(); Set<String> sidNumbers = new LinkedHashSet<>();
for (String sidCondition : sidSet) { for (String sidCondition : sidSet) {
String normalized = normalizeBlank(sidCondition); String normalized = normalizeBlank(sidCondition);
@@ -191,7 +221,10 @@ public class ListQueryRepositoryImpl implements ListQueryRepository {
if (normalized.contains("~")) { if (normalized.contains("~")) {
sidPredicate.or(toSidRangePredicate(list, normalized)); sidPredicate.or(toSidRangePredicate(list, normalized));
} else { } else {
sidNumbers.add(parseSidNumber(normalized, sidCondition)); BigDecimal sidNumber = parseSidNumber(normalized, sidCondition);
if (sidNumber != null) {
sidNumbers.add(normalized);
}
} }
} }
@@ -210,31 +243,36 @@ public class ListQueryRepositoryImpl implements ListQueryRepository {
return null; return null;
} }
Integer start = parseSidNumber(tokens[0].trim(), normalized); BigDecimal start = parseSidNumber(tokens[0].trim(), normalized);
Integer end = parseSidNumber(tokens[1].trim(), normalized); BigDecimal end = parseSidNumber(tokens[1].trim(), normalized);
if(start == null || end == null) { if(start == null || end == null) {
return null; return null;
} }
if (start > end) { if (start.compareTo(end) > 0) {
Integer temp = start; BigDecimal temp = start;
start = end; start = end;
end = temp; end = temp;
} }
return new BooleanBuilder() return new BooleanBuilder()
.and(list.id.sid.goe(start)) .and(list.sidSortNumber.isNotNull())
.and(list.id.sid.loe(end)); .and(list.sidSortNumber.goe(start))
.and(list.sidSortNumber.loe(end));
} }
private Integer parseSidNumber(String value, String originalCondition) { private BigDecimal parseSidNumber(String value, String originalCondition) {
if (value == null || !value.matches("\\d+")) { if (value == null || !value.matches("\\d+")) {
return null; return null;
} }
try { try {
return Integer.valueOf(value); BigDecimal parsed = new BigDecimal(value);
if (parsed.precision() > 32) {
throw invalidSidCondition(originalCondition);
}
return parsed;
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
throw invalidSidCondition(originalCondition); throw invalidSidCondition(originalCondition);
} }
@@ -822,6 +860,10 @@ public class ListQueryRepositoryImpl implements ListQueryRepository {
PageRequestDto pageRequest PageRequestDto pageRequest
) { ) {
SortTarget sortTarget = resolveSortTarget(pageRequest); SortTarget sortTarget = resolveSortTarget(pageRequest);
if (sortTarget.naturalSid()) {
orderByNaturalSid(query, list, sortTarget.order());
return;
}
if (sortTarget.assignType() != null) { if (sortTarget.assignType() != null) {
applyAssignSort(query, list, prjctIdx, sortTarget); applyAssignSort(query, list, prjctIdx, sortTarget);
} else if (sortTarget.listHderId() != null) { } else if (sortTarget.listHderId() != null) {
@@ -831,7 +873,15 @@ public class ListQueryRepositoryImpl implements ListQueryRepository {
} else { } else {
query.orderBy(toOrderSpecifier(sortTarget.order(), sortTarget.basePath())); query.orderBy(toOrderSpecifier(sortTarget.order(), sortTarget.basePath()));
} }
query.orderBy(list.id.sid.asc()); orderByNaturalSid(query, list, sortTarget.order());
}
private void orderByNaturalSid(JPAQuery<?> query, QTListEntity list, Order order) {
query.orderBy(
toOrderSpecifier(order, list.sidSortType),
toOrderSpecifier(order, list.sidSortNumber),
toOrderSpecifier(order, list.id.sid)
);
} }
private SortTarget resolveSortTarget(PageRequestDto pageRequest) { private SortTarget resolveSortTarget(PageRequestDto pageRequest) {
@@ -863,7 +913,7 @@ public class ListQueryRepositoryImpl implements ListQueryRepository {
if (listHderId != null) { if (listHderId != null) {
return SortTarget.item(order, listHderId); return SortTarget.item(order, listHderId);
} }
return SortTarget.base(order, QTListEntity.tListEntity.id.sid); return SortTarget.sidNatural(order);
} }
private void applyAssignSort( private void applyAssignSort(
@@ -970,22 +1020,27 @@ public class ListQueryRepositoryImpl implements ListQueryRepository {
Short assignType, Short assignType,
Integer listHderId, Integer listHderId,
Short resultType, Short resultType,
Long prjctSurveyIdx Long prjctSurveyIdx,
boolean naturalSid
) { ) {
private static SortTarget sidNatural(Order order) {
return new SortTarget(order, null, null, null, null, null, true);
}
private static SortTarget base(Order order, ComparableExpressionBase<?> path) { private static SortTarget base(Order order, ComparableExpressionBase<?> path) {
return new SortTarget(order, path, null, null, null, null); return new SortTarget(order, path, null, null, null, null, false);
} }
private static SortTarget assign(Order order, Short assignType) { private static SortTarget assign(Order order, Short assignType) {
return new SortTarget(order, null, assignType, null, null, null); return new SortTarget(order, null, assignType, null, null, null, false);
} }
private static SortTarget item(Order order, Integer listHderId) { private static SortTarget item(Order order, Integer listHderId) {
return new SortTarget(order, null, null, listHderId, null, null); return new SortTarget(order, null, null, listHderId, null, null, false);
} }
private static SortTarget result(Order order, Short resultType, Long prjctSurveyIdx) { private static SortTarget result(Order order, Short resultType, Long prjctSurveyIdx) {
return new SortTarget(order, null, null, null, resultType, prjctSurveyIdx); return new SortTarget(order, null, null, null, resultType, prjctSurveyIdx, false);
} }
} }

View File

@@ -14,16 +14,16 @@ import org.springframework.data.jpa.repository.Query;
public interface ListRepository extends JpaRepository<TListEntity, TListEntityId>, public interface ListRepository extends JpaRepository<TListEntity, TListEntityId>,
JpaSpecificationExecutor<TListEntity>, ListQueryRepository { JpaSpecificationExecutor<TListEntity>, ListQueryRepository {
List<TListEntity> findByIdPrjctIdxAndIdSidIn(Long prjctIdx, Collection<Integer> sids); List<TListEntity> findByIdPrjctIdxAndIdSidIn(Long prjctIdx, Collection<String> sids);
boolean existsByIdPrjctIdxAndIdSid(Long prjctIdx, Integer sid); boolean existsByIdPrjctIdxAndIdSid(Long prjctIdx, String sid);
@Query(""" @Query("""
select l.id.sid select l.id.sid
from TListEntity l from TListEntity l
where l.id.prjctIdx = :prjctIdx where l.id.prjctIdx = :prjctIdx
""") """)
Set<Integer> findSidsByPrjctIdx(Long prjctIdx); Set<String> findSidsByPrjctIdx(Long prjctIdx);
@Modifying(clearAutomatically = true, flushAutomatically = true) @Modifying(clearAutomatically = true, flushAutomatically = true)
@Query(""" @Query("""
@@ -40,6 +40,6 @@ public interface ListRepository extends JpaRepository<TListEntity, TListEntityId
""") """)
int deleteWithPrjctIdxAndSids( int deleteWithPrjctIdxAndSids(
Long prjctIdx, Long prjctIdx,
Collection<Integer> sids Collection<String> sids
); );
} }

View File

@@ -13,6 +13,6 @@ public interface ListReserveRepository extends JpaRepository<TListResveEntity, L
List<TListResveEntity> findByPrjctIdxAndSidOrderByResveDtAscListResveIdxAsc( List<TListResveEntity> findByPrjctIdxAndSidOrderByResveDtAscListResveIdxAsc(
Long prjctIdx, Long prjctIdx,
Integer sid String sid
); );
} }

View File

@@ -11,7 +11,7 @@ public interface ListUpdateHistRepository extends JpaRepository<TListUpdateHistE
List<TListUpdateHistEntity> findByPrjctIdxAndSidOrderByRegDtDescListUpdateHistIdxDesc( List<TListUpdateHistEntity> findByPrjctIdxAndSidOrderByRegDtDescListUpdateHistIdxDesc(
Long prjctIdx, Long prjctIdx,
Integer sid String sid
); );
@Query(""" @Query("""
@@ -23,7 +23,7 @@ public interface ListUpdateHistRepository extends JpaRepository<TListUpdateHistE
""") """)
List<TListUpdateHistEntity> findDownloadHistories( List<TListUpdateHistEntity> findDownloadHistories(
Long prjctIdx, Long prjctIdx,
Collection<Integer> sids Collection<String> sids
); );
@Query(""" @Query("""
@@ -36,11 +36,11 @@ public interface ListUpdateHistRepository extends JpaRepository<TListUpdateHistE
""") """)
List<UpdateHistoryGroupProjection> findDownloadHistoryGroups( List<UpdateHistoryGroupProjection> findDownloadHistoryGroups(
Long prjctIdx, Long prjctIdx,
Collection<Integer> sids Collection<String> sids
); );
interface UpdateHistoryGroupProjection { interface UpdateHistoryGroupProjection {
Integer getSid(); String getSid();
LocalDateTime getRegDt(); LocalDateTime getRegDt();
String getRegUser(); String getRegUser();
} }

View File

@@ -17,22 +17,22 @@ public class ListUploadFileCleanupScheduler {
private final ListUploadLogRepository listUploadLogRepository; private final ListUploadLogRepository listUploadLogRepository;
private final ListFileService listFileService; private final ListFileService listFileService;
private final long expireDays; private final long expireMonths;
public ListUploadFileCleanupScheduler( public ListUploadFileCleanupScheduler(
ListUploadLogRepository listUploadLogRepository, ListUploadLogRepository listUploadLogRepository,
ListFileService listFileService, ListFileService listFileService,
@Value("${kri.list-upload-file.cleanup-expire-days:7}") long expireDays @Value("${kri.list-upload-file.cleanup-expire-months:3}") long expireMonths
) { ) {
this.listUploadLogRepository = listUploadLogRepository; this.listUploadLogRepository = listUploadLogRepository;
this.listFileService = listFileService; this.listFileService = listFileService;
this.expireDays = expireDays; this.expireMonths = expireMonths;
} }
@Transactional @Transactional
@Scheduled(cron = "${kri.list-upload-file.cleanup-cron:0 30 0 * * SUN}") @Scheduled(cron = "${kri.list-upload-file.cleanup-cron:0 30 0 * * SUN}")
public void cleanupOldListUploadFiles() { public void cleanupOldListUploadFiles() {
LocalDateTime threshold = LocalDateTime.now().minusDays(expireDays); LocalDateTime threshold = LocalDateTime.now().minusMonths(expireMonths);
LocalDateTime deletedAt = LocalDateTime.now(); LocalDateTime deletedAt = LocalDateTime.now();
List<TListUploadLogEntity> uploadLogs = List<TListUploadLogEntity> uploadLogs =

View File

@@ -158,7 +158,7 @@ public class AssignService {
); );
} }
ListAssignType assignType = requireAssignType(req.getAssignType()); ListAssignType assignType = requireAssignType(req.getAssignType());
Set<Integer> targetSids = resolveTargetSids(prjctIdx, req.getListFilter()); Set<String> targetSids = resolveTargetSids(prjctIdx, req.getListFilter());
if (targetSids.isEmpty()) { if (targetSids.isEmpty()) {
return 0; return 0;
} }
@@ -201,7 +201,7 @@ public class AssignService {
@Transactional @Transactional
public Integer resetListAssign(Long prjctIdx, ListAssignResetRequestDto req) { public Integer resetListAssign(Long prjctIdx, ListAssignResetRequestDto req) {
ListAssignType assignType = requireAssignType(req == null ? null : req.getAssignType()); ListAssignType assignType = requireAssignType(req == null ? null : req.getAssignType());
Set<Integer> targetSids = resolveTargetSids(prjctIdx, req); Set<String> targetSids = resolveTargetSids(prjctIdx, req);
if (targetSids.isEmpty()) { if (targetSids.isEmpty()) {
return 0; return 0;
} }
@@ -218,7 +218,7 @@ public class AssignService {
} }
@Transactional(readOnly = true) @Transactional(readOnly = true)
public List<ListAssignUserRole> findListAssignUserRoles(Long prjctIdx, Collection<Integer> sids) { public List<ListAssignUserRole> findListAssignUserRoles(Long prjctIdx, Collection<String> sids) {
if (sids == null || sids.isEmpty()) { if (sids == null || sids.isEmpty()) {
return Collections.emptyList(); return Collections.emptyList();
} }
@@ -257,7 +257,7 @@ public class AssignService {
} }
@Transactional(readOnly = true) @Transactional(readOnly = true)
public List<ListAssignCmpn> findListAssignCmpns(Long prjctIdx, Collection<Integer> sids) { public List<ListAssignCmpn> findListAssignCmpns(Long prjctIdx, Collection<String> sids) {
if (sids == null || sids.isEmpty()) { if (sids == null || sids.isEmpty()) {
return Collections.emptyList(); return Collections.emptyList();
} }
@@ -368,23 +368,23 @@ public class AssignService {
return assignType; return assignType;
} }
private Set<Integer> resolveTargetSids(Long prjctIdx, ListAssignResetRequestDto req) { private Set<String> resolveTargetSids(Long prjctIdx, ListAssignResetRequestDto req) {
return resolveTargetSids(prjctIdx, req == null ? null : req.getListFilter()); return resolveTargetSids(prjctIdx, req == null ? null : req.getListFilter());
} }
private Set<Integer> resolveTargetSids(Long prjctIdx, ListFilterDto listFilter) { private Set<String> resolveTargetSids(Long prjctIdx, ListFilterDto listFilter) {
List<Integer> exactMatchHeaderIds = listHeaderService.getExactMatchHeaderId(prjctIdx); List<Integer> exactMatchHeaderIds = listHeaderService.getExactMatchHeaderId(prjctIdx);
return new LinkedHashSet<>(listRepository.findAllSids(prjctIdx, exactMatchHeaderIds, listFilter)); return new LinkedHashSet<>(listRepository.findAllSids(prjctIdx, exactMatchHeaderIds, listFilter));
} }
public record ListAssignUserRole( public record ListAssignUserRole(
Integer sid, String sid,
String userId, String userId,
Short assignRole Short assignRole
) {} ) {}
public record ListAssignCmpn( public record ListAssignCmpn(
Integer sid, String sid,
String cmpnId String cmpnId
) {} ) {}
} }

View File

@@ -37,7 +37,7 @@ public class ListCallHistService {
@Transactional @Transactional
public ListCallHistDto callStart( public ListCallHistDto callStart(
Long prjctIdx, Long prjctIdx,
Integer sid, String sid,
ListCallStartRequestDto request, ListCallStartRequestDto request,
String regUser, String regUser,
String userCmpn, String userCmpn,
@@ -50,7 +50,7 @@ public class ListCallHistService {
@Transactional @Transactional
public ListCallHistDto callClose( public ListCallHistDto callClose(
Long prjctIdx, Long prjctIdx,
Integer sid, String sid,
ListCallCloseRequestDto request, ListCallCloseRequestDto request,
String regUser, String regUser,
String userCmpn, String userCmpn,
@@ -62,7 +62,7 @@ public class ListCallHistService {
private ListCallHistDto saveCallHistory( private ListCallHistDto saveCallHistory(
Long prjctIdx, Long prjctIdx,
Integer sid, String sid,
ListCallStartRequestDto request, ListCallStartRequestDto request,
CallStatus callStatus, CallStatus callStatus,
String regUser, String regUser,
@@ -124,7 +124,7 @@ public class ListCallHistService {
public void validateListCallHistoryForEvent( public void validateListCallHistoryForEvent(
Long listCallHistIdx, Long listCallHistIdx,
Long prjctIdx, Long prjctIdx,
Integer sid, String sid,
String userId, String userId,
String userCmpn, String userCmpn,
Integer userRole Integer userRole
@@ -176,7 +176,7 @@ public class ListCallHistService {
private void validateCallIdentity( private void validateCallIdentity(
TListCallHistEntity existing, TListCallHistEntity existing,
Long prjctIdx, Long prjctIdx,
Integer sid, String sid,
ListCallStartRequestDto request ListCallStartRequestDto request
) { ) {
rejectDifferent("prjctIdx", existing.getPrjctIdx(), prjctIdx); rejectDifferent("prjctIdx", existing.getPrjctIdx(), prjctIdx);
@@ -223,7 +223,7 @@ public class ListCallHistService {
return true; return true;
} }
Long prjctIdx = entity.getPrjctIdx(); Long prjctIdx = entity.getPrjctIdx();
Integer sid = entity.getSid(); String sid = entity.getSid();
if (userRole >= ContactConstant.FIELDWORK_USER_ROLE) { if (userRole >= ContactConstant.FIELDWORK_USER_ROLE) {
return hasText(userId) return hasText(userId)
&& (projectAssignUserRepository.existsByIdPrjctIdxAndIdUserId(prjctIdx, userId) && (projectAssignUserRepository.existsByIdPrjctIdxAndIdUserId(prjctIdx, userId)

View File

@@ -81,7 +81,7 @@ public class ListDownloadService {
ExcelMapper.StreamingMapWriter writer = ExcelMapper.openStreamingMapWriter(toBaseHeaderNames(headers), 100); ExcelMapper.StreamingMapWriter writer = ExcelMapper.openStreamingMapWriter(toBaseHeaderNames(headers), 100);
ByteArrayOutputStream out = new ByteArrayOutputStream() ByteArrayOutputStream out = new ByteArrayOutputStream()
) { ) {
Integer lastSid = null; String lastSid = null;
while (true) { while (true) {
List<ListSearchService.DownloadListRow> rows = listSearchService.findDownloadListRows(prjctIdx, listFilter, lastSid); List<ListSearchService.DownloadListRow> rows = listSearchService.findDownloadListRows(prjctIdx, listFilter, lastSid);
if (rows.isEmpty()) { if (rows.isEmpty()) {
@@ -126,15 +126,15 @@ public class ListDownloadService {
ExcelMapper.StreamingMapWriter writer = ExcelMapper.openStreamingMapWriter(excelHeaders, 100); ExcelMapper.StreamingMapWriter writer = ExcelMapper.openStreamingMapWriter(excelHeaders, 100);
ByteArrayOutputStream out = new ByteArrayOutputStream() ByteArrayOutputStream out = new ByteArrayOutputStream()
) { ) {
Integer lastSid = null; String lastSid = null;
while (true) { while (true) {
List<ListSearchService.DownloadListRow> rows = listSearchService.findDownloadListRows(prjctIdx, listFilter, lastSid); List<ListSearchService.DownloadListRow> rows = listSearchService.findDownloadListRows(prjctIdx, listFilter, lastSid);
if (rows.isEmpty()) { if (rows.isEmpty()) {
break; break;
} }
List<Integer> sids = rows.stream().map(ListSearchService.DownloadListRow::sid).toList(); List<String> sids = rows.stream().map(ListSearchService.DownloadListRow::sid).toList();
Map<Integer, List<ListSearchService.EventHistoryRow>> historyMap = listSearchService.findEventHistoriesForDownload( Map<String, List<ListSearchService.EventHistoryRow>> historyMap = listSearchService.findEventHistoriesForDownload(
prjctIdx, prjctIdx,
sids, sids,
resultCodeTypes, resultCodeTypes,
@@ -174,17 +174,17 @@ public class ListDownloadService {
ExcelMapper.StreamingMapWriter writer = ExcelMapper.openStreamingMapWriter(excelHeaders, 100); ExcelMapper.StreamingMapWriter writer = ExcelMapper.openStreamingMapWriter(excelHeaders, 100);
ByteArrayOutputStream out = new ByteArrayOutputStream() ByteArrayOutputStream out = new ByteArrayOutputStream()
) { ) {
Integer lastSid = null; String lastSid = null;
while (true) { while (true) {
List<Integer> sids = listSearchService.findDownloadSids(prjctIdx, listFilter, lastSid); List<String> sids = listSearchService.findDownloadSids(prjctIdx, listFilter, lastSid);
if (sids.isEmpty()) { if (sids.isEmpty()) {
break; break;
} }
Map<Integer, List<ListSearchService.UpdateHistoryGroupRow>> historyMap = Map<String, List<ListSearchService.UpdateHistoryGroupRow>> historyMap =
listSearchService.findUpdateHistoryGroupsForDownload(prjctIdx, sids); listSearchService.findUpdateHistoryGroupsForDownload(prjctIdx, sids);
for (Integer sid : sids) { for (String sid : sids) {
lastSid = sid; lastSid = sid;
List<ListSearchService.UpdateHistoryGroupRow> histories = historyMap.getOrDefault(sid, List.of()); List<ListSearchService.UpdateHistoryGroupRow> histories = historyMap.getOrDefault(sid, List.of());
if (histories.isEmpty()) { if (histories.isEmpty()) {
@@ -223,11 +223,11 @@ public class ListDownloadService {
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
ZipOutputStream zip = new ZipOutputStream(out) ZipOutputStream zip = new ZipOutputStream(out)
) { ) {
Integer lastSid = null; String lastSid = null;
int fileCount = 0; int fileCount = 0;
while (true) { while (true) {
List<Integer> sids = listSearchService.findDownloadSids(prjctIdx, listFilter, lastSid); List<String> sids = listSearchService.findDownloadSids(prjctIdx, listFilter, lastSid);
if (sids.isEmpty()) { if (sids.isEmpty()) {
break; break;
} }
@@ -267,7 +267,7 @@ public class ListDownloadService {
} }
} }
public ListUploadFileInfoDto downloadItemFile(Long prjctIdx, Integer sid, Integer listHderId) { public ListUploadFileInfoDto downloadItemFile(Long prjctIdx, String sid, Integer listHderId) {
TListItemFileEntity fileEntity = listItemFileRepository TListItemFileEntity fileEntity = listItemFileRepository
.findById(TListItemFileEntityId.create(prjctIdx, sid, listHderId)) .findById(TListItemFileEntityId.create(prjctIdx, sid, listHderId))
.orElseThrow(() -> BusinessException.notFound( .orElseThrow(() -> BusinessException.notFound(
@@ -296,14 +296,14 @@ public class ListDownloadService {
DateRangeDto dateRange DateRangeDto dateRange
) { ) {
int maxCount = 0; int maxCount = 0;
Integer lastSid = null; String lastSid = null;
while (true) { while (true) {
List<Integer> sids = listSearchService.findDownloadSids(prjctIdx, listFilter, lastSid); List<String> sids = listSearchService.findDownloadSids(prjctIdx, listFilter, lastSid);
if (sids.isEmpty()) { if (sids.isEmpty()) {
return maxCount; return maxCount;
} }
Map<Integer, Integer> countMap = searchBase == ListEventHistoryBase.LATEST Map<String, Integer> countMap = searchBase == ListEventHistoryBase.LATEST
? listSearchService.findEventHistoriesForDownload( ? listSearchService.findEventHistoriesForDownload(
prjctIdx, prjctIdx,
sids, sids,
@@ -334,14 +334,14 @@ public class ListDownloadService {
private int findMaxUpdateHistoryGroupCount(Long prjctIdx, ListFilterDto listFilter) { private int findMaxUpdateHistoryGroupCount(Long prjctIdx, ListFilterDto listFilter) {
int maxCount = 0; int maxCount = 0;
Integer lastSid = null; String lastSid = null;
while (true) { while (true) {
List<Integer> sids = listSearchService.findDownloadSids(prjctIdx, listFilter, lastSid); List<String> sids = listSearchService.findDownloadSids(prjctIdx, listFilter, lastSid);
if (sids.isEmpty()) { if (sids.isEmpty()) {
return maxCount; return maxCount;
} }
Map<Integer, Integer> countMap = listSearchService.findUpdateHistoryGroupCountsForDownload(prjctIdx, sids); Map<String, Integer> countMap = listSearchService.findUpdateHistoryGroupCountsForDownload(prjctIdx, sids);
for (Integer count : countMap.values()) { for (Integer count : countMap.values()) {
maxCount = Math.max(maxCount, count); maxCount = Math.max(maxCount, count);
} }
@@ -396,7 +396,7 @@ public class ListDownloadService {
} }
private Map<String, Object> createUpdateHistoryRow( private Map<String, Object> createUpdateHistoryRow(
Integer sid, String sid,
List<ListSearchService.UpdateHistoryGroupRow> histories, List<ListSearchService.UpdateHistoryGroupRow> histories,
int maxHistoryCount int maxHistoryCount
) { ) {
@@ -560,4 +560,3 @@ public class ListDownloadService {
Integer resultCd Integer resultCd
) {} ) {}
} }

View File

@@ -17,7 +17,7 @@ public class ListHistoryQueryService {
private final ListUpdateHistRepository listUpdateHistRepository; private final ListUpdateHistRepository listUpdateHistRepository;
@Transactional(readOnly = true) @Transactional(readOnly = true)
public List<ListEventHistoryDto> findEventHistories(Long prjctIdx, Integer sid) { public List<ListEventHistoryDto> findEventHistories(Long prjctIdx, String sid) {
return listEventHistRepository.findByPrjctIdxAndSidOrderByRegDtDescListEventHistIdxDesc(prjctIdx, sid) return listEventHistRepository.findByPrjctIdxAndSidOrderByRegDtDescListEventHistIdxDesc(prjctIdx, sid)
.stream() .stream()
.map(ListEventHistoryDto::from) .map(ListEventHistoryDto::from)
@@ -25,7 +25,7 @@ public class ListHistoryQueryService {
} }
@Transactional(readOnly = true) @Transactional(readOnly = true)
public List<ListUpdateHistoryDto> findUpdateHistories(Long prjctIdx, Integer sid) { public List<ListUpdateHistoryDto> findUpdateHistories(Long prjctIdx, String sid) {
return listUpdateHistRepository.findByPrjctIdxAndSidOrderByRegDtDescListUpdateHistIdxDesc(prjctIdx, sid) return listUpdateHistRepository.findByPrjctIdxAndSidOrderByRegDtDescListUpdateHistIdxDesc(prjctIdx, sid)
.stream() .stream()
.map(ListUpdateHistoryDto::from) .map(ListUpdateHistoryDto::from)

View File

@@ -33,14 +33,14 @@ public class ListResetService {
String regUser, String regUser,
LocalDateTime regDt LocalDateTime regDt
) { ) {
Set<Integer> sids = listSearchService.findTargetSids(prjctIdx, filter); Set<String> sids = listSearchService.findTargetSids(prjctIdx, filter);
return resetBySids(prjctIdx, sids, mode, regUser, regDt); return resetBySids(prjctIdx, sids, mode, regUser, regDt);
} }
@Transactional @Transactional
public int resetBySids( public int resetBySids(
Long prjctIdx, Long prjctIdx,
Set<Integer> sids, Set<String> sids,
ListResetMode mode, ListResetMode mode,
String regUser, String regUser,
LocalDateTime regDt LocalDateTime regDt

View File

@@ -71,7 +71,7 @@ public class ListSearchService {
private final ProjectSurveyRepository projectSurveyRepository; private final ProjectSurveyRepository projectSurveyRepository;
@Transactional(readOnly = true) @Transactional(readOnly = true)
public ListSearchWithFullResultDto searchListWithSid(Long prjctIdx, Integer sid) { public ListSearchWithFullResultDto searchListWithSid(Long prjctIdx, String sid) {
ListFilterDto filterDto = ListFilterDto.onlyOneSid(sid); ListFilterDto filterDto = ListFilterDto.onlyOneSid(sid);
List<ListSearchWithFullResultDto> result = createListSearchWithFullResult( List<ListSearchWithFullResultDto> result = createListSearchWithFullResult(
prjctIdx, prjctIdx,
@@ -118,7 +118,7 @@ public class ListSearchService {
} }
@Transactional(readOnly = true) @Transactional(readOnly = true)
public Set<Integer> findTargetSids(Long prjctIdx, ListFilterDto listFilter) { public Set<String> findTargetSids(Long prjctIdx, ListFilterDto listFilter) {
return new LinkedHashSet<>(findAllSids(prjctIdx, listFilter)); return new LinkedHashSet<>(findAllSids(prjctIdx, listFilter));
} }
@@ -126,7 +126,7 @@ public class ListSearchService {
public List<DownloadListRow> findDownloadListRows( public List<DownloadListRow> findDownloadListRows(
Long prjctIdx, Long prjctIdx,
ListFilterDto listFilter, ListFilterDto listFilter,
Integer lastSid String lastSid
) { ) {
List<Integer> exactMatchHeaderIds = listHeaderService.getExactMatchHeaderId(prjctIdx); List<Integer> exactMatchHeaderIds = listHeaderService.getExactMatchHeaderId(prjctIdx);
List<TListEntity> listEntities = listRepository.findChunkedListEntities( List<TListEntity> listEntities = listRepository.findChunkedListEntities(
@@ -140,11 +140,11 @@ public class ListSearchService {
return Collections.emptyList(); return Collections.emptyList();
} }
Set<Integer> sidSet = listEntities.stream() Set<String> sidSet = listEntities.stream()
.map(TListEntity::getSid) .map(TListEntity::getSid)
.collect(Collectors.toCollection(LinkedHashSet::new)); .collect(Collectors.toCollection(LinkedHashSet::new));
Map<Integer, Map<Integer, String>> itemMapBySid = createItemMapBySid(prjctIdx, sidSet, null); Map<String, Map<Integer, String>> itemMapBySid = createItemMapBySid(prjctIdx, sidSet, null);
Map<Integer, AssignValues> assignMapBySid = createAssignMapBySid(prjctIdx, sidSet); Map<String, AssignValues> assignMapBySid = createAssignMapBySid(prjctIdx, sidSet);
return listEntities.stream() return listEntities.stream()
.map(entity -> new DownloadListRow( .map(entity -> new DownloadListRow(
@@ -158,10 +158,10 @@ public class ListSearchService {
} }
@Transactional(readOnly = true) @Transactional(readOnly = true)
public List<Integer> findDownloadSids( public List<String> findDownloadSids(
Long prjctIdx, Long prjctIdx,
ListFilterDto listFilter, ListFilterDto listFilter,
Integer lastSid String lastSid
) { ) {
List<Integer> exactMatchHeaderIds = listHeaderService.getExactMatchHeaderId(prjctIdx); List<Integer> exactMatchHeaderIds = listHeaderService.getExactMatchHeaderId(prjctIdx);
return listRepository.findChunkedSids( return listRepository.findChunkedSids(
@@ -174,9 +174,9 @@ public class ListSearchService {
} }
@Transactional(readOnly = true) @Transactional(readOnly = true)
public Map<Integer, Integer> findEventHistoryCountsForDownload( public Map<String, Integer> findEventHistoryCountsForDownload(
Long prjctIdx, Long prjctIdx,
Collection<Integer> sids, Collection<String> sids,
Collection<ResultCodeType> resultCodeTypes, Collection<ResultCodeType> resultCodeTypes,
DateRangeDto dateRange DateRangeDto dateRange
) { ) {
@@ -201,9 +201,9 @@ public class ListSearchService {
} }
@Transactional(readOnly = true) @Transactional(readOnly = true)
public Map<Integer, List<EventHistoryRow>> findEventHistoriesForDownload( public Map<String, List<EventHistoryRow>> findEventHistoriesForDownload(
Long prjctIdx, Long prjctIdx,
Collection<Integer> sids, Collection<String> sids,
Collection<ResultCodeType> resultCodeTypes, Collection<ResultCodeType> resultCodeTypes,
ListEventHistoryBase searchBase, ListEventHistoryBase searchBase,
DateRangeDto dateRange DateRangeDto dateRange
@@ -241,7 +241,7 @@ public class ListSearchService {
private List<TListEventHistEntity> findLatestEventHistoriesForDownload( private List<TListEventHistEntity> findLatestEventHistoriesForDownload(
Long prjctIdx, Long prjctIdx,
Collection<Integer> sids, Collection<String> sids,
Collection<Short> eventTypes, Collection<Short> eventTypes,
LocalDateTime startDate, LocalDateTime startDate,
LocalDateTime endDate LocalDateTime endDate
@@ -253,15 +253,15 @@ public class ListSearchService {
} }
@Transactional(readOnly = true) @Transactional(readOnly = true)
public Map<Integer, Integer> findUpdateHistoryGroupCountsForDownload( public Map<String, Integer> findUpdateHistoryGroupCountsForDownload(
Long prjctIdx, Long prjctIdx,
Collection<Integer> sids Collection<String> sids
) { ) {
if (sids == null || sids.isEmpty()) { if (sids == null || sids.isEmpty()) {
return Collections.emptyMap(); return Collections.emptyMap();
} }
Map<Integer, Integer> counts = new LinkedHashMap<>(); Map<String, Integer> counts = new LinkedHashMap<>();
for (ListUpdateHistRepository.UpdateHistoryGroupProjection projection for (ListUpdateHistRepository.UpdateHistoryGroupProjection projection
: listUpdateHistRepository.findDownloadHistoryGroups(prjctIdx, sids)) { : listUpdateHistRepository.findDownloadHistoryGroups(prjctIdx, sids)) {
counts.merge(projection.getSid(), 1, Integer::sum); counts.merge(projection.getSid(), 1, Integer::sum);
@@ -270,9 +270,9 @@ public class ListSearchService {
} }
@Transactional(readOnly = true) @Transactional(readOnly = true)
public Map<Integer, List<UpdateHistoryGroupRow>> findUpdateHistoryGroupsForDownload( public Map<String, List<UpdateHistoryGroupRow>> findUpdateHistoryGroupsForDownload(
Long prjctIdx, Long prjctIdx,
Collection<Integer> sids Collection<String> sids
) { ) {
if (sids == null || sids.isEmpty()) { if (sids == null || sids.isEmpty()) {
return Collections.emptyMap(); return Collections.emptyMap();
@@ -294,7 +294,7 @@ public class ListSearchService {
Collectors.toList() Collectors.toList()
)); ));
Map<Integer, List<UpdateHistoryGroupRow>> result = new LinkedHashMap<>(); Map<String, List<UpdateHistoryGroupRow>> result = new LinkedHashMap<>();
for (Map.Entry<UpdateHistoryGroupKey, List<TListUpdateHistEntity>> entry : grouped.entrySet()) { for (Map.Entry<UpdateHistoryGroupKey, List<TListUpdateHistEntity>> entry : grouped.entrySet()) {
List<TListUpdateHistEntity> groupHistories = entry.getValue().stream() List<TListUpdateHistEntity> groupHistories = entry.getValue().stream()
.sorted(Comparator.comparing( .sorted(Comparator.comparing(
@@ -328,20 +328,20 @@ public class ListSearchService {
@Transactional(readOnly = true) @Transactional(readOnly = true)
public List<ListUpdateTargetRow> findUpdateTargetRows( public List<ListUpdateTargetRow> findUpdateTargetRows(
Long prjctIdx, Long prjctIdx,
Collection<Integer> sids, Collection<String> sids,
Collection<Integer> headerIds Collection<Integer> headerIds
) { ) {
if (sids == null || sids.isEmpty()) { if (sids == null || sids.isEmpty()) {
return Collections.emptyList(); return Collections.emptyList();
} }
Set<Integer> sidSet = new LinkedHashSet<>(sids); Set<String> sidSet = new LinkedHashSet<>(sids);
List<TListEntity> listEntities = listRepository.findByIdPrjctIdxAndIdSidIn(prjctIdx, sidSet); List<TListEntity> listEntities = listRepository.findByIdPrjctIdxAndIdSidIn(prjctIdx, sidSet);
if (listEntities.isEmpty()) { if (listEntities.isEmpty()) {
return Collections.emptyList(); return Collections.emptyList();
} }
Map<Integer, Map<Integer, String>> itemMapBySid = createItemMapBySid(prjctIdx, sidSet, headerIds); Map<String, Map<Integer, String>> itemMapBySid = createItemMapBySid(prjctIdx, sidSet, headerIds);
List<ListUpdateTargetRow> rows = new ArrayList<>(listEntities.size()); List<ListUpdateTargetRow> rows = new ArrayList<>(listEntities.size());
for (TListEntity entity : listEntities) { for (TListEntity entity : listEntities) {
rows.add(new ListUpdateTargetRow( rows.add(new ListUpdateTargetRow(
@@ -371,7 +371,7 @@ public class ListSearchService {
return listRepository.findAllListEntities(prjctIdx, exactMatchHeaderIds, listFilter); return listRepository.findAllListEntities(prjctIdx, exactMatchHeaderIds, listFilter);
} }
private List<Integer> findAllSids(Long prjctIdx, ListFilterDto listFilter) { private List<String> findAllSids(Long prjctIdx, ListFilterDto listFilter) {
List<Integer> exactMatchHeaderIds = listHeaderService.getExactMatchHeaderId(prjctIdx); List<Integer> exactMatchHeaderIds = listHeaderService.getExactMatchHeaderId(prjctIdx);
return listRepository.findAllSids(prjctIdx, exactMatchHeaderIds, listFilter); return listRepository.findAllSids(prjctIdx, exactMatchHeaderIds, listFilter);
} }
@@ -388,7 +388,7 @@ public class ListSearchService {
return Collections.emptyList(); return Collections.emptyList();
} }
List<Integer> sids = rows.stream() List<String> sids = rows.stream()
.map(row -> row.listEntity().getSid()) .map(row -> row.listEntity().getSid())
.toList(); .toList();
@@ -398,7 +398,7 @@ public class ListSearchService {
return rows.stream() return rows.stream()
.map(row -> { .map(row -> {
Integer sid = row.listEntity().getSid(); String sid = row.listEntity().getSid();
return ListSearchWithResultDto.from( return ListSearchWithResultDto.from(
row.listEntity(), row.listEntity(),
row.itemList(), row.itemList(),
@@ -423,7 +423,7 @@ public class ListSearchService {
return Collections.emptyList(); return Collections.emptyList();
} }
List<Integer> sids = rows.stream() List<String> sids = rows.stream()
.map(row -> row.listEntity().getSid()) .map(row -> row.listEntity().getSid())
.toList(); .toList();
@@ -437,12 +437,12 @@ public class ListSearchService {
.with("prjctIdx", prjctIdx); .with("prjctIdx", prjctIdx);
} }
Map<Integer, ListSendResultDto> mailSendResultMap = messageResultService.findSendResultMap( Map<String, ListSendResultDto> mailSendResultMap = messageResultService.findSendResultMap(
ChannelType.EMAIL, ChannelType.EMAIL,
project.getPrjctCd(), project.getPrjctCd(),
sids sids
); );
Map<Integer, ListSendResultDto> smsSendResultMap = messageResultService.findSendResultMap( Map<String, ListSendResultDto> smsSendResultMap = messageResultService.findSendResultMap(
ChannelType.SMS, ChannelType.SMS,
project.getPrjctCd(), project.getPrjctCd(),
sids sids
@@ -450,7 +450,7 @@ public class ListSearchService {
return rows.stream() return rows.stream()
.map(row -> { .map(row -> {
Integer sid = row.listEntity().getSid(); String sid = row.listEntity().getSid();
ListSendResultDto mailSendResult = mailSendResultMap.get(sid); ListSendResultDto mailSendResult = mailSendResultMap.get(sid);
ListSendResultDto smsSendResult = smsSendResultMap.get(sid); ListSendResultDto smsSendResult = smsSendResultMap.get(sid);
return ListSearchWithFullResultDto.from( return ListSearchWithFullResultDto.from(
@@ -473,7 +473,7 @@ public class ListSearchService {
.toList(); .toList();
} }
private Map<ListResultKey, TListEventHistEntity> createLatestResultMap(Long prjctIdx, List<Integer> sids) { private Map<ListResultKey, TListEventHistEntity> createLatestResultMap(Long prjctIdx, List<String> sids) {
return listEventHistRepository return listEventHistRepository
.findLatestListByEventTyFromLatest(prjctIdx, sids) .findLatestListByEventTyFromLatest(prjctIdx, sids)
.stream() .stream()
@@ -486,7 +486,7 @@ public class ListSearchService {
} }
private List<ListSurveyResultDto> createSurveyResults( private List<ListSurveyResultDto> createSurveyResults(
Integer sid, String sid,
Map<ListResultKey, TListEventHistEntity> resultMap, Map<ListResultKey, TListEventHistEntity> resultMap,
Map<ListResultKey, Integer> attemptCountMap, Map<ListResultKey, Integer> attemptCountMap,
Map<Long, TPrjctSurveyEntity> surveyMap Map<Long, TPrjctSurveyEntity> surveyMap
@@ -518,7 +518,7 @@ public class ListSearchService {
LinkedHashMap::new LinkedHashMap::new
)); ));
} }
private Map<ListResultKey, Integer> findAttemptCountMap(Long prjctIdx, Collection<Integer> sids) { private Map<ListResultKey, Integer> findAttemptCountMap(Long prjctIdx, Collection<String> sids) {
if (sids == null || sids.isEmpty()) { if (sids == null || sids.isEmpty()) {
return Collections.emptyMap(); return Collections.emptyMap();
} }
@@ -564,11 +564,11 @@ public class ListSearchService {
return Collections.emptyList(); return Collections.emptyList();
} }
Set<Integer> sidSet = listEntities.stream() Set<String> sidSet = listEntities.stream()
.map(TListEntity::getSid) .map(TListEntity::getSid)
.collect(Collectors.toCollection(LinkedHashSet::new)); .collect(Collectors.toCollection(LinkedHashSet::new));
Map<Integer, Map<Integer, String>> itemMapBySid = createItemMapBySid(prjctIdx, sidSet, null); Map<String, Map<Integer, String>> itemMapBySid = createItemMapBySid(prjctIdx, sidSet, null);
Map<Integer, AssignValues> assignMapBySid = createAssignMapBySid(prjctIdx, sidSet); Map<String, AssignValues> assignMapBySid = createAssignMapBySid(prjctIdx, sidSet);
return listEntities.stream() return listEntities.stream()
.map(entity -> new ListSearchRow( .map(entity -> new ListSearchRow(
@@ -579,9 +579,9 @@ public class ListSearchService {
.toList(); .toList();
} }
private Map<Integer, Map<Integer, String>> createItemMapBySid( private Map<String, Map<Integer, String>> createItemMapBySid(
Long prjctIdx, Long prjctIdx,
Set<Integer> sidSet, Set<String> sidSet,
Collection<Integer> headerIds Collection<Integer> headerIds
) { ) {
List<TListItemEntity> itemEntities = headerIds == null || headerIds.isEmpty() List<TListItemEntity> itemEntities = headerIds == null || headerIds.isEmpty()
@@ -601,14 +601,14 @@ public class ListSearchService {
)); ));
} }
private Map<Integer, AssignValues> createAssignMapBySid(Long prjctIdx, Set<Integer> sidSet) { private Map<String, AssignValues> createAssignMapBySid(Long prjctIdx, Set<String> sidSet) {
List<ListAssignUserRole> assignRows = assignService.findListAssignUserRoles(prjctIdx, sidSet); List<ListAssignUserRole> assignRows = assignService.findListAssignUserRoles(prjctIdx, sidSet);
List<ListAssignCmpn> assignCmpnRows = assignService.findListAssignCmpns(prjctIdx, sidSet); List<ListAssignCmpn> assignCmpnRows = assignService.findListAssignCmpns(prjctIdx, sidSet);
if (assignRows.isEmpty() && assignCmpnRows.isEmpty()) { if (assignRows.isEmpty() && assignCmpnRows.isEmpty()) {
return Collections.emptyMap(); return Collections.emptyMap();
} }
Map<Integer, AssignValues> result = new LinkedHashMap<>(); Map<String, AssignValues> result = new LinkedHashMap<>();
for (ListAssignCmpn assignCmpnRow : assignCmpnRows) { for (ListAssignCmpn assignCmpnRow : assignCmpnRows) {
AssignValues assignValues = result.computeIfAbsent(assignCmpnRow.sid(), ignored -> AssignValues.empty()); AssignValues assignValues = result.computeIfAbsent(assignCmpnRow.sid(), ignored -> AssignValues.empty());
assignValues.outsourceUserIds().add(assignCmpnRow.cmpnId()); assignValues.outsourceUserIds().add(assignCmpnRow.cmpnId());
@@ -683,13 +683,13 @@ public class ListSearchService {
) {} ) {}
private record ListResultKey( private record ListResultKey(
Integer sid, String sid,
Short eventTy, Short eventTy,
Long prjctSurveyIdx Long prjctSurveyIdx
) {} ) {}
private record UpdateHistoryGroupKey( private record UpdateHistoryGroupKey(
Integer sid, String sid,
LocalDateTime regDt, LocalDateTime regDt,
String regUser String regUser
) {} ) {}
@@ -705,7 +705,7 @@ public class ListSearchService {
} }
public record DownloadListRow( public record DownloadListRow(
Integer sid, String sid,
Short isUse, Short isUse,
String memo, String memo,
Map<Integer, String> itemMap, Map<Integer, String> itemMap,
@@ -730,10 +730,9 @@ public class ListSearchService {
) {} ) {}
public record ListUpdateTargetRow( public record ListUpdateTargetRow(
Integer sid, String sid,
Short isUse, Short isUse,
String memo, String memo,
Map<Integer, String> itemMap Map<Integer, String> itemMap
) {} ) {}
} }

View File

@@ -84,7 +84,7 @@ public class ListUpdateService {
} }
validateResultCodes(prjctIdx, updateResultCodes); validateResultCodes(prjctIdx, updateResultCodes);
Set<Integer> sids = resolveTargetSids(prjctIdx, request.getListFilter()); Set<String> sids = resolveTargetSids(prjctIdx, request.getListFilter());
if (sids.isEmpty()) { if (sids.isEmpty()) {
return 0; return 0;
} }
@@ -97,9 +97,9 @@ public class ListUpdateService {
if (!updateContents.isEmpty()) { if (!updateContents.isEmpty()) {
List<Integer> itemHeaderIds = updateContents.keySet().stream().toList(); List<Integer> itemHeaderIds = updateContents.keySet().stream().toList();
List<Integer> sidList = new ArrayList<>(sids); List<String> sidList = new ArrayList<>(sids);
for (int i = 0; i < sidList.size(); i += chunkSize) { for (int i = 0; i < sidList.size(); i += chunkSize) {
List<Integer> sidChunk = sidList.subList(i, Math.min(sidList.size(), i + chunkSize)); List<String> sidChunk = sidList.subList(i, Math.min(sidList.size(), i + chunkSize));
List<ListSearchService.ListUpdateTargetRow> targetRows = listSearchService.findUpdateTargetRows( List<ListSearchService.ListUpdateTargetRow> targetRows = listSearchService.findUpdateTargetRows(
prjctIdx, prjctIdx,
sidChunk, sidChunk,
@@ -174,13 +174,13 @@ public class ListUpdateService {
private void insertResultCodeHistories( private void insertResultCodeHistories(
Long prjctIdx, Long prjctIdx,
Collection<Integer> sids, Collection<String> sids,
Map<ResultCodeType, Integer> resultCodes, Map<ResultCodeType, Integer> resultCodes,
String regUser, String regUser,
LocalDateTime regDt LocalDateTime regDt
) { ) {
List<ListEventHistInsertRow> rows = new ArrayList<>(); List<ListEventHistInsertRow> rows = new ArrayList<>();
for (Integer sid : sids) { for (String sid : sids) {
for (Map.Entry<ResultCodeType, Integer> entry : resultCodes.entrySet()) { for (Map.Entry<ResultCodeType, Integer> entry : resultCodes.entrySet()) {
rows.add(new ListEventHistInsertRow( rows.add(new ListEventHistInsertRow(
entry.getKey().getCode(), entry.getKey().getCode(),
@@ -197,7 +197,7 @@ public class ListUpdateService {
listUpdateJdbcSupport.batchInsertListEventHist(rows, ContactConstant.INSERT_CHUNK_SIZE); listUpdateJdbcSupport.batchInsertListEventHist(rows, ContactConstant.INSERT_CHUNK_SIZE);
} }
private void validateEventHistoryTarget(Long prjctIdx, Integer sid) { private void validateEventHistoryTarget(Long prjctIdx, String sid) {
if (!listRepository.existsByIdPrjctIdxAndIdSid(prjctIdx, sid)) { if (!listRepository.existsByIdPrjctIdxAndIdSid(prjctIdx, sid)) {
throw BusinessException.badRequest("LIST_NOT_FOUND", "이력을 추가할 리스트를 찾을 수 없습니다."); throw BusinessException.badRequest("LIST_NOT_FOUND", "이력을 추가할 리스트를 찾을 수 없습니다.");
} }
@@ -289,7 +289,7 @@ public class ListUpdateService {
LocalDateTime regDt LocalDateTime regDt
) { ) {
List<UpdateHistRow> updateHistRows = new ArrayList<>(); List<UpdateHistRow> updateHistRows = new ArrayList<>();
Map<Integer, ListUpdateRow> listUpdates = new LinkedHashMap<>(); Map<String, ListUpdateRow> listUpdates = new LinkedHashMap<>();
Map<ListItemKey, ListItemUpdateRow> itemUpdates = new LinkedHashMap<>(); Map<ListItemKey, ListItemUpdateRow> itemUpdates = new LinkedHashMap<>();
Map<ListItemKey, ListItemInsertRow> itemInserts = new LinkedHashMap<>(); Map<ListItemKey, ListItemInsertRow> itemInserts = new LinkedHashMap<>();
Map<ListItemKey, ListItemDeleteRow> itemDeletes = new LinkedHashMap<>(); Map<ListItemKey, ListItemDeleteRow> itemDeletes = new LinkedHashMap<>();
@@ -302,7 +302,7 @@ public class ListUpdateService {
for (Map.Entry<Integer, String> entry : updateContents.entrySet()) { for (Map.Entry<Integer, String> entry : updateContents.entrySet()) {
Integer headerId = entry.getKey(); Integer headerId = entry.getKey();
Integer sid = targetRow.sid(); String sid = targetRow.sid();
TListHeaderEntity header = headerMap.get(headerId); TListHeaderEntity header = headerMap.get(headerId);
boolean deleteFile = isFileDeleteCommand(header, entry.getValue()); boolean deleteFile = isFileDeleteCommand(header, entry.getValue());
String newValue = deleteFile ? "" : normalizeUpdateValue(header, entry.getValue()); String newValue = deleteFile ? "" : normalizeUpdateValue(header, entry.getValue());
@@ -428,7 +428,7 @@ public class ListUpdateService {
return; return;
} }
Set<Integer> sids = fileDeleteKeys.stream() Set<String> sids = fileDeleteKeys.stream()
.map(ListItemKey::sid) .map(ListItemKey::sid)
.collect(LinkedHashSet::new, LinkedHashSet::add, LinkedHashSet::addAll); .collect(LinkedHashSet::new, LinkedHashSet::add, LinkedHashSet::addAll);
Set<Integer> headerIds = fileDeleteKeys.stream() Set<Integer> headerIds = fileDeleteKeys.stream()
@@ -455,7 +455,7 @@ public class ListUpdateService {
} }
} }
private Set<Integer> resolveTargetSids(Long prjctIdx, ListFilterDto listFilter) { private Set<String> resolveTargetSids(Long prjctIdx, ListFilterDto listFilter) {
return new LinkedHashSet<>(listSearchService.findTargetSids(prjctIdx, listFilter)); return new LinkedHashSet<>(listSearchService.findTargetSids(prjctIdx, listFilter));
} }
@@ -545,8 +545,7 @@ public class ListUpdateService {
} }
private record ListItemKey( private record ListItemKey(
Integer sid, String sid,
Integer listHderId Integer listHderId
) {} ) {}
} }

View File

@@ -111,7 +111,7 @@ public class ListUploadService {
@Transactional @Transactional
public void uploadItemFile( public void uploadItemFile(
Long prjctIdx, Long prjctIdx,
Integer sid, String sid,
Map<String, MultipartFile> files, Map<String, MultipartFile> files,
Integer userRole, Integer userRole,
String regUser, String regUser,
@@ -376,7 +376,7 @@ public class ListUploadService {
} }
} }
private String buildItemStoredFileName(Integer sid, String headerName, String originalFileName) { private String buildItemStoredFileName(String sid, String headerName, String originalFileName) {
return sanitizeFileName(sid + "_" + headerName + "_" + originalFileName); return sanitizeFileName(sid + "_" + headerName + "_" + originalFileName);
} }
@@ -414,7 +414,7 @@ public class ListUploadService {
List<ListHeaderDto> resolvedHeaders, List<ListHeaderDto> resolvedHeaders,
Map<String, TCmpnEntity> cmpnByUploadText, Map<String, TCmpnEntity> cmpnByUploadText,
String listUploadLogId, String listUploadLogId,
Set<Integer> uploadedSids, Set<String> uploadedSids,
String uploadUser, String uploadUser,
LocalDateTime uploadDt LocalDateTime uploadDt
) { ) {
@@ -451,7 +451,7 @@ public class ListUploadService {
List<ListAssignCmpnRowInsert> assignCmpnRows = new ArrayList<>(); List<ListAssignCmpnRowInsert> assignCmpnRows = new ArrayList<>();
ExcelMapper.readStreaming(listFilePath, UPPER_CASE_HEADER_OPTIONS, (row, rowNo) -> { ExcelMapper.readStreaming(listFilePath, UPPER_CASE_HEADER_OPTIONS, (row, rowNo) -> {
Integer sid = parseOnlyInteger(row.get(sidHeaderName)); String sid = parseNumericSid(row.get(sidHeaderName));
short isUse = parseIsUseSafe(row.get(isUseHeaderName)); short isUse = parseIsUseSafe(row.get(isUseHeaderName));
String memo = normalizeBlank(row.get(memoHeaderName)); String memo = normalizeBlank(row.get(memoHeaderName));
@@ -581,7 +581,7 @@ public class ListUploadService {
String outsourceHeaderName = findOptionalHeaderNameByType(resolvedHeaders, ListHeaderType.OUTSOURCE); String outsourceHeaderName = findOptionalHeaderNameByType(resolvedHeaders, ListHeaderType.OUTSOURCE);
Set<String> prjctAssignUserSet = new LinkedHashSet<>(prjctAssignList); Set<String> prjctAssignUserSet = new LinkedHashSet<>(prjctAssignList);
Set<Integer> uploadedSids = new LinkedHashSet<>(); Set<String> uploadedSids = new LinkedHashSet<>();
List<ListUploadErrorDto> errors = new ArrayList<>(); List<ListUploadErrorDto> errors = new ArrayList<>();
List<TmpSpecialRow> tempBuffer = new ArrayList<>(); List<TmpSpecialRow> tempBuffer = new ArrayList<>();
AtomicInteger totalCount = new AtomicInteger(); AtomicInteger totalCount = new AtomicInteger();
@@ -591,7 +591,7 @@ public class ListUploadService {
ExcelMapper.readStreaming(listFilePath, UPPER_CASE_HEADER_OPTIONS, (row, rowNo) -> { ExcelMapper.readStreaming(listFilePath, UPPER_CASE_HEADER_OPTIONS, (row, rowNo) -> {
totalCount.incrementAndGet(); totalCount.incrementAndGet();
Integer sid = parseOnlyInteger(row.get(sidHeaderName)); String sid = parseNumericSid(row.get(sidHeaderName));
if (sid == null) { if (sid == null) {
errors.add(ListUploadErrorDto.of(rowNo, sidHeaderName, "SID는 필수이며 정수여야 합니다.")); errors.add(ListUploadErrorDto.of(rowNo, sidHeaderName, "SID는 필수이며 정수여야 합니다."));
return; return;
@@ -800,9 +800,14 @@ public class ListUploadService {
return parseIsUse(s); return parseIsUse(s);
} }
private String parseNumericSid(String raw) {
Integer parsed = parseOnlyInteger(raw);
return parsed == null ? null : String.valueOf(parsed);
}
private record ValidationSummary( private record ValidationSummary(
int totalCount, int totalCount,
Set<Integer> uploadedSids, Set<String> uploadedSids,
List<ListUploadErrorDto> errors List<ListUploadErrorDto> errors
) {} ) {}

View File

@@ -44,10 +44,10 @@ import org.springframework.transaction.annotation.Transactional;
public class MessageResultService { public class MessageResultService {
private final NotiHubApiClient notiHubApiClient; private final NotiHubApiClient notiHubApiClient;
public Map<Integer, ListSendResultDto> findSendResultMap( public Map<String, ListSendResultDto> findSendResultMap(
ChannelType channelTy, ChannelType channelTy,
String prjctCd, String prjctCd,
List<Integer> sids List<String> sids
) { ) {
if (sids == null || sids.isEmpty()) { if (sids == null || sids.isEmpty()) {
return Collections.emptyMap(); return Collections.emptyMap();
@@ -64,20 +64,10 @@ public class MessageResultService {
return notiHubApiClient.getLastSendResults(channelTy, REQUEST_SERVICE, prjctCd, sidValues) return notiHubApiClient.getLastSendResults(channelTy, REQUEST_SERVICE, prjctCd, sidValues)
.stream() .stream()
.collect(Collectors.toMap( .collect(Collectors.toMap(
dto -> parseSid(dto.getSid()), dto -> dto.getSid(),
ListSendResultDto::from, ListSendResultDto::from,
(left, right) -> left, (left, right) -> left,
LinkedHashMap::new LinkedHashMap::new
)); ));
} }
private Integer parseSid(String sid) {
if (sid == null || sid.isBlank()) {
return null;
}
try {
return Integer.valueOf(sid);
} catch (NumberFormatException e) {
return null;
}
}
} }

View File

@@ -183,7 +183,7 @@ public class MessageService {
) { ) {
List<NotiHubDestInfoDto> destInfos = new ArrayList<>(); List<NotiHubDestInfoDto> destInfos = new ArrayList<>();
Set<String> dedupeKeys = new LinkedHashSet<>(); Set<String> dedupeKeys = new LinkedHashSet<>();
Integer lastSid = null; String lastSid = null;
while (true) { while (true) {
List<ListSearchService.DownloadListRow> rows = listSearchService.findDownloadListRows( List<ListSearchService.DownloadListRow> rows = listSearchService.findDownloadListRows(
@@ -445,7 +445,7 @@ public class MessageService {
) {} ) {}
private static class ListFilterDtoFactory { private static class ListFilterDtoFactory {
static com.kri.contact.server.dto.list.ListFilterDto onlySid(Integer sid) { static com.kri.contact.server.dto.list.ListFilterDto onlySid(String sid) {
return com.kri.contact.server.dto.list.ListFilterDto.onlyOneSid(sid); return com.kri.contact.server.dto.list.ListFilterDto.onlyOneSid(sid);
} }
} }

View File

@@ -49,7 +49,7 @@ public class ReserveService {
} }
@Transactional(readOnly = true) @Transactional(readOnly = true)
public List<ListReserveDto> findBySid(Long prjctIdx, Integer sid) { public List<ListReserveDto> findBySid(Long prjctIdx, String sid) {
return listReserveRepository.findByPrjctIdxAndSidOrderByResveDtAscListResveIdxAsc(prjctIdx, sid) return listReserveRepository.findByPrjctIdxAndSidOrderByResveDtAscListResveIdxAsc(prjctIdx, sid)
.stream() .stream()
.map(ListReserveDto::from) .map(ListReserveDto::from)

View File

@@ -64,7 +64,7 @@ kri:
temp-cleanup-cron: "0 0 0 * * *" # 매일 00:00(초 분 시 일 월 요일) temp-cleanup-cron: "0 0 0 * * *" # 매일 00:00(초 분 시 일 월 요일)
list-upload-file: list-upload-file:
cleanup-expire-days: 7 cleanup-expire-months: 3
cleanup-cron: "0 30 0 * * SUN" cleanup-cron: "0 30 0 * * SUN"
web: web: