Merge #76 into master from cc_20260329_fix

feat:门店经纬度更新

* cc_20260329_fix: (1 commits squashed)

  - feat:门店经纬度更新

Signed-off-by: 正新 <accounts_6964c7bcd2a2c377c5bbd01b@mail.teambition.com>
Merged-by: 正新 <accounts_6964c7bcd2a2c377c5bbd01b@mail.teambition.com>

CR-link: https://codeup.aliyun.com/692ea314dec569489f6f167c/hangzhou/java/custom_zxjp/change/76
This commit is contained in:
正新
2026-03-29 09:08:21 +00:00
parent ba03a9ac7a
commit e49e8d4fc3
8 changed files with 120 additions and 5 deletions

View File

@@ -22,7 +22,7 @@ public class GeoMapUtil {
private static final String API_KEY = "0102f13948f9fba9c979aacd72eb01f1";
public static void main(String[] args) {
AddressInfo addressInfo = reverseGeoCoding("30.41875", "120.2985");
AddressInfo addressInfo = reverseGeoCoding("35.607720", "103.221869");
System.out.println(JSONObject.toJSONString(addressInfo));
System.out.println(JSONObject.toJSONString(reverseGeoCoding("30.41", "120.29")));
}

View File

@@ -1,6 +1,7 @@
package com.cool.store.dao;
import cn.hutool.core.collection.CollStreamUtil;
import com.cool.store.dto.store.StoreAddressDTO;
import com.cool.store.dto.store.StoreOrderTimeDTO;
import com.cool.store.entity.StoreDO;
import com.cool.store.mapper.StoreMapper;
@@ -235,4 +236,12 @@ public class StoreDao {
public List<StoreDO> getStoreByRegionIds(List<String> regionIds, String keyword) {
return storeMapper.getStoreByRegionIds(regionIds, keyword);
}
public List<StoreAddressDTO> getStoreAddress(Integer flag,String storeCode){
return storeMapper.getStoreAddress(flag,storeCode);
}
public Integer batchUpdateAddress(List<StoreDO> storeList){
return storeMapper.batchUpdateAddress(storeList);
}
}

View File

@@ -1,5 +1,6 @@
package com.cool.store.mapper;
import com.cool.store.dto.store.StoreAddressDTO;
import com.cool.store.dto.store.StoreAreaDTO;
import com.cool.store.dto.store.StoreOrderTimeDTO;
import com.cool.store.entity.StoreDO;
@@ -148,4 +149,8 @@ public interface StoreMapper {
* @return 门店列表
*/
List<StoreDO> getStoreByRegionIds(@Param("regionIds") List<String> regionIds, @Param("keyword") String keyword);
List<StoreAddressDTO> getStoreAddress(@Param("flag") Integer flag, @Param("storeCode") String storeCode);
int batchUpdateAddress(@Param("list") List<StoreDO> storeList);
}

View File

@@ -381,4 +381,44 @@
</if>
</where>
</select>
<select id="getStoreAddress" resultType="com.cool.store.dto.store.StoreAddressDTO">
SELECT * FROM store_${enterpriseId}
<where>
is_delete = 'effective'
<if test="storeCode!=null and storeCode!=null">
and store_num = #{storeCode}
</if>
<if test="flag==null">
and `city` is not null and county is null
</if>
</where>
</select>
<update id="batchUpdateAddress" parameterType="list">
UPDATE store_${enterpriseId}
<trim prefix="SET" suffixOverrides=",">
<trim prefix="province = CASE" suffix="END,">
<foreach collection="list" item="item" index="index">
WHEN store_id = #{item.storeId} THEN #{item.province}
</foreach>
</trim>
<trim prefix="city = CASE" suffix="END,">
<foreach collection="list" item="item" index="index">
WHEN store_id = #{item.storeId} THEN #{item.city}
</foreach>
</trim>
<trim prefix="county = CASE" suffix="END,">
<foreach collection="list" item="item" index="index">
WHEN store_id = #{item.storeId} THEN #{item.county}
</foreach>
</trim>
</trim>
WHERE store_id IN
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item.storeId}
</foreach>
</update>
</mapper>

View File

@@ -0,0 +1,18 @@
package com.cool.store.dto.store;
import lombok.Data;
/**
* @Auther zx_szh
* @Date 2026/3/29 16:28
* @Version 1.0
*/
@Data
public class StoreAddressDTO {
private String StoreId;
private String longitude;
private String latitude;
}

View File

@@ -49,4 +49,6 @@ public interface StoreService {
*/
PageInfo<StoreListVO> getAuthStoreList(StoreListRequest request);
Boolean handleStoreLogLai(Integer flag,String specialStoreCode);
}

View File

@@ -4,19 +4,17 @@ import cn.hutool.core.collection.CollStreamUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.dto.StoreNameDTO;
import com.cool.store.dao.store.StoreMasterSignerInfoDAO;
import com.cool.store.dto.store.AuthStoreUserDTO;
import com.cool.store.dto.store.*;
import com.cool.store.dao.EnterpriseUserDAO;
import com.cool.store.dao.EnterpriseUserRoleDao;
import com.cool.store.dao.StoreDao;
import com.cool.store.dao.SysRoleDao;
import com.cool.store.dto.StoreDTO;
import com.cool.store.dto.UserSimpleDTO;
import com.cool.store.dto.store.StoreAreaDTO;
import com.cool.store.dto.store.StoreUserDTO;
import com.cool.store.dto.store.StoreUserPositionDTO;
import com.cool.store.entity.*;
import com.cool.store.entity.store.StoreMasterSignerInfoDO;
import com.cool.store.enums.*;
@@ -27,6 +25,7 @@ import com.cool.store.response.MiniShopsResponse;
import com.cool.store.service.StoreService;
import com.cool.store.service.UserAuthMappingService;
import com.cool.store.utils.BeanUtil;
import com.cool.store.utils.GeoMapUtil;
import com.cool.store.utils.poi.constant.Constants;
import com.cool.store.vo.SysRoleVO;
import com.cool.store.vo.store.StoreListVO;
@@ -318,6 +317,42 @@ public class StoreServiceImpl implements StoreService {
return page;
}
@Override
public Boolean handleStoreLogLai(Integer flag,String specialStoreCode) {
boolean hasNext = true;
int pageNum = 1;
int pageSize = 50;
while (hasNext) {
PageHelper.startPage(pageNum, pageSize);
List<StoreAddressDTO> list = storeDao.getStoreAddress(flag,specialStoreCode);
//门店列表
if (CollectionUtils.isEmpty(list)) {
log.info("------门店列表为空------");
return Boolean.TRUE;
}
List<StoreDO> storeList = new ArrayList<>();
for (StoreAddressDTO x : list) {
GeoMapUtil.AddressInfo addressInfo = GeoMapUtil.reverseGeoCoding(x.getLatitude(), x.getLongitude());
if (Objects.isNull(addressInfo)){
continue;
}
StoreDO storeDO = new StoreDO();
storeDO.setStoreId(x.getStoreId());
storeDO.setProvince(addressInfo.getProvince());
storeDO.setCity(addressInfo.getCity());
storeDO.setCounty(addressInfo.getDistrict());
storeList.add(storeDO);
}
storeDao.batchUpdateAddress(storeList);
hasNext = list.size() >= pageSize;
pageNum++;
}
return Boolean.TRUE;
}
@Override
public List<AuthStoreUserDTO> authStoreUser(List<String> storeIdList, String positionType) {

View File

@@ -461,4 +461,10 @@ public class TestController {
public ResponseResult<Boolean> openOnlineBankAccount(@RequestBody @Validated CoolOpenBasicInfoRequest request) {
return ResponseResult.success(walletService.openOnlineBankAccount(request));
}
@GetMapping("/handleStoreLogLai")
public ResponseResult<Boolean> handleStoreLogLai(@RequestParam(value = "flag", required = false) Integer flag ,
@RequestParam(value = "storeCode", required = false) String storeCode) {
return ResponseResult.success(storeService.handleStoreLogLai(flag,storeCode));
}
}