|
@@ -3,9 +3,13 @@ package com.jkcredit.invoice.credit.custInterface;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.jkcredit.invoice.common.DataResult;
|
|
|
import com.jkcredit.invoice.common.ResponseCode;
|
|
|
+import com.jkcredit.invoice.mapper.customer.CustomerMapper;
|
|
|
+import com.jkcredit.invoice.mapper.customer.CustomerRecMapper;
|
|
|
+import com.jkcredit.invoice.model.entity.customer.Customer;
|
|
|
import com.jkcredit.invoice.model.entity.customer.CustomerRec;
|
|
|
import com.jkcredit.invoice.service.customer.CustomerService;
|
|
|
import com.jkcredit.invoice.service.lowerService.CustomeLowerService;
|
|
|
+import com.jkcredit.invoice.util.Base64Util;
|
|
|
import com.jkcredit.invoice.util.RespR;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -30,6 +34,14 @@ public class CustomerInterLowerServiceImpl implements CustomerInterLowerService
|
|
|
CustomerService customerService;
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
+ CustomerMapper customerMapper;
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ CustomerRecMapper customerRecMapper;
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 无车 自有车 企业注册
|
|
|
* @param appKey
|
|
@@ -54,9 +66,11 @@ public class CustomerInterLowerServiceImpl implements CustomerInterLowerService
|
|
|
Integer interType = 0;//0-接口 1-平台 3.手工录入
|
|
|
|
|
|
String name = jsonObject.getString("name");//公司名称 companyName
|
|
|
- String taxpayerCode = jsonObject.getString("taxpayerCode");//企业税号 companyReferencenum
|
|
|
+ String taxpayerCode = jsonObject.getString("taxplayerCode");//企业税号 companyReferencenum
|
|
|
String customerName = appKey;//客户名称
|
|
|
|
|
|
+ Customer cust = customerMapper.selectByCustomerName(customerName);
|
|
|
+
|
|
|
/**
|
|
|
* 所属类型:
|
|
|
*1-行业用户 2-自营平台 3-合作商户
|
|
@@ -73,22 +87,17 @@ public class CustomerInterLowerServiceImpl implements CustomerInterLowerService
|
|
|
* 运营范围
|
|
|
*/
|
|
|
Integer operatingRangeType = jsonObject.getInteger("operatingRangeType");
|
|
|
+ String contact = jsonObject.getString("contact");//联系人
|
|
|
+ String tel = jsonObject.getString("tel");//联系人电话
|
|
|
String emergencyContact = jsonObject.getString("emergencyContact");//紧急联系人 companyLeader
|
|
|
String emergencyTel = jsonObject.getString("emergencyTel");//紧急联系人电话 companyLeaderPhone
|
|
|
|
|
|
- String companyOpenbank = jsonObject.getString("companyOpenbank");//公司开户行
|
|
|
- String companyOpenbankAcc = jsonObject.getString("companyOpenbankAcc");//公司开户行电话
|
|
|
- String companyAdress = jsonObject.getString("companyAdress");//公司地址
|
|
|
- String companyPhone = jsonObject.getString("companyPhone");//公司电话
|
|
|
- String bussinessType = jsonObject.getString("bussinessType");//业务类型 0 -自有车 1-外协车 2-无车
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- String serviceStartTime = jsonObject.getString("serviceStartTime");//服务开始时间
|
|
|
- String serviceEndTime = jsonObject.getString("serviceEndTime");//服务结束时间
|
|
|
- Integer serviceType = jsonObject.getInteger("serviceType");//协议类型
|
|
|
- String contractFileName = jsonObject.getString("contractFileName");//协议文件名
|
|
|
- String base64Str = jsonObject.getString("base64Str");//协议base64编码
|
|
|
+ String buyerName = jsonObject.getString("buyerName");//购方客户名称
|
|
|
+ String buyerTaxpayerCode = jsonObject.getString("buyerTaxpayerCode");//购方税号
|
|
|
+ String buyerAddr = jsonObject.getString("buyerAddr");//购方单位地址
|
|
|
+ String buyerTel = jsonObject.getString("buyerTel");//购方电话
|
|
|
+ String buyerBank = jsonObject.getString("buyerBank");//购方开户行
|
|
|
+ String buyerBankAccount = jsonObject.getString("buyerBankAccount");//购方银行账号
|
|
|
|
|
|
|
|
|
|
|
@@ -100,39 +109,37 @@ public class CustomerInterLowerServiceImpl implements CustomerInterLowerService
|
|
|
|| null == operatingRangeType
|
|
|
|| StringUtils.isEmpty(emergencyContact)
|
|
|
|| StringUtils.isEmpty(emergencyTel)
|
|
|
- || StringUtils.isEmpty(companyOpenbank)
|
|
|
- || StringUtils.isEmpty(companyOpenbankAcc)
|
|
|
- || StringUtils.isEmpty(companyAdress)
|
|
|
- || StringUtils.isEmpty(companyPhone)
|
|
|
- || StringUtils.isEmpty(bussinessType)
|
|
|
- || StringUtils.isEmpty(serviceStartTime)
|
|
|
- || StringUtils.isEmpty(serviceEndTime)
|
|
|
- || null == serviceType
|
|
|
- || StringUtils.isEmpty(contractFileName)
|
|
|
- || StringUtils.isEmpty(base64Str)
|
|
|
+ || StringUtils.isEmpty(contact)
|
|
|
+ || StringUtils.isEmpty(tel)
|
|
|
+ || StringUtils.isEmpty(buyerName)
|
|
|
+ || StringUtils.isEmpty(buyerTaxpayerCode)
|
|
|
+ || StringUtils.isEmpty(buyerAddr)
|
|
|
+ || StringUtils.isEmpty(buyerTel)
|
|
|
+ || StringUtils.isEmpty(buyerBank)
|
|
|
+ || StringUtils.isEmpty(buyerBankAccount)
|
|
|
){
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
CustomerRec customerRec = new CustomerRec();
|
|
|
customerRec.setCustomerName(customerName);//客户名称
|
|
|
- customerRec.setCompanyLeader(emergencyContact);//紧急联系人
|
|
|
- customerRec.setCompanyLeaderPhone(emergencyTel);//紧急联系人电话
|
|
|
+ customerRec.setCompanyLeader(contact);//紧急联系人
|
|
|
+ customerRec.setCompanyLeaderPhone(tel);//紧急联系人电话
|
|
|
customerRec.setCompanyName(name);//企业名称
|
|
|
customerRec.setCompanyReferencenum(taxpayerCode);//企业税号
|
|
|
- customerRec.setCompanyOpenbank(companyOpenbank);//公司开户行
|
|
|
- customerRec.setCompanyOpenbankAcc(companyOpenbankAcc);//公司开户行电话
|
|
|
- customerRec.setCompanyAdress(companyAdress);//公司地址
|
|
|
- customerRec.setCompanyPhone(companyPhone);//公司电话
|
|
|
+ customerRec.setCompanyOpenbank(buyerBank);//公司开户行
|
|
|
+ customerRec.setCompanyOpenbankAcc(buyerBankAccount);//公司开户行电话
|
|
|
+ customerRec.setCompanyAdress(buyerAddr);//公司地址
|
|
|
+ customerRec.setCompanyPhone(buyerTel);//公司电话
|
|
|
customerRec.setInterType(interType);////0-接口 1-平台
|
|
|
- customerRec.setBussinessType(bussinessType);//业务类型 0 -自有车 1-外协车 2-无车
|
|
|
+ customerRec.setBussinessType(String.valueOf(cust.getBussinessType()));//业务类型 0 -自有车 1-外协车 2-无车
|
|
|
customerRec.setOperatingRangeType(operatingRangeType);//运用类型
|
|
|
customerRec.setCompanyType(companyType);//所属类型
|
|
|
- customerRec.setServiceStartTime(serviceStartTime);//服务开始时间
|
|
|
- customerRec.setServiceEndTime(serviceEndTime);//服务结束时间
|
|
|
- customerRec.setServiceType(serviceType);//协议类型
|
|
|
- customerRec.setContractFileName(contractFileName);//协议名称
|
|
|
- customerRec.setBase64Str(base64Str);//协议base64编码
|
|
|
+ // customerRec.setServiceStartTime(serviceStartTime);//服务开始时间
|
|
|
+ // customerRec.setServiceEndTime(serviceEndTime);//服务结束时间
|
|
|
+ // customerRec.setServiceType(serviceType);//协议类型
|
|
|
+ // customerRec.setContractFileName(contractFileName);//协议名称
|
|
|
+ // customerRec.setBase64Str(base64Str);//协议base64编码
|
|
|
|
|
|
List<CustomerRec> customerRecs = new ArrayList<CustomerRec>();
|
|
|
customerRecs.add(customerRec);
|
|
@@ -141,11 +148,29 @@ public class CustomerInterLowerServiceImpl implements CustomerInterLowerService
|
|
|
log.info("[-CustomerInterLowerServiceImpl.customeInterRec-] result is "
|
|
|
+ rs.toString() + ", request is " + data + " ,costtime="
|
|
|
+ (costtimeend - costtimestart));
|
|
|
+
|
|
|
+ //返回成功
|
|
|
if(null != rs && rs.getCode() == 0){
|
|
|
- result.setData(1);
|
|
|
- result.setCode(200);
|
|
|
- result.setMsg(rs.getMsg());
|
|
|
- return result;
|
|
|
+
|
|
|
+ RespR rs1 = customerService.customeRec(customerRec);
|
|
|
+ log.info("[-CustomerInterLowerServiceImpl.customeInterRecRc1-] result is "
|
|
|
+ + rs1.toString() + ", request is " + data + " ,costtime="
|
|
|
+ + (System.currentTimeMillis() - costtimestart));
|
|
|
+
|
|
|
+
|
|
|
+ if(null != rs1 && rs1.getCode() == 0){
|
|
|
+ result.setData(1);
|
|
|
+ result.setCode(200);
|
|
|
+ result.setMsg(rs1.getMsg());
|
|
|
+ return result;
|
|
|
+
|
|
|
+ }else {
|
|
|
+ result.setData(3);
|
|
|
+ result.setCode(200);
|
|
|
+ result.setMsg(rs1.getMsg());
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
result.setData(3);
|
|
|
result.setCode(200);
|
|
@@ -206,7 +231,7 @@ public class CustomerInterLowerServiceImpl implements CustomerInterLowerService
|
|
|
} else {
|
|
|
result.setData(3);
|
|
|
result.setCode(200);
|
|
|
- result.setMsg("无法认证");
|
|
|
+ result.setMsg(rs.getMsg());
|
|
|
return result;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
@@ -215,4 +240,96 @@ public class CustomerInterLowerServiceImpl implements CustomerInterLowerService
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public DataResult customeProtocolUpLoad(String appKey, String api, String data, String requestid) {
|
|
|
+ long costtimestart = System.currentTimeMillis();
|
|
|
+
|
|
|
+ DataResult result = new DataResult();
|
|
|
+
|
|
|
+ result.setData(3);
|
|
|
+ result.setCode(200);
|
|
|
+ result.setRequestid(requestid);
|
|
|
+ result.setMsg("无法认证");
|
|
|
+
|
|
|
+ try {
|
|
|
+ log.info("[-CustomerInterLowerServiceImpl.customeProtocolUpLoad-] request appKey=" + appKey + " ,api=" + api + " ,data=" +data);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
+ String companyNum = jsonObject.getString("companyNum");//公司编号
|
|
|
+ String serviceStartTime = jsonObject.getString("serviceStartTime");//服务开始时间
|
|
|
+ String serviceEndTime = jsonObject.getString("serviceEndTime");//服务结束时间
|
|
|
+ String contractFileName = jsonObject.getString("contractFileName");//协议文件名
|
|
|
+ String base64Str = jsonObject.getString("base64Str");//上传文件转换的base64
|
|
|
+ Integer serviceType = jsonObject.getInteger("serviceType");//协议类型
|
|
|
+ if(StringUtils.isEmpty(data)|| null == jsonObject){
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ if( StringUtils.isEmpty(companyNum) || StringUtils.isEmpty(serviceStartTime)
|
|
|
+ || StringUtils.isEmpty(serviceEndTime)
|
|
|
+ || StringUtils.isEmpty(contractFileName)
|
|
|
+ || StringUtils.isEmpty(base64Str)
|
|
|
+ || null == serviceType){
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ CustomerRec customerRec2 = new CustomerRec();
|
|
|
+ customerRec2.setCustomerName(appKey);
|
|
|
+ customerRec2.setCompanyNum(companyNum);
|
|
|
+ CustomerRec customerRec1 = customerRecMapper.selectByCustomerNameAndCompanyNum(customerRec2);
|
|
|
+ if (null == customerRec1 || customerRec1.getRecStatus() != 1){
|
|
|
+ result.setMsg("企业还未备案成功!");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* if((Base64Util.base64FileSize(base64Str)/1024)> 10){
|
|
|
+ result.setMsg("pdf不可超过10M!");
|
|
|
+ return result;
|
|
|
+ }*/
|
|
|
+
|
|
|
+
|
|
|
+ String fileType = contractFileName.substring(contractFileName.lastIndexOf(".") + 1, contractFileName.length()).toLowerCase();
|
|
|
+ if(!fileType.equals("pdf")){
|
|
|
+ result.setMsg("必须是pdf文件!");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ CustomerRec customerRec = new CustomerRec();
|
|
|
+ customerRec.setServiceStartTime(serviceStartTime);//服务开始时间
|
|
|
+ customerRec.setServiceEndTime(serviceEndTime);//服务结束时间
|
|
|
+ customerRec.setServiceType(serviceType);//协议类型
|
|
|
+ customerRec.setLowerFileName(contractFileName);//协议名称
|
|
|
+ customerRec.setLowerBase64Str(base64Str);//协议base64编码
|
|
|
+ customerRec.setCustomerName(appKey);//客户名称
|
|
|
+ customerRec.setCompanyNum(companyNum);
|
|
|
+ customerRec.setInterType(0);//接口
|
|
|
+
|
|
|
+ List<CustomerRec> customerRecs = new ArrayList<CustomerRec>();
|
|
|
+ customerRecs.add(customerRec);
|
|
|
+ RespR rs = lowerService.customeRecUpload(customerRecs);
|
|
|
+ long costtimeend = System.currentTimeMillis();
|
|
|
+ log.info("[-CustomerInterLowerServiceImpl.customeProtocolUpLoad-] result is "
|
|
|
+ + rs.toString() + ", request is " + data + " ,costtime="
|
|
|
+ + (costtimeend - costtimestart));
|
|
|
+ if(null != rs && rs.getCode() == 0){
|
|
|
+ result.setData(1);
|
|
|
+ result.setCode(200);
|
|
|
+ result.setMsg(rs.getMsg());
|
|
|
+ return result;
|
|
|
+ } else {
|
|
|
+ result.setData(3);
|
|
|
+ result.setCode(200);
|
|
|
+ result.setMsg(rs.getMsg());
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("[-CustomerInterLowerServiceImpl.customeProtocolUpLoad-] get httpclient exception is "
|
|
|
+ + e + ", request is " + data);
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|