刘帅
2026-09-22 bc68f4393cafe39c4fce614c8128936067ea25f7
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java
@@ -336,6 +336,8 @@
        User byId1 = userMapper.selectById(byId.getStoreStaffId());
        model.addAttribute("city",byId1);
        model.addAttribute("managerName", byId1 == null ? "" : byId1.getName());
        // 历史门店的手机号可能只保存在店长账号中,编辑页需与列表保持一致地回填可用手机号。
        model.addAttribute("managerPhone", resolveStoreManagerPhone(byId, byId1));
        model.addAttribute("type",1);
        // 如果当前登陆人是运营商
        if (UserExt.getUser().getObjectType()==2){
@@ -418,6 +420,7 @@
        User byId1 = userMapper.selectById(byId.getStoreStaffId());
        model.addAttribute("city",byId1);
        model.addAttribute("managerName", byId1 == null ? "" : byId1.getName());
        model.addAttribute("managerPhone", resolveStoreManagerPhone(byId, byId1));
        model.addAttribute("type",0);
        return PREFIX + "TShop_edit.html";
@@ -698,10 +701,17 @@
                        }
                    }
                }else {
                    TCity one = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getId, tStore.getProvinceCode()));
                    // 编辑页提交的是行政区划编码;按 id 查询会导致查不到省、市,随后访问名称时抛出 NPE。
                    TCity one = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, tStore.getProvinceCode()));
                    if (one == null) {
                        return ERROR;
                    }
                    tStore.setProvince(one.getName());
                    tStore.setProvinceCode(one.getCode());
                    TCity one1 = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getId, tStore.getCityCode()));
                    TCity one1 = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, tStore.getCityCode()));
                    if (one1 == null) {
                        return ERROR;
                    }
                    tStore.setCity(one1.getName());
                    tStore.setCityCode(one1.getCode());
                }
@@ -761,6 +771,13 @@
        user.setCreatetime(new Date());
        return user;
    }
    private String resolveStoreManagerPhone(TStore store, User storeManager) {
        if (ToolUtil.isNotEmpty(store.getPhone())) {
            return store.getPhone();
        }
        return storeManager == null ? "" : storeManager.getPhone();
    }
    @RequestMapping(value = "/onChange")
    @ResponseBody
    public Object onChange(Integer oneId) {