• akbar fauzi's avatar
    service : · 532b3b84
    akbar fauzi authored
    - /orafin/workorder/dgi-api/v1/inv2/read
    - /orafin/workorder/dgi-api/v1/inv2/add
    532b3b84
APIGatewayH23RESTController.java 1.5 KB
package com.eksad.masterdata.controller;

import com.eksad.masterdata.common.dto.PullNotaJBSCRequestDTO;
import com.eksad.masterdata.service.PullNJBNSCHystrixService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.util.logging.Level;
import java.util.logging.Logger;

@RestController
@Slf4j
public class APIGatewayH23RESTController {

    @Autowired
    PullNJBNSCHystrixService pullService;

    @RequestMapping(value = "/orafin/workorder/dgi-api/v1/inv2/read",
            method = RequestMethod.POST,
            produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<Object> pullNota(@RequestBody PullNotaJBSCRequestDTO dto) throws ParseException {
        try {
            System.out.println(new ObjectMapper().writeValueAsString(dto));
        } catch (JsonProcessingException ex) {
            Logger.getLogger(APIGatewayH23RESTController.class.getName()).log(Level.SEVERE, null, ex);
        }
        return pullService.postRequestPullNJBNSCv2(dto);
    }

}