增值税发票保存
This commit is contained in:
parent
e07c0b02f5
commit
ff25047310
|
|
@ -10,10 +10,12 @@ import com.cwhelp.common.enums.StatusEnum;
|
||||||
import com.cwhelp.common.utils.*;
|
import com.cwhelp.common.utils.*;
|
||||||
import com.cwhelp.common.vo.ResultVo;
|
import com.cwhelp.common.vo.ResultVo;
|
||||||
import com.cwhelp.component.fileUpload.FileUpload;
|
import com.cwhelp.component.fileUpload.FileUpload;
|
||||||
|
import com.cwhelp.component.shiro.ShiroUtil;
|
||||||
import com.cwhelp.devtools.generate.utils.jAngel.utils.StringUtil;
|
import com.cwhelp.devtools.generate.utils.jAngel.utils.StringUtil;
|
||||||
import com.cwhelp.modules.business.domain.BssGoods;
|
import com.cwhelp.modules.business.domain.BssGoods;
|
||||||
import com.cwhelp.modules.business.domain.BssTaxinfo;
|
import com.cwhelp.modules.business.domain.BssTaxinfo;
|
||||||
import com.cwhelp.modules.business.domain.BssVatInvoice;
|
import com.cwhelp.modules.business.domain.BssVatInvoice;
|
||||||
|
import com.cwhelp.modules.business.service.BssTaxinfoService;
|
||||||
import com.cwhelp.modules.business.service.BssVatInvoiceService;
|
import com.cwhelp.modules.business.service.BssVatInvoiceService;
|
||||||
import com.cwhelp.modules.system.domain.Upload;
|
import com.cwhelp.modules.system.domain.Upload;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
|
@ -28,9 +30,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -45,6 +45,9 @@ public class BssVatInvoiceController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private BssVatInvoiceService bssVatInvoiceService;
|
private BssVatInvoiceService bssVatInvoiceService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BssTaxinfoService bssTaxinfoService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表页面
|
* 列表页面
|
||||||
*/
|
*/
|
||||||
|
|
@ -110,17 +113,29 @@ public class BssVatInvoiceController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存添加/修改的数据
|
* 保存添加/修改的数据
|
||||||
* @param valid 验证对象
|
* @param
|
||||||
*/
|
*/
|
||||||
@PostMapping({"/add","/edit"})
|
@PostMapping({"/add","/edit"})
|
||||||
@RequiresPermissions({"bss:vatInvoice:add","bss:vatInvoice:edit"})
|
@RequiresPermissions({"bss:vatInvoice:add","bss:vatInvoice:edit"})
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResultVo save(@Validated BssVatInvoiceValid valid, BssVatInvoice bssVatInvoice) {
|
// public ResultVo save(@Validated @RequestBody BssVatInvoiceValid valid, @RequestBody BssVatInvoice bssVatInvoice) {
|
||||||
|
public ResultVo save(@Validated @RequestBody BssVatInvoice bssVatInvoice) {
|
||||||
// 复制保留无需修改的数据
|
// 复制保留无需修改的数据
|
||||||
if (bssVatInvoice.getId() != null) {
|
if (bssVatInvoice.getId() != null) {
|
||||||
BssVatInvoice beBssVatInvoice = bssVatInvoiceService.getById(bssVatInvoice.getId());
|
BssVatInvoice beBssVatInvoice = bssVatInvoiceService.getById(bssVatInvoice.getId());
|
||||||
EntityBeanUtil.copyProperties(beBssVatInvoice, bssVatInvoice);
|
EntityBeanUtil.copyProperties(beBssVatInvoice, bssVatInvoice);
|
||||||
}
|
}
|
||||||
|
if(!StringUtil.isBlank(String.valueOf(bssVatInvoice.getSalerTaxInfoId()))){
|
||||||
|
bssVatInvoice.setSalerTaxInfo(bssTaxinfoService.getById(bssVatInvoice.getSalerTaxInfoId()));
|
||||||
|
}
|
||||||
|
if(!StringUtil.isBlank(String.valueOf(bssVatInvoice.getBuyTaxInfoId()))) {
|
||||||
|
bssVatInvoice.setBuyTaxInfo(bssTaxinfoService.getById(bssVatInvoice.getBuyTaxInfoId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<BssGoods> bssGoods = bssVatInvoice.getBssGoods();
|
||||||
|
bssGoods.stream().forEach(good ->{
|
||||||
|
good.setVatInvoice(bssVatInvoice);
|
||||||
|
});
|
||||||
|
|
||||||
// 保存数据
|
// 保存数据
|
||||||
bssVatInvoiceService.save(bssVatInvoice);
|
bssVatInvoiceService.save(bssVatInvoice);
|
||||||
|
|
@ -170,18 +185,43 @@ public class BssVatInvoiceController {
|
||||||
File destFile = FileUpload.getDestFile(upload);
|
File destFile = FileUpload.getDestFile(upload);
|
||||||
VatInvoiceResult vatInvoiceResult = BaiduAipOCR.queryBaiduVatInvoiceApi(destFile);
|
VatInvoiceResult vatInvoiceResult = BaiduAipOCR.queryBaiduVatInvoiceApi(destFile);
|
||||||
WordsResult wordsResult = vatInvoiceResult.getWords_result();
|
WordsResult wordsResult = vatInvoiceResult.getWords_result();
|
||||||
//销售方
|
BssVatInvoice vatInvoice = new BssVatInvoice();
|
||||||
BssTaxinfo sellerTaxInfo = new BssTaxinfo();
|
Long bssplatformId = ShiroUtil.getSubject().getBssPlatform().getId();
|
||||||
sellerTaxInfo.setName(wordsResult.getSellerName());
|
//add by hjc 发票上扫到的买卖双方如果不在系统中先入库
|
||||||
sellerTaxInfo.setTaxNo(wordsResult.getSellerRegisterNum());
|
if(!StringUtil.isBlank(wordsResult.getSellerRegisterNum())){
|
||||||
sellerTaxInfo.setAccount(wordsResult.getSellerBank());
|
BssTaxinfo sellerTaxInfo = new BssTaxinfo();
|
||||||
sellerTaxInfo.setAddressPhone(wordsResult.getSellerAddress());
|
BssTaxinfo taxNo = bssTaxinfoService.getByTaxNo(wordsResult.getSellerRegisterNum());
|
||||||
//购买方
|
if(taxNo == null){
|
||||||
BssTaxinfo purchaserTaxInfo = new BssTaxinfo();
|
//销售方
|
||||||
purchaserTaxInfo.setName(wordsResult.getPurchaserName());
|
sellerTaxInfo.setName(wordsResult.getSellerName());
|
||||||
purchaserTaxInfo.setTaxNo(wordsResult.getPurchaserRegisterNum());
|
sellerTaxInfo.setTaxNo(wordsResult.getSellerRegisterNum());
|
||||||
purchaserTaxInfo.setAccount(wordsResult.getPurchaserBank());
|
sellerTaxInfo.setAccount(wordsResult.getSellerBank());
|
||||||
purchaserTaxInfo.setAddressPhone(wordsResult.getPurchaserAddress());
|
sellerTaxInfo.setAddressPhone(wordsResult.getSellerAddress());
|
||||||
|
sellerTaxInfo.setPlatformId(bssplatformId);
|
||||||
|
bssTaxinfoService.save(sellerTaxInfo);
|
||||||
|
vatInvoice.setSalerTaxInfoId(sellerTaxInfo.getId());
|
||||||
|
}else {
|
||||||
|
vatInvoice.setSalerTaxInfoId(taxNo.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!StringUtil.isBlank(wordsResult.getPurchaserRegisterNum())){
|
||||||
|
BssTaxinfo purchaserTaxInfo = new BssTaxinfo();
|
||||||
|
BssTaxinfo taxNo = bssTaxinfoService.getByTaxNo(wordsResult.getPurchaserRegisterNum());
|
||||||
|
if(taxNo == null){
|
||||||
|
//购买方
|
||||||
|
purchaserTaxInfo.setName(wordsResult.getPurchaserName());
|
||||||
|
purchaserTaxInfo.setTaxNo(wordsResult.getPurchaserRegisterNum());
|
||||||
|
purchaserTaxInfo.setAccount(wordsResult.getPurchaserBank());
|
||||||
|
purchaserTaxInfo.setAddressPhone(wordsResult.getPurchaserAddress());
|
||||||
|
purchaserTaxInfo.setPlatformId(bssplatformId);
|
||||||
|
bssTaxinfoService.save(purchaserTaxInfo);
|
||||||
|
vatInvoice.setBuyTaxInfoId(purchaserTaxInfo.getId());
|
||||||
|
}else{
|
||||||
|
vatInvoice.setBuyTaxInfoId(taxNo.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//商品
|
//商品
|
||||||
List<BssGoods> goods = new ArrayList<>();
|
List<BssGoods> goods = new ArrayList<>();
|
||||||
List<CommodityName> commodityNames = wordsResult.getCommodityName();
|
List<CommodityName> commodityNames = wordsResult.getCommodityName();
|
||||||
|
|
@ -215,12 +255,11 @@ public class BssVatInvoiceController {
|
||||||
good.setTaxRate(commodityTaxRates.get(i).getWord());
|
good.setTaxRate(commodityTaxRates.get(i).getWord());
|
||||||
}
|
}
|
||||||
if (ToolUtil.checkListSize(commodityTaxs) && !StringUtil.isBlank(commodityTaxs.get(i).getWord())) {
|
if (ToolUtil.checkListSize(commodityTaxs) && !StringUtil.isBlank(commodityTaxs.get(i).getWord())) {
|
||||||
good.setTaxAmount(new BigDecimal(commodityTaxs.get(i).getWord()));
|
good.setGoodTaxAmount(new BigDecimal(commodityTaxs.get(i).getWord()));
|
||||||
}
|
}
|
||||||
goods.add(good);
|
goods.add(good);
|
||||||
}
|
}
|
||||||
|
|
||||||
BssVatInvoice vatInvoice = new BssVatInvoice();
|
|
||||||
vatInvoice.setInvoiceCode(wordsResult.getInvoiceCode());
|
vatInvoice.setInvoiceCode(wordsResult.getInvoiceCode());
|
||||||
vatInvoice.setInvoiceNo(wordsResult.getInvoiceNum());
|
vatInvoice.setInvoiceNo(wordsResult.getInvoiceNum());
|
||||||
vatInvoice.setInvoiceDate(wordsResult.getInvoiceDate());
|
vatInvoice.setInvoiceDate(wordsResult.getInvoiceDate());
|
||||||
|
|
@ -230,8 +269,6 @@ public class BssVatInvoiceController {
|
||||||
vatInvoice.setTotalAmount(new BigDecimal(wordsResult.getAmountInFiguers()));
|
vatInvoice.setTotalAmount(new BigDecimal(wordsResult.getAmountInFiguers()));
|
||||||
vatInvoice.setTotalAmountCn(wordsResult.getAmountInWords());
|
vatInvoice.setTotalAmountCn(wordsResult.getAmountInWords());
|
||||||
vatInvoice.setRemark(wordsResult.getRemarks());
|
vatInvoice.setRemark(wordsResult.getRemarks());
|
||||||
vatInvoice.setBuyTaxInfo(purchaserTaxInfo);
|
|
||||||
vatInvoice.setSalerTaxInfo(sellerTaxInfo);
|
|
||||||
vatInvoice.setBssGoods(goods);
|
vatInvoice.setBssGoods(goods);
|
||||||
vatInvoice.setInvoiceImg(upload.getPath());
|
vatInvoice.setInvoiceImg(upload.getPath());
|
||||||
vatInvoice.setInvoiceType(VatInvoiceTypeEnum.getVatInvoiceCode(wordsResult.getInvoiceType()));
|
vatInvoice.setInvoiceType(VatInvoiceTypeEnum.getVatInvoiceCode(wordsResult.getInvoiceType()));
|
||||||
|
|
|
||||||
|
|
@ -127,18 +127,55 @@ layui.use(['element', 'form', 'layer', 'upload'], function () {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 提交表单数据 */
|
/* 提交表单数据 */ // update by hjc
|
||||||
$(document).on("click", ".ajax-submit", function (e) {
|
$(document).on("click", ".ajax-submit", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var form = $(this).parents("form");
|
var form = $(this).parents("form");
|
||||||
var url = form.attr("action");
|
var url = form.attr("action");
|
||||||
var serializeArray = form.serializeArray();
|
var serializeArray = form.serializeArray();
|
||||||
$.post(url, serializeArray, function (result) {
|
var _newData = null;
|
||||||
if (result.data == null) {
|
var from = false; // from = true 代表增值税页面请求,用设置content-type的请求
|
||||||
result.data = 'submit[refresh]';
|
for(var i=0; i<serializeArray.length; i++){
|
||||||
|
if(serializeArray[i].name == 'salerTaxInfoId'){
|
||||||
|
from = true;
|
||||||
|
_newData = trans.serialize( serializeArray );
|
||||||
|
var goods = createGoodsParams();
|
||||||
|
_newData.bssGoods = goods;
|
||||||
|
delete _newData.name;
|
||||||
|
delete _newData.specification;
|
||||||
|
delete _newData.unit;
|
||||||
|
delete _newData.num;
|
||||||
|
delete _newData.unitPrice;
|
||||||
|
delete _newData.detailAmount;
|
||||||
|
delete _newData.taxRate;
|
||||||
|
delete _newData.goodTaxAmount;
|
||||||
|
break;
|
||||||
|
}else {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
$.fn.Messager(result);
|
}
|
||||||
});
|
|
||||||
|
if(from){
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
type: 'POST',
|
||||||
|
contentType: 'application/json',
|
||||||
|
data: JSON.stringify(_newData),
|
||||||
|
success: function(result) {
|
||||||
|
if (result.data == null) {
|
||||||
|
result.data = 'submit[refresh]';
|
||||||
|
}
|
||||||
|
$.fn.Messager(result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else {
|
||||||
|
$.post(url, _newData, function(result) {
|
||||||
|
if (result.data == null) {
|
||||||
|
result.data = 'submit[refresh]';
|
||||||
|
}
|
||||||
|
$.fn.Messager(result);
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/* get方式异步 */
|
/* get方式异步 */
|
||||||
|
|
@ -406,6 +443,8 @@ layui.use(['element', 'form', 'layer', 'upload'], function () {
|
||||||
$('#taxAmount').val(res.data['taxAmount']);
|
$('#taxAmount').val(res.data['taxAmount']);
|
||||||
$('#totalAmount').val(res.data['totalAmount']);
|
$('#totalAmount').val(res.data['totalAmount']);
|
||||||
$('#totalAmountCn').val(res.data['totalAmountCn']);
|
$('#totalAmountCn').val(res.data['totalAmountCn']);
|
||||||
|
$('#salerTaxInfoId').val(res.data['salerTaxInfoId']);
|
||||||
|
$('#buyTaxInfoId').val(res.data['buyTaxInfoId']);
|
||||||
form.render("select");
|
form.render("select");
|
||||||
hide.val(res.data['invoiceImg']);
|
hide.val(res.data['invoiceImg']);
|
||||||
item.addClass('succeed');
|
item.addClass('succeed');
|
||||||
|
|
@ -413,8 +452,9 @@ layui.use(['element', 'form', 'layer', 'upload'], function () {
|
||||||
/* 实体模型操作 */
|
/* 实体模型操作 */
|
||||||
var entity = $("#entity");
|
var entity = $("#entity");
|
||||||
var goods = res.data['bssGoods'];
|
var goods = res.data['bssGoods'];
|
||||||
|
var element = null;
|
||||||
for(var i=0; i<goods.length; i++){
|
for(var i=0; i<goods.length; i++){
|
||||||
var element = entity.children("tr:last-child").clone();
|
element = entity.children("tr:last-child").clone();
|
||||||
element.find("input[name='name']").val(goods[i].name);
|
element.find("input[name='name']").val(goods[i].name);
|
||||||
element.find("input[name='specification']").val(goods[i].specification);
|
element.find("input[name='specification']").val(goods[i].specification);
|
||||||
element.find("input[name='unit']").val(goods[i].unit);
|
element.find("input[name='unit']").val(goods[i].unit);
|
||||||
|
|
@ -422,10 +462,9 @@ layui.use(['element', 'form', 'layer', 'upload'], function () {
|
||||||
element.find("input[name='unitPrice']").val(goods[i].unitPrice);
|
element.find("input[name='unitPrice']").val(goods[i].unitPrice);
|
||||||
element.find("input[name='detailAmount']").val(goods[i].detailAmount);
|
element.find("input[name='detailAmount']").val(goods[i].detailAmount);
|
||||||
element.find("input[name='taxRate']").val(goods[i].taxRate);
|
element.find("input[name='taxRate']").val(goods[i].taxRate);
|
||||||
element.find("input[name='taxAmount']").val(goods[i].taxAmount);
|
element.find("input[name='goodTaxAmount']").val(goods[i].goodTaxAmount);
|
||||||
entity.append(element);
|
entity.append(element);
|
||||||
|
element.children(".entity-number").click();
|
||||||
// element.children(".entity-number").click();
|
|
||||||
$.each(entity.children(), function (key, val) {
|
$.each(entity.children(), function (key, val) {
|
||||||
$(val).children(".entity-number").text(key + 1);
|
$(val).children(".entity-number").text(key + 1);
|
||||||
});
|
});
|
||||||
|
|
@ -461,4 +500,47 @@ layui.use(['element', 'form', 'layer', 'upload'], function () {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function createGoodsParams() {
|
||||||
|
var entity = $("#entity");
|
||||||
|
var trs = entity.children("tr");
|
||||||
|
|
||||||
|
var goods = new Array();
|
||||||
|
$.each(trs, function(index, element){
|
||||||
|
var name = element.children[1].children[0].value;
|
||||||
|
if(name == null || name == '' || name == undefined){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
var good = {};
|
||||||
|
good.name = name;
|
||||||
|
good.specification = element.children[2].children[0].value;
|
||||||
|
good.unit = element.children[3].children[0].value;
|
||||||
|
good.num = element.children[4].children[0].value;
|
||||||
|
good.unitPrice = element.children[5].children[0].value;
|
||||||
|
good.detailAmount = element.children[6].children[0].value;
|
||||||
|
good.taxRate = element.children[7].children[0].value;
|
||||||
|
good.goodTaxAmount = element.children[8].children[0].value;
|
||||||
|
|
||||||
|
goods.push(good);
|
||||||
|
});
|
||||||
|
|
||||||
|
return goods;
|
||||||
|
}
|
||||||
|
|
||||||
|
var trans={
|
||||||
|
serialize:function(obj){
|
||||||
|
var o ={};
|
||||||
|
$.each(obj,function(){
|
||||||
|
if(o[this.name]){
|
||||||
|
if(!o[this.name].push){
|
||||||
|
o[this.name]=[o[this.name]];
|
||||||
|
}
|
||||||
|
o[this.name].push(this.value||"");
|
||||||
|
}else {
|
||||||
|
o[this.name] = this.value || "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -83,6 +83,8 @@
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<input type="text" id="totalAmountCn" name="totalAmountCn" autocomplete="off" class="layui-input">
|
<input type="text" id="totalAmountCn" name="totalAmountCn" autocomplete="off" class="layui-input">
|
||||||
</div>
|
</div>
|
||||||
|
<input type="hidden" id="salerTaxInfoId" name="salerTaxInfoId" />
|
||||||
|
<input type="hidden" id="buyTaxInfoId" name="buyTaxInfoId" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-inline">
|
<div class="layui-inline">
|
||||||
|
|
@ -102,10 +104,10 @@
|
||||||
<div class="panel-header">
|
<div class="panel-header">
|
||||||
<div class="title">货物信息</div>
|
<div class="title">货物信息</div>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<button class="field-add layui-btn layui-btn-primary layui-btn-xs">
|
<button class="col-add field-add layui-btn layui-btn-primary layui-btn-xs">
|
||||||
<i class="fa fa-plus-circle"></i>添加
|
<i class="fa fa-plus-circle"></i>添加
|
||||||
</button>
|
</button>
|
||||||
<button class="field-del layui-btn layui-btn-primary layui-btn-xs">
|
<button class="col-del field-del layui-btn layui-btn-primary layui-btn-xs">
|
||||||
<i class="fa fa-minus-circle"></i>删除
|
<i class="fa fa-minus-circle"></i>删除
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -136,13 +138,13 @@
|
||||||
<td class="entity-unitPrice"><input type="text" name="unitPrice"/></td>
|
<td class="entity-unitPrice"><input type="text" name="unitPrice"/></td>
|
||||||
<td class="entity-detailAmount"><input type="text" name="detailAmount"/></td>
|
<td class="entity-detailAmount"><input type="text" name="detailAmount"/></td>
|
||||||
<td class="entity-taxRate"><input type="text" name="taxRate"/></td>
|
<td class="entity-taxRate"><input type="text" name="taxRate"/></td>
|
||||||
<td class="entity-taxAmount"><input type="text" name="taxAmount"/></td>
|
<td class="entity-taxAmount"><input type="text" name="goodTaxAmount"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item timo-finally">
|
<div class="layui-form-item timo-finally">
|
||||||
<button class="layui-btn ajax-submit"><i class="fa fa-check-circle"></i> 保存</button>
|
<button class="layui-btn ajax-submit" ><i class="fa fa-check-circle"></i> 保存</button>
|
||||||
<button class="layui-btn btn-secondary close-popup"><i class="fa fa-times-circle"></i> 关闭</button>
|
<button class="layui-btn btn-secondary close-popup"><i class="fa fa-times-circle"></i> 关闭</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -192,22 +194,73 @@
|
||||||
|
|
||||||
<script th:replace="/common/template :: script"></script>
|
<script th:replace="/common/template :: script"></script>
|
||||||
<script type="text/javascript" th:src="@{/js/plugins/jquery-3.3.1.min.js}"></script>
|
<script type="text/javascript" th:src="@{/js/plugins/jquery-3.3.1.min.js}"></script>
|
||||||
<script type="text/javascript" th:src="@{/lib/zTree_v3/js/jquery.ztree.core.min.js}"></script>
|
<!--<script type="text/javascript" th:src="@{/lib/zTree_v3/js/jquery.ztree.core.min.js}"></script>-->
|
||||||
<script type="text/javascript" th:src="@{/js/timoTree.js}"></script>
|
<!--<script type="text/javascript" th:src="@{/js/timoTree.js}"></script>-->
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// 树形菜单
|
// 树形菜单
|
||||||
$.fn.selectTree({
|
// $.fn.selectTree({
|
||||||
rootTree: '顶级菜单'
|
// rootTree: '顶级菜单'
|
||||||
|
// });
|
||||||
|
|
||||||
|
// 验证下拉选择器
|
||||||
|
// layui.config({
|
||||||
|
// base: '[[@{/lib/formSelects-v4/}]]'
|
||||||
|
// }).extend({
|
||||||
|
// formSelects: 'formSelects-v4.min'
|
||||||
|
// });
|
||||||
|
|
||||||
|
var entity = $("#entity");
|
||||||
|
var field = null;
|
||||||
|
// 选中字段
|
||||||
|
entity.on("click", ".entity-number", function () {
|
||||||
|
if(field !== null){
|
||||||
|
$(field).css("background-color", "#FFFFFF");
|
||||||
|
$(field).css("color", "#666666");
|
||||||
|
}
|
||||||
|
if(field !== this){
|
||||||
|
$(this).css("background-color", "#5FB878");
|
||||||
|
$(this).css("color", "#FFFFFF");
|
||||||
|
field = this;
|
||||||
|
}else{
|
||||||
|
field = null;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 验证下拉选择器
|
// 添加行
|
||||||
layui.config({
|
$(".col-add").on("click", function (e) {
|
||||||
base: '[[@{/lib/formSelects-v4/}]]'
|
e.preventDefault();
|
||||||
}).extend({
|
var element = entity.children("tr:last-child").clone();
|
||||||
formSelects: 'formSelects-v4.min'
|
element.find("input").val("");
|
||||||
|
if(field == null){
|
||||||
|
entity.append(element);
|
||||||
|
}else {
|
||||||
|
$(field).parent().after(element);
|
||||||
|
}
|
||||||
|
element.children(".entity-number").click();
|
||||||
|
resetNumber();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 删除行
|
||||||
|
$(".col-del").on("click", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
if(field != null){
|
||||||
|
if (entity.children("tr").length == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$(field).parent().remove();
|
||||||
|
entity.children("tr:last-child").children(".entity-number").click();
|
||||||
|
resetNumber();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 重置字段编号
|
||||||
|
var resetNumber = function(){
|
||||||
|
entity.children().each(function (key, val) {
|
||||||
|
$(val).children(".entity-number").text(key + 1);
|
||||||
|
});
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" th:src="@{/js/generate.code.js}"></script>
|
<!--<script type="text/javascript" th:src="@{/js/generate.code.js}"></script>-->
|
||||||
<script type="text/javascript" th:src="@{/js/build.js}"></script>
|
<!--<script type="text/javascript" th:src="@{/js/build.js}"></script>-->
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
</div>
|
</div>
|
||||||
<form class="user-edit" th:action="@{/userInfo}">
|
<form class="user-edit" th:action="@{/userInfo}">
|
||||||
<input type="hidden" name="username" th:value="${user.username}"/>
|
<input type="hidden" name="username" th:value="${user.username}"/>
|
||||||
<input type="hidden" name="bssDept" th:value="${user.dept?.id}"/>
|
<input type="hidden" name="bssDept" th:value="${user.dept.id}"/>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label">用户昵称</label>
|
<label class="layui-form-label">用户昵称</label>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ public class BssGoods implements Serializable {
|
||||||
private BigDecimal detailAmount;
|
private BigDecimal detailAmount;
|
||||||
// 税额
|
// 税额
|
||||||
@Column(name = "tax_amount")
|
@Column(name = "tax_amount")
|
||||||
private BigDecimal taxAmount;
|
private BigDecimal goodTaxAmount;
|
||||||
// 税率
|
// 税率
|
||||||
@Column(name = "tax_rate")
|
@Column(name = "tax_rate")
|
||||||
private String taxRate;
|
private String taxRate;
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,9 @@ import org.springframework.data.annotation.LastModifiedDate;
|
||||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.Pattern;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
@ -33,32 +36,42 @@ public class BssVatInvoice implements Serializable {
|
||||||
private Long id;
|
private Long id;
|
||||||
// 发票代码
|
// 发票代码
|
||||||
@Column(name = "invoice_code")
|
@Column(name = "invoice_code")
|
||||||
|
@NotEmpty(message = "发票代码不能为空")
|
||||||
private String invoiceCode;
|
private String invoiceCode;
|
||||||
// 发票号码
|
// 发票号码
|
||||||
@Column(name = "invoice_no")
|
@Column(name = "invoice_no")
|
||||||
|
@NotEmpty(message = "发票号码不能为空")
|
||||||
private String invoiceNo;
|
private String invoiceNo;
|
||||||
// 发票日期
|
// 发票日期
|
||||||
@Column(name = "invoice_date")
|
@Column(name = "invoice_date")
|
||||||
|
@NotEmpty(message = "发票日期不能为空")
|
||||||
|
@Pattern(regexp = "[0-9]{4}-[0-9]{2}-[0-9]{2}", message = "日期格式不正确")
|
||||||
private String invoiceDate;
|
private String invoiceDate;
|
||||||
// 校验码
|
// 校验码
|
||||||
@Column(name = "check_code")
|
@Column(name = "check_code")
|
||||||
|
@NotEmpty(message = "校验码不能为空")
|
||||||
private String checkCode;
|
private String checkCode;
|
||||||
// 发票金额
|
// 发票金额
|
||||||
@Column(name = "invoice_money")
|
@Column(name = "invoice_money")
|
||||||
|
@NotNull(message = "发票金额不能为空")
|
||||||
private BigDecimal invoiceMoney;
|
private BigDecimal invoiceMoney;
|
||||||
// 税额
|
// 税额
|
||||||
@Column(name = "tax_amount")
|
@Column(name = "tax_amount")
|
||||||
|
@NotNull(message = "税额不能为空")
|
||||||
private BigDecimal taxAmount;
|
private BigDecimal taxAmount;
|
||||||
// 总金额
|
// 总金额
|
||||||
@Column(name = "total_amount")
|
@Column(name = "total_amount")
|
||||||
|
@NotNull(message = "总金额不能为空")
|
||||||
private BigDecimal totalAmount;
|
private BigDecimal totalAmount;
|
||||||
// 总金额(大写)
|
// 总金额(大写)
|
||||||
@Column(name = "total_amount_cn")
|
@Column(name = "total_amount_cn")
|
||||||
|
@NotEmpty(message = "总金额(大写)不能为空")
|
||||||
private String totalAmountCn;
|
private String totalAmountCn;
|
||||||
|
|
||||||
//发票类型
|
//发票类型
|
||||||
//增值税普通发票 0; 增值税专用发票 1
|
//增值税普通发票 0; 增值税专用发票 1
|
||||||
@Column(name = "invoice_type")
|
@Column(name = "invoice_type")
|
||||||
|
@NotNull(message = "发票类型不能为空")
|
||||||
private Integer invoiceType;
|
private Integer invoiceType;
|
||||||
|
|
||||||
// 备注
|
// 备注
|
||||||
|
|
@ -73,7 +86,6 @@ public class BssVatInvoice implements Serializable {
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
private BssTaxinfo buyTaxInfo;
|
private BssTaxinfo buyTaxInfo;
|
||||||
// 销售方纳税人信息
|
// 销售方纳税人信息
|
||||||
// 购买方纳税人信息
|
|
||||||
@OneToOne(fetch=FetchType.LAZY)
|
@OneToOne(fetch=FetchType.LAZY)
|
||||||
@NotFound(action= NotFoundAction.IGNORE)
|
@NotFound(action= NotFoundAction.IGNORE)
|
||||||
@JoinColumn(name="saler_tax_info_id")
|
@JoinColumn(name="saler_tax_info_id")
|
||||||
|
|
@ -91,4 +103,10 @@ public class BssVatInvoice implements Serializable {
|
||||||
// 更新时间
|
// 更新时间
|
||||||
@LastModifiedDate
|
@LastModifiedDate
|
||||||
private Date updateDate;
|
private Date updateDate;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private Long buyTaxInfoId;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private Long salerTaxInfoId;
|
||||||
}
|
}
|
||||||
|
|
@ -8,4 +8,5 @@ import com.cwhelp.modules.system.repository.BaseRepository;
|
||||||
* @date 2019/08/16
|
* @date 2019/08/16
|
||||||
*/
|
*/
|
||||||
public interface BssTaxinfoRepository extends BaseRepository<BssTaxinfo, Long> {
|
public interface BssTaxinfoRepository extends BaseRepository<BssTaxinfo, Long> {
|
||||||
|
BssTaxinfo getByTaxNo(String taxNo);
|
||||||
}
|
}
|
||||||
|
|
@ -38,4 +38,9 @@ public interface BssTaxinfoService {
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
Boolean updateStatus(StatusEnum statusEnum, List<Long> idList);
|
Boolean updateStatus(StatusEnum statusEnum, List<Long> idList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据纳税人识别号查询数据
|
||||||
|
*/
|
||||||
|
BssTaxinfo getByTaxNo(String taxNo);
|
||||||
}
|
}
|
||||||
|
|
@ -24,6 +24,11 @@ public class BssTaxinfoServiceImpl implements BssTaxinfoService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private BssTaxinfoRepository bssTaxinfoRepository;
|
private BssTaxinfoRepository bssTaxinfoRepository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BssTaxinfo getByTaxNo(String taxNo) {
|
||||||
|
return bssTaxinfoRepository.getByTaxNo(taxNo);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID查询数据
|
* 根据ID查询数据
|
||||||
* @param id 主键ID
|
* @param id 主键ID
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue