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
+