develop #9
@@ -31,7 +31,7 @@ public class ListCallHistController {
|
||||
@PutMapping("/{prjctIdx}/{sid}/call-start")
|
||||
public ListCallHistDto callStart(
|
||||
@PathVariable Long prjctIdx,
|
||||
@PathVariable Integer sid,
|
||||
@PathVariable String sid,
|
||||
@Valid @RequestBody ListCallStartRequestDto request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
@@ -51,7 +51,7 @@ public class ListCallHistController {
|
||||
@PutMapping("/{prjctIdx}/{sid}/call-close")
|
||||
public ListCallHistDto callClose(
|
||||
@PathVariable Long prjctIdx,
|
||||
@PathVariable Integer sid,
|
||||
@PathVariable String sid,
|
||||
@Valid @RequestBody ListCallCloseRequestDto request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
|
||||
@@ -70,7 +70,7 @@ public class ListController {
|
||||
@GetMapping("/search-sid/{prjctIdx}/{sid}")
|
||||
public ListSearchWithFullResultDto searchListWithSid(
|
||||
@PathVariable Long prjctIdx,
|
||||
@PathVariable Integer sid
|
||||
@PathVariable String 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)
|
||||
public void uploadItemFile(
|
||||
@PathVariable Long prjctIdx,
|
||||
@PathVariable Integer sid,
|
||||
@PathVariable String sid,
|
||||
@RequestParam Map<String, MultipartFile> files,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
@@ -203,7 +203,7 @@ public class ListController {
|
||||
@GetMapping("/item-file/download/{prjctIdx}/{sid}/{listHderId}")
|
||||
public ResponseEntity<byte[]> downloadOneItemFile(
|
||||
@PathVariable Long prjctIdx,
|
||||
@PathVariable Integer sid,
|
||||
@PathVariable String sid,
|
||||
@PathVariable Integer listHderId
|
||||
) {
|
||||
getProjectOrThrow(prjctIdx);
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ListHistoryController {
|
||||
@GetMapping("/event/{prjctIdx}/{sid}")
|
||||
public List<ListEventHistoryDto> findListEventHistories(
|
||||
@PathVariable Long prjctIdx,
|
||||
@PathVariable Integer sid
|
||||
@PathVariable String sid
|
||||
) {
|
||||
return listHistoryQueryService.findEventHistories(prjctIdx, sid);
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public class ListHistoryController {
|
||||
@GetMapping("/update/{prjctIdx}/{sid}")
|
||||
public List<ListUpdateHistoryDto> findListUpdateHistories(
|
||||
@PathVariable Long prjctIdx,
|
||||
@PathVariable Integer sid
|
||||
@PathVariable String sid
|
||||
) {
|
||||
return listHistoryQueryService.findUpdateHistories(prjctIdx, sid);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class ReserveController {
|
||||
@GetMapping("/{prjctIdx}/sid/{sid}")
|
||||
public List<ListReserveDto> findBySid(
|
||||
@PathVariable Long prjctIdx,
|
||||
@PathVariable Integer sid
|
||||
@PathVariable String sid
|
||||
) {
|
||||
return reserveService.findBySid(prjctIdx, sid);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public class ListCallHistDto {
|
||||
@Schema(description = "prjctIdx")
|
||||
private Long prjctIdx;
|
||||
@Schema(description = "sid")
|
||||
private Integer sid;
|
||||
private String sid;
|
||||
@Schema(description = "listHderId")
|
||||
private Integer listHderId;
|
||||
@Schema(description = "destNum")
|
||||
|
||||
@@ -24,7 +24,7 @@ public class ListEventHistFromSurveyDto {
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "리스트 고유번호")
|
||||
private Integer sid;
|
||||
private String sid;
|
||||
|
||||
@NotNull
|
||||
@Valid
|
||||
|
||||
@@ -21,7 +21,7 @@ public class ListEventHistInsertRequestDto {
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "리스트 고유 번호")
|
||||
private Integer sid;
|
||||
private String sid;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "결과 코드 타입")
|
||||
|
||||
@@ -20,7 +20,7 @@ public class ListEventHistoryDto {
|
||||
@Schema(description = "prjctSurveyIdx")
|
||||
private Long prjctSurveyIdx;
|
||||
@Schema(description = "sid")
|
||||
private Integer sid;
|
||||
private String sid;
|
||||
@Schema(description = "resultCd")
|
||||
private Integer resultCd;
|
||||
@Schema(description = "metaData")
|
||||
|
||||
@@ -58,7 +58,7 @@ public class ListFilterDto {
|
||||
@Schema(description = "기타 항목 필터 조건")
|
||||
private List<@Valid ListOtherItemFilterConditionDto> otherItemConditions;
|
||||
|
||||
public static ListFilterDto onlyOneSid(Integer sid) {
|
||||
public static ListFilterDto onlyOneSid(String sid) {
|
||||
return ListFilterDto.builder()
|
||||
.sidSet(Set.of(String.valueOf(sid)))
|
||||
.listUseSet(Set.of())
|
||||
|
||||
@@ -26,7 +26,7 @@ public class ListSearchBaseDto {
|
||||
private Long prjctIdx;
|
||||
|
||||
@Schema(description = "SID")
|
||||
private Integer sid;
|
||||
private String sid;
|
||||
|
||||
@Schema(description = "사용 여부")
|
||||
private ListIsUse use;
|
||||
|
||||
@@ -17,7 +17,7 @@ public class ListUpdateHistoryDto {
|
||||
@Schema(description = "prjctIdx")
|
||||
private Long prjctIdx;
|
||||
@Schema(description = "sid")
|
||||
private Integer sid;
|
||||
private String sid;
|
||||
@Schema(description = "listHderId")
|
||||
private Integer listHderId;
|
||||
@Schema(description = "beforeVal")
|
||||
|
||||
@@ -28,7 +28,7 @@ public class MessageSendSingleRequestDto {
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "sid")
|
||||
private Integer sid;
|
||||
private String sid;
|
||||
|
||||
@NotEmpty
|
||||
@Schema(description = "destHeaderIds")
|
||||
|
||||
@@ -17,7 +17,7 @@ public class ListReserveDto {
|
||||
@Schema(description = "prjctIdx")
|
||||
private Long prjctIdx;
|
||||
@Schema(description = "sid")
|
||||
private Integer sid;
|
||||
private String sid;
|
||||
@Schema(description = "memo")
|
||||
private String memo;
|
||||
@Schema(description = "cnfirm")
|
||||
|
||||
@@ -21,7 +21,7 @@ public class ListReserveRequestDto {
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "sid")
|
||||
private Integer sid;
|
||||
private String sid;
|
||||
|
||||
@NotBlank
|
||||
@Schema(description = "userId")
|
||||
|
||||
@@ -29,7 +29,7 @@ public class TListAssignCmpnEntity {
|
||||
|
||||
@NotNull
|
||||
@Column(name = "sid", nullable = false)
|
||||
private Integer sid;
|
||||
private String sid;
|
||||
|
||||
@Size(max = 32)
|
||||
@Column(name = "cmpn_id", length = 32)
|
||||
|
||||
@@ -29,7 +29,7 @@ public class TListAssignUserEntity {
|
||||
|
||||
@NotNull
|
||||
@Column(name = "sid", nullable = false)
|
||||
private Integer sid;
|
||||
private String sid;
|
||||
|
||||
@Size(max = 32)
|
||||
@Column(name = "user_id", length = 32)
|
||||
|
||||
@@ -44,7 +44,7 @@ public class TListCallHistEntity {
|
||||
|
||||
@NotNull
|
||||
@Column(name = "sid", nullable = false)
|
||||
private Integer sid;
|
||||
private String sid;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "list_hder_id", nullable = false)
|
||||
@@ -126,7 +126,7 @@ public class TListCallHistEntity {
|
||||
|
||||
public static TListCallHistEntity from(
|
||||
Long prjctIdx,
|
||||
Integer sid,
|
||||
String sid,
|
||||
ListCallCloseRequestDto request,
|
||||
String regUser,
|
||||
LocalDateTime regDt
|
||||
|
||||
@@ -8,6 +8,7 @@ import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -53,11 +54,17 @@ public class TListEntity {
|
||||
@Column(name = "mod_dt", insertable = false)
|
||||
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() {
|
||||
return id.getPrjctIdx();
|
||||
}
|
||||
|
||||
public Integer getSid() {
|
||||
public String getSid() {
|
||||
return id.getSid();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class TListEventHistEntity {
|
||||
|
||||
@NotNull
|
||||
@Column(name = "sid", nullable = false)
|
||||
private Integer sid;
|
||||
private String sid;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "result_cd", nullable = false)
|
||||
|
||||
@@ -29,7 +29,7 @@ public class TListEventLatestEntity {
|
||||
|
||||
@NotNull
|
||||
@Column(name = "sid", nullable = false)
|
||||
private Integer sid;
|
||||
private String sid;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "event_ty", nullable = false)
|
||||
|
||||
@@ -49,11 +49,11 @@ public class TListItemEntity {
|
||||
return id.getPrjctIdx();
|
||||
}
|
||||
|
||||
public Integer getSid() {
|
||||
public String getSid() {
|
||||
return id.getSid();
|
||||
}
|
||||
|
||||
public Integer getListHderId() {
|
||||
return id.getListHderId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class TListItemFileEntity {
|
||||
return id.getPrjctIdx();
|
||||
}
|
||||
|
||||
public Integer getSid() {
|
||||
public String getSid() {
|
||||
return id.getSid();
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class TListItemFileEntity {
|
||||
|
||||
public static TListItemFileEntity create(
|
||||
Long prjctIdx,
|
||||
Integer sid,
|
||||
String sid,
|
||||
Integer listHderId,
|
||||
String fileNm,
|
||||
Integer fileSize,
|
||||
|
||||
@@ -29,7 +29,7 @@ public class TListResveEntity {
|
||||
|
||||
@NotNull
|
||||
@Column(name = "sid", nullable = false)
|
||||
private Integer sid;
|
||||
private String sid;
|
||||
|
||||
@Size(max = 2048)
|
||||
@NotNull
|
||||
@@ -60,4 +60,4 @@ public class TListResveEntity {
|
||||
@Column(name = "reg_dt", nullable = false)
|
||||
private LocalDateTime regDt;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class TListUpdateHistEntity {
|
||||
|
||||
@NotNull
|
||||
@Column(name = "sid", nullable = false)
|
||||
private Integer sid;
|
||||
private String sid;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "list_hder_id", nullable = false)
|
||||
@@ -56,4 +56,4 @@ public class TListUpdateHistEntity {
|
||||
@Column(name = "reg_dt", nullable = false)
|
||||
private LocalDateTime regDt;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,6 @@ public class TListEntityId implements Serializable {
|
||||
|
||||
@NotNull
|
||||
@Column(name = "sid", nullable = false)
|
||||
private Integer sid;
|
||||
private String sid;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class TListEventLatestEntityId implements Serializable {
|
||||
|
||||
@NotNull
|
||||
@Column(name = "sid", nullable = false)
|
||||
private Integer sid;
|
||||
private String sid;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "event_ty", nullable = false)
|
||||
|
||||
@@ -22,10 +22,10 @@ public class TListItemEntityId implements Serializable {
|
||||
|
||||
@NotNull
|
||||
@Column(name = "sid", nullable = false)
|
||||
private Integer sid;
|
||||
private String sid;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "list_hder_id", nullable = false)
|
||||
private Integer listHderId;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,13 +22,13 @@ public class TListItemFileEntityId implements Serializable {
|
||||
|
||||
@NotNull
|
||||
@Column(name = "sid", nullable = false)
|
||||
private Integer sid;
|
||||
private String sid;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "list_hder_id", nullable = false)
|
||||
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();
|
||||
id.setPrjctIdx(prjctIdx);
|
||||
id.setSid(sid);
|
||||
|
||||
@@ -20,9 +20,9 @@ public class ListAssignJdbcSupport {
|
||||
|
||||
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;
|
||||
for (List<Integer> sub : chunkSids(sids, chunkSize)) {
|
||||
for (List<String> sub : chunkSids(sids, chunkSize)) {
|
||||
total += updateWithSidIn(
|
||||
"delete from t_list_assign_cmpn where prjct_idx = ? and sid in (",
|
||||
prjctIdx,
|
||||
@@ -32,9 +32,9 @@ public class ListAssignJdbcSupport {
|
||||
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;
|
||||
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 ("
|
||||
+ createInSql(sub) + ")";
|
||||
List<Object> args = new ArrayList<>();
|
||||
@@ -48,7 +48,7 @@ public class ListAssignJdbcSupport {
|
||||
|
||||
public void batchInsertCmpnAssign(
|
||||
Long prjctIdx,
|
||||
Collection<Integer> sids,
|
||||
Collection<String> sids,
|
||||
String cmpnId,
|
||||
String regUser,
|
||||
LocalDateTime regDt,
|
||||
@@ -64,12 +64,12 @@ public class ListAssignJdbcSupport {
|
||||
) values (?, ?, ?, ?, ?)
|
||||
""";
|
||||
|
||||
for (List<Integer> sub : chunkSids(sids, chunkSize)) {
|
||||
for (List<String> sub : chunkSids(sids, chunkSize)) {
|
||||
jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
|
||||
@Override
|
||||
public void setValues(@NonNull PreparedStatement ps, int index) throws SQLException {
|
||||
ps.setLong(1, prjctIdx);
|
||||
ps.setInt(2, sub.get(index));
|
||||
ps.setString(2, sub.get(index));
|
||||
ps.setString(3, cmpnId);
|
||||
ps.setString(4, regUser);
|
||||
ps.setTimestamp(5, Timestamp.valueOf(regDt));
|
||||
@@ -85,7 +85,7 @@ public class ListAssignJdbcSupport {
|
||||
|
||||
public void batchInsertUserAssign(
|
||||
Long prjctIdx,
|
||||
Collection<Integer> sids,
|
||||
Collection<String> sids,
|
||||
String userId,
|
||||
Short assignRole,
|
||||
String regUser,
|
||||
@@ -103,12 +103,12 @@ public class ListAssignJdbcSupport {
|
||||
) values (?, ?, ?, ?, ?, ?)
|
||||
""";
|
||||
|
||||
for (List<Integer> sub : chunkSids(sids, chunkSize)) {
|
||||
for (List<String> sub : chunkSids(sids, chunkSize)) {
|
||||
jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
|
||||
@Override
|
||||
public void setValues(@NonNull PreparedStatement ps, int index) throws SQLException {
|
||||
ps.setLong(1, prjctIdx);
|
||||
ps.setInt(2, sub.get(index));
|
||||
ps.setString(2, sub.get(index));
|
||||
ps.setString(3, userId);
|
||||
ps.setShort(4, assignRole);
|
||||
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;
|
||||
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 ("
|
||||
+ createInSql(sub) + ")";
|
||||
List<Object> args = new ArrayList<>();
|
||||
@@ -137,7 +137,7 @@ public class ListAssignJdbcSupport {
|
||||
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) + ")";
|
||||
List<Object> args = new ArrayList<>();
|
||||
args.add(prjctIdx);
|
||||
@@ -145,7 +145,7 @@ public class ListAssignJdbcSupport {
|
||||
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()) {
|
||||
return List.of();
|
||||
}
|
||||
@@ -153,15 +153,15 @@ public class ListAssignJdbcSupport {
|
||||
throw new IllegalArgumentException("chunkSize must be greater than 0");
|
||||
}
|
||||
|
||||
List<Integer> sidList = sids instanceof List<Integer> list ? list : new ArrayList<>(sids);
|
||||
List<List<Integer>> chunks = new ArrayList<>();
|
||||
List<String> sidList = sids instanceof List<String> list ? list : new ArrayList<>(sids);
|
||||
List<List<String>> chunks = new ArrayList<>();
|
||||
for (int i = 0; i < sidList.size(); i += chunkSize) {
|
||||
chunks.add(sidList.subList(i, Math.min(sidList.size(), i + chunkSize)));
|
||||
}
|
||||
return chunks;
|
||||
}
|
||||
|
||||
private String createInSql(List<Integer> sids) {
|
||||
private String createInSql(List<String> sids) {
|
||||
StringJoiner joiner = new StringJoiner(",");
|
||||
for (int i = 0; i < sids.size(); i++) {
|
||||
joiner.add("?");
|
||||
|
||||
@@ -16,7 +16,7 @@ public class ListCallHistJdbcSupport {
|
||||
|
||||
public void upsertCallHistory(
|
||||
Long prjctIdx,
|
||||
Integer sid,
|
||||
String sid,
|
||||
ListCallStartRequestDto request,
|
||||
CallStatus callStatus,
|
||||
String regUser,
|
||||
@@ -95,4 +95,3 @@ public class ListCallHistJdbcSupport {
|
||||
return value == null ? "" : value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ public class ListResetJdbcSupport {
|
||||
|
||||
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()) {
|
||||
return DeleteCounts.empty();
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public class ListResetJdbcSupport {
|
||||
|
||||
public DeleteCounts deleteListData(
|
||||
Long prjctIdx,
|
||||
Collection<Integer> sids,
|
||||
Collection<String> sids,
|
||||
boolean includeFile,
|
||||
boolean includeResve,
|
||||
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();
|
||||
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();
|
||||
|
||||
List<Integer> sidList = new ArrayList<>(sids);
|
||||
for (List<Integer> sub : chunkSids(sidList, chunkSize)) {
|
||||
List<String> sidList = new ArrayList<>(sids);
|
||||
for (List<String> sub : chunkSids(sidList, chunkSize)) {
|
||||
insertTempSids(sub);
|
||||
}
|
||||
}
|
||||
|
||||
private void insertTempSids(List<Integer> sids) {
|
||||
private void insertTempSids(List<String> sids) {
|
||||
if (sids.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@@ -116,7 +116,7 @@ public class ListResetJdbcSupport {
|
||||
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()) {
|
||||
return List.of();
|
||||
}
|
||||
@@ -124,15 +124,15 @@ public class ListResetJdbcSupport {
|
||||
throw new IllegalArgumentException("chunkSize must be greater than 0");
|
||||
}
|
||||
|
||||
List<Integer> sidList = new ArrayList<>(sids);
|
||||
List<List<Integer>> chunks = new ArrayList<>();
|
||||
List<String> sidList = new ArrayList<>(sids);
|
||||
List<List<String>> chunks = new ArrayList<>();
|
||||
for (int i = 0; i < sidList.size(); i += chunkSize) {
|
||||
chunks.add(sidList.subList(i, Math.min(sidList.size(), i + chunkSize)));
|
||||
}
|
||||
return chunks;
|
||||
}
|
||||
|
||||
private String createValuesSql(List<Integer> sids) {
|
||||
private String createValuesSql(List<String> sids) {
|
||||
StringJoiner joiner = new StringJoiner(",");
|
||||
for (int i = 0; i < sids.size(); i++) {
|
||||
joiner.add("(:sid" + i + ")");
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ListUpdateJdbcSupport {
|
||||
public void setValues(@NonNull PreparedStatement ps, int index) throws SQLException {
|
||||
UpdateHistRow row = sub.get(index);
|
||||
ps.setLong(1, row.prjctIdx());
|
||||
ps.setInt(2, row.sid());
|
||||
ps.setString(2, row.sid());
|
||||
ps.setInt(3, row.listHderId());
|
||||
ps.setString(4, row.beforeVal());
|
||||
ps.setString(5, row.afterVal());
|
||||
@@ -79,7 +79,7 @@ public class ListUpdateJdbcSupport {
|
||||
ps.setString(3, row.modUser());
|
||||
ps.setTimestamp(4, Timestamp.valueOf(row.modDt()));
|
||||
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.setTimestamp(3, Timestamp.valueOf(row.modDt()));
|
||||
ps.setLong(4, row.prjctIdx());
|
||||
ps.setInt(5, row.sid());
|
||||
ps.setString(5, row.sid());
|
||||
ps.setInt(6, row.listHderId());
|
||||
});
|
||||
}
|
||||
@@ -126,7 +126,7 @@ public class ListUpdateJdbcSupport {
|
||||
|
||||
batchUpdate(rows, batchSize, sql, (ps, row) -> {
|
||||
ps.setLong(1, row.prjctIdx());
|
||||
ps.setInt(2, row.sid());
|
||||
ps.setString(2, row.sid());
|
||||
ps.setInt(3, row.listHderId());
|
||||
ps.setString(4, row.listItemVal());
|
||||
ps.setString(5, row.regUser());
|
||||
@@ -148,7 +148,7 @@ public class ListUpdateJdbcSupport {
|
||||
|
||||
batchUpdate(rows, batchSize, sql, (ps, row) -> {
|
||||
ps.setLong(1, row.prjctIdx());
|
||||
ps.setInt(2, row.sid());
|
||||
ps.setString(2, row.sid());
|
||||
ps.setInt(3, row.listHderId());
|
||||
});
|
||||
}
|
||||
@@ -174,7 +174,7 @@ public class ListUpdateJdbcSupport {
|
||||
batchUpdate(rows, batchSize, sql, (ps, row) -> {
|
||||
ps.setShort(1, row.eventTy());
|
||||
ps.setLong(2, row.prjctIdx());
|
||||
ps.setInt(3, row.sid());
|
||||
ps.setString(3, row.sid());
|
||||
ps.setInt(4, row.resultCd());
|
||||
if (row.metaData() == null) {
|
||||
ps.setNull(5, Types.VARCHAR);
|
||||
@@ -211,7 +211,7 @@ public class ListUpdateJdbcSupport {
|
||||
|
||||
public record UpdateHistRow(
|
||||
Long prjctIdx,
|
||||
Integer sid,
|
||||
String sid,
|
||||
Integer listHderId,
|
||||
String beforeVal,
|
||||
String afterVal,
|
||||
@@ -221,7 +221,7 @@ public class ListUpdateJdbcSupport {
|
||||
|
||||
public record ListUpdateRow(
|
||||
Long prjctIdx,
|
||||
Integer sid,
|
||||
String sid,
|
||||
Short isUse,
|
||||
String memo,
|
||||
String modUser,
|
||||
@@ -230,7 +230,7 @@ public class ListUpdateJdbcSupport {
|
||||
|
||||
public record ListItemUpdateRow(
|
||||
Long prjctIdx,
|
||||
Integer sid,
|
||||
String sid,
|
||||
Integer listHderId,
|
||||
String listItemVal,
|
||||
String modUser,
|
||||
@@ -239,7 +239,7 @@ public class ListUpdateJdbcSupport {
|
||||
|
||||
public record ListItemInsertRow(
|
||||
Long prjctIdx,
|
||||
Integer sid,
|
||||
String sid,
|
||||
Integer listHderId,
|
||||
String listItemVal,
|
||||
String regUser,
|
||||
@@ -248,14 +248,14 @@ public class ListUpdateJdbcSupport {
|
||||
|
||||
public record ListItemDeleteRow(
|
||||
Long prjctIdx,
|
||||
Integer sid,
|
||||
String sid,
|
||||
Integer listHderId
|
||||
) {}
|
||||
|
||||
public record ListEventHistInsertRow(
|
||||
Short eventTy,
|
||||
Long prjctIdx,
|
||||
Integer sid,
|
||||
String sid,
|
||||
Integer resultCd,
|
||||
String metaData,
|
||||
String memo,
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ListUploadJdbcSupport {
|
||||
ps.setString(1, r.listUploadLogId());
|
||||
ps.setLong(2, r.prjctIdx());
|
||||
ps.setInt(3, r.rowNo());
|
||||
ps.setInt(4, r.sid());
|
||||
ps.setString(4, r.sid());
|
||||
ps.setInt(5, r.listHderId());
|
||||
ps.setShort(6, r.specificType());
|
||||
setNullableString(ps, 7, r.rawVal());
|
||||
@@ -159,7 +159,7 @@ public class ListUploadJdbcSupport {
|
||||
public void setValues(@NonNull PreparedStatement ps, int index) throws SQLException {
|
||||
ListRowInsert r = sub.get(index);
|
||||
ps.setLong(1, r.prjctIdx());
|
||||
ps.setInt(2, r.sid());
|
||||
ps.setString(2, r.sid());
|
||||
ps.setString(3, r.listUploadLogId());
|
||||
ps.setShort(4, r.isUse());
|
||||
setNullableString(ps, 5, r.memo());
|
||||
@@ -198,7 +198,7 @@ public class ListUploadJdbcSupport {
|
||||
public void setValues(@NonNull PreparedStatement ps, int index) throws SQLException {
|
||||
ListItemRowInsert r = sub.get(index);
|
||||
ps.setLong(1, r.prjctIdx());
|
||||
ps.setInt(2, r.sid());
|
||||
ps.setString(2, r.sid());
|
||||
ps.setInt(3, r.listHderId());
|
||||
setNullableString(ps, 4, r.listItemVal());
|
||||
ps.setString(5, r.regUser());
|
||||
@@ -236,7 +236,7 @@ public class ListUploadJdbcSupport {
|
||||
public void setValues(@NonNull PreparedStatement ps, int index) throws SQLException {
|
||||
ListAssignRowInsert r = sub.get(index);
|
||||
ps.setLong(1, r.prjctIdx());
|
||||
ps.setInt(2, r.sid());
|
||||
ps.setString(2, r.sid());
|
||||
ps.setString(3, r.userId());
|
||||
ps.setShort(4, r.assignRole());
|
||||
ps.setString(5, r.regUser());
|
||||
@@ -273,7 +273,7 @@ public class ListUploadJdbcSupport {
|
||||
public void setValues(@NonNull PreparedStatement ps, int index) throws SQLException {
|
||||
ListAssignCmpnRowInsert r = sub.get(index);
|
||||
ps.setLong(1, r.prjctIdx());
|
||||
ps.setInt(2, r.sid());
|
||||
ps.setString(2, r.sid());
|
||||
ps.setString(3, r.cmpnId());
|
||||
ps.setString(4, r.regUser());
|
||||
ps.setTimestamp(5, Timestamp.valueOf(r.regDt()));
|
||||
@@ -299,7 +299,7 @@ public class ListUploadJdbcSupport {
|
||||
String listUploadLogId,
|
||||
Long prjctIdx,
|
||||
int rowNo,
|
||||
int sid,
|
||||
String sid,
|
||||
int listHderId,
|
||||
short specificType,
|
||||
String rawVal,
|
||||
@@ -314,7 +314,7 @@ public class ListUploadJdbcSupport {
|
||||
|
||||
public record ListRowInsert(
|
||||
Long prjctIdx,
|
||||
int sid,
|
||||
String sid,
|
||||
String listUploadLogId,
|
||||
short isUse,
|
||||
String memo,
|
||||
@@ -324,7 +324,7 @@ public class ListUploadJdbcSupport {
|
||||
|
||||
public record ListItemRowInsert(
|
||||
Long prjctIdx,
|
||||
int sid,
|
||||
String sid,
|
||||
int listHderId,
|
||||
String listItemVal,
|
||||
String regUser,
|
||||
@@ -333,7 +333,7 @@ public class ListUploadJdbcSupport {
|
||||
|
||||
public record ListAssignRowInsert(
|
||||
Long prjctIdx,
|
||||
int sid,
|
||||
String sid,
|
||||
String userId,
|
||||
short assignRole,
|
||||
String regUser,
|
||||
@@ -342,7 +342,7 @@ public class ListUploadJdbcSupport {
|
||||
|
||||
public record ListAssignCmpnRowInsert(
|
||||
Long prjctIdx,
|
||||
int sid,
|
||||
String sid,
|
||||
String cmpnId,
|
||||
String regUser,
|
||||
LocalDateTime regDt
|
||||
|
||||
@@ -11,7 +11,7 @@ public interface ListAssignCmpnRepository extends JpaRepository<TListAssignCmpnE
|
||||
|
||||
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)
|
||||
@Query("""
|
||||
@@ -26,7 +26,7 @@ public interface ListAssignCmpnRepository extends JpaRepository<TListAssignCmpnE
|
||||
where a.prjctIdx = :prjctIdx
|
||||
and a.sid in :sids
|
||||
""")
|
||||
int deleteWithPrjctIdxAndSids(Long prjctIdx, Collection<Integer> sids);
|
||||
int deleteWithPrjctIdxAndSids(Long prjctIdx, Collection<String> sids);
|
||||
|
||||
@Modifying(clearAutomatically = true, flushAutomatically = true)
|
||||
@Query("""
|
||||
@@ -43,5 +43,5 @@ public interface ListAssignCmpnRepository extends JpaRepository<TListAssignCmpnE
|
||||
and a.sid in :sids
|
||||
order by a.sid asc, a.listAssignIdx asc
|
||||
""")
|
||||
List<TListAssignCmpnEntity> findByPrjctIdxAndSidIn(Long prjctIdx, Collection<Integer> sids);
|
||||
List<TListAssignCmpnEntity> findByPrjctIdxAndSidIn(Long prjctIdx, Collection<String> sids);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ public interface ListAssignUserRepository extends JpaRepository<TListAssignUserE
|
||||
|
||||
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)
|
||||
@Query("""
|
||||
@@ -26,7 +26,7 @@ public interface ListAssignUserRepository extends JpaRepository<TListAssignUserE
|
||||
where a.prjctIdx = :prjctIdx
|
||||
and a.sid in :sids
|
||||
""")
|
||||
int deleteWithPrjctIdxAndSids(Long prjctIdx, Collection<Integer> sids);
|
||||
int deleteWithPrjctIdxAndSids(Long prjctIdx, Collection<String> sids);
|
||||
|
||||
@Modifying(clearAutomatically = true, flushAutomatically = true)
|
||||
@Query("""
|
||||
@@ -38,7 +38,7 @@ public interface ListAssignUserRepository extends JpaRepository<TListAssignUserE
|
||||
int deleteByPrjctIdxAndAssignRoleAndSidIn(
|
||||
Long prjctIdx,
|
||||
Short assignRole,
|
||||
Collection<Integer> sids
|
||||
Collection<String> sids
|
||||
);
|
||||
|
||||
@Query("""
|
||||
@@ -48,7 +48,7 @@ public interface ListAssignUserRepository extends JpaRepository<TListAssignUserE
|
||||
and a.sid in :sids
|
||||
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)
|
||||
@Query("""
|
||||
|
||||
@@ -11,7 +11,7 @@ public interface ListEventHistRepository extends JpaRepository<TListEventHistEnt
|
||||
|
||||
List<TListEventHistEntity> findByPrjctIdxAndSidOrderByRegDtDescListEventHistIdxDesc(
|
||||
Long prjctIdx,
|
||||
Integer sid
|
||||
String sid
|
||||
);
|
||||
|
||||
@Query("""
|
||||
@@ -28,7 +28,7 @@ public interface ListEventHistRepository extends JpaRepository<TListEventHistEnt
|
||||
""")
|
||||
List<TListEventHistEntity> findLatestListByEventTyFromLatest(
|
||||
Long prjctIdx,
|
||||
List<Integer> sids
|
||||
List<String> sids
|
||||
);
|
||||
|
||||
@Query("""
|
||||
@@ -43,7 +43,7 @@ public interface ListEventHistRepository extends JpaRepository<TListEventHistEnt
|
||||
""")
|
||||
List<TListEventHistEntity> findDownloadHistories(
|
||||
Long prjctIdx,
|
||||
Collection<Integer> sids,
|
||||
Collection<String> sids,
|
||||
Collection<Short> eventTypes,
|
||||
LocalDateTime startDate,
|
||||
LocalDateTime endDate
|
||||
@@ -67,7 +67,7 @@ public interface ListEventHistRepository extends JpaRepository<TListEventHistEnt
|
||||
""")
|
||||
List<TListEventHistEntity> findLatestDownloadHistories(
|
||||
Long prjctIdx,
|
||||
Collection<Integer> sids,
|
||||
Collection<String> sids,
|
||||
Collection<Short> eventTypes,
|
||||
LocalDateTime startDate,
|
||||
LocalDateTime endDate
|
||||
@@ -88,7 +88,7 @@ public interface ListEventHistRepository extends JpaRepository<TListEventHistEnt
|
||||
""")
|
||||
List<TListEventHistEntity> findLatestDownloadHistoriesFromLatest(
|
||||
Long prjctIdx,
|
||||
Collection<Integer> sids,
|
||||
Collection<String> sids,
|
||||
Collection<Short> eventTypes
|
||||
);
|
||||
|
||||
@@ -104,7 +104,7 @@ public interface ListEventHistRepository extends JpaRepository<TListEventHistEnt
|
||||
""")
|
||||
List<EventHistoryCountProjection> findDownloadHistoryCounts(
|
||||
Long prjctIdx,
|
||||
Collection<Integer> sids,
|
||||
Collection<String> sids,
|
||||
Collection<Short> eventTypes,
|
||||
LocalDateTime startDate,
|
||||
LocalDateTime endDate
|
||||
@@ -123,17 +123,17 @@ public interface ListEventHistRepository extends JpaRepository<TListEventHistEnt
|
||||
""")
|
||||
List<EventTypeHistoryCountProjection> findHistoryCountsByEventType(
|
||||
Long prjctIdx,
|
||||
Collection<Integer> sids,
|
||||
Collection<String> sids,
|
||||
Collection<Short> eventTypes
|
||||
);
|
||||
|
||||
interface EventHistoryCountProjection {
|
||||
Integer getSid();
|
||||
String getSid();
|
||||
Long getHistoryCount();
|
||||
}
|
||||
|
||||
interface EventTypeHistoryCountProjection {
|
||||
Integer getSid();
|
||||
String getSid();
|
||||
Short getEventTy();
|
||||
Long getPrjctSurveyIdx();
|
||||
Long getHistoryCount();
|
||||
|
||||
@@ -12,7 +12,7 @@ public interface ListItemFileRepository extends JpaRepository<TListItemFileEntit
|
||||
|
||||
List<TListItemFileEntity> findByIdPrjctIdxAndIdSidInAndIdListHderIdInOrderByIdSidAscIdListHderIdAsc(
|
||||
Long prjctIdx,
|
||||
Collection<Integer> sids,
|
||||
Collection<String> sids,
|
||||
Collection<Integer> listHderIds
|
||||
);
|
||||
|
||||
@@ -31,6 +31,6 @@ public interface ListItemFileRepository extends JpaRepository<TListItemFileEntit
|
||||
""")
|
||||
int deleteWithPrjctIdxAndSids(
|
||||
Long prjctIdx,
|
||||
Collection<Integer> sids
|
||||
Collection<String> sids
|
||||
);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public interface ListItemRepository extends JpaRepository<TListItemEntity, TList
|
||||
""")
|
||||
int deleteByPrjctIdxAndSids(
|
||||
Long prjctIdx,
|
||||
Collection<Integer> sids
|
||||
Collection<String> sids
|
||||
);
|
||||
|
||||
@Modifying(clearAutomatically = true, flushAutomatically = true)
|
||||
@@ -45,7 +45,7 @@ public interface ListItemRepository extends JpaRepository<TListItemEntity, TList
|
||||
""")
|
||||
int deleteByPrjctIdxAndSidsExceptHeaderIds(
|
||||
Long prjctIdx,
|
||||
Collection<Integer> sids,
|
||||
Collection<String> sids,
|
||||
Collection<Integer> rejectHeaderIds
|
||||
);
|
||||
|
||||
@@ -58,12 +58,12 @@ public interface ListItemRepository extends JpaRepository<TListItemEntity, TList
|
||||
""")
|
||||
List<TListItemEntity> findByIdPrjctIdxAndIdSidIn(
|
||||
Long prjctIdx,
|
||||
Set<Integer> sids
|
||||
Set<String> sids
|
||||
);
|
||||
|
||||
List<TListItemEntity> findByIdPrjctIdxAndIdSidInAndIdListHderIdIn(
|
||||
Long prjctIdx,
|
||||
Set<Integer> sids,
|
||||
Set<String> sids,
|
||||
Collection<Integer> listHderIds
|
||||
);
|
||||
|
||||
|
||||
@@ -11,21 +11,21 @@ public interface ListQueryRepository {
|
||||
|
||||
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(
|
||||
Long prjctIdx,
|
||||
List<Integer> emailTelnumHeaderIds,
|
||||
ListFilterDto listFilter,
|
||||
Integer lastSid,
|
||||
String lastSid,
|
||||
int limit
|
||||
);
|
||||
|
||||
List<Integer> findChunkedSids(
|
||||
List<String> findChunkedSids(
|
||||
Long prjctIdx,
|
||||
List<Integer> emailTelnumHeaderIds,
|
||||
ListFilterDto listFilter,
|
||||
Integer lastSid,
|
||||
String lastSid,
|
||||
int limit
|
||||
);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.querydsl.core.types.dsl.StringPath;
|
||||
import com.querydsl.jpa.impl.JPAQuery;
|
||||
import com.querydsl.jpa.JPAExpressions;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -81,14 +82,14 @@ public class ListQueryRepositoryImpl implements ListQueryRepository {
|
||||
QTListEntity list = QTListEntity.tListEntity;
|
||||
BooleanBuilder predicate = buildListFilterPredicate(prjctIdx, exactMatchHeaderIds, listFilter, list);
|
||||
|
||||
return jpaQueryFactory.selectFrom(list)
|
||||
.where(predicate)
|
||||
.orderBy(list.id.sid.asc())
|
||||
.fetch();
|
||||
JPAQuery<TListEntity> query = jpaQueryFactory.selectFrom(list)
|
||||
.where(predicate);
|
||||
orderByNaturalSid(query, list, Order.ASC);
|
||||
return query.fetch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> findAllSids(
|
||||
public List<String> findAllSids(
|
||||
Long prjctIdx,
|
||||
List<Integer> exactMatchHeaderIds,
|
||||
ListFilterDto listFilter
|
||||
@@ -96,11 +97,11 @@ public class ListQueryRepositoryImpl implements ListQueryRepository {
|
||||
QTListEntity list = QTListEntity.tListEntity;
|
||||
BooleanBuilder predicate = buildListFilterPredicate(prjctIdx, exactMatchHeaderIds, listFilter, list);
|
||||
|
||||
return jpaQueryFactory.select(list.id.sid)
|
||||
JPAQuery<String> query = jpaQueryFactory.select(list.id.sid)
|
||||
.from(list)
|
||||
.where(predicate)
|
||||
.orderBy(list.id.sid.asc())
|
||||
.fetch();
|
||||
.where(predicate);
|
||||
orderByNaturalSid(query, list, Order.ASC);
|
||||
return query.fetch();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,44 +109,73 @@ public class ListQueryRepositoryImpl implements ListQueryRepository {
|
||||
Long prjctIdx,
|
||||
List<Integer> exactMatchHeaderIds,
|
||||
ListFilterDto listFilter,
|
||||
Integer lastSid,
|
||||
String lastSid,
|
||||
int limit
|
||||
) {
|
||||
QTListEntity list = QTListEntity.tListEntity;
|
||||
BooleanBuilder predicate = buildListFilterPredicate(prjctIdx, exactMatchHeaderIds, listFilter, list);
|
||||
if (lastSid != null) {
|
||||
predicate.and(list.id.sid.gt(lastSid));
|
||||
predicate.and(toAfterSidSortCursorPredicate(prjctIdx, list, lastSid));
|
||||
}
|
||||
|
||||
return jpaQueryFactory.selectFrom(list)
|
||||
.where(predicate)
|
||||
.orderBy(list.id.sid.asc())
|
||||
JPAQuery<TListEntity> query = jpaQueryFactory.selectFrom(list)
|
||||
.where(predicate);
|
||||
orderByNaturalSid(query, list, Order.ASC);
|
||||
return query
|
||||
.limit(limit)
|
||||
.fetch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> findChunkedSids(
|
||||
public List<String> findChunkedSids(
|
||||
Long prjctIdx,
|
||||
List<Integer> exactMatchHeaderIds,
|
||||
ListFilterDto listFilter,
|
||||
Integer lastSid,
|
||||
String lastSid,
|
||||
int limit
|
||||
) {
|
||||
QTListEntity list = QTListEntity.tListEntity;
|
||||
BooleanBuilder predicate = buildListFilterPredicate(prjctIdx, exactMatchHeaderIds, listFilter, list);
|
||||
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)
|
||||
.where(predicate)
|
||||
.orderBy(list.id.sid.asc())
|
||||
.where(predicate);
|
||||
orderByNaturalSid(query, list, Order.ASC);
|
||||
return query
|
||||
.limit(limit)
|
||||
.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(
|
||||
Long prjctIdx,
|
||||
List<Integer> exactMatchHeaderIds,
|
||||
@@ -180,7 +210,7 @@ public class ListQueryRepositoryImpl implements ListQueryRepository {
|
||||
|
||||
private void appendSidPredicates(BooleanBuilder predicate, QTListEntity list, Set<String> sidSet) {
|
||||
BooleanBuilder sidPredicate = new BooleanBuilder();
|
||||
Set<Integer> sidNumbers = new LinkedHashSet<>();
|
||||
Set<String> sidNumbers = new LinkedHashSet<>();
|
||||
|
||||
for (String sidCondition : sidSet) {
|
||||
String normalized = normalizeBlank(sidCondition);
|
||||
@@ -191,7 +221,10 @@ public class ListQueryRepositoryImpl implements ListQueryRepository {
|
||||
if (normalized.contains("~")) {
|
||||
sidPredicate.or(toSidRangePredicate(list, normalized));
|
||||
} 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;
|
||||
}
|
||||
|
||||
Integer start = parseSidNumber(tokens[0].trim(), normalized);
|
||||
Integer end = parseSidNumber(tokens[1].trim(), normalized);
|
||||
BigDecimal start = parseSidNumber(tokens[0].trim(), normalized);
|
||||
BigDecimal end = parseSidNumber(tokens[1].trim(), normalized);
|
||||
|
||||
if(start == null || end == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (start > end) {
|
||||
Integer temp = start;
|
||||
if (start.compareTo(end) > 0) {
|
||||
BigDecimal temp = start;
|
||||
start = end;
|
||||
end = temp;
|
||||
}
|
||||
|
||||
return new BooleanBuilder()
|
||||
.and(list.id.sid.goe(start))
|
||||
.and(list.id.sid.loe(end));
|
||||
.and(list.sidSortNumber.isNotNull())
|
||||
.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+")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return Integer.valueOf(value);
|
||||
BigDecimal parsed = new BigDecimal(value);
|
||||
if (parsed.precision() > 32) {
|
||||
throw invalidSidCondition(originalCondition);
|
||||
}
|
||||
return parsed;
|
||||
} catch (NumberFormatException e) {
|
||||
throw invalidSidCondition(originalCondition);
|
||||
}
|
||||
@@ -822,6 +860,10 @@ public class ListQueryRepositoryImpl implements ListQueryRepository {
|
||||
PageRequestDto pageRequest
|
||||
) {
|
||||
SortTarget sortTarget = resolveSortTarget(pageRequest);
|
||||
if (sortTarget.naturalSid()) {
|
||||
orderByNaturalSid(query, list, sortTarget.order());
|
||||
return;
|
||||
}
|
||||
if (sortTarget.assignType() != null) {
|
||||
applyAssignSort(query, list, prjctIdx, sortTarget);
|
||||
} else if (sortTarget.listHderId() != null) {
|
||||
@@ -831,7 +873,15 @@ public class ListQueryRepositoryImpl implements ListQueryRepository {
|
||||
} else {
|
||||
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) {
|
||||
@@ -863,7 +913,7 @@ public class ListQueryRepositoryImpl implements ListQueryRepository {
|
||||
if (listHderId != null) {
|
||||
return SortTarget.item(order, listHderId);
|
||||
}
|
||||
return SortTarget.base(order, QTListEntity.tListEntity.id.sid);
|
||||
return SortTarget.sidNatural(order);
|
||||
}
|
||||
|
||||
private void applyAssignSort(
|
||||
@@ -970,22 +1020,27 @@ public class ListQueryRepositoryImpl implements ListQueryRepository {
|
||||
Short assignType,
|
||||
Integer listHderId,
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
return new SortTarget(order, null, null, null, resultType, prjctSurveyIdx);
|
||||
return new SortTarget(order, null, null, null, resultType, prjctSurveyIdx, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,16 +14,16 @@ import org.springframework.data.jpa.repository.Query;
|
||||
public interface ListRepository extends JpaRepository<TListEntity, TListEntityId>,
|
||||
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("""
|
||||
select l.id.sid
|
||||
from TListEntity l
|
||||
where l.id.prjctIdx = :prjctIdx
|
||||
""")
|
||||
Set<Integer> findSidsByPrjctIdx(Long prjctIdx);
|
||||
Set<String> findSidsByPrjctIdx(Long prjctIdx);
|
||||
|
||||
@Modifying(clearAutomatically = true, flushAutomatically = true)
|
||||
@Query("""
|
||||
@@ -40,6 +40,6 @@ public interface ListRepository extends JpaRepository<TListEntity, TListEntityId
|
||||
""")
|
||||
int deleteWithPrjctIdxAndSids(
|
||||
Long prjctIdx,
|
||||
Collection<Integer> sids
|
||||
Collection<String> sids
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@ public interface ListReserveRepository extends JpaRepository<TListResveEntity, L
|
||||
|
||||
List<TListResveEntity> findByPrjctIdxAndSidOrderByResveDtAscListResveIdxAsc(
|
||||
Long prjctIdx,
|
||||
Integer sid
|
||||
String sid
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ public interface ListUpdateHistRepository extends JpaRepository<TListUpdateHistE
|
||||
|
||||
List<TListUpdateHistEntity> findByPrjctIdxAndSidOrderByRegDtDescListUpdateHistIdxDesc(
|
||||
Long prjctIdx,
|
||||
Integer sid
|
||||
String sid
|
||||
);
|
||||
|
||||
@Query("""
|
||||
@@ -23,7 +23,7 @@ public interface ListUpdateHistRepository extends JpaRepository<TListUpdateHistE
|
||||
""")
|
||||
List<TListUpdateHistEntity> findDownloadHistories(
|
||||
Long prjctIdx,
|
||||
Collection<Integer> sids
|
||||
Collection<String> sids
|
||||
);
|
||||
|
||||
@Query("""
|
||||
@@ -36,11 +36,11 @@ public interface ListUpdateHistRepository extends JpaRepository<TListUpdateHistE
|
||||
""")
|
||||
List<UpdateHistoryGroupProjection> findDownloadHistoryGroups(
|
||||
Long prjctIdx,
|
||||
Collection<Integer> sids
|
||||
Collection<String> sids
|
||||
);
|
||||
|
||||
interface UpdateHistoryGroupProjection {
|
||||
Integer getSid();
|
||||
String getSid();
|
||||
LocalDateTime getRegDt();
|
||||
String getRegUser();
|
||||
}
|
||||
|
||||
@@ -17,22 +17,22 @@ public class ListUploadFileCleanupScheduler {
|
||||
|
||||
private final ListUploadLogRepository listUploadLogRepository;
|
||||
private final ListFileService listFileService;
|
||||
private final long expireDays;
|
||||
private final long expireMonths;
|
||||
|
||||
public ListUploadFileCleanupScheduler(
|
||||
ListUploadLogRepository listUploadLogRepository,
|
||||
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.listFileService = listFileService;
|
||||
this.expireDays = expireDays;
|
||||
this.expireMonths = expireMonths;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Scheduled(cron = "${kri.list-upload-file.cleanup-cron:0 30 0 * * SUN}")
|
||||
public void cleanupOldListUploadFiles() {
|
||||
LocalDateTime threshold = LocalDateTime.now().minusDays(expireDays);
|
||||
LocalDateTime threshold = LocalDateTime.now().minusMonths(expireMonths);
|
||||
LocalDateTime deletedAt = LocalDateTime.now();
|
||||
|
||||
List<TListUploadLogEntity> uploadLogs =
|
||||
|
||||
@@ -158,7 +158,7 @@ public class AssignService {
|
||||
);
|
||||
}
|
||||
ListAssignType assignType = requireAssignType(req.getAssignType());
|
||||
Set<Integer> targetSids = resolveTargetSids(prjctIdx, req.getListFilter());
|
||||
Set<String> targetSids = resolveTargetSids(prjctIdx, req.getListFilter());
|
||||
if (targetSids.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
@@ -201,7 +201,7 @@ public class AssignService {
|
||||
@Transactional
|
||||
public Integer resetListAssign(Long prjctIdx, ListAssignResetRequestDto req) {
|
||||
ListAssignType assignType = requireAssignType(req == null ? null : req.getAssignType());
|
||||
Set<Integer> targetSids = resolveTargetSids(prjctIdx, req);
|
||||
Set<String> targetSids = resolveTargetSids(prjctIdx, req);
|
||||
if (targetSids.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
@@ -218,7 +218,7 @@ public class AssignService {
|
||||
}
|
||||
|
||||
@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()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -257,7 +257,7 @@ public class AssignService {
|
||||
}
|
||||
|
||||
@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()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -368,23 +368,23 @@ public class AssignService {
|
||||
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());
|
||||
}
|
||||
|
||||
private Set<Integer> resolveTargetSids(Long prjctIdx, ListFilterDto listFilter) {
|
||||
private Set<String> resolveTargetSids(Long prjctIdx, ListFilterDto listFilter) {
|
||||
List<Integer> exactMatchHeaderIds = listHeaderService.getExactMatchHeaderId(prjctIdx);
|
||||
return new LinkedHashSet<>(listRepository.findAllSids(prjctIdx, exactMatchHeaderIds, listFilter));
|
||||
}
|
||||
|
||||
public record ListAssignUserRole(
|
||||
Integer sid,
|
||||
String sid,
|
||||
String userId,
|
||||
Short assignRole
|
||||
) {}
|
||||
|
||||
public record ListAssignCmpn(
|
||||
Integer sid,
|
||||
String sid,
|
||||
String cmpnId
|
||||
) {}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ListCallHistService {
|
||||
@Transactional
|
||||
public ListCallHistDto callStart(
|
||||
Long prjctIdx,
|
||||
Integer sid,
|
||||
String sid,
|
||||
ListCallStartRequestDto request,
|
||||
String regUser,
|
||||
String userCmpn,
|
||||
@@ -50,7 +50,7 @@ public class ListCallHistService {
|
||||
@Transactional
|
||||
public ListCallHistDto callClose(
|
||||
Long prjctIdx,
|
||||
Integer sid,
|
||||
String sid,
|
||||
ListCallCloseRequestDto request,
|
||||
String regUser,
|
||||
String userCmpn,
|
||||
@@ -62,7 +62,7 @@ public class ListCallHistService {
|
||||
|
||||
private ListCallHistDto saveCallHistory(
|
||||
Long prjctIdx,
|
||||
Integer sid,
|
||||
String sid,
|
||||
ListCallStartRequestDto request,
|
||||
CallStatus callStatus,
|
||||
String regUser,
|
||||
@@ -124,7 +124,7 @@ public class ListCallHistService {
|
||||
public void validateListCallHistoryForEvent(
|
||||
Long listCallHistIdx,
|
||||
Long prjctIdx,
|
||||
Integer sid,
|
||||
String sid,
|
||||
String userId,
|
||||
String userCmpn,
|
||||
Integer userRole
|
||||
@@ -176,7 +176,7 @@ public class ListCallHistService {
|
||||
private void validateCallIdentity(
|
||||
TListCallHistEntity existing,
|
||||
Long prjctIdx,
|
||||
Integer sid,
|
||||
String sid,
|
||||
ListCallStartRequestDto request
|
||||
) {
|
||||
rejectDifferent("prjctIdx", existing.getPrjctIdx(), prjctIdx);
|
||||
@@ -223,7 +223,7 @@ public class ListCallHistService {
|
||||
return true;
|
||||
}
|
||||
Long prjctIdx = entity.getPrjctIdx();
|
||||
Integer sid = entity.getSid();
|
||||
String sid = entity.getSid();
|
||||
if (userRole >= ContactConstant.FIELDWORK_USER_ROLE) {
|
||||
return hasText(userId)
|
||||
&& (projectAssignUserRepository.existsByIdPrjctIdxAndIdUserId(prjctIdx, userId)
|
||||
|
||||
@@ -81,7 +81,7 @@ public class ListDownloadService {
|
||||
ExcelMapper.StreamingMapWriter writer = ExcelMapper.openStreamingMapWriter(toBaseHeaderNames(headers), 100);
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream()
|
||||
) {
|
||||
Integer lastSid = null;
|
||||
String lastSid = null;
|
||||
while (true) {
|
||||
List<ListSearchService.DownloadListRow> rows = listSearchService.findDownloadListRows(prjctIdx, listFilter, lastSid);
|
||||
if (rows.isEmpty()) {
|
||||
@@ -126,15 +126,15 @@ public class ListDownloadService {
|
||||
ExcelMapper.StreamingMapWriter writer = ExcelMapper.openStreamingMapWriter(excelHeaders, 100);
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream()
|
||||
) {
|
||||
Integer lastSid = null;
|
||||
String lastSid = null;
|
||||
while (true) {
|
||||
List<ListSearchService.DownloadListRow> rows = listSearchService.findDownloadListRows(prjctIdx, listFilter, lastSid);
|
||||
if (rows.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
List<Integer> sids = rows.stream().map(ListSearchService.DownloadListRow::sid).toList();
|
||||
Map<Integer, List<ListSearchService.EventHistoryRow>> historyMap = listSearchService.findEventHistoriesForDownload(
|
||||
List<String> sids = rows.stream().map(ListSearchService.DownloadListRow::sid).toList();
|
||||
Map<String, List<ListSearchService.EventHistoryRow>> historyMap = listSearchService.findEventHistoriesForDownload(
|
||||
prjctIdx,
|
||||
sids,
|
||||
resultCodeTypes,
|
||||
@@ -174,17 +174,17 @@ public class ListDownloadService {
|
||||
ExcelMapper.StreamingMapWriter writer = ExcelMapper.openStreamingMapWriter(excelHeaders, 100);
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream()
|
||||
) {
|
||||
Integer lastSid = null;
|
||||
String lastSid = null;
|
||||
while (true) {
|
||||
List<Integer> sids = listSearchService.findDownloadSids(prjctIdx, listFilter, lastSid);
|
||||
List<String> sids = listSearchService.findDownloadSids(prjctIdx, listFilter, lastSid);
|
||||
if (sids.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
Map<Integer, List<ListSearchService.UpdateHistoryGroupRow>> historyMap =
|
||||
Map<String, List<ListSearchService.UpdateHistoryGroupRow>> historyMap =
|
||||
listSearchService.findUpdateHistoryGroupsForDownload(prjctIdx, sids);
|
||||
|
||||
for (Integer sid : sids) {
|
||||
for (String sid : sids) {
|
||||
lastSid = sid;
|
||||
List<ListSearchService.UpdateHistoryGroupRow> histories = historyMap.getOrDefault(sid, List.of());
|
||||
if (histories.isEmpty()) {
|
||||
@@ -223,11 +223,11 @@ public class ListDownloadService {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ZipOutputStream zip = new ZipOutputStream(out)
|
||||
) {
|
||||
Integer lastSid = null;
|
||||
String lastSid = null;
|
||||
int fileCount = 0;
|
||||
|
||||
while (true) {
|
||||
List<Integer> sids = listSearchService.findDownloadSids(prjctIdx, listFilter, lastSid);
|
||||
List<String> sids = listSearchService.findDownloadSids(prjctIdx, listFilter, lastSid);
|
||||
if (sids.isEmpty()) {
|
||||
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
|
||||
.findById(TListItemFileEntityId.create(prjctIdx, sid, listHderId))
|
||||
.orElseThrow(() -> BusinessException.notFound(
|
||||
@@ -296,14 +296,14 @@ public class ListDownloadService {
|
||||
DateRangeDto dateRange
|
||||
) {
|
||||
int maxCount = 0;
|
||||
Integer lastSid = null;
|
||||
String lastSid = null;
|
||||
while (true) {
|
||||
List<Integer> sids = listSearchService.findDownloadSids(prjctIdx, listFilter, lastSid);
|
||||
List<String> sids = listSearchService.findDownloadSids(prjctIdx, listFilter, lastSid);
|
||||
if (sids.isEmpty()) {
|
||||
return maxCount;
|
||||
}
|
||||
|
||||
Map<Integer, Integer> countMap = searchBase == ListEventHistoryBase.LATEST
|
||||
Map<String, Integer> countMap = searchBase == ListEventHistoryBase.LATEST
|
||||
? listSearchService.findEventHistoriesForDownload(
|
||||
prjctIdx,
|
||||
sids,
|
||||
@@ -334,14 +334,14 @@ public class ListDownloadService {
|
||||
|
||||
private int findMaxUpdateHistoryGroupCount(Long prjctIdx, ListFilterDto listFilter) {
|
||||
int maxCount = 0;
|
||||
Integer lastSid = null;
|
||||
String lastSid = null;
|
||||
while (true) {
|
||||
List<Integer> sids = listSearchService.findDownloadSids(prjctIdx, listFilter, lastSid);
|
||||
List<String> sids = listSearchService.findDownloadSids(prjctIdx, listFilter, lastSid);
|
||||
if (sids.isEmpty()) {
|
||||
return maxCount;
|
||||
}
|
||||
|
||||
Map<Integer, Integer> countMap = listSearchService.findUpdateHistoryGroupCountsForDownload(prjctIdx, sids);
|
||||
Map<String, Integer> countMap = listSearchService.findUpdateHistoryGroupCountsForDownload(prjctIdx, sids);
|
||||
for (Integer count : countMap.values()) {
|
||||
maxCount = Math.max(maxCount, count);
|
||||
}
|
||||
@@ -396,7 +396,7 @@ public class ListDownloadService {
|
||||
}
|
||||
|
||||
private Map<String, Object> createUpdateHistoryRow(
|
||||
Integer sid,
|
||||
String sid,
|
||||
List<ListSearchService.UpdateHistoryGroupRow> histories,
|
||||
int maxHistoryCount
|
||||
) {
|
||||
@@ -560,4 +560,3 @@ public class ListDownloadService {
|
||||
Integer resultCd
|
||||
) {}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ public class ListHistoryQueryService {
|
||||
private final ListUpdateHistRepository listUpdateHistRepository;
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<ListEventHistoryDto> findEventHistories(Long prjctIdx, Integer sid) {
|
||||
public List<ListEventHistoryDto> findEventHistories(Long prjctIdx, String sid) {
|
||||
return listEventHistRepository.findByPrjctIdxAndSidOrderByRegDtDescListEventHistIdxDesc(prjctIdx, sid)
|
||||
.stream()
|
||||
.map(ListEventHistoryDto::from)
|
||||
@@ -25,7 +25,7 @@ public class ListHistoryQueryService {
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<ListUpdateHistoryDto> findUpdateHistories(Long prjctIdx, Integer sid) {
|
||||
public List<ListUpdateHistoryDto> findUpdateHistories(Long prjctIdx, String sid) {
|
||||
return listUpdateHistRepository.findByPrjctIdxAndSidOrderByRegDtDescListUpdateHistIdxDesc(prjctIdx, sid)
|
||||
.stream()
|
||||
.map(ListUpdateHistoryDto::from)
|
||||
|
||||
@@ -33,14 +33,14 @@ public class ListResetService {
|
||||
String regUser,
|
||||
LocalDateTime regDt
|
||||
) {
|
||||
Set<Integer> sids = listSearchService.findTargetSids(prjctIdx, filter);
|
||||
Set<String> sids = listSearchService.findTargetSids(prjctIdx, filter);
|
||||
return resetBySids(prjctIdx, sids, mode, regUser, regDt);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public int resetBySids(
|
||||
Long prjctIdx,
|
||||
Set<Integer> sids,
|
||||
Set<String> sids,
|
||||
ListResetMode mode,
|
||||
String regUser,
|
||||
LocalDateTime regDt
|
||||
|
||||
@@ -71,7 +71,7 @@ public class ListSearchService {
|
||||
private final ProjectSurveyRepository projectSurveyRepository;
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public ListSearchWithFullResultDto searchListWithSid(Long prjctIdx, Integer sid) {
|
||||
public ListSearchWithFullResultDto searchListWithSid(Long prjctIdx, String sid) {
|
||||
ListFilterDto filterDto = ListFilterDto.onlyOneSid(sid);
|
||||
List<ListSearchWithFullResultDto> result = createListSearchWithFullResult(
|
||||
prjctIdx,
|
||||
@@ -118,7 +118,7 @@ public class ListSearchService {
|
||||
}
|
||||
|
||||
@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));
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ public class ListSearchService {
|
||||
public List<DownloadListRow> findDownloadListRows(
|
||||
Long prjctIdx,
|
||||
ListFilterDto listFilter,
|
||||
Integer lastSid
|
||||
String lastSid
|
||||
) {
|
||||
List<Integer> exactMatchHeaderIds = listHeaderService.getExactMatchHeaderId(prjctIdx);
|
||||
List<TListEntity> listEntities = listRepository.findChunkedListEntities(
|
||||
@@ -140,11 +140,11 @@ public class ListSearchService {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
Set<Integer> sidSet = listEntities.stream()
|
||||
Set<String> sidSet = listEntities.stream()
|
||||
.map(TListEntity::getSid)
|
||||
.collect(Collectors.toCollection(LinkedHashSet::new));
|
||||
Map<Integer, Map<Integer, String>> itemMapBySid = createItemMapBySid(prjctIdx, sidSet, null);
|
||||
Map<Integer, AssignValues> assignMapBySid = createAssignMapBySid(prjctIdx, sidSet);
|
||||
Map<String, Map<Integer, String>> itemMapBySid = createItemMapBySid(prjctIdx, sidSet, null);
|
||||
Map<String, AssignValues> assignMapBySid = createAssignMapBySid(prjctIdx, sidSet);
|
||||
|
||||
return listEntities.stream()
|
||||
.map(entity -> new DownloadListRow(
|
||||
@@ -158,10 +158,10 @@ public class ListSearchService {
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<Integer> findDownloadSids(
|
||||
public List<String> findDownloadSids(
|
||||
Long prjctIdx,
|
||||
ListFilterDto listFilter,
|
||||
Integer lastSid
|
||||
String lastSid
|
||||
) {
|
||||
List<Integer> exactMatchHeaderIds = listHeaderService.getExactMatchHeaderId(prjctIdx);
|
||||
return listRepository.findChunkedSids(
|
||||
@@ -174,9 +174,9 @@ public class ListSearchService {
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public Map<Integer, Integer> findEventHistoryCountsForDownload(
|
||||
public Map<String, Integer> findEventHistoryCountsForDownload(
|
||||
Long prjctIdx,
|
||||
Collection<Integer> sids,
|
||||
Collection<String> sids,
|
||||
Collection<ResultCodeType> resultCodeTypes,
|
||||
DateRangeDto dateRange
|
||||
) {
|
||||
@@ -201,9 +201,9 @@ public class ListSearchService {
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public Map<Integer, List<EventHistoryRow>> findEventHistoriesForDownload(
|
||||
public Map<String, List<EventHistoryRow>> findEventHistoriesForDownload(
|
||||
Long prjctIdx,
|
||||
Collection<Integer> sids,
|
||||
Collection<String> sids,
|
||||
Collection<ResultCodeType> resultCodeTypes,
|
||||
ListEventHistoryBase searchBase,
|
||||
DateRangeDto dateRange
|
||||
@@ -241,7 +241,7 @@ public class ListSearchService {
|
||||
|
||||
private List<TListEventHistEntity> findLatestEventHistoriesForDownload(
|
||||
Long prjctIdx,
|
||||
Collection<Integer> sids,
|
||||
Collection<String> sids,
|
||||
Collection<Short> eventTypes,
|
||||
LocalDateTime startDate,
|
||||
LocalDateTime endDate
|
||||
@@ -253,15 +253,15 @@ public class ListSearchService {
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public Map<Integer, Integer> findUpdateHistoryGroupCountsForDownload(
|
||||
public Map<String, Integer> findUpdateHistoryGroupCountsForDownload(
|
||||
Long prjctIdx,
|
||||
Collection<Integer> sids
|
||||
Collection<String> sids
|
||||
) {
|
||||
if (sids == null || sids.isEmpty()) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
Map<Integer, Integer> counts = new LinkedHashMap<>();
|
||||
Map<String, Integer> counts = new LinkedHashMap<>();
|
||||
for (ListUpdateHistRepository.UpdateHistoryGroupProjection projection
|
||||
: listUpdateHistRepository.findDownloadHistoryGroups(prjctIdx, sids)) {
|
||||
counts.merge(projection.getSid(), 1, Integer::sum);
|
||||
@@ -270,9 +270,9 @@ public class ListSearchService {
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public Map<Integer, List<UpdateHistoryGroupRow>> findUpdateHistoryGroupsForDownload(
|
||||
public Map<String, List<UpdateHistoryGroupRow>> findUpdateHistoryGroupsForDownload(
|
||||
Long prjctIdx,
|
||||
Collection<Integer> sids
|
||||
Collection<String> sids
|
||||
) {
|
||||
if (sids == null || sids.isEmpty()) {
|
||||
return Collections.emptyMap();
|
||||
@@ -294,7 +294,7 @@ public class ListSearchService {
|
||||
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()) {
|
||||
List<TListUpdateHistEntity> groupHistories = entry.getValue().stream()
|
||||
.sorted(Comparator.comparing(
|
||||
@@ -328,20 +328,20 @@ public class ListSearchService {
|
||||
@Transactional(readOnly = true)
|
||||
public List<ListUpdateTargetRow> findUpdateTargetRows(
|
||||
Long prjctIdx,
|
||||
Collection<Integer> sids,
|
||||
Collection<String> sids,
|
||||
Collection<Integer> headerIds
|
||||
) {
|
||||
if (sids == null || sids.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
Set<Integer> sidSet = new LinkedHashSet<>(sids);
|
||||
Set<String> sidSet = new LinkedHashSet<>(sids);
|
||||
List<TListEntity> listEntities = listRepository.findByIdPrjctIdxAndIdSidIn(prjctIdx, sidSet);
|
||||
if (listEntities.isEmpty()) {
|
||||
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());
|
||||
for (TListEntity entity : listEntities) {
|
||||
rows.add(new ListUpdateTargetRow(
|
||||
@@ -371,7 +371,7 @@ public class ListSearchService {
|
||||
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);
|
||||
return listRepository.findAllSids(prjctIdx, exactMatchHeaderIds, listFilter);
|
||||
}
|
||||
@@ -388,7 +388,7 @@ public class ListSearchService {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<Integer> sids = rows.stream()
|
||||
List<String> sids = rows.stream()
|
||||
.map(row -> row.listEntity().getSid())
|
||||
.toList();
|
||||
|
||||
@@ -398,7 +398,7 @@ public class ListSearchService {
|
||||
|
||||
return rows.stream()
|
||||
.map(row -> {
|
||||
Integer sid = row.listEntity().getSid();
|
||||
String sid = row.listEntity().getSid();
|
||||
return ListSearchWithResultDto.from(
|
||||
row.listEntity(),
|
||||
row.itemList(),
|
||||
@@ -423,7 +423,7 @@ public class ListSearchService {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<Integer> sids = rows.stream()
|
||||
List<String> sids = rows.stream()
|
||||
.map(row -> row.listEntity().getSid())
|
||||
.toList();
|
||||
|
||||
@@ -437,12 +437,12 @@ public class ListSearchService {
|
||||
.with("prjctIdx", prjctIdx);
|
||||
}
|
||||
|
||||
Map<Integer, ListSendResultDto> mailSendResultMap = messageResultService.findSendResultMap(
|
||||
Map<String, ListSendResultDto> mailSendResultMap = messageResultService.findSendResultMap(
|
||||
ChannelType.EMAIL,
|
||||
project.getPrjctCd(),
|
||||
sids
|
||||
);
|
||||
Map<Integer, ListSendResultDto> smsSendResultMap = messageResultService.findSendResultMap(
|
||||
Map<String, ListSendResultDto> smsSendResultMap = messageResultService.findSendResultMap(
|
||||
ChannelType.SMS,
|
||||
project.getPrjctCd(),
|
||||
sids
|
||||
@@ -450,7 +450,7 @@ public class ListSearchService {
|
||||
|
||||
return rows.stream()
|
||||
.map(row -> {
|
||||
Integer sid = row.listEntity().getSid();
|
||||
String sid = row.listEntity().getSid();
|
||||
ListSendResultDto mailSendResult = mailSendResultMap.get(sid);
|
||||
ListSendResultDto smsSendResult = smsSendResultMap.get(sid);
|
||||
return ListSearchWithFullResultDto.from(
|
||||
@@ -473,7 +473,7 @@ public class ListSearchService {
|
||||
.toList();
|
||||
}
|
||||
|
||||
private Map<ListResultKey, TListEventHistEntity> createLatestResultMap(Long prjctIdx, List<Integer> sids) {
|
||||
private Map<ListResultKey, TListEventHistEntity> createLatestResultMap(Long prjctIdx, List<String> sids) {
|
||||
return listEventHistRepository
|
||||
.findLatestListByEventTyFromLatest(prjctIdx, sids)
|
||||
.stream()
|
||||
@@ -486,7 +486,7 @@ public class ListSearchService {
|
||||
}
|
||||
|
||||
private List<ListSurveyResultDto> createSurveyResults(
|
||||
Integer sid,
|
||||
String sid,
|
||||
Map<ListResultKey, TListEventHistEntity> resultMap,
|
||||
Map<ListResultKey, Integer> attemptCountMap,
|
||||
Map<Long, TPrjctSurveyEntity> surveyMap
|
||||
@@ -518,7 +518,7 @@ public class ListSearchService {
|
||||
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()) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
@@ -564,11 +564,11 @@ public class ListSearchService {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
Set<Integer> sidSet = listEntities.stream()
|
||||
Set<String> sidSet = listEntities.stream()
|
||||
.map(TListEntity::getSid)
|
||||
.collect(Collectors.toCollection(LinkedHashSet::new));
|
||||
Map<Integer, Map<Integer, String>> itemMapBySid = createItemMapBySid(prjctIdx, sidSet, null);
|
||||
Map<Integer, AssignValues> assignMapBySid = createAssignMapBySid(prjctIdx, sidSet);
|
||||
Map<String, Map<Integer, String>> itemMapBySid = createItemMapBySid(prjctIdx, sidSet, null);
|
||||
Map<String, AssignValues> assignMapBySid = createAssignMapBySid(prjctIdx, sidSet);
|
||||
|
||||
return listEntities.stream()
|
||||
.map(entity -> new ListSearchRow(
|
||||
@@ -579,9 +579,9 @@ public class ListSearchService {
|
||||
.toList();
|
||||
}
|
||||
|
||||
private Map<Integer, Map<Integer, String>> createItemMapBySid(
|
||||
private Map<String, Map<Integer, String>> createItemMapBySid(
|
||||
Long prjctIdx,
|
||||
Set<Integer> sidSet,
|
||||
Set<String> sidSet,
|
||||
Collection<Integer> headerIds
|
||||
) {
|
||||
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<ListAssignCmpn> assignCmpnRows = assignService.findListAssignCmpns(prjctIdx, sidSet);
|
||||
if (assignRows.isEmpty() && assignCmpnRows.isEmpty()) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
Map<Integer, AssignValues> result = new LinkedHashMap<>();
|
||||
Map<String, AssignValues> result = new LinkedHashMap<>();
|
||||
for (ListAssignCmpn assignCmpnRow : assignCmpnRows) {
|
||||
AssignValues assignValues = result.computeIfAbsent(assignCmpnRow.sid(), ignored -> AssignValues.empty());
|
||||
assignValues.outsourceUserIds().add(assignCmpnRow.cmpnId());
|
||||
@@ -683,13 +683,13 @@ public class ListSearchService {
|
||||
) {}
|
||||
|
||||
private record ListResultKey(
|
||||
Integer sid,
|
||||
String sid,
|
||||
Short eventTy,
|
||||
Long prjctSurveyIdx
|
||||
) {}
|
||||
|
||||
private record UpdateHistoryGroupKey(
|
||||
Integer sid,
|
||||
String sid,
|
||||
LocalDateTime regDt,
|
||||
String regUser
|
||||
) {}
|
||||
@@ -705,7 +705,7 @@ public class ListSearchService {
|
||||
}
|
||||
|
||||
public record DownloadListRow(
|
||||
Integer sid,
|
||||
String sid,
|
||||
Short isUse,
|
||||
String memo,
|
||||
Map<Integer, String> itemMap,
|
||||
@@ -730,10 +730,9 @@ public class ListSearchService {
|
||||
) {}
|
||||
|
||||
public record ListUpdateTargetRow(
|
||||
Integer sid,
|
||||
String sid,
|
||||
Short isUse,
|
||||
String memo,
|
||||
Map<Integer, String> itemMap
|
||||
) {}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ public class ListUpdateService {
|
||||
}
|
||||
validateResultCodes(prjctIdx, updateResultCodes);
|
||||
|
||||
Set<Integer> sids = resolveTargetSids(prjctIdx, request.getListFilter());
|
||||
Set<String> sids = resolveTargetSids(prjctIdx, request.getListFilter());
|
||||
if (sids.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
@@ -97,9 +97,9 @@ public class ListUpdateService {
|
||||
if (!updateContents.isEmpty()) {
|
||||
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) {
|
||||
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(
|
||||
prjctIdx,
|
||||
sidChunk,
|
||||
@@ -174,13 +174,13 @@ public class ListUpdateService {
|
||||
|
||||
private void insertResultCodeHistories(
|
||||
Long prjctIdx,
|
||||
Collection<Integer> sids,
|
||||
Collection<String> sids,
|
||||
Map<ResultCodeType, Integer> resultCodes,
|
||||
String regUser,
|
||||
LocalDateTime regDt
|
||||
) {
|
||||
List<ListEventHistInsertRow> rows = new ArrayList<>();
|
||||
for (Integer sid : sids) {
|
||||
for (String sid : sids) {
|
||||
for (Map.Entry<ResultCodeType, Integer> entry : resultCodes.entrySet()) {
|
||||
rows.add(new ListEventHistInsertRow(
|
||||
entry.getKey().getCode(),
|
||||
@@ -197,7 +197,7 @@ public class ListUpdateService {
|
||||
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)) {
|
||||
throw BusinessException.badRequest("LIST_NOT_FOUND", "이력을 추가할 리스트를 찾을 수 없습니다.");
|
||||
}
|
||||
@@ -289,7 +289,7 @@ public class ListUpdateService {
|
||||
LocalDateTime regDt
|
||||
) {
|
||||
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, ListItemInsertRow> itemInserts = new LinkedHashMap<>();
|
||||
Map<ListItemKey, ListItemDeleteRow> itemDeletes = new LinkedHashMap<>();
|
||||
@@ -302,7 +302,7 @@ public class ListUpdateService {
|
||||
|
||||
for (Map.Entry<Integer, String> entry : updateContents.entrySet()) {
|
||||
Integer headerId = entry.getKey();
|
||||
Integer sid = targetRow.sid();
|
||||
String sid = targetRow.sid();
|
||||
TListHeaderEntity header = headerMap.get(headerId);
|
||||
boolean deleteFile = isFileDeleteCommand(header, entry.getValue());
|
||||
String newValue = deleteFile ? "" : normalizeUpdateValue(header, entry.getValue());
|
||||
@@ -428,7 +428,7 @@ public class ListUpdateService {
|
||||
return;
|
||||
}
|
||||
|
||||
Set<Integer> sids = fileDeleteKeys.stream()
|
||||
Set<String> sids = fileDeleteKeys.stream()
|
||||
.map(ListItemKey::sid)
|
||||
.collect(LinkedHashSet::new, LinkedHashSet::add, LinkedHashSet::addAll);
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -545,8 +545,7 @@ public class ListUpdateService {
|
||||
}
|
||||
|
||||
private record ListItemKey(
|
||||
Integer sid,
|
||||
String sid,
|
||||
Integer listHderId
|
||||
) {}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ public class ListUploadService {
|
||||
@Transactional
|
||||
public void uploadItemFile(
|
||||
Long prjctIdx,
|
||||
Integer sid,
|
||||
String sid,
|
||||
Map<String, MultipartFile> files,
|
||||
Integer userRole,
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -414,7 +414,7 @@ public class ListUploadService {
|
||||
List<ListHeaderDto> resolvedHeaders,
|
||||
Map<String, TCmpnEntity> cmpnByUploadText,
|
||||
String listUploadLogId,
|
||||
Set<Integer> uploadedSids,
|
||||
Set<String> uploadedSids,
|
||||
String uploadUser,
|
||||
LocalDateTime uploadDt
|
||||
) {
|
||||
@@ -451,7 +451,7 @@ public class ListUploadService {
|
||||
List<ListAssignCmpnRowInsert> assignCmpnRows = new ArrayList<>();
|
||||
|
||||
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));
|
||||
String memo = normalizeBlank(row.get(memoHeaderName));
|
||||
|
||||
@@ -581,7 +581,7 @@ public class ListUploadService {
|
||||
String outsourceHeaderName = findOptionalHeaderNameByType(resolvedHeaders, ListHeaderType.OUTSOURCE);
|
||||
Set<String> prjctAssignUserSet = new LinkedHashSet<>(prjctAssignList);
|
||||
|
||||
Set<Integer> uploadedSids = new LinkedHashSet<>();
|
||||
Set<String> uploadedSids = new LinkedHashSet<>();
|
||||
List<ListUploadErrorDto> errors = new ArrayList<>();
|
||||
List<TmpSpecialRow> tempBuffer = new ArrayList<>();
|
||||
AtomicInteger totalCount = new AtomicInteger();
|
||||
@@ -591,7 +591,7 @@ public class ListUploadService {
|
||||
ExcelMapper.readStreaming(listFilePath, UPPER_CASE_HEADER_OPTIONS, (row, rowNo) -> {
|
||||
totalCount.incrementAndGet();
|
||||
|
||||
Integer sid = parseOnlyInteger(row.get(sidHeaderName));
|
||||
String sid = parseNumericSid(row.get(sidHeaderName));
|
||||
if (sid == null) {
|
||||
errors.add(ListUploadErrorDto.of(rowNo, sidHeaderName, "SID는 필수이며 정수여야 합니다."));
|
||||
return;
|
||||
@@ -800,9 +800,14 @@ public class ListUploadService {
|
||||
return parseIsUse(s);
|
||||
}
|
||||
|
||||
private String parseNumericSid(String raw) {
|
||||
Integer parsed = parseOnlyInteger(raw);
|
||||
return parsed == null ? null : String.valueOf(parsed);
|
||||
}
|
||||
|
||||
private record ValidationSummary(
|
||||
int totalCount,
|
||||
Set<Integer> uploadedSids,
|
||||
Set<String> uploadedSids,
|
||||
List<ListUploadErrorDto> errors
|
||||
) {}
|
||||
|
||||
|
||||
@@ -44,10 +44,10 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
public class MessageResultService {
|
||||
|
||||
private final NotiHubApiClient notiHubApiClient;
|
||||
public Map<Integer, ListSendResultDto> findSendResultMap(
|
||||
public Map<String, ListSendResultDto> findSendResultMap(
|
||||
ChannelType channelTy,
|
||||
String prjctCd,
|
||||
List<Integer> sids
|
||||
List<String> sids
|
||||
) {
|
||||
if (sids == null || sids.isEmpty()) {
|
||||
return Collections.emptyMap();
|
||||
@@ -64,20 +64,10 @@ public class MessageResultService {
|
||||
return notiHubApiClient.getLastSendResults(channelTy, REQUEST_SERVICE, prjctCd, sidValues)
|
||||
.stream()
|
||||
.collect(Collectors.toMap(
|
||||
dto -> parseSid(dto.getSid()),
|
||||
dto -> dto.getSid(),
|
||||
ListSendResultDto::from,
|
||||
(left, right) -> left,
|
||||
LinkedHashMap::new
|
||||
));
|
||||
}
|
||||
private Integer parseSid(String sid) {
|
||||
if (sid == null || sid.isBlank()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return Integer.valueOf(sid);
|
||||
} catch (NumberFormatException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ public class MessageService {
|
||||
) {
|
||||
List<NotiHubDestInfoDto> destInfos = new ArrayList<>();
|
||||
Set<String> dedupeKeys = new LinkedHashSet<>();
|
||||
Integer lastSid = null;
|
||||
String lastSid = null;
|
||||
|
||||
while (true) {
|
||||
List<ListSearchService.DownloadListRow> rows = listSearchService.findDownloadListRows(
|
||||
@@ -445,7 +445,7 @@ public class MessageService {
|
||||
) {}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class ReserveService {
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<ListReserveDto> findBySid(Long prjctIdx, Integer sid) {
|
||||
public List<ListReserveDto> findBySid(Long prjctIdx, String sid) {
|
||||
return listReserveRepository.findByPrjctIdxAndSidOrderByResveDtAscListResveIdxAsc(prjctIdx, sid)
|
||||
.stream()
|
||||
.map(ListReserveDto::from)
|
||||
|
||||
@@ -64,7 +64,7 @@ kri:
|
||||
temp-cleanup-cron: "0 0 0 * * *" # 매일 00:00(초 분 시 일 월 요일)
|
||||
|
||||
list-upload-file:
|
||||
cleanup-expire-days: 7
|
||||
cleanup-expire-months: 3
|
||||
cleanup-cron: "0 30 0 * * SUN"
|
||||
|
||||
web:
|
||||
|
||||
Reference in New Issue
Block a user