|
@@ -11,12 +11,12 @@ import com.ydd.app.dto.ShopReq;
|
|
|
import com.ydd.app.dto.StoreDto;
|
|
|
import com.ydd.app.dto.StoreStatusDto;
|
|
|
import com.ydd.app.service.ApiStoreService;
|
|
|
-import com.ydd.common.constant.BillingConstant;
|
|
|
import com.ydd.common.core.domain.ResponseResult;
|
|
|
import com.ydd.common.enums.DeliveryTypeEnums;
|
|
|
import com.ydd.common.enums.ResponseResultCodeEnum;
|
|
|
import com.ydd.common.utils.SnCodeUtils;
|
|
|
import com.ydd.common.utils.StringUtils;
|
|
|
+import com.ydd.ecloud.core.utils.AipOcrE;
|
|
|
import com.ydd.ecloud.core.utils.JsonMapper;
|
|
|
import com.ydd.module.domain.*;
|
|
|
import com.ydd.module.dto.StoreDeliveryDto;
|
|
@@ -24,9 +24,7 @@ import com.ydd.module.enums.BindStatusEnum;
|
|
|
import com.ydd.module.enums.IsDeleteEnum;
|
|
|
import com.ydd.module.enums.MerchantStatusEnum;
|
|
|
import com.ydd.module.enums.StatusEnum;
|
|
|
-import com.ydd.module.expection.CustomAppException;
|
|
|
import com.ydd.module.service.*;
|
|
|
-import com.ydd.system.service.ISysConfigService;
|
|
|
import com.ydd.third.common.utils.AddressLngLatExchanger;
|
|
|
import com.ydd.third.common.utils.CoordinateUtils;
|
|
|
import com.ydd.third.common.vo.ResObject;
|
|
@@ -79,42 +77,42 @@ public class ApiStoreServiceImpl implements ApiStoreService {
|
|
|
public ResponseResult saveShop(Long loginId, StoreDto shopReq, boolean isMerchant) {
|
|
|
JSONObject resp = new JSONObject();
|
|
|
Member member = iMemberService.getById(loginId);
|
|
|
- Map<String, Object> map = AddressLngLatExchanger.addressToLngAndLag(shopReq.getAddress());
|
|
|
- if(map==null){
|
|
|
+ Map<String, Object> map = AddressLngLatExchanger.addressToLngAndLag(shopReq.getCityName()+shopReq.getDistrictName()+shopReq.getAddress());
|
|
|
+ if (map == null) {
|
|
|
return ResponseResult.error(ResponseResultCodeEnum.SHOP_ADDRESS_INVALID);
|
|
|
}
|
|
|
double distance = CoordinateUtils.getDistance(Double.parseDouble(map.get("lng") + ""), Double.parseDouble(map.get("lat") + ""), Double.parseDouble(shopReq.getLongitude()), Double.parseDouble(shopReq.getLatitude()));
|
|
|
if (distance > 50) {
|
|
|
return ResponseResult.error(ResponseResultCodeEnum.SHOP_ADDRESS_ERROR);
|
|
|
}
|
|
|
- shopReq.setCityCode(map.get("cityCode")+"");
|
|
|
- AipOcr client = new AipOcr("23831014", "BELGCxGTPOlcZzeZ85OLyIpD", "pLt8IG1PoXZBaDonLfFM9EkXndI1OBxh");
|
|
|
- String idCardName = "";
|
|
|
- if (StringUtils.isNotBlank(shopReq.getIdcardFront())) {
|
|
|
- //百度ocr校验
|
|
|
- org.json.JSONObject json = client.idcard(shopReq.getIdcardFront(), "front", new HashMap<String, String>());
|
|
|
- if(json.getJSONObject("words_result")!=null){
|
|
|
- String idCardNo = json.getJSONObject("words_result").getJSONObject("公民身份号码").getString("words");
|
|
|
- idCardName = json.getJSONObject("words_result").getJSONObject("姓名").getString("words");
|
|
|
- if(!idCardNo.equals(shopReq.getIdcardNo())){
|
|
|
- return ResponseResult.error(ResponseResultCodeEnum.ID_CARD_VERIFY_FAIL);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (StringUtils.isNotBlank(shopReq.getBizLicense())) {
|
|
|
- //百度ocr校验
|
|
|
- org.json.JSONObject json = client.businessLicense(shopReq.getIdcardFront(), new HashMap<String, String>());
|
|
|
- if(json.getJSONObject("words_result")!=null){
|
|
|
- String bizNo = json.getJSONObject("words_result").getJSONObject("社会信用代码").getString("words");
|
|
|
- String name = json.getJSONObject("words_result").getJSONObject("法人").getString("words");
|
|
|
- if(!bizNo.equals(shopReq.getBizLicenseNo())){
|
|
|
- return ResponseResult.error(ResponseResultCodeEnum.BUSINESS_LICENCSE_VERIFY_FAIL);
|
|
|
- }
|
|
|
- if(!idCardName.equals(name)){
|
|
|
- return ResponseResult.error(ResponseResultCodeEnum.BUSINESS_LICENCSE_AND_FAREN_VERIFY_FAIL);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ shopReq.setCityCode(map.get("cityCode") + "");
|
|
|
+// AipOcrE client = new AipOcrE("23831014", "BELGCxGTPOlcZzeZ85OLyIpD", "pLt8IG1PoXZBaDonLfFM9EkXndI1OBxh");
|
|
|
+// String idCardName = "";
|
|
|
+// if (StringUtils.isNotBlank(shopReq.getIdcardFront())) {
|
|
|
+// //百度ocr校验
|
|
|
+// org.json.JSONObject json = client.idcard(shopReq.getIdcardFront(), "front", new HashMap<String, String>());
|
|
|
+// if (json.getJSONObject("words_result").length()>0) {
|
|
|
+// String idCardNo = json.getJSONObject("words_result").getJSONObject("公民身份号码").getString("words");
|
|
|
+// idCardName = json.getJSONObject("words_result").getJSONObject("姓名").getString("words");
|
|
|
+// if (!idCardNo.equals(shopReq.getIdcardNo())) {
|
|
|
+// return ResponseResult.error(ResponseResultCodeEnum.ID_CARD_VERIFY_FAIL);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (StringUtils.isNotBlank(shopReq.getBizLicense())) {
|
|
|
+// //百度ocr校验
|
|
|
+// org.json.JSONObject json = client.businessLicense(shopReq.getBizLicense(), new HashMap<String, String>());
|
|
|
+// if (json.getJSONObject("words_result").length()>0) {
|
|
|
+// String bizNo = json.getJSONObject("words_result").getJSONObject("社会信用代码").getString("words");
|
|
|
+// String name = json.getJSONObject("words_result").getJSONObject("法人").getString("words");
|
|
|
+// if (!bizNo.equals(shopReq.getBizLicenseNo())) {
|
|
|
+// return ResponseResult.error(ResponseResultCodeEnum.BUSINESS_LICENCSE_VERIFY_FAIL);
|
|
|
+// }
|
|
|
+// if (!idCardName.equals(name)) {
|
|
|
+// return ResponseResult.error(ResponseResultCodeEnum.BUSINESS_LICENCSE_AND_FAREN_VERIFY_FAIL);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
|
|
|
Merchant merchant = iMerchantService.getById(member.getMerchantId());
|
|
@@ -223,7 +221,7 @@ public class ApiStoreServiceImpl implements ApiStoreService {
|
|
|
// shop.setDoorHeadPhoto(shopReq.getHouseNumber());
|
|
|
shop.setLat(shopReq.getLatitude());
|
|
|
shop.setLng(shopReq.getLongitude());
|
|
|
- shop.setCityCode(shopReq.getCityCode());
|
|
|
+ shop.setCityCode(shopReq.getCityCode());
|
|
|
shop.setMobile(shopReq.getContactPhone());
|
|
|
shop.setName(shopReq.getShopName());
|
|
|
shop.setStreet(shopReq.getHouseNumber());
|
|
@@ -356,7 +354,19 @@ public class ApiStoreServiceImpl implements ApiStoreService {
|
|
|
return ResponseResult.error(ResponseResultCodeEnum.SHOP_EXIST);
|
|
|
}
|
|
|
}
|
|
|
- storeDto.setCityCode(shop.getCityCode());
|
|
|
+ storeDto.setShopCode(shop.getCityCode());
|
|
|
+ if (!shop.getAddress().equals(storeDto.getAddress())) {
|
|
|
+ Map<String, Object> map = AddressLngLatExchanger.addressToLngAndLag(storeDto.getCityName()+storeDto.getDistrictName()+storeDto.getAddress());
|
|
|
+ if (map == null) {
|
|
|
+ return ResponseResult.error(ResponseResultCodeEnum.SHOP_ADDRESS_INVALID);
|
|
|
+ }
|
|
|
+ double distance = CoordinateUtils.getDistance(Double.parseDouble(map.get("lng") + ""), Double.parseDouble(map.get("lat") + ""), Double.parseDouble(storeDto.getLongitude()), Double.parseDouble(storeDto.getLatitude()));
|
|
|
+ if (distance > 50) {
|
|
|
+ return ResponseResult.error(ResponseResultCodeEnum.SHOP_ADDRESS_ERROR);
|
|
|
+ }
|
|
|
+ storeDto.setCityCode(map.get("cityCode") + "");
|
|
|
+ }
|
|
|
+
|
|
|
shop = shopBean(shop, storeDto);
|
|
|
if (storeDto.getCategoryId() != null) {
|
|
|
shop.setCategoryId(storeDto.getCategoryId());
|
|
@@ -451,20 +461,21 @@ public class ApiStoreServiceImpl implements ApiStoreService {
|
|
|
return ResponseResult.success(resp);
|
|
|
}
|
|
|
|
|
|
- public static void main(String[] args) {
|
|
|
- AipOcr client = new AipOcr("23831014", "BELGCxGTPOlcZzeZ85OLyIpD", "pLt8IG1PoXZBaDonLfFM9EkXndI1OBxh");
|
|
|
-
|
|
|
- //百度ocr校验
|
|
|
- String image = "E:\\1.jpg";
|
|
|
- org.json.JSONObject json = client.idcard(image, "front", new HashMap<String, String>());
|
|
|
- // JSONObject json = JSONObject.parseObject(ss);
|
|
|
- System.out.println(json.toString());
|
|
|
-// System.out.println(json.getJSONObject("words_result").getJSONObject("社会信用代码").getString("words"));
|
|
|
-// System.out.println(json.getJSONObject("words_result").getJSONObject("法人").getString("words"));
|
|
|
- if(json.getJSONObject("words_result")!=null){
|
|
|
- System.out.println(json.getJSONObject("words_result").getJSONObject("公民身份号码").getString("words"));
|
|
|
- System.out.println(json.getJSONObject("words_result").getJSONObject("姓名").getString("words"));
|
|
|
- }
|
|
|
+// public static void main(String[] args) {
|
|
|
+// AipOcrE client = new AipOcrE("23831014", "BELGCxGTPOlcZzeZ85OLyIpD", "pLt8IG1PoXZBaDonLfFM9EkXndI1OBxh");
|
|
|
+//
|
|
|
+// //百度ocr校验
|
|
|
+// String image = "https://tcs.teambition.net/thumbnail/312ff47d4a57c2ea151fe80355b8d02156c6/w/1652/h/308";
|
|
|
+// org.json.JSONObject json = client.idcard(image, "front", new HashMap<String, String>());
|
|
|
+// // JSONObject json = JSONObject.parseObject(ss);
|
|
|
+// System.out.println(json.toString());
|
|
|
+//// System.out.println(json.getJSONObject("words_result").getJSONObject("社会信用代码").getString("words"));
|
|
|
+//// System.out.println(json.getJSONObject("words_result").getJSONObject("法人").getString("words"));
|
|
|
+// if (json.getJSONObject("words_result").length()>0) {
|
|
|
+// System.out.println(json.getJSONObject("words_result").getJSONObject("公民身份号码").getString("words"));
|
|
|
+// System.out.println(json.getJSONObject("words_result").getJSONObject("姓名").getString("words"));
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
|
|
|
- }
|
|
|
}
|