Browse Source

fix bug

release_toaliyun_real
lin 2 years ago
parent
commit
4244b1557d
3 changed files with 37 additions and 25 deletions
  1. +27
    -18
      mallinkAdmin/src/main/java/com/iformall/controller/mem/AsyncTask.java
  2. +1
    -1
      mallinkService/src/main/java/com/iformall/service/TtMerchantPoiService.java
  3. +9
    -6
      mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java

+ 27
- 18
mallinkAdmin/src/main/java/com/iformall/controller/mem/AsyncTask.java View File

@@ -272,7 +272,7 @@ public class AsyncTask {
//查询所有匹配了poi的
TtMerchantPoi poiQ = new TtMerchantPoi();
poiQ.updateTenantInfo(tenantEntity);
Map<String,Long> poiMerchantIdMap = ttMerchantPoiService.queryPoiMerchantIdMap(poiQ);
Map<String,TtMerchantPoi> poiMerchantMap = ttMerchantPoiService.queryPoiMerchantMap(poiQ);
//查询所有商户
WxMerchant merchantQ = new WxMerchant();
@@ -282,6 +282,31 @@ public class AsyncTask {
try {
successList.parallelStream().forEach(poiBase -> {
try {
String poiId = poiBase.getPoiId();
if (StringUtils.isNotBlank(poiId) && null != poiMerchantMap) {
TtMerchantPoi tm = poiMerchantMap.get(poiId);
if (null != tm) {
if (tm.getId() > 0 ) {
poiBase.setMerchantId(String.valueOf(tm.getId()));
poiBase.setProvince(tm.getProvince());
poiBase.setCity(tm.getCity());
poiBase.setAddress(tm.getAddress());
poiBase.setLongitude(tm.getLongitude());
poiBase.setLatitude(tm.getLatitude());
poiBase.setGaodeRemark("已匹配过,无需查询高德匹配");
}else {
poiBase.setMerchantId(null);
poiBase.setMerchantName("多个商户已匹配该POI,请手动输入商户信息");
}
}
if (null != merchantMap && null != tm && tm.getId() > 0) {
WxMerchant m = merchantMap.get(tm.getId());
if (null != m) {
poiBase.setMerchantName(m.getName());
}
}
}
if (StringUtils.isNotBlank(poiBase.getProvince()) && StringUtils.isNotBlank(poiBase.getCity())
&& StringUtils.isNotBlank(poiBase.getAddress()) && null != poiBase.getLongitude() && null != poiBase.getLatitude()) {
//do nothing
@@ -302,23 +327,7 @@ public class AsyncTask {
poiBase.setGaodeRemark("未匹配到信息");
}
}
String poiId = poiBase.getPoiId();
if (StringUtils.isNotBlank(poiId) && null != poiMerchantIdMap) {
Long merchantId = poiMerchantIdMap.get(poiId);
if (null != merchantId) {
if (merchantId > 0 ) {
poiBase.setMerchantId(String.valueOf(merchantId));
}else {
poiBase.setMerchantId("多个商户已匹配该POI,请手动输入");
}
}
if (null != merchantMap && null != merchantId && merchantId > 0) {
WxMerchant m = merchantMap.get(merchantId);
if (null != m) {
poiBase.setMerchantName(m.getName());
}
}
}
} catch (UnknownSessionException ue) {
logger.error("session :"+ue.getMessage());


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/TtMerchantPoiService.java View File

@@ -72,5 +72,5 @@ public interface TtMerchantPoiService {
GaoDePoiInfo queryGaoDePoiInfo(String gaodeKey,String address);
Map<String,Long> queryPoiMerchantIdMap(TtMerchantPoi merchantPoiQ);
Map<String,TtMerchantPoi> queryPoiMerchantMap(TtMerchantPoi merchantPoiQ);
}

+ 9
- 6
mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java View File

@@ -729,18 +729,21 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService {
}

@Override
public Map<String, Long> queryPoiMerchantIdMap(TtMerchantPoi merchantPoiQ) {
public Map<String, TtMerchantPoi> queryPoiMerchantMap(TtMerchantPoi merchantPoiQ) {
List<TtMerchantPoi> poiList = ttMerchantPoiMapper.findList(merchantPoiQ);
if (null != poiList) {
Map<String,Long> poiMerchantIdMap = new HashMap<String,Long>();
Map<String,TtMerchantPoi> poiMerchantIdMap = new HashMap<String,TtMerchantPoi>();
for (int i = 0 ; i < poiList.size(); i++) {
TtMerchantPoi poi = poiList.get(i);
if (StringUtils.isNotBlank(poi.getPoiId())) {
Long curMId = poiMerchantIdMap.get(poi.getPoiId());
if (null == curMId) {
poiMerchantIdMap.put(poi.getPoiId(), poi.getId());
TtMerchantPoi curm = poiMerchantIdMap.get(poi.getPoiId());
if (null == curm) {
poiMerchantIdMap.put(poi.getPoiId(), poi);
}else {
poiMerchantIdMap.put(poi.getPoiId(), -1L);
TtMerchantPoi _poiT = new TtMerchantPoi();
_poiT.setId(-1L);
_poiT.setMerchantName("多个商户已匹配该POI");
poiMerchantIdMap.put(poi.getPoiId(), _poiT);
}
}
}


Loading…
Cancel
Save