민원 목록/상세 조회 수정

master
mjkhan21 3 weeks ago
parent 631f1877f4
commit 78b2032a0c

@ -98,7 +98,7 @@ public class SOHNN00004 extends SaeolMessage {
NONE = "none";
private String msg_key;
/** 순번 */
private String row_no;
private int row_no;
/** 민원접수번호 */
private String cnsl_qna_no;
/** 글제목 */

@ -2,6 +2,7 @@ package cokr.xit.interfaces.saeol;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
@ -217,5 +218,13 @@ public abstract class SaeolMessage extends AbstractComponent {
}
private String faultcode;
private String faultstring;
public Map<String, Object> toMap() {
return Map.of(
"success", false,
"faultCode", faultcode,
"faultstring", faultstring
);
}
}
}

@ -1,11 +1,12 @@
package cokr.xit.interfaces.saeol.service;
import java.util.List;
import java.util.Map;
import cokr.xit.interfaces.saeol.SOINN00050;
public interface SaeolService {
void getMinwons(String deptCode, String fromDate, String toDate);
Map<String, Object> getMinwons(String deptCode, String fromDate, String toDate);
void getMinwons();

@ -2,7 +2,9 @@ package cokr.xit.interfaces.saeol.service.bean;
import java.io.File;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
@ -19,18 +21,27 @@ public class MinwonBean extends SaeolBean {
@Resource(name = "fileBean")
private FileBean fileBean;
public void getMinwons(String deptCode, String startDate, String endDate) {
public Map<String, Object> getMinwons(String deptCode, String startDate, String endDate) {
log().debug("Getting minwons: '{}', {} ~ {}", deptCode, startDate, endDate);
SOHNN00004.Req00004 req00004 = new SOHNN00004.Req00004();
req00004.setDep_code(deptCode);
req00004.setStart_reg_ymd(startDate);
req00004.setEnd_reg_ymd(endDate);
SOHNN00004.Resp00004 resp00004 = getSOHNN00004(req00004).getResponse();
if (resp00004.error()) return;
if (resp00004.error())
return resp00004.getFault().toMap();
LinkedHashMap<String, Object> result = new LinkedHashMap<>();
result.put("success", true);
result.put("minwonsReceived", resp00004.getResult().size());
for (SOHNN00004.Item item: resp00004.getResult()) {
getSOHNN00011(item.getCnsl_qna_no(), item.getDetail());
String cnsl_qna_no = item.getCnsl_qna_no();
SOHNN00011 sohnn00011 = getSOHNN00011(cnsl_qna_no, item.getDetail());
result.put(cnsl_qna_no, !sohnn00011.getResponse().error() ? "success" : "fail");
}
return result;
}
public SOHNN00004 getSOHNN00004(SOHNN00004.Req00004 req) {
@ -40,16 +51,17 @@ public class MinwonBean extends SaeolBean {
req.setLink_yn("y");
SOHNN00004 msg = new SOHNN00004();
SOHNN00004.Resp00004 resp = sendMessage(msg.setRequest(req));
if (!resp.error()) {
log(msg);
save(resp);
}
if (!resp.error())
save(msg);
return msg;
}
SOHNN00004.Resp00004 save(SOHNN00004.Resp00004 resp) {
if (!resp.error())
saeolMapper.insert(resp);
SOHNN00004.Resp00004 save(SOHNN00004 msg) {
SOHNN00004.Resp00004 resp = msg.getResponse();
int affected = saeolMapper.insert(resp);
if (affected > 0)
log(msg);
return resp;
}
@ -62,20 +74,21 @@ public class MinwonBean extends SaeolBean {
req.setCnsl_qna_no(cnsl_qna_no);
SOHNN00011 msg = new SOHNN00011();
SOHNN00011.Resp00011 resp = sendMessage(msg.setRequest(req));
if (!resp.error()) {
log(msg);
save(resp, detail);
}
if (!resp.error())
save(msg, detail);
return msg;
}
SOHNN00011.Resp00011 save(SOHNN00011.Resp00011 resp, String detail) {
SOHNN00011.Resp00011 save(SOHNN00011 msg, String detail) {
SOHNN00011.Resp00011 resp = msg.getResponse();
SOHNN00011.Item result = resp.getResult();
if (result == null)
return resp;
saeolMapper.insert(resp, detail);
int affected = saeolMapper.insert(resp, detail);
if (affected > 0)
log(msg);
if (SOHNN00004.Item.GET.equals(detail)) {
String phoneNo = ifEmpty(result.getTelno_m(), result::getHpno_m);

@ -3,6 +3,7 @@ package cokr.xit.interfaces.saeol.service.bean;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
@ -20,8 +21,8 @@ public class SaeolServiceBean extends ScheduledServiceBean implements SaeolServi
private AnswerBean answerBean;
@Override
public void getMinwons(String deptCode, String fromDate, String toDate) {
minwonBean.getMinwons(deptCode, toDate, toDate);
public Map<String, Object> getMinwons(String deptCode, String fromDate, String toDate) {
return minwonBean.getMinwons(deptCode, toDate, toDate);
}
private static final DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyyMMdd");

@ -1,6 +1,7 @@
package cokr.xit.interfaces.saeol.web;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
@ -24,8 +25,8 @@ public class SaeolController extends AbstractController {
@PostMapping("/minwons")
@Operation(summary = "민원 목록/상세 조회", tags = "민원 목록/상세")
public void getMinwons(@RequestParam(required = false) String deptCode, String fromDate, String toDate) {
saeolService.getMinwons(deptCode, fromDate, toDate);
public Map<String, Object> getMinwons(@RequestParam(required = false) String deptCode, String fromDate, String toDate) {
return saeolService.getMinwons(deptCode, fromDate, toDate);
}
@PostMapping("/sohnn00004/update")

@ -3,9 +3,9 @@
"sido": "", /* 시도코드 */
"sigungu": "", /* 시군구 코드 */
"deptCodes": [], /* 부서코드 */
"deptCodes": ["부서코드"], /* 부서코드 */
"logXml": "files/xml/{date}/{interfaceID}/{msgKey}.xml", /* xml 로그파일 이름 패턴 */
"logXml": "files/xml/{date}/{interfaceID}/{msgKey}.xml", /* xml 로그파일 이름 패턴, 로그파일을 남기지 않으려면 제거할 것 */
"logToDatabase": true, /* 전문 데이터베이스 사용 여부 */
"attachmentDir": "files/attachment/{date}", /* 첨부파일 디렉토리 경로 패턴, 전문 데이터베이스를 사용하지 않을 경우에만 유효 */

@ -1,7 +1,7 @@
CREATE OR REPLACE TABLE TB_SOHNN00004 (
CNSL_QNA_NO CHAR(18) COMMENT '민원접수번호',
MSG_KEY VARCHAR(25) COMMENT '메시지 키',
ROW_NO VARCHAR(4) COMMENT '순번',
ROW_NO INT COMMENT '순번',
MW_CNSL_SJ VARCHAR(500) COMMENT '글제목',
REG_DT VARCHAR(14) COMMENT '접수일자',
@ -170,4 +170,18 @@ CREATE OR REPLACE TABLE TB_SOINN00050 (
PRIMARY KEY (MSG_ID),
INDEX (CNSL_QNA_NO)
) COMMENT '답변등록/추가답변';
) COMMENT '답변등록/추가답변';
/*
DELIMITER $$
CREATE FUNCTION NVL(IP_DATA VARCHAR(100), IP_CONVERT VARCHAR(100)) RETURNS VARCHAR(100)
BEGIN
DECLARE RTN_DATA VARCHAR(100);
SET RTN_DATA := IFNULL(IP_DATA, IP_CONVERT);
RETURN RTN_DATA;
END $$
DELIMITER ;
*/
Loading…
Cancel
Save