계정과목 반영영
This commit is contained in:
@@ -1647,6 +1647,127 @@ public class ApprovalService {
|
||||
* @param paramMap
|
||||
* @return
|
||||
*/
|
||||
/**
|
||||
* Amaranth10 전자결재 문서 상신 (사용자 인증 방식)
|
||||
* 1단계: getAuthToken(서버인증)으로 사용자 토큰 발급
|
||||
* 2단계: 발급받은 토큰으로 상신 API 호출
|
||||
* @param request HttpServletRequest
|
||||
* @param paramMap 상신 데이터 (title, appLineListJson 등)
|
||||
* @return 결과 JSON 문자열
|
||||
*/
|
||||
public String submitAmaranthApprovalDoc(HttpServletRequest request, Map paramMap){
|
||||
try {
|
||||
HttpSession session = request.getSession();
|
||||
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
|
||||
if(person == null){
|
||||
return "{\"resultCode\":-1,\"resultMsg\":\"세션이 만료되었습니다. 다시 로그인하세요.\"}";
|
||||
}
|
||||
|
||||
String empSeq = CommonUtils.checkNull(person.getEmpseq());
|
||||
String compSeq = "1000";
|
||||
|
||||
if(empSeq == null || empSeq.isEmpty()){
|
||||
return "{\"resultCode\":-1,\"resultMsg\":\"empSeq가 비어있습니다. 관리자에게 문의하세요.\"}";
|
||||
}
|
||||
|
||||
// 파라미터 추출
|
||||
String title = CommonUtils.checkNull(paramMap.get("title"));
|
||||
String appLineListJson = CommonUtils.checkNull(paramMap.get("appLineListJson"));
|
||||
String deptSeq = CommonUtils.checkNull(paramMap.get("deptSeq"));
|
||||
|
||||
// 양식코드, 연동코드, 기록물철 (Amaranth10 설정값)
|
||||
String tiKeyCode = CommonUtils.checkNull(paramMap.get("tiKeyCode"), "1576");
|
||||
String approKey = CommonUtils.checkNull(paramMap.get("approKey"), "");
|
||||
String aiKeyCode = CommonUtils.checkNull(paramMap.get("aiKeyCode"), "102433");
|
||||
|
||||
System.out.println("=== Amaranth 결재 문서 상신 (사용자 인증 - empSeqEnc) ===");
|
||||
System.out.println("empSeq: " + empSeq);
|
||||
System.out.println("title: " + title);
|
||||
System.out.println("deptSeq: " + deptSeq);
|
||||
System.out.println("appLineList: " + appLineListJson);
|
||||
|
||||
// 요청 Body 구성
|
||||
StringBuilder body = new StringBuilder();
|
||||
body.append("{");
|
||||
body.append("\"header\":{");
|
||||
body.append("\"groupSeq\":\"").append(escapeJsonValue(GROUP_SEQ)).append("\",");
|
||||
body.append("\"empSeq\":\"").append(escapeJsonValue(empSeq)).append("\"");
|
||||
body.append("},");
|
||||
body.append("\"body\":{");
|
||||
body.append("\"empSeq\":\"").append(escapeJsonValue(empSeq)).append("\",");
|
||||
body.append("\"groupSeq\":\"").append(escapeJsonValue(GROUP_SEQ)).append("\",");
|
||||
body.append("\"langCode\":\"kr\",");
|
||||
body.append("\"saveType\":\"002\",");
|
||||
body.append("\"tiKeyCode\":\"").append(escapeJsonValue(tiKeyCode)).append("\",");
|
||||
body.append("\"approKey\":\"").append(escapeJsonValue(approKey)).append("\",");
|
||||
// 결재라인 (JSON 문자열로 전달 - API 스펙: jsonstring 타입)
|
||||
body.append("\"appLineList\":\"").append(appLineListJson.replace("\"", "\\\"")).append("\",");
|
||||
// 회사정보
|
||||
body.append("\"companyInfo\":{");
|
||||
body.append("\"groupSeq\":\"").append(escapeJsonValue(GROUP_SEQ)).append("\",");
|
||||
body.append("\"compSeq\":\"").append(escapeJsonValue(compSeq)).append("\",");
|
||||
body.append("\"deptSeq\":\"").append(escapeJsonValue(deptSeq)).append("\",");
|
||||
body.append("\"empSeq\":\"").append(escapeJsonValue(empSeq)).append("\"");
|
||||
body.append("},");
|
||||
// 문서기본정보
|
||||
body.append("\"docParamList\":[{");
|
||||
body.append("\"diTitle\":\"").append(escapeJsonValue(title)).append("\",");
|
||||
body.append("\"aiKeyCode\":\"").append(escapeJsonValue(aiKeyCode)).append("\",");
|
||||
body.append("\"diDocGrade\":\"000\",");
|
||||
body.append("\"diDocType\":\"000\",");
|
||||
body.append("\"diPublic\":\"001\",");
|
||||
body.append("\"diGrade\":\"000\",");
|
||||
body.append("\"diSecretGrade\":\"\",");
|
||||
body.append("\"diTreatMent\":\"001\",");
|
||||
body.append("\"fileAttachInfo\":[]");
|
||||
body.append("}]");
|
||||
body.append("}");
|
||||
body.append("}");
|
||||
|
||||
String requestBody = body.toString();
|
||||
System.out.println("Request Body: " + requestBody);
|
||||
|
||||
// API 호출 (사용자 인증 - empSeq로 토큰 발급 후 상신)
|
||||
com.pms.api.AmaranthApprovalApiClient apiClient = new com.pms.api.AmaranthApprovalApiClient();
|
||||
String baseUrl = "https://erp.rps-korea.com";
|
||||
|
||||
String apiResponse = apiClient.submitApprovalDoc(baseUrl, empSeq, requestBody);
|
||||
|
||||
System.out.println("상신 API 응답: " + apiResponse);
|
||||
|
||||
return apiResponse;
|
||||
|
||||
} catch(Exception e){
|
||||
System.err.println("Amaranth 결재 문서 상신 오류: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
return "{\"resultCode\":-1,\"resultMsg\":\"" + escapeJsonValue(e.getMessage()) + "\"}";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Amaranth10 사원 목록 조회 (결재라인 사용자 검색용)
|
||||
* @param request HttpServletRequest
|
||||
* @return 사원 목록 JSON 문자열
|
||||
*/
|
||||
public String searchAmaranthEmployees(HttpServletRequest request, Map paramMap){
|
||||
try {
|
||||
com.pms.api.AmaranthUserApiClient apiClient = new com.pms.api.AmaranthUserApiClient();
|
||||
String baseUrl = "https://erp.rps-korea.com";
|
||||
|
||||
String apiResponse = apiClient.getAllUserInfo(baseUrl);
|
||||
|
||||
return apiResponse;
|
||||
|
||||
} catch(Exception e){
|
||||
System.err.println("Amaranth 사원 검색 오류: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
return "{\"resultCode\":-1,\"resultMsg\":\"" + escapeJsonValue(e.getMessage()) + "\"}";
|
||||
}
|
||||
}
|
||||
|
||||
// Amaranth10 그룹 시퀀스 (상신 Body 구성용)
|
||||
private static final String GROUP_SEQ = "gcmsAmaranth40578";
|
||||
|
||||
public Map checkApprovalComplete(Map paramMap){
|
||||
Map<String,Object> resultMap = new HashMap();
|
||||
SqlSession sqlSession = null;
|
||||
|
||||
Reference in New Issue
Block a user