wjj 19 órája
szülő
commit
6a652cd17d

+ 29 - 1
fs-company/src/main/java/com/fs/company/controller/qw/FsCompanyCustomerController.java

@@ -1,5 +1,6 @@
 package com.fs.company.controller.qw;
 
+import com.alibaba.fastjson.JSON;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
@@ -13,6 +14,7 @@ import com.fs.framework.security.LoginUser;
 import com.fs.framework.security.SecurityUtils;
 import com.fs.his.domain.FsDoctorPatient;
 import com.fs.his.domain.FsPrescribe;
+import com.fs.his.dto.AddressInfoDTO;
 import com.fs.his.param.CollectionPhoneParam;
 import com.fs.his.param.PrescribePhoneParam;
 import com.fs.his.service.IFsDoctorPatientService;
@@ -66,7 +68,7 @@ public class FsCompanyCustomerController extends BaseController {
     private IFsDoctorPatientService fsDoctorPatientService;
 
     @Autowired
-    private FsUserInformationCollectionServiceImpl informationCollectionService;
+    private IFsUserInformationCollectionService informationCollectionService;
 
     /**
      * 查询客户列表
@@ -296,4 +298,30 @@ public class FsCompanyCustomerController extends BaseController {
         String appId="wx50bcb040b4963a7e";
         return informationCollectionService.getCustomerGenerateQRCode(orderId,appId);
     }
+
+    @GetMapping(value = "/getAddress")
+    public AjaxResult getAddress(@RequestParam("address") String address)
+    {
+        String kdnAddress = fsCompanyCustomerService.getKdnAddress(address);
+
+        AddressInfoDTO addressInfoDTO = JSON.parseObject(kdnAddress, AddressInfoDTO.class);
+        if (!addressInfoDTO.isSuccess()) {
+            return AjaxResult.error(addressInfoDTO.getReason());
+        }
+        AddressInfoDTO.AddressData data = addressInfoDTO.getData();
+        logger.info("快递鸟返回{}:",kdnAddress);
+        if (data==null){
+            return AjaxResult.error("解析地址失败请输入正确地址");
+        }
+        String provinceName = data.getProvinceName();
+        if (!provinceName.contains("省") && !provinceName.contains("区")){
+            data.setProvinceName(data.getProvinceName()+"市");
+            if (data.getExpAreaName().contains("县")){
+                data.setCityName("县");
+            }else {
+                data.setCityName("市辖区");
+            }
+        }
+        return AjaxResult.success(addressInfoDTO);
+    }
 }

+ 2 - 0
fs-service/src/main/java/com/fs/qw/service/IFsCompanyCustomerService.java

@@ -37,4 +37,6 @@ public interface IFsCompanyCustomerService {
 
     //查询客户订单列表
     List<FsStoreOrderVO> selectStoreOrderScrmByCompanyCustomerParam(FsCompanyCustomerOrderParam param);
+
+    String getKdnAddress(String address);
 }

+ 9 - 0
fs-service/src/main/java/com/fs/qw/service/impl/FsCompanyCustomerServiceImpl.java

@@ -10,6 +10,7 @@ import com.fs.company.domain.CompanyUser;
 import com.fs.company.mapper.CompanyDeptMapper;
 import com.fs.his.domain.FsImportMember;
 import com.fs.his.mapper.FsImportMemberMapper;
+import com.fs.his.service.IFsUserAddressService;
 import com.fs.hisStore.mapper.FsStoreOrderScrmMapper;
 import com.fs.hisStore.param.FsCompanyCustomerOrderParam;
 import com.fs.hisStore.vo.FsStoreOrderItemVO;
@@ -60,6 +61,9 @@ public class FsCompanyCustomerServiceImpl implements IFsCompanyCustomerService {
     @Autowired
     private FsCompanyExternalPayReceiptMapper externalPayReceiptMapper;
 
+    @Autowired
+    private IFsUserAddressService fsUserAddressService;
+
     @Override
     public FsCompanyCustomer selectFsCompanyCustomerById(Long id) {
         return fsCompanyCustomerMapper.selectFsCompanyCustomerById(id);
@@ -239,4 +243,9 @@ public class FsCompanyCustomerServiceImpl implements IFsCompanyCustomerService {
         }
         return fsStoreOrderVOS;
     }
+
+    @Override
+    public String getKdnAddress(String address) {
+        return fsUserAddressService.getKdnAddress(address);
+    }
 }