zepengdev
2025-08-29 38213237cc11c9bd3f11b0fa69c56ef663049a4b
feat: 店铺地址和坐标合并
3 files modified
13 ■■■■ changed files
oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreMerchantController.java 2 ●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/pc/store/service/StoreService.java 2 ●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/pc/store/service/impl/StoreServiceImpl.java 9 ●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreMerchantController.java
@@ -188,7 +188,7 @@
    public ResponseEntity<?> updateAddress(@PathVariable("storeId") Long storeId,
                              @Validated(value = StoreFieldUpdateRequest.UpdateStoreAddressGroup.class)
                              @RequestBody StoreFieldUpdateRequest request) {
        storeService.updateAddress(storeId, request.getAddress(), request.getVersion());
        storeService.updateAddress(storeId, request.getAddress(), request.getLongitude(), request.getLatitude(), request.getVersion());
        return ResponseEntity.noContent().build();
    }
oying-system/src/main/java/com/oying/modules/pc/store/service/StoreService.java
@@ -50,7 +50,7 @@
    boolean updateContactPhone(Long storeId, String contactPhone, Long version);
    boolean updateAddress(Long storeId, String address, Long version);
    boolean updateAddress(Long storeId, String address, Double longitude, Double latitude, Long version);
    boolean updateLocation(Long storeId, Double longitude, Double latitude, Long version);
oying-system/src/main/java/com/oying/modules/pc/store/service/impl/StoreServiceImpl.java
@@ -1,6 +1,7 @@
package com.oying.modules.pc.store.service.impl;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -167,10 +168,16 @@
    }
    @Override
    public boolean updateAddress(Long storeId, String address, Long version) {
    public boolean updateAddress(Long storeId, String address, Double longitude, Double latitude, Long version) {
        Store existingStore = this.getOrThrow(storeId, version);
        LambdaUpdateWrapper<Store> wrapper = this.createLambdaUpdateWrapper(storeId, existingStore.getVersion())
                .set(Store::getAddress, address);
        if (ObjectUtil.isNotEmpty(longitude)) {
            wrapper.set(Store::getLongitude, longitude);
        }
        if (ObjectUtil.isNotEmpty(latitude)) {
            wrapper.set(Store::getLatitude, latitude);
        }
        return update(wrapper);
    }