Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
wangyuanfeng
/
chain-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2316410e
authored
Jan 15, 2019
by
wangyuanfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成保存mapper
parent
d32bbad9
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
319 additions
and
19 deletions
+319
-19
build.gradle
+1
-0
src/main/java/com/itfuture/chainservice/common/utils/rsautil/RsaUtil.java
+38
-0
src/main/java/com/itfuture/chainservice/common/utils/webservice/WebServiceUtil.java
+5
-2
src/main/java/com/itfuture/chainservice/repository/Payment/PaymentMapper.java
+37
-0
src/main/java/com/itfuture/chainservice/repository/Payment/entity/InvoiceEntity.java
+28
-0
src/main/java/com/itfuture/chainservice/repository/Payment/entity/PaymentEntity.java
+27
-0
src/main/java/com/itfuture/chainservice/repository/Supplier/SupplierMapper.java
+17
-0
src/main/java/com/itfuture/chainservice/repository/Supplier/entity/SupplierEntity.java
+2
-2
src/main/java/com/itfuture/chainservice/repository/contract/ContractMapper.java
+22
-3
src/main/java/com/itfuture/chainservice/repository/contract/entity/ContractEntity.java
+3
-3
src/main/java/com/itfuture/chainservice/repository/order/OrderMapper.java
+20
-1
src/main/java/com/itfuture/chainservice/repository/order/entity/OrderEntity.java
+3
-3
src/main/java/com/itfuture/chainservice/repository/warehousing/WarehousingMapper.java
+26
-0
src/main/java/com/itfuture/chainservice/repository/warehousing/impl/WarehousingEntity.java
+48
-0
src/main/java/com/itfuture/chainservice/service/contract/impl/ContractServiceImpl.java
+6
-3
src/main/java/com/itfuture/chainservice/service/order/impl/OrderServiceImpl.java
+1
-1
src/main/java/com/itfuture/chainservice/service/payment/PaymentService.java
+8
-0
src/main/java/com/itfuture/chainservice/service/payment/impl/PaymentServiceImpl.java
+13
-0
src/main/java/com/itfuture/chainservice/service/supplier/impl/SupplierServiceImpl.java
+1
-1
src/main/java/com/itfuture/chainservice/service/warehousing/WarehousingService.java
+4
-0
src/main/java/com/itfuture/chainservice/service/warehousing/impl/WarehousingServiceImpl.java
+9
-0
No files found.
build.gradle
View file @
2316410e
...
...
@@ -40,4 +40,5 @@ dependencies {
compile
'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.8.10'
compile
'com.github.pagehelper:pagehelper:4.1.0'
compile
'cn.hutool:hutool-all:4.3.2'
compile
'com.alibaba:fastjson:1.2.41'
}
src/main/java/com/itfuture/chainservice/common/utils/rsautil/RsaUtil.java
View file @
2316410e
package
com
.
itfuture
.
chainservice
.
common
.
utils
.
rsautil
;
import
jdk.nashorn.internal.runtime.logging.Logger
;
import
lombok.extern.log4j.Log4j
;
import
javax.crypto.Cipher
;
import
java.io.IOException
;
import
java.security.*
;
import
java.security.spec.PKCS8EncodedKeySpec
;
import
java.util.Base64
;
/**
...
...
@@ -9,6 +14,7 @@ import java.util.Base64;
* @date 2019/1/13 8:34 PM
* @desc rsa加密工具类
*/
@Log4j
public
class
RsaUtil
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
...
...
@@ -36,4 +42,36 @@ public class RsaUtil {
byte
[]
bytesDecrypt
=
cipher2
.
doFinal
(
bytesDecode
);
System
.
out
.
println
(
"解密后的数据:"
+
new
String
(
bytesDecrypt
));
}
/**
* 私钥解密
* @param data
* @throws IOException
*/
private
byte
[]
encryptDataByPrivateKey
(
String
data
,
PrivateKey
privateKey
)
{
byte
[]
bytesDecrypt
=
null
;
try
{
byte
[]
bytesDecode
=
data
.
getBytes
();
//7.解密
Cipher
cipher2
=
Cipher
.
getInstance
(
"RSA"
);
cipher2
.
init
(
Cipher
.
DECRYPT_MODE
,
privateKey
);
bytesDecrypt
=
cipher2
.
doFinal
(
bytesDecode
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
e
);
}
return
bytesDecrypt
;
}
/**
* 获取私钥
*
* @param privateKey 私钥字符串
* @return
*/
public
static
PrivateKey
getPrivateKey
(
String
privateKey
)
throws
Exception
{
KeyFactory
keyFactory
=
KeyFactory
.
getInstance
(
"RSA"
);
byte
[]
decodedKey
=
Base64
.
getDecoder
().
decode
(
privateKey
.
getBytes
());
PKCS8EncodedKeySpec
keySpec
=
new
PKCS8EncodedKeySpec
(
decodedKey
);
return
keyFactory
.
generatePrivate
(
keySpec
);
}
}
src/main/java/com/itfuture/chainservice/common/utils/webservice/WebServiceUtil.java
View file @
2316410e
package
com
.
itfuture
.
chainservice
.
common
.
utils
.
webservice
;
import
cn.hutool.http.webservice.SoapRequest
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.XML
;
import
java.nio.charset.Charset
;
import
java.util.Map
;
...
...
@@ -12,7 +14,7 @@ import java.util.Map;
*/
public
class
WebServiceUtil
{
public
static
String
RequestWebService
(
String
path
,
String
method
,
Map
<
String
,
String
>
map
){
public
static
JSONObject
RequestWebService
(
String
path
,
String
method
,
Map
<
String
,
String
>
map
){
SoapRequest
request
=
new
SoapRequest
(
path
,
""
);
request
.
setCharset
(
Charset
.
defaultCharset
());
request
.
setParams
(
map
);
...
...
@@ -21,6 +23,7 @@ public class WebServiceUtil {
request
.
setXmlns
(
"http://schemas.xmlsoap.org/soap/envelope/"
);
request
.
setMethod
(
method
);
String
xmlResponse
=
request
.
execute
();
return
xmlResponse
;
JSONObject
jsonObject
=
XML
.
toJSONObject
(
xmlResponse
);
return
jsonObject
;
}
}
src/main/java/com/itfuture/chainservice/repository/Payment/PaymentMapper.java
0 → 100644
View file @
2316410e
package
com
.
itfuture
.
chainservice
.
repository
.
Payment
;
import
com.itfuture.chainservice.repository.Payment.entity.InvoiceEntity
;
import
com.itfuture.chainservice.repository.Payment.entity.PaymentEntity
;
import
org.apache.ibatis.annotations.Insert
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Options
;
@Mapper
public
interface
PaymentMapper
{
/**
* 新增发票
* @param invoiceEntity
* @return
*/
@Insert
(
"insert into "
+
" invoice(payment_id,contract_no,supplier,invoice_code,invoice_title,invoice_type,invoice_no,"
+
" amount,invoice_name,approved_date,approver,invoice_date,approver,invoice_date,state,tax_rate,"
+
" create_time,modify_time) "
+
" value(#{paymentId},#{contractNo},#{supplier},#{invoiceCode},#{invoiceTitle},#{invoiceType},#{invoiceNo},"
+
" #{amount},#{invoiceName},#{approvedDate},#{approver},#{state},#{taxRate},#{createTime},#{modifyTime})"
)
@Options
(
useGeneratedKeys
=
true
,
keyProperty
=
"id"
)
InvoiceEntity
saveInvoice
(
InvoiceEntity
invoiceEntity
);
@Insert
(
"insert into "
+
" invoice(project_type,principal,payment_no,supplier,project_company,project_company_code,area,contract_name,"
+
" contract_no,payment_amount,bank_name,account,recipient_name,payment_state,payment_timestamp,create_time,"
+
" modify_time)"
+
" value(#{projectType},#{principal},#{paymentNo},#{supplier},#{projectCompany},#{projectCompanyCode},#{area},#{contractName},"
+
" #{contractNo},#{paymentAmount},#{bankName},#{account},#{recipientName},#{account},#{recipientName},#{paymentState},"
+
" #{paymentTimestamp},#{createTime},#{modifyTime})"
)
@Options
(
useGeneratedKeys
=
true
,
keyProperty
=
"id"
)
PaymentEntity
savePayment
(
PaymentEntity
paymentEntity
);
}
src/main/java/com/itfuture/chainservice/repository/Payment/entity/InvoiceEntity.java
0 → 100644
View file @
2316410e
package
com
.
itfuture
.
chainservice
.
repository
.
Payment
.
entity
;
import
lombok.Data
;
/**
* 发票
*/
@Data
public
class
InvoiceEntity
{
private
Integer
id
;
// 主键ID
private
Integer
paymentId
;
// 付款单号
private
String
contractNo
;
//订单编号/合同编号
private
String
supplier
;
// 供应商名称
private
String
invoiceCode
;
//发票代码
private
String
invoiceTitle
;
//发票抬头
private
String
invoiceType
;
//发票类型
private
String
invoiceNo
;
//发票号码
private
String
amount
;
//发票金额
private
String
invoiceName
;
//发票名称
private
String
approvedDate
;
//审批日期
private
String
approver
;
//审批人
private
String
invoiceDate
;
//开票日期
private
String
state
;
//单据状态
private
String
taxRate
;
//税率
private
String
createTime
;
// 创建时间
private
String
modifyTime
;
// 修改时间
}
src/main/java/com/itfuture/chainservice/repository/Payment/entity/PaymentEntity.java
0 → 100644
View file @
2316410e
package
com
.
itfuture
.
chainservice
.
repository
.
Payment
.
entity
;
import
lombok.Data
;
@Data
public
class
PaymentEntity
{
private
Integer
id
;
private
String
projectType
;
// 项目类型
private
String
principal
;
// 业务主体(供应链公司)
private
String
paymentNo
;
// 付款单号
private
String
supplier
;
// 供应商名称
private
String
projectCompany
;
// 项目公司名称
private
String
projectCompanyCode
;
// 项目公司编码
private
String
area
;
// 区域
private
String
contractName
;
// 订单名称/合同名称
private
String
contractNo
;
// 订单编号/合同编号
private
String
paymentAmount
;
// 付款金额(最终执行金额)
private
String
bankName
;
// 供应商开户行
private
String
account
;
// 供应商账号
private
String
recipientName
;
// 收方户名
private
String
paymentState
;
// 付款状态(0否/1是)
private
String
paymentTimestamp
;
// 时间戳
private
String
createTime
;
// 创建时间
private
String
modifyTime
;
// 修改时间
}
src/main/java/com/itfuture/chainservice/repository/Supplier/SupplierMapper.java
View file @
2316410e
package
com
.
itfuture
.
chainservice
.
repository
.
Supplier
;
import
com.itfuture.chainservice.repository.Payment.entity.PaymentEntity
;
import
com.itfuture.chainservice.repository.Supplier.entity.SupplierEntity
;
import
org.apache.ibatis.annotations.Insert
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Options
;
/**
* @author naihe
...
...
@@ -9,4 +13,17 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public
interface
SupplierMapper
{
/**
* 新增供应商信息
* @param supplierEntity
* @return
*/
@Insert
(
"insert into "
+
" supplier(supplier,contact,contact_number,construction_area,regional_company,accumulated_orders_amount,"
+
" accumulated_amount,payment_type,qualification,settlement_amount,unsettled_amount,create_time,modify_time)"
+
" value(#{supplier},#{contact},#{contactNumber},#{constructionArea},#{regionalCompany},#{accumulatedOrdersAmount},"
+
" #{accumulatedAmount},#{paymentType},#{qualification},#{settlementAmount},#{unsettledAmount},#{createTime},"
+
" #{modifyTime})"
)
@Options
(
useGeneratedKeys
=
true
,
keyProperty
=
"id"
)
SupplierEntity
savePayment
(
SupplierEntity
supplierEntity
);
}
src/main/java/com/itfuture/chainservice/repository/Supplier/entity/SupplierEntity.java
View file @
2316410e
...
...
@@ -36,8 +36,8 @@ public class SupplierEntity {
private
String
unsettledAmount
;
// 未施工金额
private
LocalDateTime
createTime
;
// 创建时间
private
String
createTime
;
// 创建时间
private
LocalDateTime
modifyTI
me
;
// 修改时间
private
String
modifyTi
me
;
// 修改时间
}
src/main/java/com/itfuture/chainservice/repository/contract/ContractMapper.java
View file @
2316410e
package
com
.
itfuture
.
chainservice
.
repository
.
contract
;
import
com.itfuture.chainservice.repository.Payment.entity.PaymentEntity
;
import
com.itfuture.chainservice.repository.contract.entity.ContractEntity
;
import
org.apache.ibatis.annotations.Insert
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Options
;
/**
* @author naihe
* @date 2019/1/14 5:46 PM
* @desc
* @desc
合同
*/
@Mapper
public
interface
ContractMapper
{
/**
* 新增合同
* @param contractEntity
* @return
*/
@Insert
(
"insert into "
+
" contract(contract_no,contract_name,contract_type,contract_nature,first_party,second_party,project_category,"
+
" payment_type,valid_contract_amount,tax_amount,unified_social_credit_code,valid_contract_amount2,tax_rate,"
+
" second_party_name,second_party_account,second_party_bank_name,sign_date,progress_payment_ratio,contract_amount,"
+
" create_time,modify_time) "
+
" value(#{contractNo},#{contractName},#{contractType},#{contractNature},#{firstParty},#{secondParty},#{projectCategory},"
+
" #{paymentType},#{validContractAmount},#{taxAmount},#{unifiedSocialCreditCode},#{validContractAmount2},#{taxRate},"
+
" #{secondPartyName},#{secondPartyAccount},#{secondPartyBankName},#{signDate},#{progressPaymentRatio},#{contractAmount},"
+
" #{createTime},#{modifyTime})"
)
@Options
(
useGeneratedKeys
=
true
,
keyProperty
=
"id"
)
ContractEntity
savePayment
(
ContractEntity
contractEntity
);
}
src/main/java/com/itfuture/chainservice/repository/contract/entity/ContractEntity.java
View file @
2316410e
...
...
@@ -7,7 +7,7 @@ import java.time.LocalDateTime;
/**
* @author naihe
* @date 2019/1/14 7:46 PM
* @desc
* @desc
合同实体
*/
@Data
public
class
ContractEntity
{
...
...
@@ -52,8 +52,8 @@ public class ContractEntity {
private
String
contractAmount
;
//合同金额
private
LocalDateTime
createTime
;
// 创建时间
private
String
createTime
;
// 创建时间
private
LocalDateTime
modifyTime
;
// 修改时间
private
String
modifyTime
;
// 修改时间
}
src/main/java/com/itfuture/chainservice/repository/order/OrderMapper.java
View file @
2316410e
package
com
.
itfuture
.
chainservice
.
repository
.
order
;
import
com.itfuture.chainservice.repository.Payment.entity.PaymentEntity
;
import
org.apache.ibatis.annotations.Insert
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Options
;
/**
* @author naihe
* @date 2019/1/14 9:27 AM
* @desc
* @desc
订单
*/
@Mapper
public
interface
OrderMapper
{
/**
* 新增订单
* @param paymentEntity
* @return
*/
@Insert
(
"insert into "
+
" order(purchasing_organization,order_no,order_number,order_type_code,order_data,contract_files,service_stream,"
+
" sum_count,price_tax_sum,supplier,is_provide,project,delivery_address,order_pK,arrive_data,material_code,"
+
" material_version,material_name,unit,number,warehousing_count,create_time,modify_time) "
+
" value(#{purchasingOrganization},#{orderNo},#{orderNumber},#{orderTypeCode},#{orderData},#{contractFiles},"
+
" #{serviceStream},#{sumCount},#{priceTaxSum},#{supplier},#{isProvide},#{project},#{deliveryAddress},#{orderPK},"
+
" #{arriveData},#{materialCode},#{materialVersion},#{materialName},#{unit},#{number},#{warehousingCount},"
+
" #{createTime},#{modifyTime})"
)
@Options
(
useGeneratedKeys
=
true
,
keyProperty
=
"id"
)
PaymentEntity
savePayment
(
PaymentEntity
paymentEntity
);
}
src/main/java/com/itfuture/chainservice/repository/order/entity/OrderEntity.java
View file @
2316410e
...
...
@@ -38,7 +38,7 @@ public class OrderEntity {
private
String
project
;
//项目
private
String
D
eliveryAddress
;
// 送货地址
private
String
d
eliveryAddress
;
// 送货地址
private
String
orderPK
;
// 请购单头PK
...
...
@@ -56,8 +56,8 @@ public class OrderEntity {
private
String
warehousingCount
;
// 可入库数量
private
LocalDateTime
createTime
;
// 创建时间
private
String
createTime
;
// 创建时间
private
LocalDateTime
modifyTime
;
// 修改时间
private
String
modifyTime
;
// 修改时间
}
src/main/java/com/itfuture/chainservice/repository/warehousing/WarehousingMapper.java
0 → 100644
View file @
2316410e
package
com
.
itfuture
.
chainservice
.
repository
.
warehousing
;
import
com.itfuture.chainservice.repository.Supplier.entity.SupplierEntity
;
import
com.itfuture.chainservice.repository.warehousing.impl.WarehousingEntity
;
import
org.apache.ibatis.annotations.Insert
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Options
;
/**
* @author naihe
* @date 2019/1/15 3:19 PM
* @desc 入库单
*/
@Mapper
public
interface
WarehousingMapper
{
@Insert
(
"insert into "
+
" supplier(supplier,bill_no,service_type,settlement_cost,settlement_organization,cope_with_organization,"
+
" contract_files,primary_bill_no,delivery_address,material_code,material_name,project,batch_number,"
+
" net_receipts_number,receivable_number,unit,sign_for_data,create_time,modify_time) "
+
" value(#{supplier},#{billNo},#{serviceType},#{settlementCost},#{settlementOrganization},#{copeWithOrganization},"
+
" #{contractFiles},#{primaryBillNo},#{deliveryAddress},#{materialCode},#{materialName},#{project},#{batchNumber},"
+
" #{netReceiptsNumber},#{receivableNumber},#{unit},#{signForData},#{createTime},#{modifyTime})"
)
@Options
(
useGeneratedKeys
=
true
,
keyProperty
=
"id"
)
WarehousingEntity
savePayment
(
WarehousingEntity
warehousingEntity
);
}
src/main/java/com/itfuture/chainservice/repository/warehousing/impl/WarehousingEntity.java
0 → 100644
View file @
2316410e
package
com
.
itfuture
.
chainservice
.
repository
.
warehousing
.
impl
;
import
lombok.Data
;
@Data
public
class
WarehousingEntity
{
private
Integer
id
;
// 主键ID
private
String
supplier
;
// 供应商
private
String
billNo
;
// 单据号
private
String
serviceType
;
// 业务类型
private
String
settlementCost
;
// 结算成本域
private
String
settlementOrganization
;
// 结算财务组织
private
String
copeWithOrganization
;
// 应付财务组织
private
String
contractFiles
;
// 合同档案
private
String
primaryBillNo
;
// 原始单据号
private
String
deliveryAddress
;
// 送货地址
private
String
materialCode
;
// 物料编码
private
String
materialName
;
// 物料名称
private
String
project
;
// 项目
private
String
batchNumber
;
// 批次号
private
String
netReceiptsNumber
;
// 实收主数量
private
String
receivableNumber
;
// 应收主数量
private
String
unit
;
// 单位
private
String
signForData
;
// 签收日期
private
String
createTime
;
// 创建时间
private
String
modifyTime
;
// 修改时间
}
src/main/java/com/itfuture/chainservice/service/contract/impl/ContractServiceImpl.java
View file @
2316410e
package
com
.
itfuture
.
chainservice
.
service
.
contract
.
impl
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.XML
;
import
com.itfuture.chainservice.common.config.request.RequestUrlProperties
;
import
com.itfuture.chainservice.common.utils.webservice.WebServiceUtil
;
import
com.itfuture.chainservice.repository.contract.ContractMapper
;
...
...
@@ -13,7 +15,7 @@ import java.util.HashMap;
/**
* @author naihe
* @date 2019/1/14 5:48 PM
* @desc
* @desc
合同
*/
@Service
public
class
ContractServiceImpl
implements
ContractService
{
...
...
@@ -28,7 +30,8 @@ public class ContractServiceImpl implements ContractService {
* 定时请求合同接口
*/
public
void
timingRequestMethod
(){
String
s
=
WebServiceUtil
.
RequestWebService
(
requestUrlProperties
.
getContractRequestUrl
(),
""
,
new
HashMap
<>());
JSONObject
jsonObject1
=
WebServiceUtil
.
RequestWebService
(
requestUrlProperties
.
getContractRequestUrl
(),
""
,
new
HashMap
<>());
// JSONObject jsonObject = XML.toJSONObject(s);
// FaceResultResponse t = JSONObject.toJavaObject(JSONObject.parseObject(s), FaceResultResponse.class);
}
}
src/main/java/com/itfuture/chainservice/service/order/impl/OrderServiceImpl.java
View file @
2316410e
...
...
@@ -10,7 +10,7 @@ import org.springframework.stereotype.Service;
/**
* @author naihe
* @date 2019/1/14 9:10 AM
* @desc 订单
业务逻辑
* @desc 订单
*/
@Service
public
class
OrderServiceImpl
implements
OrderService
{
...
...
src/main/java/com/itfuture/chainservice/service/payment/PaymentService.java
0 → 100644
View file @
2316410e
package
com
.
itfuture
.
chainservice
.
service
.
payment
;
/**
* @author
* @date 2019/1/15 2:11 PM
* @desc 付款单
*/
public
interface
PaymentService
{
}
src/main/java/com/itfuture/chainservice/service/payment/impl/PaymentServiceImpl.java
0 → 100644
View file @
2316410e
package
com
.
itfuture
.
chainservice
.
service
.
payment
.
impl
;
import
com.itfuture.chainservice.service.payment.PaymentService
;
import
org.springframework.stereotype.Service
;
/**
* @author
* @date 2019/1/15 2:12 PM
* @desc 付款单
*/
@Service
public
class
PaymentServiceImpl
implements
PaymentService
{
}
src/main/java/com/itfuture/chainservice/service/supplier/impl/SupplierServiceImpl.java
View file @
2316410e
...
...
@@ -13,7 +13,7 @@ import javax.annotation.Resource;
/**
* @author naihe
* @date 2019/1/14 8:02 PM
* @desc 供应商
业务
* @desc 供应商
*/
@Service
public
class
SupplierServiceImpl
implements
SupplierService
{
...
...
src/main/java/com/itfuture/chainservice/service/warehousing/WarehousingService.java
0 → 100644
View file @
2316410e
package
com
.
itfuture
.
chainservice
.
service
.
warehousing
;
public
interface
WarehousingService
{
}
src/main/java/com/itfuture/chainservice/service/warehousing/impl/WarehousingServiceImpl.java
0 → 100644
View file @
2316410e
package
com
.
itfuture
.
chainservice
.
service
.
warehousing
.
impl
;
import
com.itfuture.chainservice.service.warehousing.WarehousingService
;
import
org.springframework.stereotype.Service
;
@Service
public
class
WarehousingServiceImpl
implements
WarehousingService
{
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment