|
@@ -1,5 +1,6 @@
|
|
|
package com.idea.invoice.controller;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.idea.invoice.dto.InvoiceManageDto;
|
|
|
import com.idea.invoice.model.InvoiceBank;
|
|
@@ -16,14 +17,16 @@ import io.swagger.annotations.Api;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
@Controller
|
|
|
@RequestMapping(value = "InvoiceManageController")
|
|
|
-@Api(value="开票管理")
|
|
|
+@Api(value = "开票管理")
|
|
|
public class InvoiceManageController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
@@ -31,68 +34,72 @@ public class InvoiceManageController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 预收款发票
|
|
|
+ *
|
|
|
* @param tablepar
|
|
|
* @param model
|
|
|
* @param dt
|
|
|
* @return
|
|
|
*/
|
|
|
- @PostMapping(value = "advancePaymentInvoiceList",produces = {"application/json;charset=UTF-8"})
|
|
|
+ @PostMapping(value = "advancePaymentInvoiceList", produces = {"application/json;charset=UTF-8"})
|
|
|
@ResponseBody
|
|
|
- public Object advancePaymentInvoiceList(Tablepar tablepar, InvoiceManageDto model, DateTrans dt){
|
|
|
- PageInfo<InvoiceManageDto> page= modelService.advancePaymentInvoiceList(tablepar,model,dt);
|
|
|
+ public Object advancePaymentInvoiceList(Tablepar tablepar, InvoiceManageDto model, DateTrans dt) {
|
|
|
+ PageInfo<InvoiceManageDto> page = modelService.advancePaymentInvoiceList(tablepar, model, dt);
|
|
|
return new TableSplitResult<>(page.getPageNum(), page.getTotal(), page.getList());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 正式发票
|
|
|
+ *
|
|
|
* @param tablepar
|
|
|
* @param model
|
|
|
* @param dt
|
|
|
* @return
|
|
|
*/
|
|
|
- @PostMapping(value = "formalInvoiceList",produces = {"application/json;charset=UTF-8"})
|
|
|
+ @PostMapping(value = "formalInvoiceList", produces = {"application/json;charset=UTF-8"})
|
|
|
@ResponseBody
|
|
|
- public Object formalInvoiceList(Tablepar tablepar, InvoiceManageDto model, DateTrans dt){
|
|
|
- PageInfo<InvoiceManageDto> page= modelService.formalInvoiceList(tablepar,model,dt);
|
|
|
+ public Object formalInvoiceList(Tablepar tablepar, InvoiceManageDto model, DateTrans dt) {
|
|
|
+ PageInfo<InvoiceManageDto> page = modelService.formalInvoiceList(tablepar, model, dt);
|
|
|
return new TableSplitResult<>(page.getPageNum(), page.getTotal(), page.getList());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 新增预收款发票
|
|
|
+ *
|
|
|
* @param record
|
|
|
* @return
|
|
|
*/
|
|
|
- @PostMapping(value = "add",produces = {"application/json;charset=UTF-8"})
|
|
|
+ @PostMapping(value = "add", produces = {"application/json;charset=UTF-8"})
|
|
|
@ResponseBody
|
|
|
- public AjaxResult add(InvoiceManageDto record){
|
|
|
+ public AjaxResult add(InvoiceManageDto record) {
|
|
|
int result = modelService.add(record);
|
|
|
return result(result);
|
|
|
}
|
|
|
|
|
|
- @PostMapping(value = "getById",produces = {"application/json;charset=UTF-8"})
|
|
|
+ @PostMapping(value = "getById", produces = {"application/json;charset=UTF-8"})
|
|
|
@ResponseBody
|
|
|
- public Object getById(String id){
|
|
|
+ public Object getById(String id) {
|
|
|
InvoiceManageDto result = modelService.getById(id);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
- @PostMapping(value = "getByContractId",produces = {"application/json;charset=UTF-8"})
|
|
|
+ @PostMapping(value = "getByContractId", produces = {"application/json;charset=UTF-8"})
|
|
|
@ResponseBody
|
|
|
- public Object getInfoByContract(String id,String invoiceGoodsName,Integer payType){
|
|
|
- InvoiceManageDto result = modelService.getInfoByContract(id,invoiceGoodsName,payType);
|
|
|
+ public Object getInfoByContract(String id, String invoiceGoodsName, Integer payType) {
|
|
|
+ InvoiceManageDto result = modelService.getInfoByContract(id, invoiceGoodsName, payType);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询对应的银行
|
|
|
+ *
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
- @PostMapping(value = "getBankTaxRateByFloor",produces = {"application/json;charset=UTF-8"})
|
|
|
+ @PostMapping(value = "getBankTaxRateByFloor", produces = {"application/json;charset=UTF-8"})
|
|
|
@ResponseBody
|
|
|
public Object getBankTaxRateByFloor(String id) {
|
|
|
- if(!StringUtils.isNotEmpty(id)){
|
|
|
+ if (!StringUtils.isNotEmpty(id)) {
|
|
|
return AjaxResult.error(503, "参数不能为空");
|
|
|
}
|
|
|
return modelService.getBankTaxRateByFloor(id);
|
|
@@ -100,47 +107,71 @@ public class InvoiceManageController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 查询对应的银行
|
|
|
+ *
|
|
|
* @param contractId
|
|
|
* @param paymentType
|
|
|
* @return
|
|
|
*/
|
|
|
- @PostMapping(value = "getBankTaxRateByFloor_2",produces = {"application/json;charset=UTF-8"})
|
|
|
+ @PostMapping(value = "getBankTaxRateByFloor_2", produces = {"application/json;charset=UTF-8"})
|
|
|
@ResponseBody
|
|
|
- public Object getBankTaxRateByFloor(String contractId,String paymentType) {
|
|
|
- if(!StringUtils.isNotEmpty(contractId)){
|
|
|
+ public Object getBankTaxRateByFloor(String contractId, String paymentType) {
|
|
|
+ if (!StringUtils.isNotEmpty(contractId)) {
|
|
|
return AjaxResult.error(503, "参数不能为空");
|
|
|
}
|
|
|
- return modelService.getBankTaxRateByFloor(contractId,paymentType);
|
|
|
+ return modelService.getBankTaxRateByFloor(contractId, paymentType);
|
|
|
}
|
|
|
|
|
|
|
|
|
- @PostMapping(value = "batchListVo",produces = {"application/json;charset=UTF-8"})
|
|
|
+ @PostMapping(value = "batchListVo", produces = {"application/json;charset=UTF-8"})
|
|
|
@ResponseBody
|
|
|
- public List<InvoiceManageDto> batchListVo(String invoiceManages){
|
|
|
+ public List<InvoiceManageDto> batchListVo(String invoiceManages) {
|
|
|
return modelService.batchListVo(invoiceManages);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 推送开票
|
|
|
- * @param record
|
|
|
+ *
|
|
|
+ * @param model
|
|
|
* @return
|
|
|
*/
|
|
|
- @PostMapping(value = "sendInvoice",produces = {"application/json;charset=UTF-8"})
|
|
|
+ @PostMapping(value = "sendInvoice", produces = {"application/json;charset=UTF-8"})
|
|
|
@ResponseBody
|
|
|
- public AjaxResult sendInvoice(InvoiceManageDto record){
|
|
|
- return modelService.sendInvoice(record);
|
|
|
+ public AjaxResult sendInvoice(InvoiceManageDto model) {
|
|
|
+
|
|
|
+ String result;
|
|
|
+ try {
|
|
|
+ result = modelService.sendInvoice(model);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.error(504, e.getMessage());
|
|
|
+ }
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
+ String success = jsonObject.getString("success");
|
|
|
+ if ("true".equals(success)) {
|
|
|
+ String code = jsonObject.getJSONObject("data").getJSONObject("ar_recbill").getString("code");
|
|
|
+ model.setSendStatus("1");
|
|
|
+ model.setSubmitTime(new Date());
|
|
|
+ model.setSubmitUser(ShiroUtils.getUserId());
|
|
|
+ model.setNcJson(result);
|
|
|
+ model.setNcCode(code);
|
|
|
+ modelService.updateByPrimaryKeySelective(model);
|
|
|
+ } else if ("false".equals(success)) {
|
|
|
+ return AjaxResult.error(504, jsonObject.getString("message"));
|
|
|
+ }
|
|
|
+
|
|
|
+ return AjaxResult.success();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 批量推送开票
|
|
|
+ *
|
|
|
* @param list
|
|
|
* @return
|
|
|
*/
|
|
|
- @PostMapping(value = "batchSendInvoice",produces = {"application/json;charset=UTF-8"})
|
|
|
+ @PostMapping(value = "batchSendInvoice", produces = {"application/json;charset=UTF-8"})
|
|
|
@ResponseBody
|
|
|
- public AjaxResult batchSendInvoice(List<InvoiceManageDto> list){
|
|
|
- return modelService.batchSendInvoice(list);
|
|
|
+ public AjaxResult batchSendInvoice(@RequestBody List<InvoiceManageDto> list) {
|
|
|
+ return modelService.batchSendInvoice(list);
|
|
|
}
|
|
|
|
|
|
}
|