Commit f958cd4e by shibingbing

update“

parent ee4482cf
orderNo 订单编号
purchasingOrganization 采购组织
orderNumber 订单流水号
orderTypeCode 订单类型编码
orderData 订单日期
contractFiles 合同档案
serviceStream 业务流程
sumCount 总数量
priceTaxSum 价税合计
Supplier 供应商
isProvide 是否甲供材
project 项目
DeliveryAddress 送货地址
orderPK 请购单头PK
arriveData 计划到货日期
materialCode 物料编号
materialVersion 物料版本
materialName 物料名称
unit 单位
Number 数量
warehousingCount 可入库数量
......@@ -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 group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.3'
}
package com.itfuture.chainservice.common.utils.bus;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.Credentials;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.entity.HttpEntityWrapper;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.io.DefaultHttpResponseWriterFactory;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
public class BusRequest {
public static void main(String[] args) {
//以 HTTP Client 工具包为例
HttpClient httpClient = HttpClientBuilder.create().build();
Credentials defaultcreds = new UsernamePasswordCredentials("ice","123456");
HttpClientContext httpClientContext = new HttpClientContext();
BasicCredentialsProvider basicCredentialsProvider = new BasicCredentialsProvider();
basicCredentialsProvider.setCredentials(AuthScope.ANY, defaultcreds);
httpClientContext.setCredentialsProvider(basicCredentialsProvider);
RequestConfig requestConfig = RequestConfig.copy(RequestConfig.DEFAULT).setConnectTimeout(60000).build();
httpClientContext.setRequestConfig(requestConfig);
try {
HttpResponse response = httpClient.execute(new HttpGet("http://yapi.maxrocky.com/mock/21/account/password"), httpClientContext);
HttpEntity entity = response.getEntity();
String body = EntityUtils.toString(entity);
System.out.println(body);
} catch (IOException e) {
e.printStackTrace();
}
}
}
package com.itfuture.chainservice.common.utils.sql;
/**
* @author Ice, You're very best
* @date 2019/1/15 10:38
* @desc
*/
public class SqlUtil {
public static void main(String[] args) {
String[] keys = new String[]{"orderNo","purchasingOrganization","orderNumber","orderTypeCode","orderData","contractFiles","serviceStream","sumCount","priceTaxSum","Supplier","isProvide","project","DeliveryAddress","orderPK","arriveData","materialCode","materialVersion","materialName","unit","Number","warehousingCount"};
String[] type = new String[]{"String","String","String","String","Long","String","String","int","Integer","String","String","String","String","String","String","String","String","String","String","int","int"};
String[] must = new String[]{"是" ,"是" ,"是" ,"是" ,"是" ,"是" ,"是" ,"是" ,"是" ,"是" ,"是" ,"是" ,"是" ,"是" ,"是" ,"是" ,"是" ,"是" ,"是" ,"是" ,"是"};
String[] comments = new String[]{"订单编号","采购组织","订单流水号","订单类型编码","订单日期","合同档案","业务流程","总数量","价税合计","供应商","是否甲供材","项目","送货地址","请购单头PK","计划到货日期","物料编号","物料版本","物料名称","单位","数量","可入库数量"};
String tableName = "order";
// String[] keys = new String[]{"supplier","contact","contactNumber","constructionArea","regionalCompany","accumulatedOrdersAmount","accumulatedAmount","paymentType","qualification","settlementAmount","unsettledAmount"};
// String[] type = new String[]{"String", "String", "String", "String", "String", "String", "String", "String", "String", "String", "String",};
// String[] must = new String[]{"是","是","是","是","是","是","是","是","是","是","是"};
// String[] comments = new String[]{"供应商名称","联系人","联系人电话","区域","区域公司名称","过往一年累计订单数量","过往一年累计付款","结算方式(现金、商承、银承、供应链)","供应商资质","已结算金额","未施工金额"};
// String tableName = "supplier";
// String[] keys = new String[]{"contractNo","contractName","contractType","contractNature","firstParty","secondParty","projectCategory","paymentType","validContractAmount","taxAmount","unifiedSocialCreditCode","validContractAmount2","taxRate","secondPartyName","secondPartyAccount","secondPartyBankName","signDate","progressPaymentRatio","contractAmount"};
// String[] type = new String[]{"String","String","String","String","String","String","String","String","String","String","String","String","String","String","String","String","String","String","String"};
// String[] must = new String[]{"是","是","是","是","是","是","是","是","是","是","是","是","是","是","是","是","是","是","是"};
// String[] comments = new String[]{"合同编号","合同名称","合同类别","合同性质","甲方单位","乙方单位","工程类别","支付方式","有效合同金额","进项税额","统一社会信用代码","有效合同金额(不含增值税)","税率","乙方账户名称","乙方银行账号","乙方开户银行","签约日期","进度款支付比例","合同金额"};
// String tableName = "warehousing";
// String[] keys = new String[]{"contractNo","contractName","contractType","contractNature","firstParty","secondParty","projectCategory","paymentType","validContractAmount","taxAmount","unifiedSocialCreditCode","validContractAmount2","taxRate","secondPartyName","secondPartyAccount","secondPartyBankName","signDate","progressPaymentRatio","contractAmount"};
// String[] type = new String[]{"String","String","String","String","String","String","String","String","String","String","String","String","String","String","String","String","String","String","String"};
// String[] must = new String[]{"是","是","是","是","是","是","是","是","是","是","是","是","是","是","是","是","是","是","是"};
// String[] comments = new String[]{"合同编号","合同名称","合同类别","合同性质","甲方单位","乙方单位","工程类别","支付方式","有效合同金额","进项税额","统一社会信用代码","有效合同金额(不含增值税)","税率","乙方账户名称","乙方银行账号","乙方开户银行","签约日期","进度款支付比例","合同金额"};
// String tableName = "contract";
// String[] keys = new String[]{"projectType","principal","paymentNo","supplier","projectCompany","projectCompanyCode","area","contractName","contractNo","paymentAmount","bankName","account","recipientName","paymentState","paymentTimestamp"};
// String[] type = new String[]{"String","String","String","String","String","String","String","String","String","String","String","String","String","String","String"};
// String[] must = new String[]{"是","是","是","是","是","是","是","是","是","是","是","是","是","是","是"};
// String[] comments = new String[]{"项目类型(0:成本,1:采购)","业务主体(供应链公司)","付款单号","供应商名称","项目公司名称","项目公司编码","区域","订单名称/合同名称","订单编号/合同编号","付款金额(最终执行金额)","供应商开户行","供应商账号","收方户名","付款状态(0否/1是)","时间戳"};
// String tableName = "payment";
// String[] keys = new String[]{"contractNo","supplier","invoiceCode","invoiceTitle","invoiceType","invoiceNo","amount","invoiceName","approvedDate","approver","invoiceDate","state","taxRate"};
// String[] type = new String[]{"String","String","String","String","String","String","String","String","String","String","String","String","String"};
// String[] must = new String[]{"是","是","是","是","是","是","是","是","是","是","是","是","是"};
// String[] comments = new String[]{"订单编号/合同编号","供应商名称","发票代码","发票抬头","发票类型","发票号码","发票金额","发票名称","审批日期","审批人","开票日期","单据状态","税率"};
// String tableName = "Invoice";
generateCreateSQL(tableName, keys, type, must, comments);
}
private static void generateCreateSQL(String tableName, String[] keys,String[] type ,String[] must ,String[] comments){
if (keys.length != type.length || keys.length != must.length || keys.length != comments.length){
throw new RuntimeException(String.format("Length is not match, %d,%d,%d,%d", keys.length, type.length, must.length, comments.length));
}
StringBuffer sb = new StringBuffer("CREATE TABLE IF NOT EXISTS `" + tableName.toLowerCase() + "` (\n\t`id` int(20) NOT NULL AUTO_INCREMENT,\n");
for (int i = 0; i < keys.length; i++) {
String convert = HumpToUnderline(keys[i]);
sb.append("\t`").append(convert.toLowerCase()).append("`");
//判断类型
String dataType = type[i].toLowerCase();
if (dataType.equalsIgnoreCase("string") || dataType.equalsIgnoreCase("long")) {
sb.append(" varchar(64) ");
}else if (dataType.startsWith("int")) {
sb.append(" int(11) ");
}else {
throw new RuntimeException("Unknow type " + dataType);
}
//判断是否必须
String isMust = must[i];
if (isMust.equalsIgnoreCase("是")){
sb.append(" NOT NULL ");
}else if (isMust.equalsIgnoreCase("否")){
sb.append(" DEFAULT NULL ");
}else {
throw new RuntimeException("Unknow must " + isMust);
}
sb.append("COMMENT '").append(comments[i]).append("',\n");
}
sb.append("\tPRIMARY KEY (`id`)\n").append(") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;");
System.out.println(sb);
}
/***
* 下划线命名转为驼峰命名
* @param para 下划线命名的字符串
*/
public static String UnderlineToHump(String para){
StringBuilder result=new StringBuilder();
String a[]=para.split("_");
for(String s:a){
if(result.length()==0){
result.append(s.toLowerCase());
}else{
result.append(s.substring(0, 1).toUpperCase());
result.append(s.substring(1).toLowerCase());
}
}
return result.toString();
}
/***
* 驼峰命名转为下划线命名
* @param para 驼峰命名的字符串
*/
public static String HumpToUnderline(String para){
StringBuilder sb=new StringBuilder(para);
int temp=0;//定位
for(int i=0;i<para.length();i++){
if(Character.isUpperCase(para.charAt(i)) && i-1 > 0 && !Character.isUpperCase(para.charAt(i-1))){
sb.insert(i+temp, "_");
temp+=1;
}
}
return sb.toString().startsWith("_") ? sb.toString().replaceFirst("_", "") : sb.toString();
}
}
-- 订单表
CREATE TABLE IF NOT EXISTS `order` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`order_no` varchar(64) NOT NULL COMMENT '订单编号',
`purchasing_organization` varchar(64) NOT NULL COMMENT '采购组织',
`order_number` varchar(64) NOT NULL COMMENT '订单流水号',
`order_type_code` varchar(64) NOT NULL COMMENT '订单类型编码',
`order_data` varchar(64) NOT NULL COMMENT '订单日期',
`contract_files` varchar(64) NOT NULL COMMENT '合同档案',
`service_stream` varchar(64) NOT NULL COMMENT '业务流程',
`sum_count` int(11) NOT NULL COMMENT '总数量',
`price_tax_sum` int(11) NOT NULL COMMENT '价税合计',
`supplier` varchar(64) NOT NULL COMMENT '供应商',
`is_provide` varchar(64) NOT NULL COMMENT '是否甲供材',
`project` varchar(64) NOT NULL COMMENT '项目',
`delivery_address` varchar(64) NOT NULL COMMENT '送货地址',
`order_pk` varchar(64) NOT NULL COMMENT '请购单头PK',
`arrive_data` varchar(64) NOT NULL COMMENT '计划到货日期',
`material_code` varchar(64) NOT NULL COMMENT '物料编号',
`material_version` varchar(64) NOT NULL COMMENT '物料版本',
`material_name` varchar(64) NOT NULL COMMENT '物料名称',
`unit` varchar(64) NOT NULL COMMENT '单位',
`number` int(11) NOT NULL COMMENT '数量',
`warehousing_count` int(11) NOT NULL COMMENT '可入库数量',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- 2017年12月9日
-- 活动详情表
CREATE TABLE IF NOT EXISTS`activity` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`title` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '活动名称',
`content` longtext COLLATE utf8mb4_unicode_ci COMMENT '活动正文内容',
`address` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '活动地点',
`contact_tel` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '联系电话',
`max_enrolment` int(11) DEFAULT NULL COMMENT '最大报名人数',
`cover_url` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '封面图url',
`activity_status` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '活动状态 ,报名中ENROLLING 报名结束ENROLLED 进行中ONGOING,已结束ENDED',
`activity_end_time` datetime DEFAULT NULL COMMENT '活动结束时间',
`registe_end_time` datetime DEFAULT NULL COMMENT '报名截止时间',
-- 供应商表
CREATE TABLE IF NOT EXISTS `supplier` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`supplier` varchar(64) NOT NULL COMMENT '供应商名称',
`contact` varchar(64) NOT NULL COMMENT '联系人',
`contact_number` varchar(64) NOT NULL COMMENT '联系人电话',
`construction_area` varchar(64) NOT NULL COMMENT '区域',
`regional_company` varchar(64) NOT NULL COMMENT '区域公司名称',
`accumulated_orders_amount` varchar(64) NOT NULL COMMENT '过往一年累计订单数量',
`accumulated_amount` varchar(64) NOT NULL COMMENT '过往一年累计付款',
`payment_type` varchar(64) NOT NULL COMMENT '结算方式(现金、商承、银承、供应链)',
`qualification` varchar(64) NOT NULL COMMENT '供应商资质',
`settlement_amount` varchar(64) NOT NULL COMMENT '已结算金额',
`unsettled_amount` varchar(64) NOT NULL COMMENT '未施工金额',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
`create_time` datetime DEFAULT NULL COMMENT '活动开始时间',
`modify_time` datetime DEFAULT NULL COMMENT '修改时间',
`reserve` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备用字段',
`remark` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
`block_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL ,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
\ No newline at end of file
-- 入库单
CREATE TABLE IF NOT EXISTS `warehousing` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`supplier` varchar(64) NOT NULL COMMENT '供应商',
`bill_no` varchar(64) NOT NULL COMMENT '单据号',
`service_type` varchar(64) NOT NULL COMMENT '业务类型',
`settlement_cost` varchar(64) NOT NULL COMMENT '结算成本域',
`settlement_organization` varchar(64) NOT NULL COMMENT '结算财务组织',
`cope_with_organization` varchar(64) NOT NULL COMMENT '应付财务组织',
`contract_files` varchar(64) NOT NULL COMMENT '合同档案',
`primary_bill_no` varchar(64) NOT NULL COMMENT '原始单据号',
`delivery_address` varchar(64) NOT NULL COMMENT '送货地址',
`material_code` varchar(64) NOT NULL COMMENT '物料编码',
`material_name` varchar(64) NOT NULL COMMENT '物料名称',
`project` varchar(64) NOT NULL COMMENT '项目',
`batch_number` varchar(64) NOT NULL COMMENT '批次号',
`net_receipts_number` varchar(64) NOT NULL COMMENT '实收主数量',
`receivable_number` varchar(64) NOT NULL COMMENT '应收主数量',
`unit` varchar(64) NOT NULL COMMENT '单位',
`sign_for_data` varchar(64) NOT NULL COMMENT '签收日期',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- 合同明细
CREATE TABLE IF NOT EXISTS `contract` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`contract_no` varchar(64) NOT NULL COMMENT '合同编号',
`contract_name` varchar(64) NOT NULL COMMENT '合同名称',
`contract_type` varchar(64) NOT NULL COMMENT '合同类别',
`contract_nature` varchar(64) NOT NULL COMMENT '合同性质',
`first_party` varchar(64) NOT NULL COMMENT '甲方单位',
`second_party` varchar(64) NOT NULL COMMENT '乙方单位',
`project_category` varchar(64) NOT NULL COMMENT '工程类别',
`payment_type` varchar(64) NOT NULL COMMENT '支付方式',
`valid_contract_amount` varchar(64) NOT NULL COMMENT '有效合同金额',
`tax_amount` varchar(64) NOT NULL COMMENT '进项税额',
`unified_social_credit_code` varchar(64) NOT NULL COMMENT '统一社会信用代码',
`valid_contract_amount2` varchar(64) NOT NULL COMMENT '有效合同金额(不含增值税)',
`tax_rate` varchar(64) NOT NULL COMMENT '税率',
`second_party_name` varchar(64) NOT NULL COMMENT '乙方账户名称',
`second_party_account` varchar(64) NOT NULL COMMENT '乙方银行账号',
`second_party_bank_name` varchar(64) NOT NULL COMMENT '乙方开户银行',
`sign_date` varchar(64) NOT NULL COMMENT '签约日期',
`progress_payment_ratio` varchar(64) NOT NULL COMMENT '进度款支付比例',
`contract_amount` varchar(64) NOT NULL COMMENT '合同金额',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- 付款单
-- 发票
\ No newline at end of file
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