결재 오류
This commit is contained in:
@@ -643,15 +643,11 @@
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 기존 매핑의 APPRO_KEY 갱신 (재상신 시) -->
|
||||
<!-- 기존 매핑 갱신 (재상신 시 - approKey는 유지) -->
|
||||
<update id="updateAmaranthApprovalResubmit" parameterType="map">
|
||||
UPDATE AMARANTH_APPROVAL SET
|
||||
APPRO_KEY = #{approKey},
|
||||
APPROVAL_TITLE = #{approvalTitle},
|
||||
WRITER = #{writer},
|
||||
STATUS = 'create',
|
||||
AMARANTH_DOC_ID = NULL,
|
||||
DOC_STS = '0',
|
||||
UPDATE_DATE = NOW()
|
||||
WHERE TARGET_OBJID = #{targetObjId} AND TARGET_TYPE = #{targetType}
|
||||
</update>
|
||||
|
||||
@@ -1809,14 +1809,30 @@ public class ApprovalService {
|
||||
String compSeq = CommonUtils.checkNull(paramMap.get("compSeq"), "1000");
|
||||
String deptSeq = CommonUtils.checkNull(paramMap.get("deptSeq"));
|
||||
|
||||
// approKey 생성: "UB_" + UUID (외부시스템과 결재문서 매핑 키)
|
||||
String approKey = "UB_" + java.util.UUID.randomUUID().toString();
|
||||
// DB에서 기존 매핑 조회 → 있으면 approKey 재사용, 없으면 신규 생성
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||||
Map<String, Object> mappingParam = new HashMap();
|
||||
mappingParam.put("targetType", targetType);
|
||||
mappingParam.put("targetObjId", targetObjId);
|
||||
|
||||
Map<String, Object> existing = sqlSession.selectOne("approval.selectAmaranthApprovalByTarget", mappingParam);
|
||||
existing = existing != null ? CommonUtils.toUpperCaseMapKey(existing) : null;
|
||||
|
||||
String approKey;
|
||||
boolean isNewRecord;
|
||||
if(existing != null){
|
||||
approKey = CommonUtils.checkNull(existing.get("APPRO_KEY"));
|
||||
isNewRecord = false;
|
||||
System.out.println("=== 기존 approKey 재사용: " + approKey + " ===");
|
||||
} else {
|
||||
approKey = "UB_" + java.util.UUID.randomUUID().toString();
|
||||
isNewRecord = true;
|
||||
System.out.println("=== 신규 approKey 생성: " + approKey + " ===");
|
||||
}
|
||||
|
||||
System.out.println("=== Amaranth SSO URL 생성 ===");
|
||||
System.out.println("empSeq: " + empSeq + ", loginId: " + loginId);
|
||||
System.out.println("targetType: " + targetType + ", targetObjId: " + targetObjId);
|
||||
System.out.println("outProcessCode: " + outProcessCode + ", formId: " + formId);
|
||||
System.out.println("approKey: " + approKey);
|
||||
|
||||
// API 클라이언트 생성
|
||||
com.pms.api.AmaranthApprovalApiClient apiClient = new com.pms.api.AmaranthApprovalApiClient();
|
||||
@@ -1830,7 +1846,7 @@ public class ApprovalService {
|
||||
fileEx.printStackTrace();
|
||||
}
|
||||
|
||||
// SSO URL 생성 API 호출
|
||||
// SSO URL 생성 API 호출 (기존/신규 동일한 approKey 사용)
|
||||
String apiResponse = apiClient.getSsoUrl(
|
||||
AMARANTH_BASE_URL, empSeq, outProcessCode, formId,
|
||||
approKey, approvalTitle, "W", compSeq, deptSeq, loginId, fileListEncoded
|
||||
@@ -1843,22 +1859,17 @@ public class ApprovalService {
|
||||
String resultCode = extractJsonStringValue(apiResponse, "resultCode");
|
||||
|
||||
if("0".equals(resultCode) && !fullUrl.isEmpty()){
|
||||
// approKey → targetObjId 매핑: 기존 건 있으면 UPDATE, 없으면 INSERT
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||||
Map<String, Object> mappingParam = new HashMap();
|
||||
// 신규면 INSERT, 기존이면 UPDATE (제목/작성자만 갱신)
|
||||
mappingParam.put("approKey", approKey);
|
||||
mappingParam.put("targetType", targetType);
|
||||
mappingParam.put("targetObjId", targetObjId);
|
||||
mappingParam.put("approvalTitle", approvalTitle);
|
||||
mappingParam.put("writer", loginId);
|
||||
|
||||
Map<String, Object> existing = sqlSession.selectOne("approval.selectAmaranthApprovalByTarget", mappingParam);
|
||||
if(existing != null){
|
||||
sqlSession.update("approval.updateAmaranthApprovalResubmit", mappingParam);
|
||||
System.out.println("Amaranth 결재 매핑 UPDATE - approKey: " + approKey);
|
||||
} else {
|
||||
if(isNewRecord){
|
||||
sqlSession.insert("approval.insertAmaranthApproval", mappingParam);
|
||||
System.out.println("Amaranth 결재 매핑 INSERT - approKey: " + approKey);
|
||||
} else {
|
||||
sqlSession.update("approval.updateAmaranthApprovalResubmit", mappingParam);
|
||||
System.out.println("Amaranth 결재 매핑 UPDATE - approKey: " + approKey);
|
||||
}
|
||||
sqlSession.commit();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user