Commit 86d4e745 authored by neo.wang's avatar neo.wang

Merge branch 'dev_neo' into 'dev'

Dev neo

See merge request root/atms!34
parents f7d31266 2473dbeb
......@@ -383,6 +383,12 @@
</includes>
<filtering>true</filtering><!-- replace variable attribute or not -->
</resource>
<resource>
<directory>test/resources</directory>
<includes>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
......@@ -395,7 +401,7 @@
</archive>
<webResources>
<resource>
<directory>src/main/webapp-filtered</directory>
<directory>test</directory>
<includes>
<include>**</include>
</includes>
......
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;
}
}
package pwc.taxtech.atms;
import org.apache.ibatis.io.Resources;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
import java.io.IOException;
public class ControllerApiTranslator {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(Resources.getResourceAsReader("api_temp.properties"));
String line="";
while ((line=reader.readLine())!=null){
System.out.println(line);
}
}
}
[HttpGet, Route("GetCustomsInvoicesByPeriodId/{periodId}")]
public IHttpActionResult GetCustomsInvoicesByPeriodId(int periodId)
{
return Ok(_customsInvoiceService.GetCustomsInvoicesByPeriodId(periodId));
}
\ No newline at end of file
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