zhangyuewww 2 年之前
父节点
当前提交
499832c562

+ 5 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/OrderInfo.java

@@ -658,6 +658,11 @@ public class OrderInfo extends BaseModel<OrderInfo> {
      */
      */
     @TableField(exist = false)
     @TableField(exist = false)
     private String consignorName;
     private String consignorName;
+    /**
+     * 托运人电话
+     */
+    @TableField(exist = false)
+    private String consignorPhone;
     /**
     /**
      * 托运人身份证号或社会信用代码
      * 托运人身份证号或社会信用代码
      */
      */

+ 1 - 1
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IOrderInfoService.java

@@ -156,7 +156,7 @@ public interface IOrderInfoService extends IService<OrderInfo> {
      * @param orderInfo
      * @param orderInfo
      * @return
      * @return
      */
      */
-    String tripartiteReport(OrderInfo orderInfo);
+    String tripartiteReport(OrderInfo orderInfo) throws Exception;
 
 
     /**
     /**
      * 审核
      * 审核

+ 1 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/DriverCarInfoServiceImpl.java

@@ -465,6 +465,7 @@ public class DriverCarInfoServiceImpl extends ServiceImpl<DriverCarInfoMapper, H
     }
     }
 
 
     @Override
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public String tripartiteReport(HyDriverCarInfo hyDriverCarInfo) {
     public String tripartiteReport(HyDriverCarInfo hyDriverCarInfo) {
         if ("3".equals(ENV)) {
         if ("3".equals(ENV)) {
             if (!CollectionUtils.isEmpty(hyDriverCarInfo.getHyDriverCarInfoList())) {
             if (!CollectionUtils.isEmpty(hyDriverCarInfo.getHyDriverCarInfoList())) {

+ 1 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/DriverInfoServiceImpl.java

@@ -553,6 +553,7 @@ public class DriverInfoServiceImpl extends ServiceImpl<DriverInfoMapper, HyDrive
     }
     }
 
 
     @Override
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public String tripartiteReport(HyDriverInfo hyDriverInfo) {
     public String tripartiteReport(HyDriverInfo hyDriverInfo) {
         if ("3".equals(ENV)) {
         if ("3".equals(ENV)) {
             if (!CollectionUtils.isEmpty(hyDriverInfo.getHyDriverInfoList())) {
             if (!CollectionUtils.isEmpty(hyDriverInfo.getHyDriverInfoList())) {

+ 19 - 1
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/OrderInfoServiceImpl.java

@@ -1493,7 +1493,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
     }
     }
 
 
     @Override
     @Override
-    public String tripartiteReport(OrderInfo orderInfo) {
+    @Transactional(rollbackFor = Exception.class)
+    public String tripartiteReport(OrderInfo orderInfo) throws Exception {
         if ("3".equals(ENV)) {
         if ("3".equals(ENV)) {
             if (CollectionUtils.isNotEmpty(orderInfo.getOrderInfoList())) {
             if (CollectionUtils.isNotEmpty(orderInfo.getOrderInfoList())) {
                 for (OrderInfo orderInfo1 : orderInfo.getOrderInfoList()) {
                 for (OrderInfo orderInfo1 : orderInfo.getOrderInfoList()) {
@@ -1514,6 +1515,14 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
                             HyCompanyInfo hyCompanyInfo = companyInfoService.selectById(publishTaskInfo.getCompId());
                             HyCompanyInfo hyCompanyInfo = companyInfoService.selectById(publishTaskInfo.getCompId());
                             if (hyCompanyInfo != null) {
                             if (hyCompanyInfo != null) {
                                 orderInfo1.setConsignorID(hyCompanyInfo.getUnifiedSocialCreditCode());
                                 orderInfo1.setConsignorID(hyCompanyInfo.getUnifiedSocialCreditCode());
+                                orderInfo1.setConsignorPhone(hyCompanyInfo.getPhone());
+                                orderInfo1.setHyCompanyInfo(hyCompanyInfo);
+                                //上报运单时上报客户信息
+                                String result = UplodeUtil.uploadCustomer(hyCompanyInfo);
+                                JSONObject jsonObject = JSONObject.fromObject(result);
+                                if (!"00000".equals(jsonObject.getString("code"))) {
+                                    throw new RuntimeException(jsonObject.getString("message"));
+                                }
                             }
                             }
                             //查询托运人名称
                             //查询托运人名称
                             orderInfo1.setConsignorName(publishTaskInfo.getCargoOwner());
                             orderInfo1.setConsignorName(publishTaskInfo.getCargoOwner());
@@ -1542,6 +1551,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
                             //查询托运人身份证号
                             //查询托运人身份证号
                             orderInfo1.setConsignorID(hyCargoOwnerInfo.getCardNumber());
                             orderInfo1.setConsignorID(hyCargoOwnerInfo.getCardNumber());
                             orderInfo1.setConsignorName(hyCargoOwnerInfo.getName());
                             orderInfo1.setConsignorName(hyCargoOwnerInfo.getName());
+                            orderInfo1.setConsignorPhone(hyCargoOwnerInfo.getPhone());
                         }
                         }
                     }
                     }
                     //查询发货地区行政区划代码
                     //查询发货地区行政区划代码
@@ -1576,6 +1586,14 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
                         if (!"00000".equals(jsonObject1.getString("code"))) {
                         if (!"00000".equals(jsonObject1.getString("code"))) {
                             throw new RuntimeException(jsonObject1.getString("message"));
                             throw new RuntimeException(jsonObject1.getString("message"));
                         }
                         }
+                        HyFreightSettlementInfo hyFreightSettlementInfo=hyFreightSettlementInfoService.selectOne(new EntityWrapper<HyFreightSettlementInfo>()
+                        .eq("order_id",orderInfo1.getId()));
+                        //上报运单时上报收款人信息
+                        String result4 = UplodeUtil.uploadSettlement(hyFreightSettlementInfo);
+                        JSONObject jsonObject4 = JSONObject.fromObject(result4);
+                        if (!"00000".equals(jsonObject4.getString("code"))) {
+                            throw new RuntimeException(jsonObject4.getString("message"));
+                        }
                         String result = UplodeUtil.uploadOrder(orderInfo1);
                         String result = UplodeUtil.uploadOrder(orderInfo1);
                         JSONObject jsonObject = JSONObject.fromObject(result);
                         JSONObject jsonObject = JSONObject.fromObject(result);
                         if ("00000".equals(jsonObject.getString("code"))) {
                         if ("00000".equals(jsonObject.getString("code"))) {

+ 9 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/util/CarrierUtil.java

@@ -19,6 +19,15 @@ public class CarrierUtil {
     private String transportBusinessLicenseOtherFilename;
     private String transportBusinessLicenseOtherFilename;
     private String transportBusinessLicense;
     private String transportBusinessLicense;
     private String businessHouseholdsName;
     private String businessHouseholdsName;
+    private String carrierName;
+
+    public String getCarrierName() {
+        return carrierName;
+    }
+
+    public void setCarrierName(String carrierName) {
+        this.carrierName = carrierName;
+    }
 
 
     public String getName() {
     public String getName() {
         return name;
         return name;

+ 186 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/util/CustomerUtil.java

@@ -0,0 +1,186 @@
+package com.yh.saas.plugin.yiliangyiyun.util;
+
+import java.util.List;
+
+public class CustomerUtil {
+    private Byte type;
+    private String name;
+    private String legalName;
+    private String phone;
+    private String idCard;
+    private String creditCode;
+    private String idCardFrontFilename;
+    private String idCardBackFilename;
+    private String businessLicenseFilename;
+    private String province;
+    private String city;
+    private String district;
+    private String provinceName;
+    private String cityName;
+    private String districtName;
+    private String location;
+    private String remark;
+    private Integer serviceCostRate;
+    private List<String> nameList;
+    private List<String> creditCodeList;
+
+    public List<String> getNameList() {
+        return nameList;
+    }
+
+    public void setNameList(List<String> nameList) {
+        this.nameList = nameList;
+    }
+
+    public List<String> getCreditCodeList() {
+        return creditCodeList;
+    }
+
+    public void setCreditCodeList(List<String> creditCodeList) {
+        this.creditCodeList = creditCodeList;
+    }
+
+    public Byte getType() {
+        return type;
+    }
+
+    public void setType(Byte type) {
+        this.type = type;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getLegalName() {
+        return legalName;
+    }
+
+    public void setLegalName(String legalName) {
+        this.legalName = legalName;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public String getIdCard() {
+        return idCard;
+    }
+
+    public void setIdCard(String idCard) {
+        this.idCard = idCard;
+    }
+
+    public String getCreditCode() {
+        return creditCode;
+    }
+
+    public void setCreditCode(String creditCode) {
+        this.creditCode = creditCode;
+    }
+
+    public String getIdCardFrontFilename() {
+        return idCardFrontFilename;
+    }
+
+    public void setIdCardFrontFilename(String idCardFrontFilename) {
+        this.idCardFrontFilename = idCardFrontFilename;
+    }
+
+    public String getIdCardBackFilename() {
+        return idCardBackFilename;
+    }
+
+    public void setIdCardBackFilename(String idCardBackFilename) {
+        this.idCardBackFilename = idCardBackFilename;
+    }
+
+    public String getBusinessLicenseFilename() {
+        return businessLicenseFilename;
+    }
+
+    public void setBusinessLicenseFilename(String businessLicenseFilename) {
+        this.businessLicenseFilename = businessLicenseFilename;
+    }
+
+    public String getProvince() {
+        return province;
+    }
+
+    public void setProvince(String province) {
+        this.province = province;
+    }
+
+    public String getCity() {
+        return city;
+    }
+
+    public void setCity(String city) {
+        this.city = city;
+    }
+
+    public String getDistrict() {
+        return district;
+    }
+
+    public void setDistrict(String district) {
+        this.district = district;
+    }
+
+    public String getProvinceName() {
+        return provinceName;
+    }
+
+    public void setProvinceName(String provinceName) {
+        this.provinceName = provinceName;
+    }
+
+    public String getCityName() {
+        return cityName;
+    }
+
+    public void setCityName(String cityName) {
+        this.cityName = cityName;
+    }
+
+    public String getDistrictName() {
+        return districtName;
+    }
+
+    public void setDistrictName(String districtName) {
+        this.districtName = districtName;
+    }
+
+    public String getLocation() {
+        return location;
+    }
+
+    public void setLocation(String location) {
+        this.location = location;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public Integer getServiceCostRate() {
+        return serviceCostRate;
+    }
+
+    public void setServiceCostRate(Integer serviceCostRate) {
+        this.serviceCostRate = serviceCostRate;
+    }
+}

+ 20 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/util/SettlementUtil.java

@@ -1,5 +1,7 @@
 package com.yh.saas.plugin.yiliangyiyun.util;
 package com.yh.saas.plugin.yiliangyiyun.util;
 
 
+import java.util.List;
+
 public class SettlementUtil {
 public class SettlementUtil {
     private String name;
     private String name;
     private String phone;
     private String phone;
@@ -7,6 +9,24 @@ public class SettlementUtil {
     private Integer type;
     private Integer type;
     private String bankCardNumber;
     private String bankCardNumber;
     private String bankDeposit;
     private String bankDeposit;
+    private List<String> bankCardNumberList;
+    private List<String> idCardList;
+
+    public List<String> getBankCardNumberList() {
+        return bankCardNumberList;
+    }
+
+    public void setBankCardNumberList(List<String> bankCardNumberList) {
+        this.bankCardNumberList = bankCardNumberList;
+    }
+
+    public List<String> getIdCardList() {
+        return idCardList;
+    }
+
+    public void setIdCardList(List<String> idCardList) {
+        this.idCardList = idCardList;
+    }
 
 
     public String getName() {
     public String getName() {
         return name;
         return name;

+ 178 - 62
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/util/UplodeUtil.java

@@ -5,9 +5,9 @@ import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.TypeReference;
 import com.alibaba.fastjson.TypeReference;
 import com.aliyun.oss.ServiceException;
 import com.aliyun.oss.ServiceException;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.winsea.svc.base.base.service.ICommonCompanyService;
 import com.yh.saas.plugin.yiliangyiyun.entity.*;
 import com.yh.saas.plugin.yiliangyiyun.entity.*;
 import com.yh.saas.plugin.yiliangyiyun.entity.view.DistinguishView;
 import com.yh.saas.plugin.yiliangyiyun.entity.view.DistinguishView;
-import com.yh.saas.plugin.yiliangyiyun.entity.view.DriverInfo;
 import com.yh.saas.plugin.yiliangyiyun.service.ICommonSysParameterService;
 import com.yh.saas.plugin.yiliangyiyun.service.ICommonSysParameterService;
 import com.yh.saas.plugin.yiliangyiyun.service.IDriverInfoService;
 import com.yh.saas.plugin.yiliangyiyun.service.IDriverInfoService;
 import com.yh.saas.plugin.yiliangyiyun.service.IHyCarCaptainInfoService;
 import com.yh.saas.plugin.yiliangyiyun.service.IHyCarCaptainInfoService;
@@ -28,6 +28,8 @@ import org.apache.http.ssl.SSLContexts;
 import org.apache.http.util.EntityUtils;
 import org.apache.http.util.EntityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PostConstruct;
 import javax.crypto.Mac;
 import javax.crypto.Mac;
@@ -54,6 +56,8 @@ public class UplodeUtil {
     private IDriverInfoService driverInfoService;
     private IDriverInfoService driverInfoService;
     @Autowired
     @Autowired
     private IHyCarCaptainInfoService carCaptainInfoService;
     private IHyCarCaptainInfoService carCaptainInfoService;
+    @Autowired
+    private ICommonCompanyService commonCompanyService;
 
 
     public static UplodeUtil uplodeUtil;
     public static UplodeUtil uplodeUtil;
     @PostConstruct
     @PostConstruct
@@ -123,7 +127,7 @@ public class UplodeUtil {
         driverUtil.setIdCardIssueOrganization("");
         driverUtil.setIdCardIssueOrganization("");
         driverUtil.setQualificationNumber(hyDriverInfo.getQualificationCertificateNumber());
         driverUtil.setQualificationNumber(hyDriverInfo.getQualificationCertificateNumber());
         driverUtil.setIdCardFrontFilename(UplodeUtil.postFile(new ByteArrayInputStream(hyDriverInfo.getCardAddressUrl().getBytes()), "身份证正面照.jpeg"));
         driverUtil.setIdCardFrontFilename(UplodeUtil.postFile(new ByteArrayInputStream(hyDriverInfo.getCardAddressUrl().getBytes()), "身份证正面照.jpeg"));
-        driverUtil.setIdCardBackFilename(UplodeUtil.postFile(new ByteArrayInputStream(hyDriverInfo.getCardBackAddressUrl().getBytes()), "身份证面照.jpeg"));
+        driverUtil.setIdCardBackFilename(UplodeUtil.postFile(new ByteArrayInputStream(hyDriverInfo.getCardBackAddressUrl().getBytes()), "身份证面照.jpeg"));
         driverUtil.setLicenseFilename(UplodeUtil.postFile(new ByteArrayInputStream(hyDriverInfo.getDriverLicenseHomePage().getBytes()), "驾驶证主页.jpeg"));
         driverUtil.setLicenseFilename(UplodeUtil.postFile(new ByteArrayInputStream(hyDriverInfo.getDriverLicenseHomePage().getBytes()), "驾驶证主页.jpeg"));
         driverUtil.setQualificationLicenceMainFilename(UplodeUtil.postFile(new ByteArrayInputStream(hyDriverInfo.getQualificationCertificate().getBytes()), "从业资格证主页.jpeg"));
         driverUtil.setQualificationLicenceMainFilename(UplodeUtil.postFile(new ByteArrayInputStream(hyDriverInfo.getQualificationCertificate().getBytes()), "从业资格证主页.jpeg"));
         driverUtil.setQualificationLicenceSideFilename("");
         driverUtil.setQualificationLicenceSideFilename("");
@@ -135,6 +139,7 @@ public class UplodeUtil {
         return result;
         return result;
     }
     }
 
 
+
     /**
     /**
      * 车辆信息上报
      * 车辆信息上报
      * @param hyDriverCarInfo
      * @param hyDriverCarInfo
@@ -198,6 +203,68 @@ public class UplodeUtil {
         return result;
         return result;
     }
     }
 
 
+    /**
+     * 客户信息上报
+     * @param hyCompanyInfo
+     * @throws Exception
+     */
+    public static String uploadCustomer(HyCompanyInfo hyCompanyInfo) throws Exception {
+        CustomerUtil customerUtil = new CustomerUtil();
+        customerUtil.setType((byte) 1);
+        String result="";
+        List<String> list = new ArrayList<String>();
+        String name=hyCompanyInfo.getCompanyName();
+        list.add(name);
+        customerUtil.setNameList(list);
+        List<String> list1 = new ArrayList<String>();
+        String creditCode=hyCompanyInfo.getUnifiedSocialCreditCode();
+        list1.add(creditCode);
+        customerUtil.setCreditCodeList(list1);
+        String customerJson = JSON.toJSONString(customerUtil);
+        result = postJson("customer/search", customerJson);
+        net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(result);
+//        net.sf.json.JSONArray dataNJson = jsonObject.getJSONArray("date");
+
+        if(jsonObject.get("data").toString().length()==0){
+            customerUtil.setName(hyCompanyInfo.getCompanyName());
+            customerUtil.setCreditCode(hyCompanyInfo.getUnifiedSocialCreditCode());
+            customerUtil.setLegalName(hyCompanyInfo.getLegalPersonName());
+            customerUtil.setPhone(hyCompanyInfo.getPhone());
+            customerUtil.setIdCard(hyCompanyInfo.getCardNumber());
+            customerUtil.setIdCardFrontFilename(UplodeUtil.postFile(new ByteArrayInputStream(hyCompanyInfo.getCardAddressUrl().getBytes()), "身份证正面.jpeg"));
+            customerUtil.setIdCardBackFilename(UplodeUtil.postFile(new ByteArrayInputStream(hyCompanyInfo.getCardBackAddressUrl().getBytes()), "身份证反面.jpeg"));
+            customerUtil.setBusinessLicenseFilename(UplodeUtil.postFile(new ByteArrayInputStream(hyCompanyInfo.getBusinessLicenseAddressUrl().getBytes()), "营业执照.jpeg"));
+            List<Map<String,String>> table=UplodeUtil.addressResolution(hyCompanyInfo.getMailingAddress());
+            customerUtil.setProvinceName(table.get(0).get("province"));
+            customerUtil.setCityName(table.get(0).get("city"));
+            customerUtil.setDistrictName(table.get(0).get("county"));
+            HyCommonSysParameter hyCommonSysParameter = uplodeUtil.commonSysParameterService.selectOne(new EntityWrapper<HyCommonSysParameter>()
+                    .eq("const_id", "REGION1").eq("const_value", table.get(0).get("province")));
+            if (hyCommonSysParameter!=null) {
+                customerUtil.setProvince(hyCommonSysParameter.getConstKey());
+            }
+            HyCommonSysParameter hyCommonSysParameter2 = uplodeUtil.commonSysParameterService.selectOne(new EntityWrapper<HyCommonSysParameter>()
+                    .eq("const_id", "REGION1").eq("const_value", table.get(0).get("city")));
+            if (hyCommonSysParameter2!=null) {
+                customerUtil.setCity(hyCommonSysParameter2.getConstKey());
+            }
+            HyCommonSysParameter hyCommonSysParameter3 = uplodeUtil.commonSysParameterService.selectOne(new EntityWrapper<HyCommonSysParameter>()
+                    .eq("const_id", "REGION1").eq("const_value", table.get(0).get("county")));
+            if (hyCommonSysParameter3!=null) {
+                customerUtil.setDistrict(hyCommonSysParameter3.getConstKey());
+            }
+            customerUtil.setLocation(hyCompanyInfo.getMailingAddress());
+            customerUtil.setRemark("备注");
+            customerUtil.setServiceCostRate(0);
+            customerJson = JSON.toJSONString(customerUtil);
+
+            result = postJson("customer/create", customerJson);
+        }
+
+
+        System.out.println(result);
+        return result;
+    }
     /**
     /**
      * 流水单上报
      * 流水单上报
      * @param hyFreightSettlementInfo
      * @param hyFreightSettlementInfo
@@ -205,17 +272,31 @@ public class UplodeUtil {
      */
      */
     public static String uploadSettlement(HyFreightSettlementInfo hyFreightSettlementInfo) throws Exception {
     public static String uploadSettlement(HyFreightSettlementInfo hyFreightSettlementInfo) throws Exception {
         SettlementUtil settlementUtil = new SettlementUtil();
         SettlementUtil settlementUtil = new SettlementUtil();
-        settlementUtil.setName(hyFreightSettlementInfo.getPayeeName());
-        settlementUtil.setPhone("");
-        settlementUtil.setIdCard(hyFreightSettlementInfo.getPayeeIdCard());
-        //默认为1-银行账户
-        settlementUtil.setType(1);
-        settlementUtil.setBankCardNumber(hyFreightSettlementInfo.getBankCard());
-        settlementUtil.setBankDeposit(hyFreightSettlementInfo.getBankDeposit());
+        List<String> list = new ArrayList<String>();
+        String bankCardNumber=hyFreightSettlementInfo.getBankCard();
+        list.add(bankCardNumber);
+        settlementUtil.setBankCardNumberList(list);
+        List<String> list1 = new ArrayList<String>();
+        String idCard=hyFreightSettlementInfo.getPayeeIdCard();
+        list1.add(idCard);
+        settlementUtil.setIdCardList(list1);
         String settlementJson = JSON.toJSONString(settlementUtil);
         String settlementJson = JSON.toJSONString(settlementUtil);
 
 
-        String result = postJson("payee/create", settlementJson);
+        String result = postJson("payee/search", settlementJson);
+        net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(result);
+
+        if(jsonObject.get("data").toString().length()==0) {
+            settlementUtil.setName(hyFreightSettlementInfo.getPayeeName());
+            settlementUtil.setPhone("");
+            settlementUtil.setIdCard(hyFreightSettlementInfo.getPayeeIdCard());
+            //默认为1-银行账户
+            settlementUtil.setType(1);
+            settlementUtil.setBankCardNumber(hyFreightSettlementInfo.getBankCard());
+            settlementUtil.setBankDeposit(hyFreightSettlementInfo.getBankDeposit());
+            settlementJson = JSON.toJSONString(settlementUtil);
 
 
+            result = postJson("payee/create", settlementJson);
+        }
         System.out.println(result);
         System.out.println(result);
         return result;
         return result;
     }
     }
@@ -262,35 +343,46 @@ public class UplodeUtil {
         SimpleDateFormat formatter2 = new SimpleDateFormat( "yyyy.MM.dd");
         SimpleDateFormat formatter2 = new SimpleDateFormat( "yyyy.MM.dd");
         SimpleDateFormat formatter1 = new SimpleDateFormat( "yyyy年MM月dd日");
         SimpleDateFormat formatter1 = new SimpleDateFormat( "yyyy年MM月dd日");
         CarrierUtil carrierUtil = new CarrierUtil();
         CarrierUtil carrierUtil = new CarrierUtil();
+        String result="";
         //承运人取车队长信息
         //承运人取车队长信息
         if (orderInfo.getCarCaptainCommonId()!=null){
         if (orderInfo.getCarCaptainCommonId()!=null){
             HyCarCaptainInfo carCaptainInfo=uplodeUtil.carCaptainInfoService.selectOne(new EntityWrapper<HyCarCaptainInfo>()
             HyCarCaptainInfo carCaptainInfo=uplodeUtil.carCaptainInfoService.selectOne(new EntityWrapper<HyCarCaptainInfo>()
                     .eq("common_id",orderInfo.getCarCaptainCommonId()));
                     .eq("common_id",orderInfo.getCarCaptainCommonId()));
             if (carCaptainInfo!=null){
             if (carCaptainInfo!=null){
-                carrierUtil.setName(carCaptainInfo.getName());
                 carrierUtil.setIdCard(carCaptainInfo.getIdCard());
                 carrierUtil.setIdCard(carCaptainInfo.getIdCard());
-                carrierUtil.setPhone(orderInfo.getContactPersonPhone());
-                carrierUtil.setIdCardFrontFilename(UplodeUtil.postFile(new ByteArrayInputStream(carCaptainInfo.getCardAddressUrl().getBytes()), "身份证正面照.jpeg"));
-                carrierUtil.setIdCardBackFilename(UplodeUtil.postFile(new ByteArrayInputStream(carCaptainInfo.getCardBackAddressUrl().getBytes()), "身份证背面照.jpeg"));
-                //身份证起始日期
-                String startDate=formatter1.format(carCaptainInfo.getCardValidityStartDate());
-                //身份证截止日期
-                Date date=formatter.parse(carCaptainInfo.getCardValidityEndDate());
-                String endDate=formatter1.format(date);
-                carrierUtil.setIdCardBeginTime(formatter1.parse(startDate).getTime());
-                carrierUtil.setIdCardEndTime(formatter1.parse(endDate).getTime());
-                DistinguishView distinguishView=UplodeUtil.personShibie(carCaptainInfo.getCardAddressUrl(),"1");
-                carrierUtil.setAddress(distinguishView.getRecPersonAddr());
-                carrierUtil.setType(20);
-                carrierUtil.setBusinessLicenseFilename("");
-                carrierUtil.setBankDeposit(orderInfo.getBankDeposit());
-                carrierUtil.setBankCardNumber(orderInfo.getBankCard());
-                carrierUtil.setBranch(orderInfo.getBankDepositBranch());
-                carrierUtil.setLegalName("");
-                carrierUtil.setTransportBusinessLicenseFilename(UplodeUtil.postFile(new ByteArrayInputStream(carCaptainInfo.getRoadTransportOperationLicense().getBytes()), "道路运输许可证.jpeg"));
-                carrierUtil.setTransportBusinessLicenseOtherFilename("");
-                carrierUtil.setTransportBusinessLicense(carCaptainInfo.getRoadTransportOperationLicenseNo());
-                carrierUtil.setBusinessHouseholdsName("");
+                carrierUtil.setCarrierName(carCaptainInfo.getName());
+
+                String carrierJson = JSON.toJSONString(carrierUtil);
+                result = postJson("open_middleman/search", carrierJson);
+                net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(result);
+                if(jsonObject.get("data").toString().length()==0) {
+                    carrierUtil.setName(carCaptainInfo.getName());
+                    carrierUtil.setPhone(orderInfo.getContactPersonPhone());
+                    carrierUtil.setIdCardFrontFilename(UplodeUtil.postFile(new ByteArrayInputStream(carCaptainInfo.getCardAddressUrl().getBytes()), "身份证正面照.jpeg"));
+                    carrierUtil.setIdCardBackFilename(UplodeUtil.postFile(new ByteArrayInputStream(carCaptainInfo.getCardBackAddressUrl().getBytes()), "身份证背面照.jpeg"));
+                    //身份证起始日期
+                    String startDate = formatter1.format(carCaptainInfo.getCardValidityStartDate());
+                    //身份证截止日期
+                    Date date = formatter.parse(carCaptainInfo.getCardValidityEndDate());
+                    String endDate = formatter1.format(date);
+                    carrierUtil.setIdCardBeginTime(formatter1.parse(startDate).getTime());
+                    carrierUtil.setIdCardEndTime(formatter1.parse(endDate).getTime());
+                    DistinguishView distinguishView = UplodeUtil.personShibie(carCaptainInfo.getCardAddressUrl(), "1");
+                    carrierUtil.setAddress(distinguishView.getRecPersonAddr());
+                    carrierUtil.setType(20);
+                    carrierUtil.setBusinessLicenseFilename("");
+                    carrierUtil.setBankDeposit(orderInfo.getBankDeposit());
+                    carrierUtil.setBankCardNumber(orderInfo.getBankCard());
+                    carrierUtil.setBranch(orderInfo.getBankDepositBranch());
+                    carrierUtil.setLegalName("");
+                    carrierUtil.setTransportBusinessLicenseFilename(UplodeUtil.postFile(new ByteArrayInputStream(carCaptainInfo.getRoadTransportOperationLicense().getBytes()), "道路运输许可证.jpeg"));
+                    carrierUtil.setTransportBusinessLicenseOtherFilename("");
+                    carrierUtil.setTransportBusinessLicense(carCaptainInfo.getRoadTransportOperationLicenseNo());
+                    carrierUtil.setBusinessHouseholdsName("");
+                    carrierJson = JSON.toJSONString(carrierUtil);
+
+                    result = postJson("open_middleman/create", carrierJson);
+                }
             }
             }
         }
         }
         //承运人取司机信息
         //承运人取司机信息
@@ -298,37 +390,44 @@ public class UplodeUtil {
             HyDriverInfo hyDriverInfo=uplodeUtil.driverInfoService.selectOne(new EntityWrapper<HyDriverInfo>()
             HyDriverInfo hyDriverInfo=uplodeUtil.driverInfoService.selectOne(new EntityWrapper<HyDriverInfo>()
                     .eq("common_id",orderInfo.getCommonId()));
                     .eq("common_id",orderInfo.getCommonId()));
             if (hyDriverInfo!=null){
             if (hyDriverInfo!=null){
-                carrierUtil.setName(hyDriverInfo.getDriverName());
                 carrierUtil.setIdCard(hyDriverInfo.getNumberCard());
                 carrierUtil.setIdCard(hyDriverInfo.getNumberCard());
-                carrierUtil.setPhone(orderInfo.getDriverPhone());
-                carrierUtil.setIdCardFrontFilename(UplodeUtil.postFile(new ByteArrayInputStream(hyDriverInfo.getCardAddressUrl().getBytes()), "身份证正面照.jpeg"));
-                carrierUtil.setIdCardBackFilename(UplodeUtil.postFile(new ByteArrayInputStream(hyDriverInfo.getCardBackAddressUrl().getBytes()), "身份证背面照.jpeg"));
-                DistinguishView distinguishView=UplodeUtil.personShibie(hyDriverInfo.getCardBackAddressUrl(),"2");
-                String time = distinguishView.getIdCardValidity().substring(0, distinguishView.getIdCardValidity().indexOf('-'));
-                Date date1=formatter2.parse(time);
-                //身份证起始日期
-                String startDate=formatter1.format(date1);
-                //身份证截止日期
-                Date date=formatter.parse(hyDriverInfo.getCardValidityDate());
-                String endDate=formatter1.format(date);
-                carrierUtil.setIdCardBeginTime(formatter1.parse(startDate).getTime());
-                carrierUtil.setIdCardEndTime(formatter1.parse(endDate).getTime());
-                carrierUtil.setAddress(hyDriverInfo.getCardAddress());
-                carrierUtil.setType(20);
-                carrierUtil.setBusinessLicenseFilename("");
-                carrierUtil.setBankDeposit(orderInfo.getBankDeposit());
-                carrierUtil.setBankCardNumber(orderInfo.getBankCard());
-                carrierUtil.setBranch(orderInfo.getBankDepositBranch());
-                carrierUtil.setLegalName("");
-                carrierUtil.setTransportBusinessLicenseFilename("");
-                carrierUtil.setTransportBusinessLicenseOtherFilename("");
-                carrierUtil.setTransportBusinessLicense(hyDriverInfo.getActualCarrierBusinessLicense());
-                carrierUtil.setBusinessHouseholdsName("");
+                carrierUtil.setCarrierName(hyDriverInfo.getDriverName());
+                String carrierJson = JSON.toJSONString(carrierUtil);
+                result = postJson("open_middleman/search", carrierJson);
+                net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(result);
+                if(jsonObject.get("data").toString().length()==0) {
+                    carrierUtil.setName(hyDriverInfo.getDriverName());
+                    carrierUtil.setPhone(orderInfo.getDriverPhone());
+                    carrierUtil.setIdCardFrontFilename(UplodeUtil.postFile(new ByteArrayInputStream(hyDriverInfo.getCardAddressUrl().getBytes()), "身份证正面照.jpeg"));
+                    carrierUtil.setIdCardBackFilename(UplodeUtil.postFile(new ByteArrayInputStream(hyDriverInfo.getCardBackAddressUrl().getBytes()), "身份证背面照.jpeg"));
+                    DistinguishView distinguishView = UplodeUtil.personShibie(hyDriverInfo.getCardBackAddressUrl(), "2");
+                    String time = distinguishView.getIdCardValidity().substring(0, distinguishView.getIdCardValidity().indexOf('-'));
+                    Date date1 = formatter2.parse(time);
+                    //身份证起始日期
+                    String startDate = formatter1.format(date1);
+                    //身份证截止日期
+                    Date date = formatter.parse(hyDriverInfo.getCardValidityDate());
+                    String endDate = formatter1.format(date);
+                    carrierUtil.setIdCardBeginTime(formatter1.parse(startDate).getTime());
+                    carrierUtil.setIdCardEndTime(formatter1.parse(endDate).getTime());
+                    carrierUtil.setAddress(hyDriverInfo.getCardAddress());
+                    carrierUtil.setType(20);
+                    carrierUtil.setBusinessLicenseFilename("");
+                    carrierUtil.setBankDeposit(orderInfo.getBankDeposit());
+                    carrierUtil.setBankCardNumber(orderInfo.getBankCard());
+                    carrierUtil.setBranch(orderInfo.getBankDepositBranch());
+                    carrierUtil.setLegalName("");
+                    carrierUtil.setTransportBusinessLicenseFilename("");
+                    carrierUtil.setTransportBusinessLicenseOtherFilename("");
+                    carrierUtil.setTransportBusinessLicense(hyDriverInfo.getActualCarrierBusinessLicense());
+                    carrierUtil.setBusinessHouseholdsName("");
+                    carrierJson = JSON.toJSONString(carrierUtil);
+
+                    result = postJson("open_middleman/create", carrierJson);
+                }
             }
             }
         }
         }
-        String carrierJson = JSON.toJSONString(carrierUtil);
 
 
-        String result = postJson("open_middleman/create", carrierJson);
 
 
         System.out.println(result);
         System.out.println(result);
         return result;
         return result;
@@ -373,7 +472,7 @@ public class UplodeUtil {
         JSONObject shipperInfoDTO = new JSONObject();
         JSONObject shipperInfoDTO = new JSONObject();
         shipperInfoDTO.put("payType", 0);
         shipperInfoDTO.put("payType", 0);
         shipperInfoDTO.put("shipperName", orderInfo.getConsignorName());
         shipperInfoDTO.put("shipperName", orderInfo.getConsignorName());
-        shipperInfoDTO.put("shipperPhone", orderInfo.getDriverPhone());
+        shipperInfoDTO.put("shipperPhone", orderInfo.getConsignorPhone());
         shipperInfoDTO.put("shipperIdCard", orderInfo.getConsignorID());
         shipperInfoDTO.put("shipperIdCard", orderInfo.getConsignorID());
         shipperInfoDTO.put("shipperTransportCost", orderInfo.getFreight());
         shipperInfoDTO.put("shipperTransportCost", orderInfo.getFreight());
         orderUtil.setShipperInfoDTO(shipperInfoDTO);
         orderUtil.setShipperInfoDTO(shipperInfoDTO);
@@ -582,7 +681,24 @@ public class UplodeUtil {
             return null;
             return null;
         }
         }
     }
     }
-
+    public static List<Map<String,String>> addressResolution(String address){
+        String regex="(?<province>[^省]+自治区|.*?省|.*?行政区|.*?市)(?<city>[^市]+自治州|.*?地区|.*?行政单位|.+盟|市辖区|.*?市|.*?县)(?<county>[^县]+县|.+区|.+市|.+旗|.+海域|.+岛)?(?<town>[^区]+区|.+镇)?(?<village>.*)";
+        Matcher m=Pattern.compile(regex).matcher(address);
+        String province=null,city=null,county=null;
+        List<Map<String,String>> table=new ArrayList<Map<String,String>>();
+        Map<String,String> row=null;
+        row=new LinkedHashMap<String,String>();
+        while( m.find() ){
+            province=m.group("province");
+            row.put("province", province==null?"":province.trim());
+            city=m.group("city");
+            row.put("city", city==null?"":city.trim());
+            county=m.group("county");
+            row.put("county", county==null?"":county.trim());
+        }
+        table.add(row);
+        return table;
+    }
     public static DistinguishView personShibie(String personImg,String flag) throws ServiceException {
     public static DistinguishView personShibie(String personImg,String flag) throws ServiceException {
         String appcode = "2d59bfa794994f5f94d1d98b7b5bd102";
         String appcode = "2d59bfa794994f5f94d1d98b7b5bd102";
         //API产品路径
         //API产品路径