| | |
| | | package com.product.contract.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.product.common.lang.StringUtils; |
| | | import com.product.contract.config.CmnConst; |
| | | import com.product.contract.config.SystemCode; |
| | |
| | | import com.product.core.exception.BaseException; |
| | | import com.product.core.spring.context.SpringMVCContextHolder; |
| | | import com.product.module.sys.version.ApiVersion; |
| | | import com.product.util.BaseUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | |
| | | return this.error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText()); |
| | | } |
| | | FieldSetEntity fs = contractInfoService.findContractInfo(fse); |
| | | return OK_List(fs); |
| | | JSONObject resultObj = BaseUtil.fieldSetEntityToJson(fs); |
| | | resultObj.put("~showType~", fse.getString("showType")); |
| | | return OK(resultObj); |
| | | } catch (BaseException e) { |
| | | e.printStackTrace(); |
| | | SpringMVCContextHolder.getSystemLogger().error(e); |
| | |
| | | SystemCode.SYSTEM_SAVE_CONTRACT_FILE_FAIL.getText()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 验证发票号,不同次数的开票中不能有相同的发票号(同次的可以) |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @RequestMapping(value="/check-invoice-number/{version}", method = RequestMethod.POST) |
| | | @ApiVersion(1) |
| | | public String checkInvoiceNumber(HttpServletRequest request) { |
| | | try { |
| | | FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, CmnConst.PRODUCT_PROJECT_CONTRACT_INVOICE_INFO); |
| | | // 判断参数是否为空 |
| | | if (fse == null) { |
| | | SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); |
| | | return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); |
| | | } |
| | | return OK(contractInfoService.checkInvoiceNumber(fse)); |
| | | } catch (BaseException e) { |
| | | e.printStackTrace(); |
| | | SpringMVCContextHolder.getSystemLogger().error(e); |
| | | return this.error(e); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | SpringMVCContextHolder.getSystemLogger().error(e); |
| | | return this.error(SystemCode.CHECK_INVOICE_NUMBER_FAIL.getValue(), SystemCode.CHECK_INVOICE_NUMBER_FAIL.getText()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 验证发票号,单个发票的回款总额不能超过开票金额 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @RequestMapping(value="/check-invoice-payment/{version}", method = RequestMethod.POST) |
| | | @ApiVersion(1) |
| | | public String checkInvoicePayment(HttpServletRequest request) { |
| | | try { |
| | | FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, CmnConst.PRODUCT_PROJECT_CONTRACT_INVOICE_INFO); |
| | | // 判断参数是否为空 |
| | | if (fse == null) { |
| | | SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); |
| | | return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); |
| | | } |
| | | return OK(contractInfoService.checkInvoicePayment(fse)); |
| | | } catch (BaseException e) { |
| | | e.printStackTrace(); |
| | | SpringMVCContextHolder.getSystemLogger().error(e); |
| | | return this.error(e); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | SpringMVCContextHolder.getSystemLogger().error(e); |
| | | return this.error(SystemCode.CHECK_INVOICE_NUMBER_FAIL.getValue(), SystemCode.CHECK_INVOICE_NUMBER_FAIL.getText()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询合同下的开票和回款记录 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @RequestMapping(value="/list-contract-invoice-and-collection/{version}", method = RequestMethod.POST) |
| | | @ApiVersion(1) |
| | | public String listContractInvoiceAndCollection(HttpServletRequest request) { |
| | | try { |
| | | FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, CmnConst.LX_PROJECT_CONTRACT_INFO); |
| | | // 判断参数是否为空 |
| | | if (fse == null) { |
| | | SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); |
| | | return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); |
| | | } |
| | | return OK(contractInfoService.listContractInvoiceAndCollection(fse)); |
| | | } catch (BaseException e) { |
| | | e.printStackTrace(); |
| | | SpringMVCContextHolder.getSystemLogger().error(e); |
| | | return this.error(e); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | SpringMVCContextHolder.getSystemLogger().error(e); |
| | | return this.error(SystemCode.LIST_CONTRACT_INVOICE_AND_COLLECTION_FAIL.getValue(), SystemCode.LIST_CONTRACT_INVOICE_AND_COLLECTION_FAIL.getText()); |
| | | } |
| | | } |
| | | } |