Commit 2b05f439 authored by neo's avatar neo

[DEV] add custom service

parent f7d31266
package pwc.taxtech.atms.controller;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import pwc.taxtech.atms.exception.ApplicationException;
import pwc.taxtech.atms.exception.ServiceException;
@ControllerAdvice
public class AtmsExceptionHandler extends ResponseEntityExceptionHandler {
@ExceptionHandler(value = {
ApplicationException.class,
ServiceException.class
})
protected ResponseEntity<Object> handleExceptions(Exception ex) throws ServiceException {
logger.error("Rest Exception!", ex);
if (ex instanceof ApplicationException) {
return handleApplicationException((ApplicationException) ex);
} else if (ex instanceof ServiceException) {
return handleServiceException((ServiceException) ex);
} else {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
}
}
private ResponseEntity<Object> handleApplicationException(ApplicationException ex) {
throw ex;
}
private ResponseEntity<Object> handleServiceException(ServiceException ex) throws ServiceException {
throw ex;
}
}
......@@ -5,6 +5,8 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
......@@ -16,6 +18,7 @@ import pwc.taxtech.atms.dto.vatdto.CustomsInvoiceDto;
import pwc.taxtech.atms.dto.vatdto.CustomsInvoiceFilter;
import pwc.taxtech.atms.dto.vatdto.JsonCustomsInvoice;
import pwc.taxtech.atms.dto.vatdto.JsonCustomsInvoiceDto;
import pwc.taxtech.atms.exception.ApplicationException;
import pwc.taxtech.atms.thirdparty.ExcelUtil;
import pwc.taxtech.atms.vat.service.CustomsInvoiceService;
......@@ -50,6 +53,11 @@ public class CustomsInvoiceController {
return convertCustomsInvoiceDataToJson(fromPeriod, toPeriod, filter, paging);
}
@RequestMapping(value = "GetCustomsInvoicesByPeriodId/{periodId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity getCustomsInvoicesByPeriodId(@PathVariable Integer periodId) {
return ResponseEntity.ok().body(customsInvoiceService.getCustomsInvoicesByPeriodId(periodId));
}
@RequestMapping(value = "ExportQueryData/get", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void exportQueryData(@RequestParam String criteria, HttpServletResponse response) {
CustomsInvoiceFilter filter = new CustomsInvoiceFilter();
......
......@@ -19,9 +19,7 @@ import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import com.alibaba.fastjson.JSON;
import pwc.taxtech.atms.common.ApplicationException;
import pwc.taxtech.atms.exception.ApplicationException;
import pwc.taxtech.atms.common.AuthUserHelper;
import pwc.taxtech.atms.common.CommonConstants;
import pwc.taxtech.atms.common.CommonUtils;
......
package pwc.taxtech.atms.vat.service;
import org.springframework.http.ResponseEntity;
import pwc.taxtech.atms.dto.vatdto.CustomsInvoiceDto;
import java.util.List;
......@@ -12,4 +13,6 @@ public interface CustomsInvoiceService {
* @return
*/
List<CustomsInvoiceDto> getCustomsInvoicesByPeriodIds(int fromPeriod, int toPeriod);
List<CustomsInvoiceDto> getCustomsInvoicesByPeriodId(Integer periodId);
}
......@@ -42,6 +42,9 @@ public class CustomsInvoiceServiceImpl extends VatAbstractService implements Cus
@Override
public List<CustomsInvoiceDto> getCustomsInvoicesByPeriodId(Integer periodId) {
CustomsInvoiceExample example = new CustomsInvoiceExample();
// example.createCriteria().andPeriodIdEqualTo(periodId)
return null;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment