공지 정렬 수정
히스토리 caliverse_meta_data 제거
This commit is contained in:
@@ -7,6 +7,7 @@ import com.caliverse.admin.domain.entity.web3.ResponseErrorCode;
|
||||
import com.caliverse.admin.domain.entity.web3.ResponseRequestData;
|
||||
import com.caliverse.admin.domain.entity.web3.ResponseWithdrawableData;
|
||||
import com.caliverse.admin.domain.request.CaliumRequest;
|
||||
import com.caliverse.admin.domain.request.LogGenericRequest;
|
||||
import com.caliverse.admin.domain.request.Web3Request;
|
||||
import com.caliverse.admin.domain.response.CaliumResponse;
|
||||
import com.caliverse.admin.domain.response.Web3Response;
|
||||
@@ -17,6 +18,9 @@ import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.constants.Web3Constants;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.logs.Indicatordomain.GenericMongoLog;
|
||||
import com.caliverse.admin.logs.entity.LogAction;
|
||||
import com.caliverse.admin.logs.logservice.businesslogservice.BusinessLogGenericService;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -25,6 +29,7 @@ import org.springframework.http.HttpMethod;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -41,6 +46,7 @@ public class CaliumService {
|
||||
// private final DynamoDBService dynamoDBService;
|
||||
private final DynamodbCaliumService dynamodbCaliumService;
|
||||
private final MysqlHistoryLogService mysqlHistoryLogService;
|
||||
private final BusinessLogGenericService businessLogGenericService;
|
||||
|
||||
public CaliumResponse getCaliumLimit(){
|
||||
Web3Response<ResponseWithdrawableData> web3Response = web3Service.get(
|
||||
@@ -82,6 +88,13 @@ public class CaliumService {
|
||||
double allCnt = caliumMapper.getCaliumTotal();
|
||||
double stock_qty = dynamodbCaliumService.getCaliumTotal();
|
||||
|
||||
LogGenericRequest logGenericRequest = new LogGenericRequest();
|
||||
logGenericRequest.setLogAction(LogAction.FailCaliumEchoSystem);
|
||||
logGenericRequest.setStartDt(LocalDateTime.now().minusDays(1));
|
||||
logGenericRequest.setEndDt(LocalDateTime.now());
|
||||
logGenericRequest.setOrderBy("ASC");
|
||||
List<GenericMongoLog> failList = businessLogGenericService.loadBusinessLogData(logGenericRequest, GenericMongoLog.class);
|
||||
|
||||
return CaliumResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
@@ -89,6 +102,7 @@ public class CaliumService {
|
||||
.caliumList(list)
|
||||
.total(stock_qty)
|
||||
.totalAll(allCnt)
|
||||
.failCount(failList.size())
|
||||
.pageNo(requestParam.get("page_no")!=null?
|
||||
Integer.parseInt(requestParam.get("page_no").toString()):1)
|
||||
.build()
|
||||
@@ -153,13 +167,6 @@ public class CaliumService {
|
||||
calium
|
||||
);
|
||||
|
||||
//로그 기록
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("dept",caliumRequest.getDept());
|
||||
jsonObject.put("count",caliumRequest.getCount());
|
||||
jsonObject.put("content",caliumRequest.getContent());
|
||||
historyService.setLog(HISTORYTYPEDETAIL.CALIUM_ADD, jsonObject);
|
||||
|
||||
return CaliumResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
@@ -173,10 +180,10 @@ public class CaliumService {
|
||||
public CaliumResponse updateCaliumCharged(CaliumRequest caliumRequest){
|
||||
log.info("updateCaliumCharged calium Request: {}", caliumRequest);
|
||||
Calium calium = caliumMapper.getCaliumRequestDetail(caliumRequest.getId());
|
||||
Long id = CommonUtils.getAdmin().getId();
|
||||
Long userId = CommonUtils.getAdmin().getId();
|
||||
// 상태가 승인완료거나 요청한 본인이 아니면 에러처리
|
||||
if(!calium.getStatus().equals(Calium.CALIUMREQUESTSTATUS.COMPLETE) || !calium.getCreateBy().equals(id.toString())){
|
||||
log.error("updateCaliumCharged Calium Request Status or User Not Match status: {}, id: {}", calium.getStatus(), id);
|
||||
if(!calium.getStatus().equals(Calium.CALIUMREQUESTSTATUS.COMPLETE) || !calium.getCreateBy().equals(userId.toString())){
|
||||
log.error("updateCaliumCharged Calium Request Status or User Not Match status: {}, id: {}", calium.getStatus(), userId);
|
||||
return CaliumResponse.builder()
|
||||
.status(CommonCode.ERROR.getHttpStatus())
|
||||
.result(ErrorCode.ERROR_CALIUM_FINISH.toString())
|
||||
@@ -186,14 +193,24 @@ public class CaliumService {
|
||||
.build();
|
||||
}
|
||||
|
||||
Calium info = caliumMapper.getCaliumRequestDetail(caliumRequest.getId());
|
||||
|
||||
dynamodbCaliumService.updateCaliumTotal(caliumRequest.getCount());
|
||||
|
||||
updateCaliumRequest(caliumRequest.getId(), Calium.CALIUMREQUESTSTATUS.FINISH);
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_CALIUM_REQUEST,
|
||||
HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE.name(),
|
||||
info,
|
||||
caliumMapper.getCaliumRequestDetail(caliumRequest.getId())
|
||||
);
|
||||
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// jsonObject.put("dynamoDB_update",dynamoResult);
|
||||
|
||||
historyService.setLog(HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE, jsonObject);
|
||||
// historyService.setLog(HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE, jsonObject);
|
||||
|
||||
return CaliumResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
|
||||
Reference in New Issue
Block a user