Add files via upload

This commit is contained in:
gopi17701 2018-07-24 23:24:21 -04:00 committed by GitHub
parent 0cf87cc13f
commit 1d55c5aa21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 15 deletions

View File

@ -8,6 +8,9 @@ import com.astute.service.InvoicePaymentService;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.sql.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@Path("/invoicePayment")
@Consumes(MediaType.APPLICATION_JSON)
@ -28,15 +31,22 @@ public class InvoicePaymentResource {
@Path("/{invoiceNum}/{invoicePaymentId}")
@PUT
public Response updateInvoicePayment(InvoicePaymentRequest request, @PathParam("invoiceNum") String invoiceNum, @PathParam("invoicePaymentId") int invoicePaymentId)
throws AstuteException {
service.updateInvoicePayment(invoiceNum,invoicePaymentId, request.getInvoiceAmount(), request.getPaymentDate());
throws AstuteException, ParseException {
String dateStr = request.getPaymentDate();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date date = new java.sql.Date(df.parse(dateStr).getTime());
service.updateInvoicePayment(invoiceNum,invoicePaymentId, request.getInvoiceAmount(), date);
return new ApiResponse(ApiResponse.UPDATE_ACCESS_SUCESS).toResponse();
}
@POST
public Response createInvoicePayment(InvoicePaymentRequest request)
throws AstuteException {
service.createInvoicePayment(request.getInvoiceNum(), request.getInvoicePaymentId(), request.getInvoiceAmount(),request.getPaymentDate());
throws AstuteException, ParseException {
String dateStr = request.getPaymentDate();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date date = new java.sql.Date(df.parse(dateStr).getTime());
service.createInvoicePayment(request.getInvoiceNum(), request.getInvoicePaymentId(), request.getInvoiceAmount(),date);
return new ApiResponse(ApiResponse.UPDATE_ACCESS_SUCESS).toResponse();
}
}

View File

@ -10,7 +10,10 @@ import com.astute.service.InvoiceService;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.sql.Date;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@Path("/invoice")
@Consumes(MediaType.APPLICATION_JSON)
@ -39,8 +42,12 @@ public class InvoiceResource {
@Path("/{InvoiceNum}")
@PUT
public Response updateInvoiceMaster(@PathParam("InvoiceNum") String InvoiceNum, InvoiceMasterRequest request)
throws AstuteException {
service.updateInvoiceMaster(InvoiceNum, request.getInvoiceDate(), request.getPoNum(),
throws AstuteException, ParseException {
String dateStr = request.getInvoiceDate();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date date = new java.sql.Date(df.parse(dateStr).getTime());
service.updateInvoiceMaster(InvoiceNum, date, request.getPoNum(),
request.getPmtStatus(), request.getBillAmt(), request.getSpecialNotes(), request.getCertification(), request.getInvoiceStatus());
return new ApiResponse(ApiResponse.UPDATE_ACCESS_SUCESS).toResponse();
}
@ -55,8 +62,12 @@ public class InvoiceResource {
}
@POST
public Response createInvoiceMaster(InvoiceMasterRequest request)
throws AstuteException {
service.createInvoiceMaster(request.getInvoiceNumber(), request.getInvoiceDate(), request.getPoNum(),
throws AstuteException, ParseException {
String dateStr = request.getInvoiceDate();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date date = new java.sql.Date(df.parse(dateStr).getTime());
service.createInvoiceMaster(request.getInvoiceNumber(), date, request.getPoNum(),
request.getPmtStatus(), request.getBillAmt(), request.getSpecialNotes(), request.getCertification(), request.getInvoiceStatus());
return new ApiResponse(ApiResponse.UPDATE_ACCESS_SUCESS).toResponse();
}

View File

@ -10,6 +10,8 @@ import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.sql.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@Path("/po")
@Consumes(MediaType.APPLICATION_JSON)
@ -25,9 +27,11 @@ public class POResource {
public Response getPOMaster(
@QueryParam("PONum") String PONum,
@QueryParam("ContractNum") String contractNum,
@QueryParam("PODate") Date PODate, String astuteProjectNumber)
throws AstuteException {
return new ApiResponse(POService.getPOMaster(PONum, contractNum, PODate, astuteProjectNumber)).toResponse();
@QueryParam("PODate") String PODate, String astuteProjectNumber)
throws AstuteException, ParseException {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date date = new java.sql.Date(df.parse(PODate).getTime());
return new ApiResponse(POService.getPOMaster(PONum, contractNum, date, astuteProjectNumber)).toResponse();
}
@Path("/detail")
@ -40,8 +44,12 @@ public class POResource {
@Path("/{PONum}")
@PUT
public Response updatePOMaster(@PathParam("PONum") String PONum, POMasterRequest request)
throws AstuteException {
POService.updatePOMaster(PONum, request.getContractNum(), request.getPODate(), request.getContractAmt(), request.getAstuteProjectNumber());
throws AstuteException, ParseException {
String dateStr = request.getPODate();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date date = new java.sql.Date(df.parse(dateStr).getTime());
POService.updatePOMaster(PONum, request.getContractNum(), date, request.getContractAmt(), request.getAstuteProjectNumber());
return new ApiResponse(ApiResponse.UPDATE_ACCESS_SUCESS).toResponse();
}
@ -56,8 +64,12 @@ public class POResource {
@POST
public Response createPOMaster(POMasterRequest request)
throws AstuteException {
POService.createPOMaster(request.getPoNum(), request.getContractNum(), request.getPODate(), request.getContractAmt(), request.getCustomerId(), request.getAstuteProjectNumber());
throws AstuteException, ParseException {
String dateStr = request.getPODate();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date date = new java.sql.Date(df.parse(dateStr).getTime());
POService.createPOMaster(request.getPoNum(), request.getContractNum(), date, request.getContractAmt(), request.getCustomerId(), request.getAstuteProjectNumber());
return new ApiResponse(ApiResponse.UPDATE_ACCESS_SUCESS).toResponse();
}
@Path("/detail")