Kaynağa Gözat

api 관리 오류 수정

databank102 4 yıl önce
ebeveyn
işleme
352b3a7cf4

+ 17 - 6
src/main/java/com/lemon/lifecenter/controller/ApiManagerController.java

@@ -1,7 +1,5 @@
 package com.lemon.lifecenter.controller;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -11,11 +9,11 @@ import javax.servlet.http.HttpServletResponse;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.servlet.ModelAndView;
 
 import com.lemon.lifecenter.common.LifeCenterConfigVO;
@@ -23,12 +21,10 @@ import com.lemon.lifecenter.common.LifeCenterController;
 import com.lemon.lifecenter.common.LifeCenterFunction;
 import com.lemon.lifecenter.common.LifeCenterPaging;
 import com.lemon.lifecenter.common.LifeCenterSessionController;
-
 import com.lemon.lifecenter.dto.ApiManagerDTO;
-import com.lemon.lifecenter.dto.CooperationDTO;
 import com.lemon.lifecenter.service.ApiManagerService;
 
-@RestController
+@Controller
 @RequestMapping("/apiManager")
 public class ApiManagerController extends LifeCenterController {
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
@@ -106,4 +102,19 @@ public class ApiManagerController extends LifeCenterController {
         
         //return "redirect:/cooperation/info?cooperativeCode="+dto.getCooperativeCode();
     }
+    
+    @RequestMapping( value = "/accept", method = RequestMethod.POST)
+    public String updateUseYnApiManager(
+            @ModelAttribute("dto") final ApiManagerDTO dto,
+            HttpServletRequest request,HttpServletResponse response) {
+        String sesId  = LifeCenterSessionController.getSession( request, "sesId" );
+        //dto.setCreateBy(sesId);
+         
+        service.updateUseYnApiManager(dto);
+        
+        LifeCenterFunction.scriptMessage( response, "alertBox({ txt: '협력병원이 등록되었습니다.', callBack : function(){ location.href='/apiManager/list'; } });" );
+        return "/common/blank";
+        
+        //return "redirect:/cooperation/info?cooperativeCode="+dto.getCooperativeCode();
+    }
 }

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

@@ -141,7 +141,7 @@ public class CooperationController extends LifeCenterController {
         dto.setUpdateBy(sesId);
         
         service.updateCooperationInfo(dto);
-        LifeCenterFunction.scriptMessage( response, "alertBox({ txt: '협력병원 정보가 수정되었습니다.', callBack : function(){ location.href='/cooperation/info?cooperativeCode="+dto.getCooperativeCode()+"'; } });" );
+        LifeCenterFunction.scriptMessage( response, "alertBox({ txt: '서비스 신청을 완료하였습니다.', callBack : function(){ location.href='/cooperation/info?cooperativeCode="+dto.getCooperativeCode()+"'; } });" );
         return "/common/blank";
         //return "redirect:/cooperation/info?cooperativeCode="+dto.getCooperativeCode();
     }

+ 1 - 0
src/main/java/com/lemon/lifecenter/mapper/ApiManagerMapper.java

@@ -15,5 +15,6 @@ public interface ApiManagerMapper {
     public List<ApiManagerDTO> selectApiManagerList(ApiManagerDTO dto);
     public ApiManagerDTO selectApiManagerInfoOne(String idx);
     public void insertApiManager(ApiManagerDTO dto);
+    public void updateUseYnApiManager(ApiManagerDTO dto);
     
 }

+ 4 - 0
src/main/java/com/lemon/lifecenter/service/ApiManagerService.java

@@ -30,4 +30,8 @@ public class ApiManagerService {
     public void insertApiManager(ApiManagerDTO dto) {
         mapper.insertApiManager(dto);
     }
+    
+    public void updateUseYnApiManager(ApiManagerDTO dto) {
+        mapper.updateUseYnApiManager(dto);
+    }
 }

+ 14 - 11
src/main/resources/mybatis/mapper/api/apiManager.xml

@@ -59,6 +59,7 @@
             ]]>
         </if>
         <![CDATA[
+            ORDER BY IDX DESC
             LIMIT #{limit}, #{limitMax}
         ]]>
     </select>
@@ -95,16 +96,17 @@
     <insert id="insertApiManager" parameterType="ApiManagerDTO">
         <![CDATA[
             INSERT INTO
-                api_manager (
-                    manager_id,
-                    manager_name,
-                    hospital_name,
-                    department_name,
-                    manager_email,
-                    manager_phone,
-                    use_purpose,
-                    request_date,
-                    create_date
+                API_MANAGER (
+                    MANAGER_ID,
+                    MANAGER_NAME,
+                    HOSPITAL_NAME,
+                    DEPARTMENT_NAME,
+                    MANAGER_EMAIL,
+                    MANAGER_PHONE,
+                    USE_PURPOSE,
+                    REQUEST_DATE,
+                    CREATE_DATE,
+                    USE_YN
                 )
             VALUES
                 (
@@ -116,7 +118,8 @@
                     #{managerPhone},
                     #{usePurpose},
                     NOW(),
-                    NOW()
+                    NOW(),
+                    'W'
                 )
         ]]>
     </insert>

+ 3 - 2
src/main/webapp/WEB-INF/jsp/api/info.jsp

@@ -64,8 +64,8 @@ $( function(){
                     <div class="row">
                         <div class="col-12">
                             <div class="card">
-                                <form action="?" id="newForm">
-                                <input type="hidden" value="${returnUrl}" name="returnUrl">
+                                <form action="./useyn" id="newForm" method="post">
+                                <input type="hidden" value="${info.idx}" name="idx">
                                     <div class="card-body">
                                         <table class="table mobile-table">
                                             <colgroup>
@@ -138,6 +138,7 @@ $( function(){
                                         <div class="row mt-3">
                                             <div class="col-12">
                                                 <div class="text-right">
+                                                    <button type="button" class="btn btn-primary w100" onclick="location.href='./list';">승인</button>
                                                     <button type="button" class="btn btn-primary w100" onclick="location.href='./list';">목록</button>
                                                 </div>
                                             </div>

+ 1 - 1
src/main/webapp/WEB-INF/jsp/api/list.jsp

@@ -108,7 +108,7 @@
                                                         
                                                             <c:set var="pageNum" value="${ ( total - lStatus.index ) - ( (page - 1) * pageSize ) }" />
                                                             <tr>
-                                                                <td><c:out value="${pageNum}" /></td>
+                                                                <td><a href="./info?idx=${l.idx}"><c:out value="${pageNum}" /></a></td>
                                                                 <td class="text-left">
                                                                     <a href="./info?idx=${l.idx}"><c:out value="${l.hospitalName}" /></a>
                                                                 </td>