|
|
@@ -30,18 +30,47 @@ public class OrderInvoiceApiController extends CertifyApiController {
|
|
|
private final String uploadPath = null;
|
|
|
|
|
|
/**
|
|
|
+ * 验证发票申请基本参数
|
|
|
+ * @param t 发票对象
|
|
|
+ * @param res 结果对象
|
|
|
+ * @return 是否有错误,true表示有错误
|
|
|
+ */
|
|
|
+ private boolean validateInvoiceParams(TOrderInvoice t, Result res) {
|
|
|
+ if(t==null){
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","请求数据不能为空"));
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if(null==t.getInvoiceType()){
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","发票类型不能为空"));
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(t.getTaxNumber())){
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","税号不能为空"));
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if(null==t.getAmount()){
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","金额不能为空"));
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(t.getUnitName())){
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","单位名称不能为空"));
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(t.getOrderNo())){
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","订单编号不能为空"));
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 创建发票申请
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/createOrderInvoice",method = RequestMethod.POST)
|
|
|
public Result createOrderInvoice(TOrderInvoice t){
|
|
|
Result res = new Result();
|
|
|
- if(t==null||null==t.getInvoiceType()||StringUtils.isBlank(t.getTaxNumber())||
|
|
|
- null==t.getAmount()||null==t.getBanks()||StringUtils.isBlank(t.getContent())
|
|
|
- ||StringUtils.isBlank(t.getUnitAddress())||StringUtils.isBlank(t.getUnitMobile())
|
|
|
- ||StringUtils.isBlank(t.getUnitName())||StringUtils.isBlank(t.getVoucherUrl())
|
|
|
- ||StringUtils.isBlank(t.getOrderNo())){
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","基本资料"));
|
|
|
+ if(validateInvoiceParams(t, res)){
|
|
|
return res;
|
|
|
}
|
|
|
//status 0保存 1提交
|
|
|
@@ -91,12 +120,7 @@ public class OrderInvoiceApiController extends CertifyApiController {
|
|
|
@RequestMapping(value = "/updateOrderInvoice",method = RequestMethod.POST)
|
|
|
public Result updateOrderInvoice(TOrderInvoice t){
|
|
|
Result res = new Result();
|
|
|
- if(t==null||null==t.getInvoiceType()||StringUtils.isBlank(t.getTaxNumber())||
|
|
|
- null==t.getAmount()||null==t.getBanks()||StringUtils.isBlank(t.getContent())
|
|
|
- ||StringUtils.isBlank(t.getUnitAddress())||StringUtils.isBlank(t.getUnitMobile())
|
|
|
- ||StringUtils.isBlank(t.getUnitName())||StringUtils.isBlank(t.getVoucherUrl())
|
|
|
- ||StringUtils.isBlank(t.getOrderNo())){
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","基本资料"));
|
|
|
+ if(validateInvoiceParams(t, res)){
|
|
|
return res;
|
|
|
}
|
|
|
if(orderInvoiceService.checkAmount(t)) {
|