Bläddra i källkod

api 모니터링 데이터 insert 중간 커밋

junekeunsong 4 år sedan
förälder
incheckning
4f09338aac

+ 3 - 1
src/main/java/com/lemon/lifecenter/controller/RestApiController.java

@@ -27,6 +27,7 @@ import org.springframework.web.bind.annotation.RestController;
 import com.lemon.lifecenter.common.LifeCenterConfigVO;
 import com.lemon.lifecenter.common.LifeCenterFunction;
 import com.lemon.lifecenter.dto.ApiPhrResponseDTO;
+import com.lemon.lifecenter.dto.ApiStatisticsDTO;
 import com.lemon.lifecenter.dto.ApiSymptomDTO;
 import com.lemon.lifecenter.dto.AppVersionDTO;
 import com.lemon.lifecenter.dto.DeviceInfoDTO;
@@ -168,7 +169,8 @@ public class RestApiController {
         if (message.equals("")) {
             message = "success";
         }
-        
+//        ApiStatisticsDTO sDto = new ApiStatisticsDTO();
+//        service.insertStatisticsData(sDto);
         return result;
     }
     

+ 66 - 0
src/main/java/com/lemon/lifecenter/dto/ApiStatisticsDTO.java

@@ -13,4 +13,70 @@ public class ApiStatisticsDTO {
     private String ip              = "";
     private String createDate      = "";
     
+    public int getCenterCode() {
+        return centerCode;
+    }
+    public void setCenterCode(int centerCode) {
+        this.centerCode = centerCode;
+    }
+    public String getCenterName() {
+        return centerName;
+    }
+    public void setCenterName(String centerName) {
+        this.centerName = centerName;
+    }
+    public String getLocationCode() {
+        return locationCode;
+    }
+    public void setLocationCode(String locationCode) {
+        this.locationCode = locationCode;
+    }
+    public String getLocationName() {
+        return locationName;
+    }
+    public void setLocationName(String locationName) {
+        this.locationName = locationName;
+    }
+    public String getCooperativeCode() {
+        return cooperativeCode;
+    }
+    public void setCooperativeCode(String cooperativeCode) {
+        this.cooperativeCode = cooperativeCode;
+    }
+    public String getCooperativeName() {
+        return cooperativeName;
+    }
+    public void setCooperativeName(String cooperativeName) {
+        this.cooperativeName = cooperativeName;
+    }
+    public int getApiCount() {
+        return apiCount;
+    }
+    public void setApiCount(int apiCount) {
+        this.apiCount = apiCount;
+    }
+    public String getResourceType() {
+        return resourceType;
+    }
+    public void setResourceType(String resourceType) {
+        this.resourceType = resourceType;
+    }
+    public String getResult() {
+        return result;
+    }
+    public void setResult(String result) {
+        this.result = result;
+    }
+    public String getIp() {
+        return ip;
+    }
+    public void setIp(String ip) {
+        this.ip = ip;
+    }
+    public String getCreateDate() {
+        return createDate;
+    }
+    public void setCreateDate(String createDate) {
+        this.createDate = createDate;
+    }
 }

+ 3 - 0
src/main/java/com/lemon/lifecenter/mapper/RestApiMapper.java

@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Mapper;
 import org.springframework.stereotype.Repository;
 
 import com.lemon.lifecenter.dto.ApiPhrResponseDTO;
+import com.lemon.lifecenter.dto.ApiStatisticsDTO;
 import com.lemon.lifecenter.dto.ApiSymptomDTO;
 import com.lemon.lifecenter.dto.HlRequestDTO;
 import com.lemon.lifecenter.dto.PatientDTO;
@@ -22,4 +23,6 @@ public interface RestApiMapper {
     public List<ApiPhrResponseDTO> selectClinicMemo(HlRequestDTO dto);
     
     public String selectApiKey(HlRequestDTO dto);
+    
+    public void insertStatisticsData(ApiStatisticsDTO dto);
 }

+ 5 - 0
src/main/java/com/lemon/lifecenter/service/RestApiService.java

@@ -6,6 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.lemon.lifecenter.dto.ApiPhrResponseDTO;
+import com.lemon.lifecenter.dto.ApiStatisticsDTO;
 import com.lemon.lifecenter.dto.ApiSymptomDTO;
 import com.lemon.lifecenter.dto.AppVersionDTO;
 import com.lemon.lifecenter.dto.DeviceInfoDTO;
@@ -49,4 +50,8 @@ public class RestApiService {
     public String selectApiKey(HlRequestDTO dto) {
         return mapper.selectApiKey(dto);
     }
+    
+    public void insertStatisticsData(ApiStatisticsDTO dto) {
+        mapper.insertStatisticsData(dto);
+    }
 }

+ 10 - 0
src/main/resources/mybatis/mapper/api/api.xml

@@ -364,4 +364,14 @@
                AND USE_YN = 'C'
         ]]>
      </select>
+     
+     <insert id="insertStatisticsData" parameterType="ApiStatisticsDTO">
+        <![CDATA[
+            INSERT INTO API_STATISTICS
+                        (CENTER_CODE,     LOCATION_CODE,   COOPERATIVE_CODE,   API_COUNT,
+                         RESOURCE_TYPE,   RESULT,          IP,                 CREATE_DATE)
+                 VALUES (#{centerCode},   #{locationCode}, #{cooperativeCode}, #{apiCount},
+                         #{resourceType}, #{result},       #{ip},              NOW())
+        ]]>
+     </insert>
 </mapper>