|
@@ -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;
|
|
|
|
|
|
String name = jsonObject.getString("name");
|
|
|
- String taxpayerCode = jsonObject.getString("taxpayerCode");
|
|
|
+ String taxpayerCode = jsonObject.getString("taxplayerCode");
|
|
|
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");
|
|
|
String emergencyTel = jsonObject.getString("emergencyTel");
|
|
|
|
|
|
- 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");
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- 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");
|
|
|
+ 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);
|
|
|
- customerRec.setBussinessType(bussinessType);
|
|
|
+ customerRec.setBussinessType(String.valueOf(cust.getBussinessType()));
|
|
|
customerRec.setOperatingRangeType(operatingRangeType);
|
|
|
customerRec.setCompanyType(companyType);
|
|
|
- customerRec.setServiceStartTime(serviceStartTime);
|
|
|
- customerRec.setServiceEndTime(serviceEndTime);
|
|
|
- customerRec.setServiceType(serviceType);
|
|
|
- customerRec.setContractFileName(contractFileName);
|
|
|
- customerRec.setBase64Str(base64Str);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
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");
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ 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);
|
|
|
+ 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;
|
|
|
+ }
|
|
|
}
|