Compare commits

...

10 Commits

Author SHA1 Message Date
hjc e49dc747e7 拦截器 2019-12-19 22:37:52 +08:00
hjc 12b0f4eab7 11 2019-12-15 21:29:17 +08:00
hjc 1e9b48b79f update 2019-12-15 20:19:08 +08:00
hjc de67a633d2 update 2019-12-14 20:29:40 +08:00
hjc 4e63bbd12b 科目信息 2019-12-11 22:22:35 +08:00
hjc ed643abfe5 小程序端login demo 2019-12-09 21:06:14 +08:00
hjc 8ac6000605 提交 2019-11-23 18:11:43 +08:00
hjc ff25047310 增值税发票保存 2019-11-22 20:42:09 +08:00
hjc e07c0b02f5 修改頁面 2019-11-18 21:03:22 +08:00
hjc 7fe32afd3f 增值税页面修改 2019-11-18 16:53:50 +08:00
65 changed files with 2042 additions and 134 deletions

View File

@ -6,7 +6,9 @@
</facet>
<facet type="web" name="Web">
<configuration>
<webroots />
<webroots>
<root url="file://$MODULE_DIR$/src/main/webapp" relative="/" />
</webroots>
<sourceRoots>
<root url="file://$MODULE_DIR$/src/main/java" />
<root url="file://$MODULE_DIR$/src/main/resources" />

View File

@ -0,0 +1,128 @@
package com.cwhelp.admin.business.controller;
import com.cwhelp.admin.business.validator.BssClassItemValid;
import com.cwhelp.common.enums.AccountStandardEnum;
import com.cwhelp.common.enums.StatusEnum;
import com.cwhelp.common.utils.EntityBeanUtil;
import com.cwhelp.common.utils.ResultVoUtil;
import com.cwhelp.common.utils.StatusUtil;
import com.cwhelp.common.vo.ResultVo;
import com.cwhelp.modules.business.domain.BssClassItem;
import com.cwhelp.modules.business.service.BssClassItemService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author huang.jc
* @date 2019/12/11
*/
@Controller
@RequestMapping("/bss/classItem")
public class BssClassItemController {
@Autowired
private BssClassItemService bssClassItemService;
/**
* 列表页面
*/
@GetMapping("/index")
@RequiresPermissions("bss:classItem:index")
public String index(Model model, BssClassItem classItem) {
// 创建匹配器进行动态查询匹配
ExampleMatcher matcher = ExampleMatcher.matching()
.withMatcher("itemName", match -> match.contains());
// 获取数据列表
Example<BssClassItem> example = Example.of(classItem, matcher);
Page<BssClassItem> list = bssClassItemService.getPageList(example);
List<BssClassItem> items = list.getContent();
items.stream().forEach(bssClassItem -> {
bssClassItem.setItemTypeName(AccountStandardEnum.getNameById(bssClassItem.getItemType()));
});
// 封装数据
model.addAttribute("list", items);
model.addAttribute("page", list);
return "/business/classItem/index";
}
/**
* 跳转到添加页面
*/
@GetMapping("/add")
@RequiresPermissions("bss:classItem:add")
public String toAdd() {
return "/business/classItem/add";
}
/**
* 跳转到编辑页面
*/
@GetMapping("/edit/{id}")
@RequiresPermissions("bss:classItem:edit")
public String toEdit(@PathVariable("id") BssClassItem classItem, Model model) {
model.addAttribute("classItem", classItem);
return "/business/classItem/add";
}
/**
* 保存添加/修改的数据
* @param valid 验证对象
*/
@PostMapping({"/add","/edit"})
@RequiresPermissions({"bss:classItem:add","bss:classItem:edit"})
@ResponseBody
public ResultVo save(@Validated BssClassItemValid valid, BssClassItem classItem) {
// 复制保留无需修改的数据
if (classItem.getId() != null) {
BssClassItem beClassItem = bssClassItemService.getById(classItem.getId());
EntityBeanUtil.copyProperties(beClassItem, classItem);
}
// 保存数据
bssClassItemService.save(classItem);
return ResultVoUtil.SAVE_SUCCESS;
}
/**
* 跳转到详细页面
*/
@GetMapping("/detail/{id}")
@RequiresPermissions("bss:classItem:detail")
public String toDetail(@PathVariable("id") BssClassItem classItem, Model model) {
model.addAttribute("classItem",classItem);
return "/business/classItem/detail";
}
/**
* 设置一条或者多条数据的状态
*/
@RequestMapping("/status/{param}")
@RequiresPermissions("bss:classItem:status")
@ResponseBody
public ResultVo status(
@PathVariable("param") String param,
@RequestParam(value = "ids", required = false) List<Long> ids) {
// 更新状态
StatusEnum statusEnum = StatusUtil.getStatusEnum(param);
if (bssClassItemService.updateStatus(statusEnum, ids)) {
return ResultVoUtil.success(statusEnum.getMessage() + "成功");
} else {
return ResultVoUtil.error(statusEnum.getMessage() + "失败,请重新操作");
}
}
}

View File

@ -6,14 +6,17 @@ import com.cwhelp.admin.business.validator.BssVatInvoiceValid;
import com.cwhelp.common.api.baidu.BaiduAipOCR;
import com.cwhelp.common.api.baidu.entity.vatinvoice.*;
import com.cwhelp.common.api.baidu.entity.vatinvoice.enums.VatInvoiceTypeEnum;
import com.cwhelp.common.enums.InvoiceTypeEnum;
import com.cwhelp.common.enums.StatusEnum;
import com.cwhelp.common.utils.*;
import com.cwhelp.common.vo.ResultVo;
import com.cwhelp.component.fileUpload.FileUpload;
import com.cwhelp.component.shiro.ShiroUtil;
import com.cwhelp.devtools.generate.utils.jAngel.utils.StringUtil;
import com.cwhelp.modules.business.domain.BssGoods;
import com.cwhelp.modules.business.domain.BssTaxinfo;
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.system.domain.Upload;
import org.apache.shiro.authz.annotation.RequiresPermissions;
@ -28,9 +31,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
@ -45,6 +46,9 @@ public class BssVatInvoiceController {
@Autowired
private BssVatInvoiceService bssVatInvoiceService;
@Autowired
private BssTaxinfoService bssTaxinfoService;
/**
* 列表页面
*/
@ -110,18 +114,33 @@ public class BssVatInvoiceController {
/**
* 保存添加/修改的数据
* @param valid 验证对象
* @param
*/
@PostMapping({"/add","/edit"})
@RequiresPermissions({"bss:vatInvoice:add","bss:vatInvoice:edit"})
@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) {
BssVatInvoice beBssVatInvoice = bssVatInvoiceService.getById(bssVatInvoice.getId());
EntityBeanUtil.copyProperties(beBssVatInvoice, bssVatInvoice);
bssVatInvoice.setSalerTaxInfo(beBssVatInvoice.getSalerTaxInfo());
bssVatInvoice.setBuyTaxInfo(beBssVatInvoice.getBuyTaxInfo());
}else {
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();
if(bssGoods != null && bssGoods.size() > 0){
bssGoods.stream().forEach(good ->{
good.setVatInvoice(bssVatInvoice);
});
}
}
// 保存数据
bssVatInvoiceService.save(bssVatInvoice);
return ResultVoUtil.SAVE_SUCCESS;
@ -168,20 +187,45 @@ public class BssVatInvoiceController {
try {
FileUpload.transferTo(multipartFile, upload);
File destFile = FileUpload.getDestFile(upload);
VatInvoiceResult vatInvoiceResult = BaiduAipOCR.queryBaiduVatInvoiceApi(destFile);
VatInvoiceResult vatInvoiceResult = (VatInvoiceResult)BaiduAipOCR.queryBaiduVatInvoiceApi(destFile, InvoiceTypeEnum.ADD_VALUE_TAX_INVOICE.getCode());
WordsResult wordsResult = vatInvoiceResult.getWords_result();
//销售方
BssTaxinfo sellerTaxInfo = new BssTaxinfo();
sellerTaxInfo.setName(wordsResult.getSellerName());
sellerTaxInfo.setTaxNo(wordsResult.getSellerRegisterNum());
sellerTaxInfo.setAccount(wordsResult.getSellerBank());
sellerTaxInfo.setAddressPhone(wordsResult.getSellerAddress());
//购买方
BssTaxinfo purchaserTaxInfo = new BssTaxinfo();
purchaserTaxInfo.setName(wordsResult.getPurchaserName());
purchaserTaxInfo.setTaxNo(wordsResult.getPurchaserRegisterNum());
purchaserTaxInfo.setAccount(wordsResult.getPurchaserBank());
purchaserTaxInfo.setAddressPhone(wordsResult.getPurchaserAddress());
BssVatInvoice vatInvoice = new BssVatInvoice();
Long bssplatformId = ShiroUtil.getSubject().getBssPlatform().getId();
//add by hjc 发票上扫到的买卖双方如果不在系统中先入库
if(!StringUtil.isBlank(wordsResult.getSellerRegisterNum())){
BssTaxinfo sellerTaxInfo = new BssTaxinfo();
BssTaxinfo taxNo = bssTaxinfoService.getByTaxNo(wordsResult.getSellerRegisterNum());
if(taxNo == null){
//销售方
sellerTaxInfo.setName(wordsResult.getSellerName());
sellerTaxInfo.setTaxNo(wordsResult.getSellerRegisterNum());
sellerTaxInfo.setAccount(wordsResult.getSellerBank());
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<CommodityName> commodityNames = wordsResult.getCommodityName();
@ -203,7 +247,7 @@ public class BssVatInvoiceController {
good.setUnit(commodityUnits.get(i).getWord());
}
if (ToolUtil.checkListSize(commodityNums) && !StringUtil.isBlank(commodityNums.get(i).getWord())) {
good.setNum(Integer.valueOf(commodityNums.get(i).getWord()));
good.setNum(Double.valueOf(commodityNums.get(i).getWord()));
}
if (ToolUtil.checkListSize(commodityPrices) && commodityPrices.size() > i && !StringUtil.isBlank(commodityPrices.get(i).getWord())) {
good.setUnitPrice(commodityPrices.get(i).getWord());
@ -215,12 +259,11 @@ public class BssVatInvoiceController {
good.setTaxRate(commodityTaxRates.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);
}
BssVatInvoice vatInvoice = new BssVatInvoice();
vatInvoice.setInvoiceCode(wordsResult.getInvoiceCode());
vatInvoice.setInvoiceNo(wordsResult.getInvoiceNum());
vatInvoice.setInvoiceDate(wordsResult.getInvoiceDate());
@ -230,8 +273,6 @@ public class BssVatInvoiceController {
vatInvoice.setTotalAmount(new BigDecimal(wordsResult.getAmountInFiguers()));
vatInvoice.setTotalAmountCn(wordsResult.getAmountInWords());
vatInvoice.setRemark(wordsResult.getRemarks());
vatInvoice.setBuyTaxInfo(purchaserTaxInfo);
vatInvoice.setSalerTaxInfo(sellerTaxInfo);
vatInvoice.setBssGoods(goods);
vatInvoice.setInvoiceImg(upload.getPath());
vatInvoice.setInvoiceType(VatInvoiceTypeEnum.getVatInvoiceCode(wordsResult.getInvoiceType()));

View File

@ -0,0 +1,74 @@
package com.cwhelp.admin.business.controller.api;
import com.cwhelp.common.api.baidu.BaiduAipOCR;
import com.cwhelp.common.api.baidu.entity.vatinvoice.*;
import com.cwhelp.common.constant.ApiConst;
import com.cwhelp.common.enums.InvoiceTypeEnum;
import com.cwhelp.common.utils.ResultVoUtil;
import com.cwhelp.common.vo.ResultVo;
import com.cwhelp.component.fileUpload.FileUpload;
import com.cwhelp.component.fileUpload.enums.UploadResultEnum;
import com.cwhelp.devtools.generate.utils.jAngel.utils.StringUtil;
import com.cwhelp.modules.business.domain.BssVatInvoice;
import com.cwhelp.modules.system.domain.Upload;
import com.cwhelp.modules.system.service.ApiBizService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
/**
* Created by huangjc on 2019/12/1 0001.
*/
@RestController
@RequestMapping("/apiBiz")
public class BssApiBizController {
@Autowired
private ApiBizService apiBizService;
@PostMapping("/invoiceOCR")
@ResponseBody
public ResultVo invoiceOCR(@RequestParam("image") MultipartFile multipartFile,
@RequestParam("invoiceType") int invoiceType,
@RequestParam("operator") String operator){
if (multipartFile.getSize() == 0){
return new ResultVo(ApiConst.API_PARAM_BLANK_CODE, UploadResultEnum.NO_FILE_NULL.getMessage());
}
if(invoiceType == 0 || StringUtil.isBlank(operator)){
return new ResultVo(ApiConst.API_PARAM_BLANK_CODE, ApiConst.API_PARAM_BLANK_MSG);
}
// 创建Upload实体对象
Upload upload = FileUpload.getFile(multipartFile, "/images");
try {
FileUpload.transferTo(multipartFile, upload);
File destFile = FileUpload.getDestFile(upload);
BssVatInvoice vatInvoice = new BssVatInvoice();
if(invoiceType == InvoiceTypeEnum.TRAIN_INVOICE.getCode()){
TrainResult trainResult = (TrainResult)BaiduAipOCR.queryBaiduVatInvoiceApi(destFile, invoiceType);
TrainWordsResult trainWordsResult = trainResult.getWords_result();
vatInvoice = apiBizService.getResultByTrain(trainWordsResult, destFile.getPath());
}else if(invoiceType == InvoiceTypeEnum.ADD_VALUE_TAX_INVOICE.getCode()){
VatInvoiceResult vatInvoiceResult = (VatInvoiceResult)BaiduAipOCR.queryBaiduVatInvoiceApi(destFile, invoiceType);
WordsResult wordsResult = vatInvoiceResult.getWords_result();
vatInvoice = apiBizService.getResultByAddValue(wordsResult, destFile.getPath());
}
return ResultVoUtil.success(ApiConst.API_OPT_SUCCESS_MSG, vatInvoice);
} catch (Exception e) {
e.printStackTrace();
return new ResultVo(ApiConst.API_UPLOAD_PICTURE_FAILED_CODE, ApiConst.API_UPLOAD_PICTURE_FAILED_MSG);
}
}
}

View File

@ -0,0 +1,20 @@
package com.cwhelp.admin.business.validator;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @author huang.jc
* @date 2019/12/11
*/
@Data
public class BssClassItemValid implements Serializable {
@NotEmpty(message = "科目名称不能为空")
private String itemName;
@NotNull(message = "科目类型不能为空")
private Short itemType;
}

View File

@ -3,8 +3,10 @@ package com.cwhelp.admin.business.validator;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author yan.y
@ -14,8 +16,8 @@ import java.io.Serializable;
public class BssVatInvoiceValid implements Serializable {
@NotEmpty(message = "发票代码不能为空")
private String invoiceCode;
@NotEmpty(message = "发票类型不能为空")
private String invoiceType;
@NotNull(message = "发票类型不能为空")
private Integer invoiceType;
@NotEmpty(message = "发票号码不能为空")
private String invoiceNo;
@NotEmpty(message = "发票日期不能为空")
@ -23,12 +25,13 @@ public class BssVatInvoiceValid implements Serializable {
private String invoiceDate;
@NotEmpty(message = "校验码不能为空")
private String checkCode;
@NotEmpty(message = "发票金额不能为空")
private String invoiceMoney;
@NotEmpty(message = "税额不能为空")
private String taxAmount;
@NotEmpty(message = "总金额不能为空")
private String totalAmount;
@NotNull(message = "发票金额不能为空")
private BigDecimal invoiceMoney;
@NotNull(message = "税额不能为空")
private BigDecimal taxAmount;
@NotNull(message = "总金额不能为空")
private BigDecimal totalAmount;
@NotEmpty(message = "总金额(大写)不能为空")
private String totalAmountCn;
}

View File

@ -0,0 +1,95 @@
package com.cwhelp.admin.system.controller.api;
import com.cwhelp.common.constant.ApiConst;
import com.cwhelp.common.utils.ResultVoUtil;
import com.cwhelp.common.vo.ResultVo;
import com.cwhelp.component.actionLog.action.UserAction;
import com.cwhelp.component.actionLog.annotation.ActionLog;
import com.cwhelp.devtools.generate.utils.jAngel.utils.StringUtil;
import com.cwhelp.modules.business.domain.BssEmployee;
import com.cwhelp.modules.system.domain.Role;
import com.cwhelp.modules.system.domain.User;
import com.cwhelp.modules.system.service.ApiUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.Iterator;
import java.util.UUID;
/**
* Created by huangjc on 2019/12/1 0001.
*/
@RestController
@RequestMapping("/api")
public class ApiLoginController {
@Autowired
private ApiUserService apiUserService;
@PostMapping("/me/login")
@ResponseBody
@ActionLog(key = UserAction.API_USER_LOGIN, action = UserAction.class)
public ResultVo apiUserlogin(HttpServletRequest request, @RequestParam("telephone") String telephone, @RequestParam("password") String password){
if(StringUtil.isBlank(telephone) || StringUtil.isBlank(password)){
return new ResultVo(ApiConst.API_PARAM_BLANK_CODE, ApiConst.API_PARAM_BLANK_MSG);
}
User user = apiUserService.checkLoginPremission(telephone);
if(user == null){
return new ResultVo(ApiConst.API_LOGIN_PWD_ERR_CODE, ApiConst.API_LOGIN_PWD_ERR_MSG);
}else {
Iterator<Role> iterator = user.getRoles().iterator();
boolean hasPremission = false;
while(iterator.hasNext()){
if (iterator.next().getName().contains(ApiConst.API_PREMISSION_USER_STR)) {
hasPremission = true;
break;
}
}
if (hasPremission) {
//暂定密码为 telephone后六位
if(password.equals(telephone.substring(5, telephone.length()))){
HttpSession session = request.getSession();
String token = UUID.randomUUID().toString();
session.setAttribute(token,user);
return ResultVoUtil.success(ApiConst.API_LOGIN_SUCCESS_MSG, token);
}else{
return new ResultVo(ApiConst.API_LOGIN_PWD_ERR_CODE, ApiConst.API_LOGIN_PWD_ERR_MSG);
}
} else {
return new ResultVo(ApiConst.API_NOT_PREMISSION_CODE, ApiConst.API_NOT_PREMISSION_MSG);
}
}
}
@PostMapping("/biz/modifyPwd")
@ResponseBody
// @ActionLog(key = UserAction.API_USER_LOGIN, action = UserAction.class)
public ResultVo modifyPwd(@RequestParam("telephone") String telephone,
@RequestParam("oldPassword") String oldPassword,
@RequestParam("newPassword") String newPassword){
if(StringUtil.isBlank(telephone) || StringUtil.isBlank(oldPassword) || StringUtil.isBlank(newPassword)){
return new ResultVo(ApiConst.API_PARAM_BLANK_CODE, ApiConst.API_PARAM_BLANK_MSG);
}
BssEmployee user = apiUserService.getUserByPhoneNum(telephone);
if(user == null){
return new ResultVo(ApiConst.API_SYS_ERR_CODE, ApiConst.API_SYS_ERR_MSG);
}else {
// user.setPassword(newPassword);
// apiUserService.save(user);
return new ResultVo(ApiConst.API_OPT_SUCCESS_CODE, ApiConst.API_OPT_SUCCESS_MSG);
}
}
public static void main(String[] args) {
String tel = "16621001775";
System.out.println(tel.substring(5, tel.length()));
}
}

View File

@ -13,6 +13,8 @@ project:
### spring配置
spring:
main:
allow-bean-definition-overriding: true
## 数据库配置
datasource:
driver-class-name: com.mysql.jdbc.Driver

View File

@ -127,18 +127,52 @@ layui.use(['element', 'form', 'layer', 'upload'], function () {
}
};
/* 提交表单数据 */
/* 提交表单数据 */ // update by hjc
$(document).on("click", ".ajax-submit", function (e) {
e.preventDefault();
var form = $(this).parents("form");
var url = form.attr("action");
var serializeArray = form.serializeArray();
$.post(url, serializeArray, function (result) {
if (result.data == null) {
result.data = 'submit[refresh]';
var _newData = null;
var fromFlag = false; // from = true 代表增值税页面请求用设置content-type的请求
if(url == '/bss/vatInvoice/add' || url == '/bss/vatInvoice/edit'){//增值税add/edit页面请求
fromFlag = true;
_newData = trans.serialize( serializeArray );
if(url == '/bss/vatInvoice/add'){
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;
}
$.fn.Messager(result);
});
}
if(fromFlag){
$.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, serializeArray, function(result) {
if (result.data == null) {
result.data = 'submit[refresh]';
}
$.fn.Messager(result);
});
}
});
/* get方式异步 */
@ -405,10 +439,34 @@ layui.use(['element', 'form', 'layer', 'upload'], function () {
$('#invoiceMoney').val(res.data['invoiceMoney']);
$('#taxAmount').val(res.data['taxAmount']);
$('#totalAmount').val(res.data['totalAmount']);
$('#totalAmountCn').val(res.data['totalAmountCn']);
$('#salerTaxInfoId').val(res.data['salerTaxInfoId']);
$('#buyTaxInfoId').val(res.data['buyTaxInfoId']);
form.render("select");
hide.val(res.data['invoiceImg']);
item.addClass('succeed');
/* 实体模型操作 */
var entity = $("#entity");
var goods = res.data['bssGoods'];
var element = null;
for(var i=0; i<goods.length; i++){
element = entity.children("tr:last-child").clone();
element.find("input[name='name']").val(goods[i].name);
element.find("input[name='specification']").val(goods[i].specification);
element.find("input[name='unit']").val(goods[i].unit);
element.find("input[name='num']").val(goods[i].num);
element.find("input[name='unitPrice']").val(goods[i].unitPrice);
element.find("input[name='detailAmount']").val(goods[i].detailAmount);
element.find("input[name='taxRate']").val(goods[i].taxRate);
element.find("input[name='goodTaxAmount']").val(goods[i].goodTaxAmount);
entity.append(element);
element.children(".entity-number").click();
$.each(entity.children(), function (key, val) {
$(val).children(".entity-number").text(key + 1);
});
}
form.render();
}else {
hide.remove();
item.addClass('error');
@ -424,4 +482,62 @@ layui.use(['element', 'form', 'layer', 'upload'], function () {
$(this).parent('.upload-item').remove();
});
/* 解决时间控件弹不出 */
layui.use('laydate', function(){
var laydate = layui.laydate;
//同时绑定多个
lay('.test-item').each(function(){
laydate.render({
elem: this
,format:'yyyy-MM-dd'
,type:'date'
,trigger: 'click'
});
});
});
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;
}
}
});

View File

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
</head>
<body>
<div class="layui-form timo-compile">
<form th:action="@{/bss/classItem/add}">
<input type="hidden" name="id" th:if="${classItem}" th:value="${classItem.id}">
<div class="layui-form-item">
<label class="layui-form-label">科目名称</label>
<div class="layui-input-inline">
<input class="layui-input" type="text" name="itemName" placeholder="请输入科目名称" th:value="${classItem?.itemName}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">科目类型</label>
<div class="layui-input-inline">
<select class="layui-select" name="itemType" mo:dict="ACCOUNTING_STANDARDS" mo-selected="${classItem?.itemType}" mo-empty="" lay-type="itemType"></select>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">备注</label>
<div class="layui-input-block">
<textarea placeholder="请输入内容" class="layui-textarea" name="remark">[[${classItem?.remark}]]</textarea>
</div>
</div>
<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 btn-secondary close-popup"><i class="fa fa-times-circle"></i> 关闭</button>
</div>
</form>
</div>
<script th:replace="/common/template :: script"></script>
</body>
</html>

View File

@ -0,0 +1,39 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
</head>
<body>
<div class="timo-detail-page">
<div class="timo-detail-title">基本信息</div>
<table class="layui-table timo-detail-table">
<colgroup>
<col width="100px"><col>
<col width="100px"><col>
</colgroup>
<tbody>
<tr>
<th>主键ID</th>
<td th:text="${classItem.id}"></td>
<th>科目名称</th>
<td th:text="${classItem.itemName}"></td>
</tr>
<tr>
<th>科目类型</th>
<td th:text="${classItem.itemType}"></td>
<th>创建者</th>
<td th:text="${classItem.createBy?.nickname}"></td>
</tr>
<tr>
<th>创建时间</th>
<td th:text="${#dates.format(classItem.createDate, 'yyyy-MM-dd HH:mm:ss')}" colspan="3"></td>
</tr>
<tr>
<th>备注</th>
<td th:text="${classItem.remark}" colspan="3"></td>
</tr>
</tbody>
</table>
</div>
<script th:replace="/common/template :: script"></script>
</body>
</html>

View File

@ -0,0 +1,84 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
</head>
<body class="timo-layout-page">
<div class="layui-card">
<div class="layui-card-header timo-card-header">
<span><i class="fa fa-bars"></i> 科目信息管理</span>
<i class="layui-icon layui-icon-refresh refresh-btn"></i>
</div>
<div class="layui-card-body">
<div class="layui-row timo-card-screen">
<div class="pull-left layui-form-pane timo-search-box">
<div class="layui-inline">
<label class="layui-form-label">状态</label>
<div class="layui-input-block timo-search-status">
<select class="timo-search-select" name="status" mo:dict="SEARCH_STATUS" mo-selected="${param.status}"></select>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">科目名称</label>
<div class="layui-input-block">
<input type="text" name="itemName" th:value="${param.itemName}" placeholder="请输入科目名称" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<button class="layui-btn timo-search-btn">
<i class="fa fa-search"></i>
</button>
</div>
</div>
<div class="pull-right screen-btn-group">
<button class="layui-btn open-popup" data-title="添加科目信息" th:attr="data-url=@{/bss/classItem/add}" data-size="auto">
<i class="fa fa-plus"></i> 添加</button>
<div class="btn-group">
<button class="layui-btn">操作<span class="caret"></span></button>
<dl class="layui-nav-child layui-anim layui-anim-upbit">
<dd><a class="ajax-status" th:href="@{/bss/classItem/status/ok}">启用</a></dd>
<dd><a class="ajax-status" th:href="@{/bss/classItem/status/freezed}">冻结</a></dd>
<dd><a class="ajax-status" th:href="@{/bss/classItem/status/delete}">删除</a></dd>
</dl>
</div>
</div>
</div>
<div class="timo-table-wrap">
<table class="layui-table timo-table">
<thead>
<tr>
<th class="timo-table-checkbox">
<label class="timo-checkbox"><input type="checkbox">
<i class="layui-icon layui-icon-ok"></i></label>
</th>
<th>主键ID</th>
<th>科目名称</th>
<th>科目类型</th>
<th>数据状态</th>
<th>创建时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr th:each="item:${list}">
<td><label class="timo-checkbox"><input type="checkbox" th:value="${item.id}">
<i class="layui-icon layui-icon-ok"></i></label></td>
<td th:text="${item.id}">主键ID</td>
<td th:text="${item.itemName}">科目名称</td>
<td th:text="${item.itemTypeName}">科目类型</td>
<td th:text="${#dicts.dataStatus(item.status)}">数据状态</td>
<td th:text="${#dates.format(item.createDate, 'yyyy-MM-dd HH:mm:ss')}">创建时间</td>
<td>
<a class="open-popup" data-title="编辑科目信息" th:attr="data-url=@{'/bss/classItem/edit/'+${item.id}}" data-size="auto" href="#">编辑</a>
<a class="open-popup" data-title="详细信息" th:attr="data-url=@{'/bss/classItem/detail/'+${item.id}}" data-size="800,600" href="#">详细</a>
<a class="ajax-get" data-msg="您是否确认删除" th:href="@{/bss/classItem/status/delete(ids=${item.id})}">删除</a>
</td>
</tr>
</tbody>
</table>
</div>
<div th:replace="/common/fragment :: page"></div>
</div>
</div>
<script th:replace="/common/template :: script"></script>
</body>
</html>

View File

@ -5,7 +5,7 @@
<body class="timo-layout-page">
<div class="layui-card">
<div class="layui-card-header timo-card-header">
<span><i class="fa fa-bars"></i> 账套信息管理</span>
<span><i class="fa fa-bars"></i> 客户公司信息管理</span>
<i class="layui-icon layui-icon-refresh refresh-btn"></i>
</div>
<div class="layui-card-body">

View File

@ -12,7 +12,7 @@
</ul>
<div class="layui-tab-content" style="height: 100%;">
<div class="layui-tab-item layui-show">
<!-- <form th:action="@{/bss/vatInvoice/add}">-->
<form th:action="@{/bss/vatInvoice/add}">
<fieldset id="basic" class="layui-elem-field layui-form">
<legend class="code-legend">基本信息</legend>
<div class="layui-field-box">
@ -49,7 +49,7 @@
<div class="layui-inline">
<label class="layui-form-label required">发票日期</label>
<div class="layui-input-inline">
<input type="text" name="invoiceDate" class="layui-input" id="laydate" placeholder="yyyy-MM-dd" lay-key="1">
<input type="text" name="invoiceDate" class="layui-input test-item" id="laydate" placeholder="yyyy-MM-dd" lay-key="1">
</div>
</div>
<div class="layui-inline">
@ -78,6 +78,14 @@
<input type="text" id="totalAmount" name="totalAmount" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label required">价税合计(大写)</label>
<div class="layui-input-inline">
<input type="text" id="totalAmountCn" name="totalAmountCn" autocomplete="off" class="layui-input">
</div>
<input type="hidden" id="salerTaxInfoId" name="salerTaxInfoId" />
<input type="hidden" id="buyTaxInfoId" name="buyTaxInfoId" />
</div>
</div>
<div class="layui-inline">
<div class="layui-form-item">
@ -96,10 +104,10 @@
<div class="panel-header">
<div class="title">货物信息</div>
<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>添加
</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>删除
</button>
</div>
@ -130,13 +138,13 @@
<td class="entity-unitPrice"><input type="text" name="unitPrice"/></td>
<td class="entity-detailAmount"><input type="text" name="detailAmount"/></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>
</tbody>
</table>
</div>
<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>
</div>
</div>
@ -186,22 +194,73 @@
<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="@{/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="@{/lib/zTree_v3/js/jquery.ztree.core.min.js}"></script>-->
<!--<script type="text/javascript" th:src="@{/js/timoTree.js}"></script>-->
<script type="text/javascript">
// 树形菜单
$.fn.selectTree({
rootTree: '顶级菜单'
});
// $.fn.selectTree({
// rootTree: '顶级菜单'
// });
// 验证下拉选择器
layui.config({
base: '[[@{/lib/formSelects-v4/}]]'
}).extend({
formSelects: 'formSelects-v4.min'
});
// 验证下拉选择器
// 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;
}
});
// 添加行
$(".col-add").on("click", function (e) {
e.preventDefault();
var element = entity.children("tr:last-child").clone();
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 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/generate.code.js}"></script>-->
<!--<script type="text/javascript" th:src="@{/js/build.js}"></script>-->
</body>
</html>

View File

@ -26,8 +26,11 @@
<tr>
<th>校验码</th>
<td th:text="${bssVatInvoice.checkCode}"></td>
<th>机器编码</th>
<td th:text="${bssVatInvoice.machineNo}"></td>
<!--<th>机器编码</th>
<td th:text="${bssVatInvoice.machineNo}"></td>-->
<th>发票类型</th>
<td th:if="${bssVatInvoice.invoiceType} eq '0'">增值税普通发票</td>
<td th:if="${bssVatInvoice.invoiceType} eq '1'">增值税专用发票</td>
</tr>
<tr>
<th>发票金额</th>
@ -43,9 +46,9 @@
</tr>
<tr>
<th>购买方纳税人信息</th>
<td th:text="${bssVatInvoice?.buyTaxInfo?.name}"></td>
<td th:text="${bssVatInvoice.buyTaxInfo?.name}"></td>
<th>销售方纳税人信息</th>
<td th:text="${bssVatInvoice?.salerTaxInfo?.name}"></td>
<td th:text="${bssVatInvoice.salerTaxInfo?.name}"></td>
</tr>
<tr>
<th>创建时间</th>

View File

@ -4,78 +4,87 @@
</head>
<body>
<div class="layui-form timo-compile">
<form th:action="@{/bss/vatInvoice/add}">
<form th:action="@{/bss/vatInvoice/edit}">
<input type="hidden" name="id" th:if="${bssVatInvoice}" th:value="${bssVatInvoice.id}">
<div class="layui-form-item">
<label class="layui-form-label">发票类型</label>
<div class="layui-input-inline">
<select id="invoiceType" name="invoiceType" lay-filter="invoiceType" >
<option th:selected="${bssVatInvoice.invoiceType} eq '0'" value="0">增值税普通发票</option>
<option th:selected="${bssVatInvoice.invoiceType} eq '1'" value="1">增值税专用发票</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">发票代码</label>
<div class="layui-input-inline">
<input class="layui-input" type="text" name="invoiceCode" placeholder="请输入发票代码" th:value="${bssVatInvoice?.invoiceCode}">
<input class="layui-input" type="text" name="invoiceCode" placeholder="请输入发票代码" th:value="${bssVatInvoice.invoiceCode}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">发票号码</label>
<div class="layui-input-inline">
<input class="layui-input" type="text" name="invoiceNo" placeholder="请输入发票号码" th:value="${bssVatInvoice?.invoiceNo}">
<input class="layui-input" type="text" name="invoiceNo" placeholder="请输入发票号码" th:value="${bssVatInvoice.invoiceNo}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">发票日期</label>
<div class="layui-input-inline">
<input class="layui-input" type="text" name="invoiceDate" placeholder="请输入发票日期" th:value="${bssVatInvoice?.invoiceDate}">
<input class="layui-input" type="text" name="invoiceDate" placeholder="请输入发票日期" th:value="${bssVatInvoice.invoiceDate}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">校验码</label>
<div class="layui-input-inline">
<input class="layui-input" type="text" name="checkCode" placeholder="请输入校验码" th:value="${bssVatInvoice?.checkCode}">
<input class="layui-input" type="text" name="checkCode" placeholder="请输入校验码" th:value="${bssVatInvoice.checkCode}">
</div>
</div>
<div class="layui-form-item">
<!--<div class="layui-form-item">
<label class="layui-form-label">机器编码</label>
<div class="layui-input-inline">
<input class="layui-input" type="text" name="machineNo" placeholder="请输入机器编码" th:value="${bssVatInvoice?.machineNo}">
<input class="layui-input" type="text" name="machineNo" placeholder="请输入机器编码" th:value="${bssVatInvoice.machineNo}">
</div>
</div>
</div>-->
<div class="layui-form-item">
<label class="layui-form-label">发票金额</label>
<div class="layui-input-inline">
<input class="layui-input" type="text" name="invoiceMoney" placeholder="请输入发票金额" th:value="${bssVatInvoice?.invoiceMoney}">
<input class="layui-input" type="text" name="invoiceMoney" placeholder="请输入发票金额" th:value="${bssVatInvoice.invoiceMoney}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">税额</label>
<div class="layui-input-inline">
<input class="layui-input" type="text" name="taxAmount" placeholder="请输入税额" th:value="${bssVatInvoice?.taxAmount}">
<input class="layui-input" type="text" name="taxAmount" placeholder="请输入税额" th:value="${bssVatInvoice.taxAmount}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">总金额</label>
<div class="layui-input-inline">
<input class="layui-input" type="text" name="totalAmount" placeholder="请输入总金额" th:value="${bssVatInvoice?.totalAmount}">
<input class="layui-input" type="text" name="totalAmount" placeholder="请输入总金额" th:value="${bssVatInvoice.totalAmount}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">总金额(大写)</label>
<div class="layui-input-inline">
<input class="layui-input" type="text" name="totalAmountCn" placeholder="请输入总金额(大写)" th:value="${bssVatInvoice?.totalAmountCn}">
<input class="layui-input" type="text" name="totalAmountCn" placeholder="请输入总金额(大写)" th:value="${bssVatInvoice.totalAmountCn}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">购买方纳税人信息</label>
<div class="layui-input-inline">
<input class="layui-input" type="text" name="buyTaxInfo" placeholder="请输入购买方纳税人信息" th:value="${bssVatInvoice?.buyTaxInfo?.name}">
<input class="layui-input" type="text" name="buyTaxInfo" placeholder="请输入购买方纳税人信息" th:value="${bssVatInvoice.buyTaxInfo?.name}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">销售方纳税人信息</label>
<div class="layui-input-inline">
<input class="layui-input" type="text" name="salerTaxInfo" placeholder="请输入销售方纳税人信息" th:value="${bssVatInvoice?.salerTaxInfo?.name}">
<input class="layui-input" type="text" name="salerTaxInfo" placeholder="请输入销售方纳税人信息" th:value="${bssVatInvoice.salerTaxInfo?.name}">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">备注</label>
<div class="layui-input-block">
<textarea placeholder="请输入内容" class="layui-textarea" name="remark">[[${bssVatInvoice?.remark}]]</textarea>
<textarea placeholder="请输入内容" class="layui-textarea" name="remark">[[${bssVatInvoice.remark}]]</textarea>
</div>
</div>
<div class="layui-form-item timo-finally">

View File

@ -61,7 +61,11 @@
<tr th:each="item:${list}">
<td><label class="timo-checkbox"><input type="checkbox" th:value="${item.id}">
<i class="layui-icon layui-icon-ok"></i></label></td>
<td th:text="${item.invoiceType}">发票类型</td>
<!--<td th:text="${item.invoiceType}">发票类型</td>-->
<!-- update by hjc -->
<td th:if="${item.invoiceType} eq '0'">增值税普通发票</td>
<td th:if="${item.invoiceType} eq '1'">增值税专用发票</td>
<td th:text="${item.invoiceCode}">发票代码</td>
<td th:text="${item.invoiceNo}">发票号码</td>
<td th:text="${item.invoiceDate}">发票日期</td>

View File

@ -0,0 +1,267 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
<link rel="stylesheet" th:href="@{/css/generate.code.css}">
</head>
<body>
生产凭证
<div class="layui-form timo-compile" style="padding-top: 0px;">
<!-- <div class="layui-tab layui-tab-card">
<ul class="layui-tab-title">
<li class="layui-this">手工录入</li>
&lt;!&ndash; <li>查验录入</li>&ndash;&gt;
</ul>
<div class="layui-tab-content" style="height: 100%;">
<div class="layui-tab-item layui-show">
<form th:action="@{/bss/vatInvoice/add}">
<fieldset id="basic" class="layui-elem-field layui-form">
<legend class="code-legend">基本信息</legend>
<div class="layui-field-box">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label required">发票类型</label>
<div class="layui-input-inline">
<select id="invoiceType" name="invoiceType" lay-filter="invoiceType">
<option value="0">增值税普通发票</option>
<option value="1">增值税专用发票</option>
</select>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label required">发票代码</label>
<div class="layui-input-inline">
<input type="text" id="invoiceCode" name="invoiceCode" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label required">发票号码</label>
<div class="layui-input-inline">
<input type="text" id="invoiceNo" name="invoiceNo" autocomplete="off" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label required">校验码</label>
<div class="layui-input-inline">
<input type="text" id="checkCode" name="checkCode" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label required">发票日期</label>
<div class="layui-input-inline">
<input type="text" name="invoiceDate" class="layui-input test-item" id="laydate" placeholder="yyyy-MM-dd" lay-key="1">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">备注</label>
<div class="layui-input-inline">
<input type="text" id="remark" name="remark" autocomplete="off" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label required">不含税金额</label>
<div class="layui-input-inline">
<input type="text" id="invoiceMoney" name="invoiceMoney" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label required">税额</label>
<div class="layui-input-inline">
<input type="text" id="taxAmount" name="taxAmount" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label required">价税合计</label>
<div class="layui-input-inline">
<input type="text" id="totalAmount" name="totalAmount" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label required">价税合计(大写)</label>
<div class="layui-input-inline">
<input type="text" id="totalAmountCn" name="totalAmountCn" autocomplete="off" class="layui-input">
</div>
<input type="hidden" id="salerTaxInfoId" name="salerTaxInfoId" />
<input type="hidden" id="buyTaxInfoId" name="buyTaxInfoId" />
</div>
</div>
<div class="layui-inline">
<div class="layui-form-item">
<label class="layui-form-label">发票图片</label>
<div class="layui-input-inline">
<button type="button" class="layui-btn" id="vatInvoiceImg" name="invoiceImg" up-field="path" up-url="/bss/vatInvoice/upload/image">
<i class="layui-icon"></i>上传图片
</button>
</div>
<div class="upload-show"></div>
</div>
</div>
</div>
</fieldset>
<div class="panel">
<div class="panel-header">
<div class="title">货物信息</div>
<div class="control">
<button class="col-add field-add layui-btn layui-btn-primary layui-btn-xs">
<i class="fa fa-plus-circle"></i>添加
</button>
<button class="col-del field-del layui-btn layui-btn-primary layui-btn-xs">
<i class="fa fa-minus-circle"></i>删除
</button>
</div>
<div class="entity"><span class="bindTableEntity"></span>(<span class="bindTablePrefix"></span><span class="bindTableName"></span>)</div>
</div>
<div class="panel-body panel-body-entity">
<table class="layui-table">
<thead>
<tr>
<th width="20">#</th>
<th width="100">货物名称</th>
<th width="100">规格型号</th>
<th width="100">单位</th>
<th width="100">数量</th>
<th width="100">单价</th>
<th width="100">金额</th>
<th width="100">税率</th>
<th width="100">税额</th>
</tr>
</thead>
<tbody id="entity">
<tr>
<td class="entity-number" th:text="1"></td>
<td class="entity-name"><input type="text" name="name"/></td>
<td class="entity-specification"><input type="text" name="specification"/></td>
<td class="entity-unit"><input type="text" name="unit"/></td>
<td class="entity-num"><input type="text" name="num"/></td>
<td class="entity-unitPrice"><input type="text" name="unitPrice"/></td>
<td class="entity-detailAmount"><input type="text" name="detailAmount"/></td>
<td class="entity-taxRate"><input type="text" name="taxRate"/></td>
<td class="entity-taxAmount"><input type="text" name="goodTaxAmount"/></td>
</tr>
</tbody>
</table>
</div>
<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 btn-secondary close-popup"><i class="fa fa-times-circle"></i> 关闭</button>
</div>
</div>
</form>
</div>
&lt;!&ndash;<div class="layui-tab-item">
<form th:action="@{/bss/vatInvoice/check}">
<div class="layui-form-item">
<label class="layui-form-label required">发票代码</label>
<div class="layui-input-inline">
<input class="layui-input" type="text" name="invoiceCode" placeholder="请输入发票代码" />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label required">发票号码</label>
<div class="layui-input-inline">
<input class="layui-input" type="text" name="invoiceNo" placeholder="请输入发票号码" />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label required">开票时间</label>
<div class="layui-input-inline">
<input type="text" class="layui-input" name="invoiceDate" placeholder="yyyy-MM-dd">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">开具金额(不含税)</label>
<div class="layui-input-inline">
<input class="layui-input" type="text" name="invoiceMoney" placeholder="请输入开具金额(不含税)" />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label required">校验码</label>
<div class="layui-input-inline">
<input class="layui-input" type="text" name="checkCode" placeholder="请输入校验码" />
</div>
</div>
<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 btn-secondary close-popup"><i class="fa fa-times-circle"></i> 关闭</button>
</div>
</form>
</div>&ndash;&gt;
</div>
</div>-->
</div>
<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="@{/lib/zTree_v3/js/jquery.ztree.core.min.js}"></script>-->
<!--<script type="text/javascript" th:src="@{/js/timoTree.js}"></script>-->
<script type="text/javascript">
// 树形菜单
// $.fn.selectTree({
// 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;
}
});
// 添加行
$(".col-add").on("click", function (e) {
e.preventDefault();
var element = entity.children("tr:last-child").clone();
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 type="text/javascript" th:src="@{/js/generate.code.js}"></script>-->
<!--<script type="text/javascript" th:src="@{/js/build.js}"></script>-->
</body>
</html>

View File

@ -20,7 +20,7 @@
</div>
<form class="user-edit" th:action="@{/userInfo}">
<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">
<label class="layui-form-label">用户昵称</label>
<div class="layui-input-inline">

View File

@ -4,19 +4,12 @@
<facet type="Spring" name="Spring">
<configuration />
</facet>
<facet type="web" name="Web">
<configuration>
<webroots />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/${project.build.directory}/classes" />
<excludeFolder url="file://$MODULE_DIR$/${project.build.directory}/test-classes" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />

View File

@ -2,7 +2,9 @@ package com.cwhelp.common.api.baidu;
import com.alibaba.fastjson.JSON;
import com.baidu.aip.ocr.AipOcr;
import com.cwhelp.common.api.baidu.entity.vatinvoice.TrainResult;
import com.cwhelp.common.api.baidu.entity.vatinvoice.VatInvoiceResult;
import com.cwhelp.common.enums.InvoiceTypeEnum;
import org.json.JSONObject;
import java.io.File;
@ -41,9 +43,34 @@ public class BaiduAipOCR {
* @param file
* @return
*/
public static VatInvoiceResult queryBaiduVatInvoiceApi(File file){
public static Object queryBaiduVatInvoiceApi(File file, int invoiceType){
byte[] data = null;
try {
data = getDataByFile(file);
} catch (Exception e) {
e.printStackTrace();
}
JSONObject result = null;
if(invoiceType == InvoiceTypeEnum.TRAIN_INVOICE.getCode()){
result = client.trainTicket(data, null);
return JSON.parseObject(result.toString(), TrainResult.class);
}else if(invoiceType == InvoiceTypeEnum.METRO_INVOICE.getCode()){
return null;
}else if(invoiceType == InvoiceTypeEnum.MEAL_INVOICE.getCode()){
return null;
}else {
result = client.vatInvoice(data, null);
return JSON.parseObject(result.toString(), VatInvoiceResult.class);
}
}
/**
* 读取图片字节数组
* @param file
* @return
*/
public static byte[] getDataByFile(File file){
byte[] data = null;
// 读取图片字节数组
try {
InputStream in = new FileInputStream(file);
data = new byte[in.available()];
@ -52,9 +79,7 @@ public class BaiduAipOCR {
} catch (IOException e) {
e.printStackTrace();
}
JSONObject result = client.vatInvoice(data, null);
VatInvoiceResult vatInvoiceResult = JSON.parseObject(result.toString(), VatInvoiceResult.class);
return vatInvoiceResult;
return data;
}
}

View File

@ -0,0 +1,19 @@
package com.cwhelp.common.api.baidu.entity.vatinvoice;
import lombok.Data;
/**
* Created by huangjc on 2019/12/3 0003.
*/
@Data
public class TrainResult {
private String log_id;
private TrainWordsResult words_result;
private String words_result_num;
private String direction;
}

View File

@ -0,0 +1,56 @@
package com.cwhelp.common.api.baidu.entity.vatinvoice;
import lombok.Data;
/**
* Created by Administrator on 2019/12/7 0007.
*/
@Data
public class TrainWordsResult {
/**
* 请求标识码随机数唯一
*/
private long logId;
/**
* 车票号
*/
private String ticketNum;
/**
* 始发站
*/
private String startingStation;
/**
* 车次号
*/
private String trainNum;
/**
* 到达站
*/
private String destinationStation;
/**
* 出发日期
*/
private String date;
/**
* 车票金额
*/
private String ticketRates;
/**
* 席别
*/
private String seatCategory;
/**
* 乘客姓名
*/
private String name;
}

View File

@ -0,0 +1,23 @@
package com.cwhelp.common.config;
import com.cwhelp.common.interceptor.ApiLoginInterceptor;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.util.Arrays;
/**
* Created by huangjc on 2019/12/19 0019.
*/
@SpringBootConfiguration
public class WebMvcConfig implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new ApiLoginInterceptor()).addPathPatterns("/apiBiz/**")
.addPathPatterns("/api/biz/**").excludePathPatterns(Arrays.asList("/css/**", "/js/**", "/images/**", "/lib/**"));
}
}

View File

@ -0,0 +1,42 @@
package com.cwhelp.common.constant;
/**
* Created by huangjc on 2019/12/2 0002.
*/
public class ApiConst {
/**
* 假定用户角色名中包含api的为小程序权限用户
*/
public static final String API_PREMISSION_USER_STR = "api";
/**
* 操作成功
*/
public static final int API_OPT_SUCCESS_CODE = 200;
public static final String API_OPT_SUCCESS_MSG = "操作成功";
public static final String API_LOGIN_SUCCESS_MSG = "登录成功";
public static final int API_PARAM_BLANK_CODE = 201;
public static final String API_PARAM_BLANK_MSG = "缺少必要参数";
public static final int API_NOT_PREMISSION_CODE = 202;
public static final String API_NOT_PREMISSION_MSG = "没有权限,请到财务帮后台进行授权";
public static final int API_LOGIN_PWD_ERR_CODE = 203;
public static final String API_LOGIN_PWD_ERR_MSG = "用户名或密码错误";
public static final int API_UPLOAD_PICTURE_FAILED_CODE = 204;
public static final String API_UPLOAD_PICTURE_FAILED_MSG = "上传图片失败";
public static final int API_SYS_ERR_CODE = 500;
public static final String API_SYS_ERR_MSG = "系统异常!";
}

View File

@ -0,0 +1,34 @@
package com.cwhelp.common.enums;
import lombok.Getter;
/**
* Created by huangjc on 2019/12/11 0011.
* 会计准则
*/
@Getter
public enum AccountStandardEnum {
SMALL_ENTERPRISES(1, "小企业会计准则"),
ENTERPRISES(2, "小企业会计准则"),
NON_PROFIT_ORGANIZATIONS(3, "民间非营利组织会计制度");
AccountStandardEnum(int id, String name){
this.id = id;
this.name = name;
}
private int id;
private String name;
public static String getNameById(int id){
for (AccountStandardEnum accountStandardEnum : AccountStandardEnum.values()) {
if(accountStandardEnum.getId() == id){
return accountStandardEnum.getName();
}
}
return "";
}
}

View File

@ -0,0 +1,25 @@
package com.cwhelp.common.enums;
import lombok.Getter;
/**
* Created by huangjc on 2019/12/3 0003.
*/
@Getter
public enum InvoiceTypeEnum {
TRAIN_INVOICE(1, "通用火车票"),
METRO_INVOICE(2, "地铁票"),
MEAL_INVOICE(3, "饭票"),
ADD_VALUE_TAX_INVOICE(4, "增值税发票");
InvoiceTypeEnum(int code, String name){
this.code = code;
this.name = name;
}
private int code;
private String name;
}

View File

@ -7,6 +7,7 @@ import com.cwhelp.common.vo.ResultVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindException;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
@ -36,6 +37,13 @@ public class ResultExceptionHandler {
return ResultVoUtil.error(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
}
@ExceptionHandler(MethodArgumentNotValidException.class)
@ResponseBody
public ResultVo methodArgumentNotValidException(MethodArgumentNotValidException e){
BindingResult bindingResult = e.getBindingResult();
return ResultVoUtil.error(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
}
// 拦截未知的运行时异常
@ExceptionHandler(RuntimeException.class)
@ResponseBody

View File

@ -0,0 +1,53 @@
package com.cwhelp.common.filter;
import com.alibaba.fastjson.JSONObject;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.stereotype.Component;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;
/**
* Created by huangjc on 2019/12/10 0010.
*/
//@Component
//@ServletComponentScan
//@WebFilter(filterName = "apiLoginFilter", urlPatterns = {"/api_biz/*", "/api/biz/*"})
public class ApiLoginFilter implements Filter {
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest)servletRequest;
HttpServletResponse response = (HttpServletResponse)servletResponse;
String token = request.getHeader("token");
HttpSession session = request.getSession();
if(session.getAttribute(token) == null){
response.setStatus(401);
response.setContentType("application/json;charset=utf-8");
PrintWriter writer = response.getWriter();
JSONObject json = new JSONObject();
json.put("code","401");
json.put("msg","请先登录!");
writer.print(json);
return;
}else{
filterChain.doFilter(request, response);
}
}
@Override
public void init(FilterConfig filterConfig) throws ServletException {
System.out.println("ApiLoginFilter initing..." + filterConfig.getFilterName());
}
@Override
public void destroy() {
}
}

View File

@ -0,0 +1,46 @@
package com.cwhelp.common.interceptor;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.PrintWriter;
/**
* Created by huangjc on 2019/12/19 0019.
*/
@Component
public class ApiLoginInterceptor extends HandlerInterceptorAdapter {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String token = request.getHeader("token");
HttpSession session = request.getSession();
if(session.getAttribute(token) == null){
response.setStatus(401);
response.setContentType("application/json;charset=utf-8");
PrintWriter writer = response.getWriter();
JSONObject json = new JSONObject();
json.put("code","401");
json.put("msg","请先登录!");
writer.print(json);
return false;
}
return true;
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
}
}

View File

@ -15,4 +15,14 @@ public class ResultVo<T> {
private String msg;
// 响应数据
private T data;
public ResultVo(){
}
public ResultVo(Integer code, String msg){
this.code = code;
this.msg = msg;
}
}

View File

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="common" />
<orderEntry type="module" module-name="system" />
<orderEntry type="module" module-name="excel" />
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:4.0.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi:4.0.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-schemas:4.0.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:3.0.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-compress:1.18" level="project" />
<orderEntry type="library" name="Maven: com.github.virtuald:curvesapi:1.04" level="project" />
<orderEntry type="module" module-name="shiro" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-spring:1.4.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-core:1.4.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-lang:1.4.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-crypto-hash:1.4.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-crypto-core:1.4.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-crypto-cipher:1.4.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-config-core:1.4.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-config-ogdl:1.4.0" level="project" />
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.9.3" level="project" />
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-event:1.4.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-web:1.4.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-ehcache:1.4.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-cache:1.4.0" level="project" />
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.6.11" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.1.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.1.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.1.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.11.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.11.2" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.26" level="project" />
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.23" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.1.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.8" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.8" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.8" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.8" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.8" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.1.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.17" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.17" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.17" level="project" />
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.16.Final" level="project" />
<orderEntry type="library" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.4.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-jpa:2.1.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.1.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.1.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.2.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: javax.transaction:javax.transaction-api:1.3" level="project" />
<orderEntry type="library" name="Maven: javax.xml.bind:jaxb-api:2.3.1" level="project" />
<orderEntry type="library" name="Maven: javax.activation:javax.activation-api:1.2.0" level="project" />
<orderEntry type="library" name="Maven: org.hibernate:hibernate-core:5.3.9.Final" level="project" />
<orderEntry type="library" name="Maven: javax.persistence:javax.persistence-api:2.2" level="project" />
<orderEntry type="library" name="Maven: org.javassist:javassist:3.23.1-GA" level="project" />
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.9.12" level="project" />
<orderEntry type="library" name="Maven: antlr:antlr:2.7.7" level="project" />
<orderEntry type="library" name="Maven: org.jboss:jandex:2.0.5.Final" level="project" />
<orderEntry type="library" name="Maven: org.dom4j:dom4j:2.1.1" level="project" />
<orderEntry type="library" name="Maven: org.hibernate.common:hibernate-commons-annotations:5.0.4.Final" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-jpa:2.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-orm:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aspects:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-configuration-processor:2.1.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-cache:2.1.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.1.6.RELEASE" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.springframework.boot:spring-boot-devtools:2.1.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.1.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.1.4.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.1.4.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.1.4.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.1.4.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.11.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:2.23.4" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.9.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.6" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-library:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.6.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.1.6.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.6.2" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:5.1.46" level="project" />
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.2" level="project" />
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache:2.10.5" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.26" level="project" />
<orderEntry type="library" name="Maven: org.jsoup:jsoup:1.11.3" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.56" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.11" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.8" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.11" level="project" />
<orderEntry type="library" name="Maven: com.baidu.aip:java-sdk:4.12.0" level="project" />
<orderEntry type="library" name="Maven: org.json:json:20160810" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-simple:1.7.26" level="project" />
<orderEntry type="library" name="Maven: net.coobird:thumbnailator:0.4.8" level="project" />
</component>
</module>

View File

@ -25,6 +25,8 @@ public class UserAction extends ActionMap {
public static final String EDIT_PWD = "edit_pwd";
public static final String EDIT_ROLE = "edit_role";
public static final String API_USER_LOGIN = "api_user_login";
@Override
public void init() {
// 用户登录行为
@ -35,6 +37,9 @@ public class UserAction extends ActionMap {
putMethod(EDIT_PWD, new BusinessMethod("用户密码","editPwd"));
// 角色分配行为
putMethod(EDIT_ROLE, new BusinessMethod("角色分配","editRole"));
// 用户登录行为
putMethod(API_USER_LOGIN, new LoginMethod("API用户登录","apiUserLogin"));
}
// 用户登录行为方法
@ -50,6 +55,19 @@ public class UserAction extends ActionMap {
}
}
// api用户登录行为方法
public void apiUserLogin(ResetLog resetLog){
ActionLog actionLog = resetLog.getActionLog();
if (resetLog.isSuccess()){
actionLog.setMessage("api后台登录成功");
}else {
String username = (String) resetLog.getParam("username");
ResultVo resultVo = (ResultVo) resetLog.getRetValue();
actionLog.setOperName(username);
actionLog.setMessage(String.format("api后台登录失败[%s]%s", username, resultVo.getMsg()));
}
}
// 保存用户行为方法
public void userSave(ResetLog resetLog){
resetLog.getActionLog().setMessage("用户成功:${username}");

View File

@ -4,11 +4,6 @@
<facet type="Spring" name="Spring">
<configuration />
</facet>
<facet type="web" name="Web">
<configuration>
<webroots />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />

View File

@ -4,11 +4,6 @@
<facet type="Spring" name="Spring">
<configuration />
</facet>
<facet type="web" name="Web">
<configuration>
<webroots />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />

View File

@ -4,11 +4,6 @@
<facet type="Spring" name="Spring">
<configuration />
</facet>
<facet type="web" name="Web">
<configuration>
<webroots />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />

View File

@ -4,11 +4,6 @@
<facet type="Spring" name="Spring">
<configuration />
</facet>
<facet type="web" name="Web">
<configuration>
<webroots />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />

View File

@ -47,6 +47,8 @@ public class ShiroConfig {
*/
LinkedHashMap<String, String> filterMap = new LinkedHashMap<>();
filterMap.put("/login", "anon");
filterMap.put("/api/me/login", "anon");
filterMap.put("/apiBiz/**", "anon");
filterMap.put("/logout", "anon");
filterMap.put("/captcha", "anon");
filterMap.put("/noAuth", "anon");

View File

@ -4,11 +4,6 @@
<facet type="Spring" name="Spring">
<configuration />
</facet>
<facet type="web" name="Web">
<configuration>
<webroots />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />

View File

@ -1,5 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="web" name="Web">
<configuration>
<webroots>
<root url="file://$MODULE_DIR$/src/main/webapp" relative="/" />
</webroots>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />

View File

@ -4,11 +4,6 @@
<facet type="Spring" name="Spring">
<configuration />
</facet>
<facet type="web" name="Web">
<configuration>
<webroots />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />

View File

@ -125,7 +125,7 @@ layui.use(['element', 'form', 'layer', 'formSelects'], function () {
// 添加字段
$(".field-add").on("click", function () {
var element = entity.children("tr:last-child").clone();
element.find("input, select").val("");
element.find("input").val("");
element.find("[name='type']").val("1");
var random = Math.random()*10000;
element.find("[xm-select]").attr("xm-select", random);
@ -195,6 +195,15 @@ layui.use(['element', 'form', 'layer', 'formSelects'], function () {
field.show = $(trNode).find("[name='show']").is(':checked');
var xmId = $(trNode).find(".entity-verify select").attr("xm-select");
field.verify = formSelects.value(xmId, 'val');
// add by hjc
// field.specification = $(trNode).find("[name='specification']").val();
// field.unit = $(trNode).find("[name='unit']").val();
// field.num = $(trNode).find("[name='num']").val();
// field.unitPrice = $(trNode).find("[name='unitPrice']").val();
// field.detailAmount = $(trNode).find("[name='detailAmount']").val();
// field.taxRate = $(trNode).find("[name='taxRate']").val();
// field.taxAmount = $(trNode).find("[name='taxAmount']").val();
fieldList[key] = field;
});
return fieldList;

View File

@ -0,0 +1,54 @@
package com.cwhelp.modules.business.domain;
import com.cwhelp.common.enums.StatusEnum;
import com.cwhelp.common.utils.StatusUtil;
import com.cwhelp.modules.system.domain.User;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
/**
* @author huang.jc
* @date 2019/12/11
*/
@Data
@Entity
@Table(name="sys_class_item")
@EntityListeners(AuditingEntityListener.class)
@Where(clause = StatusUtil.notDelete)
public class BssClassItem implements Serializable {
// 主键ID
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Long id;
// 科目名称
private String itemName;
// 科目类型
private Short itemType;
// 数据状态
private Byte status = StatusEnum.OK.getCode();
// 备注
private String remark;
// 创建者
@CreatedBy
@ManyToOne(fetch=FetchType.LAZY)
@NotFound(action=NotFoundAction.IGNORE)
@JoinColumn(name="create_by")
@JsonIgnore
private User createBy;
// 创建时间
@CreatedDate
private Date createDate;
@Transient
private String itemTypeName;
}

View File

@ -32,13 +32,13 @@ public class BssGoods implements Serializable {
private Long id;
private String name;
// 数量
private Integer num;
private Double num;
// 细节金额
@Column(name = "detail_amount")
private BigDecimal detailAmount;
// 税额
@Column(name = "tax_amount")
private BigDecimal taxAmount;
private BigDecimal goodTaxAmount;
// 税率
@Column(name = "tax_rate")
private String taxRate;

View File

@ -12,6 +12,9 @@ import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@ -57,6 +60,7 @@ public class BssVatInvoice implements Serializable {
private String totalAmountCn;
//发票类型
//增值税普通发票 0; 增值税专用发票 1
@Column(name = "invoice_type")
private Integer invoiceType;
@ -72,7 +76,6 @@ public class BssVatInvoice implements Serializable {
@JsonIgnore
private BssTaxinfo buyTaxInfo;
// 销售方纳税人信息
// 购买方纳税人信息
@OneToOne(fetch=FetchType.LAZY)
@NotFound(action= NotFoundAction.IGNORE)
@JoinColumn(name="saler_tax_info_id")
@ -90,4 +93,10 @@ public class BssVatInvoice implements Serializable {
// 更新时间
@LastModifiedDate
private Date updateDate;
@Transient
private Long buyTaxInfoId;
@Transient
private Long salerTaxInfoId;
}

View File

@ -0,0 +1,11 @@
package com.cwhelp.modules.business.repository;
import com.cwhelp.modules.business.domain.BssClassItem;
import com.cwhelp.modules.system.repository.BaseRepository;
/**
* @author huang.jc
* @date 2019/12/11
*/
public interface BssClassItemRepository extends BaseRepository<BssClassItem, Long> {
}

View File

@ -1,8 +1,14 @@
package com.cwhelp.modules.business.repository;
import com.cwhelp.common.constant.StatusConst;
import com.cwhelp.modules.business.domain.BssEmployee;
import com.cwhelp.modules.system.repository.BaseRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
@ -10,4 +16,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
* @date 2019/07/31
*/
public interface BssEmployeeRepository extends BaseRepository<BssEmployee, Long>, JpaSpecificationExecutor<BssEmployee> {
BssEmployee findByPhoneNum(String telephone);
}

View File

@ -8,4 +8,5 @@ import com.cwhelp.modules.system.repository.BaseRepository;
* @date 2019/08/16
*/
public interface BssTaxinfoRepository extends BaseRepository<BssTaxinfo, Long> {
BssTaxinfo getByTaxNo(String taxNo);
}

View File

@ -0,0 +1,41 @@
package com.cwhelp.modules.business.service;
import com.cwhelp.common.enums.StatusEnum;
import com.cwhelp.modules.business.domain.BssClassItem;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author huang.jc
* @date 2019/12/11
*/
public interface BssClassItemService {
/**
* 获取分页列表数据
* @param example 查询实例
* @return 返回分页数据
*/
Page<BssClassItem> getPageList(Example<BssClassItem> example);
/**
* 根据ID查询数据
* @param id 主键ID
*/
BssClassItem getById(Long id);
/**
* 保存数据
* @param classItem 实体对象
*/
BssClassItem save(BssClassItem classItem);
/**
* 状态(启用冻结删除)/批量状态处理
*/
@Transactional
Boolean updateStatus(StatusEnum statusEnum, List<Long> idList);
}

View File

@ -38,4 +38,9 @@ public interface BssTaxinfoService {
*/
@Transactional
Boolean updateStatus(StatusEnum statusEnum, List<Long> idList);
/**
* 根据纳税人识别号查询数据
*/
BssTaxinfo getByTaxNo(String taxNo);
}

View File

@ -0,0 +1,66 @@
package com.cwhelp.modules.business.service.impl;
import com.cwhelp.common.data.PageSort;
import com.cwhelp.common.enums.StatusEnum;
import com.cwhelp.modules.business.domain.BssClassItem;
import com.cwhelp.modules.business.repository.BssClassItemRepository;
import com.cwhelp.modules.business.service.BssClassItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author huang.jc
* @date 2019/12/11
*/
@Service
public class BssClassItemServiceImpl implements BssClassItemService {
@Autowired
private BssClassItemRepository bssClassItemRepository;
/**
* 根据ID查询数据
* @param id 主键ID
*/
@Override
@Transactional
public BssClassItem getById(Long id) {
return bssClassItemRepository.findById(id).orElse(null);
}
/**
* 获取分页列表数据
* @param example 查询实例
* @return 返回分页数据
*/
@Override
public Page<BssClassItem> getPageList(Example<BssClassItem> example) {
// 创建分页对象
PageRequest page = PageSort.pageRequest();
return bssClassItemRepository.findAll(example, page);
}
/**
* 保存数据
* @param classItem 实体对象
*/
@Override
public BssClassItem save(BssClassItem classItem) {
return bssClassItemRepository.save(classItem);
}
/**
* 状态(启用冻结删除)/批量状态处理
*/
@Override
@Transactional
public Boolean updateStatus(StatusEnum statusEnum, List<Long> idList) {
return bssClassItemRepository.updateStatus(statusEnum.getCode(), idList) > 0;
}
}

View File

@ -24,6 +24,11 @@ public class BssTaxinfoServiceImpl implements BssTaxinfoService {
@Autowired
private BssTaxinfoRepository bssTaxinfoRepository;
@Override
public BssTaxinfo getByTaxNo(String taxNo) {
return bssTaxinfoRepository.getByTaxNo(taxNo);
}
/**
* 根据ID查询数据
* @param id 主键ID

View File

@ -72,7 +72,7 @@ public class User implements Serializable {
private BssPlatform bssPlatform;
@ManyToMany(fetch = FetchType.LAZY)
@ManyToMany(fetch = FetchType.EAGER)
@JoinTable(name = "sys_user_role",
joinColumns = @JoinColumn(name="user_id"),
inverseJoinColumns = @JoinColumn(name = "role_id"))

View File

@ -44,4 +44,11 @@ public interface UserRepository extends BaseRepository<User, Long>, JpaSpecifica
* @param ids ID列表
*/
Integer deleteByIdIn(List<Long> ids);
/**
* 根据手机号码查询用户数据
* @param telephone 用户手机号码
* @return 用户数据
*/
User findByPhone(String telephone);
}

View File

@ -0,0 +1,15 @@
package com.cwhelp.modules.system.service;
import com.cwhelp.common.api.baidu.entity.vatinvoice.TrainWordsResult;
import com.cwhelp.common.api.baidu.entity.vatinvoice.WordsResult;
import com.cwhelp.modules.business.domain.BssVatInvoice;
/**
* Created by huangjc on 2019/12/3 0003.
*/
public interface ApiBizService {
BssVatInvoice getResultByAddValue(WordsResult wordsResult, String path);
BssVatInvoice getResultByTrain(TrainWordsResult wordsResult, String path);
}

View File

@ -0,0 +1,15 @@
package com.cwhelp.modules.system.service;
import com.cwhelp.modules.business.domain.BssEmployee;
import com.cwhelp.modules.system.domain.User;
/**
* Created by huangjc on 2019/12/1 0001.
*/
public interface ApiUserService {
User checkLoginPremission(String telephone);
BssEmployee getUserByPhoneNum(String telephone);
}

View File

@ -63,4 +63,6 @@ public interface UserService {
*/
@Transactional
Boolean updateStatus(StatusEnum statusEnum, List<Long> idList);
User getByPhone(String telephone);
}

View File

@ -0,0 +1,144 @@
package com.cwhelp.modules.system.service.impl;
import com.cwhelp.common.api.baidu.entity.vatinvoice.*;
import com.cwhelp.common.api.baidu.entity.vatinvoice.enums.VatInvoiceTypeEnum;
import com.cwhelp.common.enums.InvoiceTypeEnum;
import com.cwhelp.common.utils.ToolUtil;
import com.cwhelp.modules.business.domain.BssGoods;
import com.cwhelp.modules.business.domain.BssTaxinfo;
import com.cwhelp.modules.business.domain.BssVatInvoice;
import com.cwhelp.modules.business.service.BssTaxinfoService;
import com.cwhelp.modules.system.service.ApiBizService;
import org.jsoup.helper.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* Created by huangjc on 2019/12/3 0003.
*/
@Service
public class ApiBizServiceImpl implements ApiBizService{
@Autowired
private BssTaxinfoService bssTaxinfoService;
@Override
public BssVatInvoice getResultByAddValue(WordsResult wordsResult, String path) {
BssVatInvoice vatInvoice = new BssVatInvoice();
Long bssplatformId = 0L;
//add by hjc 发票上扫到的买卖双方如果不在系统中先入库
if(!StringUtil.isBlank(wordsResult.getSellerRegisterNum())){
BssTaxinfo sellerTaxInfo = new BssTaxinfo();
BssTaxinfo taxNo = bssTaxinfoService.getByTaxNo(wordsResult.getSellerRegisterNum());
if(taxNo == null){
//销售方
sellerTaxInfo.setName(wordsResult.getSellerName());
sellerTaxInfo.setTaxNo(wordsResult.getSellerRegisterNum());
sellerTaxInfo.setAccount(wordsResult.getSellerBank());
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<CommodityName> commodityNames = wordsResult.getCommodityName();
List<CommodityType> commodityTypes = wordsResult.getCommodityType();
List<CommodityUnit> commodityUnits = wordsResult.getCommodityUnit();
List<CommodityNum> commodityNums = wordsResult.getCommodityNum();
List<CommodityPrice> commodityPrices = wordsResult.getCommodityPrice();
List<CommodityAmount> commodityAmounts = wordsResult.getCommodityAmount();
List<CommodityTaxRate> commodityTaxRates = wordsResult.getCommodityTaxRate();
List<CommodityTax> commodityTaxs = wordsResult.getCommodityTax();
for (int i = 0; i < commodityNames.size(); i++) {
BssGoods good = new BssGoods();
good.setName(commodityNames.get(i).getWord());
if (ToolUtil.checkListSize(commodityTypes) && commodityTypes.size() > i && !StringUtil.isBlank(commodityTypes.get(i).getWord())) {
good.setSpecification(commodityTypes.get(i).getWord());
}
if (ToolUtil.checkListSize(commodityUnits) && commodityUnits.size() > i && !StringUtil.isBlank(commodityUnits.get(i).getWord())) {
good.setUnit(commodityUnits.get(i).getWord());
}
if (ToolUtil.checkListSize(commodityNums) && !StringUtil.isBlank(commodityNums.get(i).getWord())) {
good.setNum(Double.valueOf(commodityNums.get(i).getWord()));
}
if (ToolUtil.checkListSize(commodityPrices) && commodityPrices.size() > i && !StringUtil.isBlank(commodityPrices.get(i).getWord())) {
good.setUnitPrice(commodityPrices.get(i).getWord());
}
if (ToolUtil.checkListSize(commodityAmounts) && !StringUtil.isBlank(commodityAmounts.get(i).getWord())) {
good.setDetailAmount(new BigDecimal(commodityAmounts.get(i).getWord()));
}
if (ToolUtil.checkListSize(commodityTaxRates) && !StringUtil.isBlank(commodityTaxRates.get(i).getWord())) {
good.setTaxRate(commodityTaxRates.get(i).getWord());
}
if (ToolUtil.checkListSize(commodityTaxs) && !StringUtil.isBlank(commodityTaxs.get(i).getWord())) {
good.setGoodTaxAmount(new BigDecimal(commodityTaxs.get(i).getWord()));
}
goods.add(good);
}
vatInvoice.setInvoiceCode(wordsResult.getInvoiceCode());
vatInvoice.setInvoiceNo(wordsResult.getInvoiceNum());
vatInvoice.setInvoiceDate(wordsResult.getInvoiceDate());
vatInvoice.setCheckCode(wordsResult.getCheckCode());
vatInvoice.setInvoiceMoney(new BigDecimal(wordsResult.getTotalAmount()));
vatInvoice.setTaxAmount(new BigDecimal(wordsResult.getTotalTax()));
vatInvoice.setTotalAmount(new BigDecimal(wordsResult.getAmountInFiguers()));
vatInvoice.setTotalAmountCn(wordsResult.getAmountInWords());
vatInvoice.setRemark(wordsResult.getRemarks());
vatInvoice.setBssGoods(goods);
vatInvoice.setInvoiceImg(path);
vatInvoice.setInvoiceType(VatInvoiceTypeEnum.getVatInvoiceCode(wordsResult.getInvoiceType()));
return vatInvoice;
}
@Override
public BssVatInvoice getResultByTrain(TrainWordsResult wordsResult, String path) {
BssVatInvoice vatInvoice = new BssVatInvoice();
//商品
List<BssGoods> goods = new ArrayList<>();
BssGoods good = new BssGoods();
good.setName(InvoiceTypeEnum.TRAIN_INVOICE.getName());
good.setDetailAmount(new BigDecimal(wordsResult.getTicketRates()));
good.setNum(1d);
good.setUnit("");
good.setUnitPrice(wordsResult.getTicketRates());
goods.add(good);
vatInvoice.setInvoiceMoney(new BigDecimal(wordsResult.getTicketRates()));
vatInvoice.setTotalAmount(new BigDecimal(wordsResult.getTicketRates()));
vatInvoice.setRemark(wordsResult.getStartingStation().concat("").concat(wordsResult.getDestinationStation()));
vatInvoice.setBssGoods(goods);
vatInvoice.setInvoiceImg(path);
return vatInvoice;
}
}

View File

@ -0,0 +1,34 @@
package com.cwhelp.modules.system.service.impl;
import com.cwhelp.modules.business.domain.BssEmployee;
import com.cwhelp.modules.business.repository.BssEmployeeRepository;
import com.cwhelp.modules.system.domain.User;
import com.cwhelp.modules.system.repository.UserRepository;
import com.cwhelp.modules.system.service.ApiUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created by Administrator on 2019/12/2 0002.
*/
@Service
public class ApiUserServiceImpl implements ApiUserService {
@Autowired
private UserRepository userRepository;
@Autowired
private BssEmployeeRepository bssEmployeeRepository;
@Override
public User checkLoginPremission(String telephone) {
return userRepository.findByPhone(telephone);
}
@Override
public BssEmployee getUserByPhoneNum(String telephone) {
return bssEmployeeRepository.findByPhoneNum(telephone);
}
}

View File

@ -4,7 +4,6 @@ import com.cwhelp.common.constant.AdminConst;
import com.cwhelp.common.data.PageSort;
import com.cwhelp.common.enums.StatusEnum;
import com.cwhelp.modules.business.domain.BssPlatform;
import com.cwhelp.modules.business.repository.BssPlatformRepository;
import com.cwhelp.modules.system.domain.Dept;
import com.cwhelp.modules.system.domain.User;
import com.cwhelp.modules.system.repository.UserRepository;
@ -34,8 +33,6 @@ public class UserServiceImpl implements UserService {
@Autowired
private DeptService deptService;
@Autowired
private BssPlatformRepository bssPlatformRepository;
/**
* 根据用户名查询用户数据
@ -161,4 +158,12 @@ public class UserServiceImpl implements UserService {
}
return userRepository.updateStatus(statusEnum.getCode(), ids) > 0;
}
/**
* 根据手机号获取员工信息
*/
@Override
public User getByPhone(String telephone) {
return userRepository.findByPhone(telephone);
}
}

View File

@ -4,11 +4,6 @@
<facet type="Spring" name="Spring">
<configuration />
</facet>
<facet type="web" name="Web">
<configuration>
<webroots />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />

View File

@ -46,6 +46,13 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!-- 打包時 加上 解決jar包衝突 -->
<!--<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
</exclusions>-->
</dependency>
<!--spring data jpa持久层框架-->
<dependency>

View File

@ -626,3 +626,27 @@ INSERT INTO `sys_user_role` VALUES ('12', '17');
INSERT INTO `sys_user_role` VALUES ('8', '18');
INSERT INTO `sys_user_role` VALUES ('10', '18');
INSERT INTO `sys_user_role` VALUES ('12', '18');
-- ----------------------------
-- Table structure for sys_class_item
-- ----------------------------
CREATE TABLE `sys_class_item` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`create_date` datetime DEFAULT NULL,
`item_name` varchar(255) DEFAULT NULL,
`item_type` smallint(6) DEFAULT NULL,
`remark` varchar(255) DEFAULT NULL,
`status` tinyint(4) DEFAULT NULL,
`create_by` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FKscjv9528cflikft0lwnwcujv0` (`create_by`),
CONSTRAINT `FKscjv9528cflikft0lwnwcujv0` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of sys_class_item
-- ----------------------------
INSERT INTO `sys_user_role` VALUES (1, '2019-12-11 21:12:20','食品支出',1,'',1,1);
INSERT INTO `sys_user_role` VALUES (2, '2019-12-11 21:12:20','食品收入',1,'',1,1);

Binary file not shown.