From 63e7402ed94101871fb34b7a75fdfcf3c4af05c0 Mon Sep 17 00:00:00 2001 From: yiyan Date: Sat, 31 Aug 2019 10:34:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=A7=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/admin.iml | 8 +- admin/pom.xml | 10 - .../controller/BssVatInvoiceController.java | 146 ++++++++++++ .../business/validator/BssTaxinfoValid.java | 4 - .../validator/BssVatInvoiceCheckValid.java | 24 ++ .../validator/BssVatInvoiceValid.java | 34 +++ admin/src/main/resources/application.yml | 3 +- .../templates/business/vatInvoice/add.html | 213 ++++++++++++++++++ .../templates/business/vatInvoice/detail.html | 65 ++++++ .../templates/business/vatInvoice/edit.html | 89 ++++++++ .../templates/business/vatInvoice/index.html | 88 ++++++++ admin/src/main/resources/templates/main.html | 2 +- .../templates/system/main/index.html | 50 +--- .../utils/HttpYoushangFapiaoUtilTest.java | 29 +++ common/common.iml | 6 + common/pom.xml | 1 + .../common/utils/HttpYoushangFapiaoUtil.java | 50 ++++ component/actionLog/actionLog.iml | 5 +- component/component.iml | 4 + component/excel/excel.iml | 5 +- component/fileUpload/fileUpload.iml | 5 +- component/jwt/jwt.iml | 3 + component/shiro/shiro.iml | 5 +- component/thymeleaf/thymeleaf.iml | 5 +- cwhelp.iml | 4 + devtools/devtools.iml | 5 +- modules/modules.iml | 4 + .../modules/business/domain/BssGoods.java | 28 ++- .../business/domain/BssVatInvoice.java | 91 ++++++++ .../repository/BssVatInvoiceRepository.java | 11 + .../service/BssVatInvoiceService.java | 41 ++++ .../impl/BssVatInvoiceServiceImpl.java | 66 ++++++ modules/system/system.iml | 5 +- pom.xml | 17 ++ 34 files changed, 1041 insertions(+), 85 deletions(-) create mode 100644 admin/src/main/java/com/cwhelp/admin/business/controller/BssVatInvoiceController.java create mode 100644 admin/src/main/java/com/cwhelp/admin/business/validator/BssVatInvoiceCheckValid.java create mode 100644 admin/src/main/java/com/cwhelp/admin/business/validator/BssVatInvoiceValid.java create mode 100644 admin/src/main/resources/templates/business/vatInvoice/add.html create mode 100644 admin/src/main/resources/templates/business/vatInvoice/detail.html create mode 100644 admin/src/main/resources/templates/business/vatInvoice/edit.html create mode 100644 admin/src/main/resources/templates/business/vatInvoice/index.html create mode 100644 admin/src/test/java/com/cwhelp/common/utils/HttpYoushangFapiaoUtilTest.java create mode 100644 common/src/main/java/com/cwhelp/common/utils/HttpYoushangFapiaoUtil.java create mode 100644 modules/system/src/main/java/com/cwhelp/modules/business/domain/BssVatInvoice.java create mode 100644 modules/system/src/main/java/com/cwhelp/modules/business/repository/BssVatInvoiceRepository.java create mode 100644 modules/system/src/main/java/com/cwhelp/modules/business/service/BssVatInvoiceService.java create mode 100644 modules/system/src/main/java/com/cwhelp/modules/business/service/impl/BssVatInvoiceServiceImpl.java diff --git a/admin/admin.iml b/admin/admin.iml index 2cd04ec..41d2cd7 100644 --- a/admin/admin.iml +++ b/admin/admin.iml @@ -19,8 +19,8 @@ - + @@ -46,7 +46,6 @@ - @@ -77,7 +76,6 @@ - @@ -160,5 +158,9 @@ + + + + \ No newline at end of file diff --git a/admin/pom.xml b/admin/pom.xml index b140f53..e662ccd 100644 --- a/admin/pom.xml +++ b/admin/pom.xml @@ -51,16 +51,6 @@ fileUpload ${project.version} - - com.cwhelp.modules - bss - ${project.version} - - - com.cwhelp.modules - bss - ${project.version} - diff --git a/admin/src/main/java/com/cwhelp/admin/business/controller/BssVatInvoiceController.java b/admin/src/main/java/com/cwhelp/admin/business/controller/BssVatInvoiceController.java new file mode 100644 index 0000000..df823be --- /dev/null +++ b/admin/src/main/java/com/cwhelp/admin/business/controller/BssVatInvoiceController.java @@ -0,0 +1,146 @@ +package com.cwhelp.admin.business.controller; + +import com.alibaba.fastjson.JSONObject; +import com.cwhelp.admin.business.validator.BssVatInvoiceCheckValid; +import com.cwhelp.admin.business.validator.BssVatInvoiceValid; +import com.cwhelp.common.enums.StatusEnum; +import com.cwhelp.common.utils.EntityBeanUtil; +import com.cwhelp.common.utils.HttpYoushangFapiaoUtil; +import com.cwhelp.common.utils.ResultVoUtil; +import com.cwhelp.common.utils.StatusUtil; +import com.cwhelp.common.vo.ResultVo; +import com.cwhelp.modules.business.domain.BssVatInvoice; +import com.cwhelp.modules.business.service.BssVatInvoiceService; +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 yan.y + * @date 2019/08/26 + */ +@Controller +@RequestMapping("/bss/vatInvoice") +public class BssVatInvoiceController { + + @Autowired + private BssVatInvoiceService bssVatInvoiceService; + + /** + * 列表页面 + */ + @GetMapping("/index") + @RequiresPermissions("bss:vatInvoice:index") + public String index(Model model, BssVatInvoice bssVatInvoice) { + + // 创建匹配器,进行动态查询匹配 + ExampleMatcher matcher = ExampleMatcher.matching(); + + // 获取数据列表 + Example example = Example.of(bssVatInvoice, matcher); + Page list = bssVatInvoiceService.getPageList(example); + + // 封装数据 + model.addAttribute("list", list.getContent()); + model.addAttribute("page", list); + return "/business/vatInvoice/index"; + } + + /** + * 跳转到添加页面 + */ + @GetMapping("/add") + @RequiresPermissions("bss:vatInvoice:add") + public String toAdd() { + return "/business/vatInvoice/add"; + } + + /** + * 跳转到编辑页面 + */ + @GetMapping("/edit/{id}") + @RequiresPermissions("bss:vatInvoice:edit") + public String toEdit(@PathVariable("id") BssVatInvoice bssVatInvoice, Model model) { + model.addAttribute("bssVatInvoice", bssVatInvoice); + return "/business/vatInvoice/add"; + } + + /** + * 查验录入 + * @return + */ + @PostMapping("/check") + @RequiresPermissions("bss:vatInvoice:add") + public String check(@Validated BssVatInvoiceCheckValid checkValid, BssVatInvoice bssVatInvoice){ + JSONObject params = new JSONObject(); + //发票代码 + params.put("fpdm", bssVatInvoice.getInvoiceCode()); + //发票号码 + params.put("fphm", bssVatInvoice.getInvoiceNo()); + //开票日期 + params.put("kprq", bssVatInvoice.getInvoiceDate()); + //开具金额(不含税) + params.put("kjje", bssVatInvoice.getInvoiceMoney()); + //校验码 + params.put("jym", bssVatInvoice.getCheckCode()); + JSONObject vatInfoiceInfo = HttpYoushangFapiaoUtil.getVatInfoiceInfo(params); + + + return null; + } + + /** + * 保存添加/修改的数据 + * @param valid 验证对象 + */ + @PostMapping({"/add","/edit"}) + @RequiresPermissions({"bss:vatInvoice:add","bss:vatInvoice:edit"}) + @ResponseBody + public ResultVo save(@Validated BssVatInvoiceValid valid, BssVatInvoice bssVatInvoice) { + // 复制保留无需修改的数据 + if (bssVatInvoice.getId() != null) { + BssVatInvoice beBssVatInvoice = bssVatInvoiceService.getById(bssVatInvoice.getId()); + EntityBeanUtil.copyProperties(beBssVatInvoice, bssVatInvoice); + } + + // 保存数据 + bssVatInvoiceService.save(bssVatInvoice); + return ResultVoUtil.SAVE_SUCCESS; + } + + /** + * 跳转到详细页面 + */ + @GetMapping("/detail/{id}") + @RequiresPermissions("bss:vatInvoice:detail") + public String toDetail(@PathVariable("id") BssVatInvoice bssVatInvoice, Model model) { + model.addAttribute("bssVatInvoice",bssVatInvoice); + return "/business/vatInvoice/detail"; + } + + /** + * 设置一条或者多条数据的状态 + */ + @RequestMapping("/status/{param}") + @RequiresPermissions("bss:vatInvoice:status") + @ResponseBody + public ResultVo status( + @PathVariable("param") String param, + @RequestParam(value = "ids", required = false) List ids) { + // 更新状态 + StatusEnum statusEnum = StatusUtil.getStatusEnum(param); + if (bssVatInvoiceService.updateStatus(statusEnum, ids)) { + return ResultVoUtil.success(statusEnum.getMessage() + "成功"); + } else { + return ResultVoUtil.error(statusEnum.getMessage() + "失败,请重新操作"); + } + } +} \ No newline at end of file diff --git a/admin/src/main/java/com/cwhelp/admin/business/validator/BssTaxinfoValid.java b/admin/src/main/java/com/cwhelp/admin/business/validator/BssTaxinfoValid.java index c8286e9..329bd49 100644 --- a/admin/src/main/java/com/cwhelp/admin/business/validator/BssTaxinfoValid.java +++ b/admin/src/main/java/com/cwhelp/admin/business/validator/BssTaxinfoValid.java @@ -13,10 +13,6 @@ import javax.validation.constraints.NotEmpty; public class BssTaxinfoValid implements Serializable { @NotEmpty(message = "纳税人识别号不能为空") private String taxNo; - @NotEmpty(message = "开户行及账号不能为空") - private String account; - @NotEmpty(message = "地址、电话不能为空") - private String addressPhone; @NotEmpty(message = "名称不能为空") private String name; } \ No newline at end of file diff --git a/admin/src/main/java/com/cwhelp/admin/business/validator/BssVatInvoiceCheckValid.java b/admin/src/main/java/com/cwhelp/admin/business/validator/BssVatInvoiceCheckValid.java new file mode 100644 index 0000000..f0c5c6e --- /dev/null +++ b/admin/src/main/java/com/cwhelp/admin/business/validator/BssVatInvoiceCheckValid.java @@ -0,0 +1,24 @@ +package com.cwhelp.admin.business.validator; + +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Pattern; +import java.io.Serializable; + +/** + * @author yan.y + * @date 2019/08/26 + */ +@Data +public class BssVatInvoiceCheckValid implements Serializable { + @NotEmpty(message = "发票代码不能为空") + private String invoiceCode; + @NotEmpty(message = "发票号码不能为空") + private String invoiceNo; + @NotEmpty(message = "发票日期不能为空") + @Pattern(regexp = "[0-9]{4}-[0-9]{2}-[0-9]{2}", message = "日期格式不正确") + private String invoiceDate; + @NotEmpty(message = "校验码不能为空") + private String checkCode; +} \ No newline at end of file diff --git a/admin/src/main/java/com/cwhelp/admin/business/validator/BssVatInvoiceValid.java b/admin/src/main/java/com/cwhelp/admin/business/validator/BssVatInvoiceValid.java new file mode 100644 index 0000000..7436901 --- /dev/null +++ b/admin/src/main/java/com/cwhelp/admin/business/validator/BssVatInvoiceValid.java @@ -0,0 +1,34 @@ +package com.cwhelp.admin.business.validator; + +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Pattern; +import java.io.Serializable; + +/** + * @author yan.y + * @date 2019/08/26 + */ +@Data +public class BssVatInvoiceValid implements Serializable { + @NotEmpty(message = "发票代码不能为空") + private String invoiceCode; + @NotEmpty(message = "发票类型不能为空") + private String invoiceType; + @NotEmpty(message = "发票号码不能为空") + private String invoiceNo; + @NotEmpty(message = "发票日期不能为空") + @Pattern(regexp = "[0-9]{4}-[0-9]{2}-[0-9]{2}", message = "日期格式不正确") + private String invoiceDate; + @NotEmpty(message = "校验码不能为空") + private String checkCode; + @NotEmpty(message = "发票金额不能为空") + private String invoiceMoney; + @NotEmpty(message = "税额不能为空") + private String taxAmount; + @NotEmpty(message = "总金额不能为空") + private String totalAmount; + @NotEmpty(message = "总金额(大写)不能为空") + private String totalAmountCn; +} \ No newline at end of file diff --git a/admin/src/main/resources/application.yml b/admin/src/main/resources/application.yml index 70fdec8..a7a247a 100644 --- a/admin/src/main/resources/application.yml +++ b/admin/src/main/resources/application.yml @@ -36,11 +36,12 @@ spring: thymeleaf: prefix: classpath:/templates suffix: .html - mode: HTML + mode: LEGACYHTML5 encoding: utf-8 servlet.content-type: text/html cache: false + ## 文件上传配置 servlet: multipart: diff --git a/admin/src/main/resources/templates/business/vatInvoice/add.html b/admin/src/main/resources/templates/business/vatInvoice/add.html new file mode 100644 index 0000000..a975c54 --- /dev/null +++ b/admin/src/main/resources/templates/business/vatInvoice/add.html @@ -0,0 +1,213 @@ + + + + + + +
+
+
    +
  • 手工录入
  • +
  • 查验录入
  • +
+
+
+ +
+ 基本信息 +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
+
+ +
+ + +
+
+
+
+
+
+
+
+
实体类
+
+ + +
+
()
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
#字段名称字段标题数据类型查询(可选)列表显示字段验证(可选)
+ + + + + + + +
+
+
+ + +
+
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + +
+
+
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/admin/src/main/resources/templates/business/vatInvoice/detail.html b/admin/src/main/resources/templates/business/vatInvoice/detail.html new file mode 100644 index 0000000..97c8404 --- /dev/null +++ b/admin/src/main/resources/templates/business/vatInvoice/detail.html @@ -0,0 +1,65 @@ + + + + + +
+
基本信息
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
主键ID发票代码
发票号码发票日期
校验码机器编码
发票金额税额
总金额总金额(大写)
购买方纳税人信息销售方纳税人信息
创建时间更新时间
备注
+
+ + + \ No newline at end of file diff --git a/admin/src/main/resources/templates/business/vatInvoice/edit.html b/admin/src/main/resources/templates/business/vatInvoice/edit.html new file mode 100644 index 0000000..65f6737 --- /dev/null +++ b/admin/src/main/resources/templates/business/vatInvoice/edit.html @@ -0,0 +1,89 @@ + + + + + +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + +
+
+
+ + + \ No newline at end of file diff --git a/admin/src/main/resources/templates/business/vatInvoice/index.html b/admin/src/main/resources/templates/business/vatInvoice/index.html new file mode 100644 index 0000000..7543991 --- /dev/null +++ b/admin/src/main/resources/templates/business/vatInvoice/index.html @@ -0,0 +1,88 @@ + + + + + +
+
+ 增值税发票信息管理 + +
+
+
+ +
+ +
+ +
+
启用
+
冻结
+
删除
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + 发票类型发票代码发票号码发票日期发票金额税额总金额总金额(大写)购买方纳税人信息销售方纳税人信息操作
发票类型发票代码发票号码发票日期发票金额税额总金额总金额(大写)购买方纳税人信息销售方纳税人信息 + 编辑 + 详细 + 删除 +
+
+
+
+
+ + + \ No newline at end of file diff --git a/admin/src/main/resources/templates/main.html b/admin/src/main/resources/templates/main.html index 8f40104..c533c04 100644 --- a/admin/src/main/resources/templates/main.html +++ b/admin/src/main/resources/templates/main.html @@ -31,7 +31,7 @@
  • - TIMO + 财务帮
    -
    项目介绍
    -
    -
    - Cwhelp后台管理系统,基于SpringBoot2.0 + Spring Data Jpa + Thymeleaf + Shiro 开发的后台管理系统,采用分模块的方式便于开发和维护,目前支持的功能有:权限管理、部门管理、字典管理、日志记录、文件上传、代码生成等! -
    -
    -

    技术选型

    -
      -
    1. 后端技术:SpringBoot + Spring Data Jpa + Thymeleaf + Shiro + EhCache
    2. -
    3. 前端技术:Layui + Jquery + zTree + Font-awesome
    4. -
    -
    -
    -

    功能列表

    -
      -
    1. 用户管理:用于管理后台系统的用户,可进行增删改查等操作。
    2. -
    3. 角色管理:分配权限的最小单元,通过角色给用户分配权限。
    4. -
    5. 菜单管理:用于配置系统菜单,同时也作为权限资源。
    6. -
    7. 部门管理:通过不同的部门来管理和区分用户。
    8. -
    9. 字典管理:对一些需要转换的数据进行统一管理,如:男、女等。
    10. -
    11. 行为日志:用于记录用户对系统的操作,同时监视系统运行时发生的错误。
    12. -
    13. 文件上传:内置了文件上传接口,方便开发者使用文件上传功能。
    14. -
    15. 代码生成:可以帮助开发者快速开发项目,减少不必要的重复操作,花更多精力注重业务实现。
    16. -
    17. 表单构建:通过拖拽的方式快速构建一个表单模块。
    18. -
    19. 数据接口:根据业务代码自动生成相关的api接口文档
    20. -
    -
    -
    +
    -
    更新日志
    -
    -
      -
    • - -
      -

      v2.0.1

      -

      - 1.项目初始化
      -

      -
      -
    • -
    • - -
      -
      yan.y
      -
      -
    • -
    -
    +
    diff --git a/admin/src/test/java/com/cwhelp/common/utils/HttpYoushangFapiaoUtilTest.java b/admin/src/test/java/com/cwhelp/common/utils/HttpYoushangFapiaoUtilTest.java new file mode 100644 index 0000000..d5a6f76 --- /dev/null +++ b/admin/src/test/java/com/cwhelp/common/utils/HttpYoushangFapiaoUtilTest.java @@ -0,0 +1,29 @@ +package com.cwhelp.common.utils; + +import com.alibaba.fastjson.JSONObject; +import org.junit.Assert; +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * @author: yan.y + * @Description: + * @Date: Created in 01:00 2019-08-27 + * @Modified by: + */ +public class HttpYoushangFapiaoUtilTest { + + @Test + public void getVatInfoiceInfo() { + JSONObject params = new JSONObject(); + params.put("fpdm","031001800304"); + params.put("fphm","00073818"); + params.put("kprq","2019-06-26"); + params.put("kjje",""); + params.put("jym","554287"); + JSONObject fapiaoInfo = HttpYoushangFapiaoUtil.getVatInfoiceInfo(params); + String code = fapiaoInfo.getString("code"); + Assert.assertEquals("200",code); + } +} \ No newline at end of file diff --git a/common/common.iml b/common/common.iml index b90dc1f..44f5126 100644 --- a/common/common.iml +++ b/common/common.iml @@ -15,6 +15,8 @@ + + @@ -103,5 +105,9 @@ + + + + \ No newline at end of file diff --git a/common/pom.xml b/common/pom.xml index caacfe2..04d330a 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -13,4 +13,5 @@ cwhelp 2.0.1 + \ No newline at end of file diff --git a/common/src/main/java/com/cwhelp/common/utils/HttpYoushangFapiaoUtil.java b/common/src/main/java/com/cwhelp/common/utils/HttpYoushangFapiaoUtil.java new file mode 100644 index 0000000..d674648 --- /dev/null +++ b/common/src/main/java/com/cwhelp/common/utils/HttpYoushangFapiaoUtil.java @@ -0,0 +1,50 @@ +package com.cwhelp.common.utils; + +import com.alibaba.fastjson.JSONObject; +import com.cwhelp.common.enums.ResultEnum; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.utils.URIBuilder; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; + +import java.net.URI; + +/** + * @author: yan.y + * @Description: + * @Date: Created in 23:59 2019-08-26 + * @Modified by: + */ +public class HttpYoushangFapiaoUtil { + private static final String url = "https://fapiao.youshang.com/GuoShuiAction.do"; + + public static final JSONObject getVatInfoiceInfo(JSONObject params){ + final String action = "findInvoiceResult"; + JSONObject result = new JSONObject(); + try { + HttpClient httpClient = HttpClients.createDefault(); + URIBuilder uriBuilder = new URIBuilder(url); + URI uri = uriBuilder.addParameter("action", action) + .addParameter("fpdm", params.getString("fpdm")) + .addParameter("fphm", params.getString("fphm")) + .addParameter("kprq", params.getString("kprq")) + .addParameter("kjje", params.getString("kjje")) + .addParameter("jym", params.getString("jym")).build(); + HttpGet httpGet = new HttpGet(uri); + HttpResponse response = httpClient.execute(httpGet); + if (response.getStatusLine().getStatusCode() == 200) { + String content = EntityUtils.toString(response.getEntity(), "UTF-8"); + result.put("code", ResultEnum.SUCCESS.getCode()); + result.put("meg", ResultEnum.SUCCESS.getMessage()); + result.put("data", content); + } + } catch (Exception e) { + result.put("code", ResultEnum.ERROR.getCode()); + result.put("msg", ResultEnum.ERROR.getMessage() + "-" + e.getMessage()); + } + return result; + } + +} diff --git a/component/actionLog/actionLog.iml b/component/actionLog/actionLog.iml index 177f3cd..bcbf6ac 100644 --- a/component/actionLog/actionLog.iml +++ b/component/actionLog/actionLog.iml @@ -24,7 +24,6 @@ - @@ -130,5 +129,9 @@ + + + + \ No newline at end of file diff --git a/component/component.iml b/component/component.iml index 3bdc066..8c6e153 100644 --- a/component/component.iml +++ b/component/component.iml @@ -92,5 +92,9 @@ + + + + \ No newline at end of file diff --git a/component/excel/excel.iml b/component/excel/excel.iml index 70aec00..b628316 100644 --- a/component/excel/excel.iml +++ b/component/excel/excel.iml @@ -22,7 +22,6 @@ - @@ -112,5 +111,9 @@ + + + + \ No newline at end of file diff --git a/component/fileUpload/fileUpload.iml b/component/fileUpload/fileUpload.iml index 48f6201..29e9cf0 100644 --- a/component/fileUpload/fileUpload.iml +++ b/component/fileUpload/fileUpload.iml @@ -24,7 +24,6 @@ - @@ -114,5 +113,9 @@ + + + + \ No newline at end of file diff --git a/component/jwt/jwt.iml b/component/jwt/jwt.iml index 70af762..f373a42 100644 --- a/component/jwt/jwt.iml +++ b/component/jwt/jwt.iml @@ -115,5 +115,8 @@ + + + \ No newline at end of file diff --git a/component/shiro/shiro.iml b/component/shiro/shiro.iml index caee117..465c811 100644 --- a/component/shiro/shiro.iml +++ b/component/shiro/shiro.iml @@ -24,7 +24,6 @@ - @@ -129,5 +128,9 @@ + + + + \ No newline at end of file diff --git a/component/thymeleaf/thymeleaf.iml b/component/thymeleaf/thymeleaf.iml index b278704..a576569 100644 --- a/component/thymeleaf/thymeleaf.iml +++ b/component/thymeleaf/thymeleaf.iml @@ -24,7 +24,6 @@ - @@ -120,5 +119,9 @@ + + + + \ No newline at end of file diff --git a/cwhelp.iml b/cwhelp.iml index 3bdc066..8c6e153 100644 --- a/cwhelp.iml +++ b/cwhelp.iml @@ -92,5 +92,9 @@ + + + + \ No newline at end of file diff --git a/devtools/devtools.iml b/devtools/devtools.iml index 619da2c..593b033 100644 --- a/devtools/devtools.iml +++ b/devtools/devtools.iml @@ -25,7 +25,6 @@ - @@ -144,5 +143,9 @@ + + + + \ No newline at end of file diff --git a/modules/modules.iml b/modules/modules.iml index 3bdc066..8c6e153 100644 --- a/modules/modules.iml +++ b/modules/modules.iml @@ -92,5 +92,9 @@ + + + + \ No newline at end of file diff --git a/modules/system/src/main/java/com/cwhelp/modules/business/domain/BssGoods.java b/modules/system/src/main/java/com/cwhelp/modules/business/domain/BssGoods.java index 54f3dc0..8255029 100644 --- a/modules/system/src/main/java/com/cwhelp/modules/business/domain/BssGoods.java +++ b/modules/system/src/main/java/com/cwhelp/modules/business/domain/BssGoods.java @@ -2,21 +2,19 @@ package com.cwhelp.modules.business.domain; import com.cwhelp.common.enums.StatusEnum; import com.cwhelp.common.utils.StatusUtil; +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.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; +import javax.persistence.*; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; -import javax.persistence.Entity; -import javax.persistence.EntityListeners; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; /** * @author yan.y @@ -38,19 +36,27 @@ public class BssGoods implements Serializable { // 数量 private Integer num; // 细节金额 - private BigDecimal detail_amount; + @Column(name = "detail_amount") + private BigDecimal detailAmount; // 税额 - private BigDecimal tax_amount; + @Column(name = "tax_amount") + private BigDecimal taxAmount; // 税率 - private String tax_rate; + @Column(name = "tax_rate") + private String taxRate; // 单位 private String unit; // 单价 - private String unit_price; + @Column(name = "unit_price") + private String unitPrice; // 规格型号 private String specification; // 增值税 - private Integer vat_invoice_id; + @OneToOne(fetch=FetchType.LAZY) + @NotFound(action= NotFoundAction.IGNORE) + @JoinColumn(name="vat_invoice_id") + @JsonIgnore + private BssVatInvoice vatInvoice; // 创建时间 @CreatedDate private Date createDate; diff --git a/modules/system/src/main/java/com/cwhelp/modules/business/domain/BssVatInvoice.java b/modules/system/src/main/java/com/cwhelp/modules/business/domain/BssVatInvoice.java new file mode 100644 index 0000000..4de6700 --- /dev/null +++ b/modules/system/src/main/java/com/cwhelp/modules/business/domain/BssVatInvoice.java @@ -0,0 +1,91 @@ +package com.cwhelp.modules.business.domain; + +import com.cwhelp.common.enums.StatusEnum; +import com.cwhelp.common.utils.StatusUtil; +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.CreatedDate; +import org.springframework.data.annotation.LastModifiedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +import javax.persistence.*; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * @author yan.y + * @date 2019/08/26 + */ +@Data +@Entity +@Table(name="bss_vat_invoice") +@EntityListeners(AuditingEntityListener.class) +@Where(clause = StatusUtil.notDelete) +public class BssVatInvoice implements Serializable { + // 主键ID + @Id + @GeneratedValue(strategy=GenerationType.IDENTITY) + private Long id; + // 发票代码 + @Column(name = "invoice_code") + private String invoiceCode; + // 发票号码 + @Column(name = "invoice_no") + private String invoiceNo; + // 发票日期 + @Column(name = "invoice_date") + private String invoiceDate; + // 校验码 + @Column(name = "check_code") + private String checkCode; + // 机器编码 + @Column(name = "machine_no") + private String machineNo; + // 发票金额 + @Column(name = "invoice_money") + private BigDecimal invoiceMoney; + // 税额 + @Column(name = "tax_amount") + private BigDecimal taxAmount; + // 总金额 + @Column(name = "total_amount") + private BigDecimal totalAmount; + // 总金额(大写) + @Column(name = "total_amount_cn") + private String totalAmountCn; + @Column(name = "invoice_type") + private Integer invoiceType; + + // 备注 + private String remark; + // 购买方纳税人信息 + @OneToOne(fetch=FetchType.LAZY) + @NotFound(action= NotFoundAction.IGNORE) + @JoinColumn(name="buy_tax_info_id") + @JsonIgnore + private BssTaxinfo buyTaxInfo; + // 销售方纳税人信息 + // 购买方纳税人信息 + @OneToOne(fetch=FetchType.LAZY) + @NotFound(action= NotFoundAction.IGNORE) + @JoinColumn(name="saler_tax_info_id") + @JsonIgnore + private BssTaxinfo salerTaxInfo; + + @OneToMany(cascade = CascadeType.ALL,fetch = FetchType.EAGER) + @JoinColumn(name="vatInvoice",referencedColumnName = "id") + private List bssGoods; + // 状态 + private Byte status = StatusEnum.OK.getCode(); + // 创建时间 + @CreatedDate + private Date createDate; + // 更新时间 + @LastModifiedDate + private Date updateDate; +} \ No newline at end of file diff --git a/modules/system/src/main/java/com/cwhelp/modules/business/repository/BssVatInvoiceRepository.java b/modules/system/src/main/java/com/cwhelp/modules/business/repository/BssVatInvoiceRepository.java new file mode 100644 index 0000000..c811806 --- /dev/null +++ b/modules/system/src/main/java/com/cwhelp/modules/business/repository/BssVatInvoiceRepository.java @@ -0,0 +1,11 @@ +package com.cwhelp.modules.business.repository; + +import com.cwhelp.modules.business.domain.BssVatInvoice; +import com.cwhelp.modules.system.repository.BaseRepository; + +/** + * @author yan.y + * @date 2019/08/26 + */ +public interface BssVatInvoiceRepository extends BaseRepository { +} \ No newline at end of file diff --git a/modules/system/src/main/java/com/cwhelp/modules/business/service/BssVatInvoiceService.java b/modules/system/src/main/java/com/cwhelp/modules/business/service/BssVatInvoiceService.java new file mode 100644 index 0000000..6ae5991 --- /dev/null +++ b/modules/system/src/main/java/com/cwhelp/modules/business/service/BssVatInvoiceService.java @@ -0,0 +1,41 @@ +package com.cwhelp.modules.business.service; + +import com.cwhelp.common.enums.StatusEnum; +import com.cwhelp.modules.business.domain.BssVatInvoice; +import org.springframework.data.domain.Example; +import org.springframework.data.domain.Page; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + * @author yan.y + * @date 2019/08/26 + */ +public interface BssVatInvoiceService { + + /** + * 获取分页列表数据 + * @param example 查询实例 + * @return 返回分页数据 + */ + Page getPageList(Example example); + + /** + * 根据ID查询数据 + * @param id 主键ID + */ + BssVatInvoice getById(Long id); + + /** + * 保存数据 + * @param bssVatInvoice 实体对象 + */ + BssVatInvoice save(BssVatInvoice bssVatInvoice); + + /** + * 状态(启用,冻结,删除)/批量状态处理 + */ + @Transactional + Boolean updateStatus(StatusEnum statusEnum, List idList); +} \ No newline at end of file diff --git a/modules/system/src/main/java/com/cwhelp/modules/business/service/impl/BssVatInvoiceServiceImpl.java b/modules/system/src/main/java/com/cwhelp/modules/business/service/impl/BssVatInvoiceServiceImpl.java new file mode 100644 index 0000000..ab4b317 --- /dev/null +++ b/modules/system/src/main/java/com/cwhelp/modules/business/service/impl/BssVatInvoiceServiceImpl.java @@ -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.BssVatInvoice; +import com.cwhelp.modules.business.repository.BssVatInvoiceRepository; +import com.cwhelp.modules.business.service.BssVatInvoiceService; +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 yan.y + * @date 2019/08/26 + */ +@Service +public class BssVatInvoiceServiceImpl implements BssVatInvoiceService { + + @Autowired + private BssVatInvoiceRepository bssVatInvoiceRepository; + + /** + * 根据ID查询数据 + * @param id 主键ID + */ + @Override + @Transactional + public BssVatInvoice getById(Long id) { + return bssVatInvoiceRepository.findById(id).orElse(null); + } + + /** + * 获取分页列表数据 + * @param example 查询实例 + * @return 返回分页数据 + */ + @Override + public Page getPageList(Example example) { + // 创建分页对象 + PageRequest page = PageSort.pageRequest(); + return bssVatInvoiceRepository.findAll(example, page); + } + + /** + * 保存数据 + * @param bssVatInvoice 实体对象 + */ + @Override + public BssVatInvoice save(BssVatInvoice bssVatInvoice) { + return bssVatInvoiceRepository.save(bssVatInvoice); + } + + /** + * 状态(启用,冻结,删除)/批量状态处理 + */ + @Override + @Transactional + public Boolean updateStatus(StatusEnum statusEnum, List idList) { + return bssVatInvoiceRepository.updateStatus(statusEnum.getCode(), idList) > 0; + } +} \ No newline at end of file diff --git a/modules/system/system.iml b/modules/system/system.iml index 1c720a3..c85455c 100644 --- a/modules/system/system.iml +++ b/modules/system/system.iml @@ -23,7 +23,6 @@ - @@ -113,5 +112,9 @@ + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 6e24168..cae0ab3 100644 --- a/pom.xml +++ b/pom.xml @@ -103,5 +103,22 @@ jsoup ${jsoup.version} + + + com.alibaba + fastjson + 1.2.56 + + + + org.apache.httpcomponents + httpcore + 4.4.11 + + + org.apache.httpcomponents + httpclient + 4.5.8 +