Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@
</dependencies>

<build>
<finalName>qure</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/app/snapshot/qure/config/AwsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
import org.springframework.context.annotation.*;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3Client;

@Configuration
@PropertySource("classpath:application-db.properties") // 여길 읽게 함
@PropertySource("classpath:application.properties") // 여길 읽게 함
public class AwsConfig {

// 서블릿 컨텍스트에도 플레이스홀더 해석기를 등록
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.springframework.web.bind.annotation.*;
import java.util.List;

// 작성자: 김민서
@RestController
@RequestMapping("/api/facilities")
public class FacilitiesApiController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

// 작성자: 김민서
@Controller
@RequestMapping("/facilities")
public class FacilitiesController {
Expand All @@ -31,9 +33,6 @@ public FacilitiesController(IFacilitiesService facilitiesService,
}


// 목록 + 검색
// FacilitiesController.java

// 목록 + 검색 + 페이지네이션
@GetMapping
public String list(@RequestParam(value = "q", required = false) String q,
Expand Down Expand Up @@ -146,7 +145,6 @@ public String create(@ModelAttribute FacilitiesDto dto,
return "redirect:/facilities/" + facilityId + "/qr";
}

// ========== 유틸 ==========

// dto.address에서 "도로명+번지" 핵심만 추출 (예: "서울특별시 종로구 창경궁로 254 55" → "서울특별시 종로구 창경궁로 254")
private static String extractRoadCore(String s) {
Expand Down Expand Up @@ -258,7 +256,7 @@ public String editForm(@PathVariable("facilityId") Long facilityId,
return "redirect:/facilities";
}

// 설비에 연결된 템플릿 조회 → 모델에 넣기
// 설비에 연결된 템플릿 조회 → 모델에 넣기
var attached = facilitiesService.findTemplatesByFacilityIdAndManager(facilityId, managerId);
model.addAttribute("facility", facility);
model.addAttribute("attachedTemplates", attached); // ← JSP는 이것만 사용
Expand Down Expand Up @@ -338,24 +336,12 @@ public String edit(@PathVariable("id") Long facilityId,
facilitiesService.updateFacilityTemplates(facilityId, removedIds, addedIds, managerId);
System.out.println("점검표 변경 처리 - 삭제: " + removedIds + ", 추가: " + addedIds);
}

/* 또는 전체 교체 방식 (더 단순하지만 덜 효율적)
if (facility.getTemplateIds() != null && !facility.getTemplateIds().isBlank()) {
facilitiesService.replaceAllFacilityTemplates(
facilityId,
parseIds(facility.getTemplateIds()),
managerId
);
} else {
// 모든 점검표 연결 해제
facilitiesService.replaceAllFacilityTemplates(facilityId, new ArrayList<>(), managerId);
}
*/
}

ra.addFlashAttribute("msg", rows > 0 ? "설비가 수정되었습니다." : "수정 권한이 없거나 실패했습니다.");
return "redirect:/facilities/" + facilityId;
}

@PostMapping("/{facilityId}/delete")
public String delete(@PathVariable Long facilityId, RedirectAttributes ra, HttpSession session) {
Long managerId = SessionUtil.mustManagerId(session);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

// 작성자: 김민서
@RestController
@RequestMapping("/api/facilities")
public class FacilitySummaryApiController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

// 작성자: 김민서
@Controller
public class MapController {

Expand All @@ -17,6 +18,6 @@ public MapController(MapService mapService) {
@GetMapping("/map")
public String addForm(Model model) {
model.addAttribute("kakaoAppKey", mapService.getKakaoAppKey());
return "facilities/map"; // /WEB-INF/views/facilities/map.jsp
return "facilities/map";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

// PopupController.java
// 작성자: 김민서
@Controller
@RequestMapping("/popup")
public class PopupController {
@GetMapping("/juso")
public String jusoPopup() {
return "facilities/jusoPopup"; // /WEB-INF/views/popup/jusoPopup.jsp
return "facilities/jusoPopup";
}

// JUSO에서 결과를 POST로 되돌려줄 때도 같은 뷰로 렌더
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;

// 작성자: 김민서
@Controller
@RequiredArgsConstructor
public class QrController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import lombok.Data;

// 작성자: 김민서
@Data
public class ChecklistTemplateDto {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import java.util.Date;

// 작성자: 김민서
@Data
public class FacilitiesDto {
private Long facilityId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import lombok.Data;

// 작성자: 김민서
@Data
public class FacilityMarkerDto {
private Long facilityId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.Data;


// 작성자: 김민서
@Data
public class FacilitySummaryDto {
private Long facilityId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.sql.Timestamp;
import lombok.Data;

// 작성자: 김민서
@Data
public class FacilityTagDto {
private Long tagId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import lombok.Data;

// 작성자: 김민서
@Data
public class InspectionDto {
private Long inspectionId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.List;
import java.util.Map;

// 작성자: 김민서
@Mapper
public interface IFacilitiesRepository {
List<FacilitiesDto> getFacilitiesListByManager(@Param("managerId") Long managerId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import app.snapshot.qure.facilities.dto.FacilitySummaryDto;
import org.apache.ibatis.annotations.Param;

// 작성자: 김민서
public interface IFacilitySummaryRepository {
FacilitySummaryDto findSummaryByFacilityId(@Param("facilityId") Long facilityId);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package app.snapshot.qure.facilities.repository;
import app.snapshot.qure.facilities.dto.FacilityTagDto;

// 작성자: 김민서
public interface IFacilityTagRepository {
Long getNextTagId();
int insertFacilityTagWithGivenId(FacilityTagDto tag);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import app.snapshot.qure.facilities.repository.IFacilitiesRepository;

// 작성자: 김민서
@Service
public class FacilitiesService implements IFacilitiesService {

Expand All @@ -24,7 +25,7 @@ public class FacilitiesService implements IFacilitiesService {
IFacilityTagRepository facilityTagRepository;

@Autowired
GeocodingService geocodingService; // 주소→좌표 변환용 주입
GeocodingService geocodingService; // 주소→좌표 변환용 주입


@Value("${app.public-domain}")
Expand Down Expand Up @@ -118,7 +119,7 @@ public Long createFacilityWithQr(FacilitiesDto dto, Long managerId) {
FacilityTagDto tag = new FacilityTagDto();
tag.setTagId(nextTagId);
tag.setFacilityId(dto.getFacilityId());
tag.setCode(publicDomain + "/mobile/main/" + nextTagId);
tag.setCode(publicDomain + "qure/mobile/main/" + nextTagId);

facilityTagRepository.insertFacilityTagWithGivenId(tag);
return dto.getFacilityId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

// 작성자: 김민서
@Service
public class FacilitySummaryService {
@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.nio.charset.StandardCharsets;
import java.util.List;

// 작성자: 김민서
@Service
public class GeocodingService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import app.snapshot.qure.facilities.dto.FacilityTagDto;
import app.snapshot.qure.facilities.dto.InspectionDto;

// 작성자: 김민서
public interface IFacilitiesService {

/* 목록/검색: 로그인한 관리자 소유만 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Service;

// 작성자: 김민서
@Getter
@Service
@PropertySource("classpath:application-map.properties")
Expand All @@ -16,7 +17,4 @@ public MapService(@Value("${kakao.app.key}") String kakaoAppKey, @Value("${kakao
this.kakaoAppKey = kakaoAppKey;
this.kakaoApiKey = kakaoApiKey;
}



}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package app.snapshot.qure.login.controller;
// 작성자 : 구희원
// 세션 관련 작성자: 김민서
import app.snapshot.qure.login.dto.ManagerDTO;
import app.snapshot.qure.login.service.ManagerService;
import app.snapshot.qure.login.util.SessionUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import jakarta.servlet.http.HttpSession;

// 작성자: 김민서
public class SessionUtil {

public static final String LOGIN_MANAGER_ID = "LOGIN_MANAGER_ID";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.util.List;

// 팝업 관련 작성자: 김민서
@Slf4j
@Controller
@RequestMapping("/template")
Expand Down
10 changes: 5 additions & 5 deletions src/main/resources/config/mybatis/root-context.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">

<context:property-placeholder
location="classpath:application-db.properties,classpath:application-map.properties"
location="classpath:application.properties,classpath:application-map.properties"
ignore-unresolvable="true"/>


Expand All @@ -20,10 +20,10 @@

<!-- DataSource -->
<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${db.driver:oracle.jdbc.OracleDriver}"/>
<property name="url" value="${db.url}"/>
<property name="username" value="${db.user}"/>
<property name="password" value="${db.pass}"/>
<property name="driverClassName" value="${spring.datasource.driver-class-name:oracle.jdbc.OracleDriver}"/>
<property name="url" value="${spring.datasource.url}"/>
<property name="username" value="${spring.datasource.username}"/>
<property name="password" value="${spring.datasource.password}"/>
</bean>

<!-- MyBatis -->
Expand Down
53 changes: 33 additions & 20 deletions src/main/resources/mappers/FacilitiesMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<!-- 작성자 : 김민서 -->
<mapper namespace="app.snapshot.qure.facilities.repository.IFacilitiesRepository">

<!-- Dto 매핑 -->
Expand Down Expand Up @@ -348,28 +348,41 @@

<!-- 목록 페이징 -->
<select id="findFacilitiesPaged" parameterType="map" resultMap="FacilityMap">
<![CDATA[
SELECT *
FROM (
SELECT
f.FACILITY_ID,
f.NAME,
f.DOMAIN,
f.ZONE,
f.UPDATED_AT,
f.NEXT_SCHEDULED_AT,
ROW_NUMBER() OVER (ORDER BY f.FACILITY_ID DESC) AS rn
FROM FACILITIES f
WHERE f.MANAGERS_ID = #{managerId}
<if test="q != null and q != ''">
AND (
LOWER(f.NAME) LIKE '%' || LOWER(#{q}) || '%'
OR LOWER(f.DOMAIN) LIKE '%' || LOWER(#{q}) || '%'
OR LOWER(f.ZONE) LIKE '%' || LOWER(#{q}) || '%'
)
</if>
) t
SELECT
f.FACILITY_ID,
f.NAME,
f.DOMAIN,
f.ZONE,
f.UPDATED_AT,
f.NEXT_SCHEDULED_AT,

CASE
WHEN f.NEXT_SCHEDULED_AT IS NULL THEN 'NONE'
WHEN TRUNC(f.NEXT_SCHEDULED_AT) < TRUNC(NVL(f.UPDATED_AT, SYSDATE)) THEN 'OVERDUE'
ELSE 'UPCOMING'
END AS SCHEDULE_STATUS,

CASE
WHEN f.NEXT_SCHEDULED_AT IS NULL THEN NULL
WHEN TRUNC(f.NEXT_SCHEDULED_AT) < TRUNC(NVL(f.UPDATED_AT, SYSDATE))
THEN TRUNC(NVL(f.UPDATED_AT, SYSDATE)) - TRUNC(f.NEXT_SCHEDULED_AT)
ELSE TRUNC(f.NEXT_SCHEDULED_AT) - TRUNC(SYSDATE)
END AS DAYS_DELTA,

ROW_NUMBER() OVER (ORDER BY f.FACILITY_ID DESC) AS rn
FROM FACILITIES f
WHERE f.MANAGERS_ID = #{managerId}
/* 검색 조건 */
/* 동적 SQL은 CDATA 밖으로 빼도 되지만 안전하게 넣어도 무방 */
) t
WHERE t.rn BETWEEN #{startRow} AND #{endRow}
</select>
]]>
</select>



<!-- 총 개수 -->
<select id="countFacilities" parameterType="map" resultType="int">
Expand Down
Loading