Commit 2316410e by wangyuanfeng

完成保存mapper

parent d32bbad9
......@@ -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'
}
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);
}
}
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;
}
}
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);
}
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; // 修改时间
}
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; // 修改时间
}
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);
}
......@@ -36,8 +36,8 @@ public class SupplierEntity {
private String unsettledAmount; // 未施工金额
private LocalDateTime createTime; // 创建时间
private String createTime; // 创建时间
private LocalDateTime modifyTIme; // 修改时间
private String modifyTime; // 修改时间
}
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);
}
......@@ -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; // 修改时间
}
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);
}
......@@ -38,7 +38,7 @@ public class OrderEntity {
private String project; //项目
private String DeliveryAddress; // 送货地址
private String deliveryAddress; // 送货地址
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; // 修改时间
}
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);
}
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; // 修改时间
}
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);
}
}
......@@ -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 {
......
package com.itfuture.chainservice.service.payment;
/**
* @author
* @date 2019/1/15 2:11 PM
* @desc 付款单
*/
public interface PaymentService {
}
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 {
}
......@@ -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 {
......
package com.itfuture.chainservice.service.warehousing;
public interface WarehousingService {
}
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 {
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment