| | |
| | | String roleid = UserExt.getUser().getRoleid(); |
| | | model.addAttribute("role",roleid); |
| | | model.addAttribute("time",byId.getStartTime()+" - "+byId.getEndTime()); |
| | | 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("managerName", byId.getManagerName()); |
| | | model.addAttribute("managerPhone", byId.getPhone()); |
| | | model.addAttribute("type",1); |
| | | // 如果当前登陆人是运营商 |
| | | if (UserExt.getUser().getObjectType()==2){ |
| | |
| | | String roleid = UserExt.getUser().getRoleid(); |
| | | model.addAttribute("role",roleid); |
| | | model.addAttribute("time",byId.getStartTime()+" - "+byId.getEndTime()); |
| | | 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("managerName", byId.getManagerName()); |
| | | model.addAttribute("managerPhone", byId.getPhone()); |
| | | model.addAttribute("type",0); |
| | | |
| | | return PREFIX + "TShop_edit.html"; |
| | |
| | | page.setRecords(list); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | @RequestMapping(value = "/listOne") |
| | | @ResponseBody |
| | | public Object listOne(Integer id) { |
| | |
| | | if (ToolUtil.isEmpty(userName) || ToolUtil.isEmpty(tStore.getPhone())) { |
| | | return ERROR; |
| | | } |
| | | if (!userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getAccount, tStore.getPhone())).isEmpty()) { |
| | | return "5001"; |
| | | } |
| | | tStore.setManagerName(userName); |
| | | if(yyId==null || type==1){ |
| | | yyId=0; |
| | | } |
| | |
| | | String space_id = data.getString("space_id"); |
| | | Integer integer = Integer.valueOf(space_id); |
| | | tStore.setId(integer); |
| | | User storeManager = createStoreManager(userName, tStore.getPhone(), tStore.getId()); |
| | | userMapper.insert(storeManager); |
| | | tStore.setStoreStaffId(storeManager.getId()); |
| | | storeService.save(tStore); |
| | | ArrayList<StoreConfig> storeConfigs = new ArrayList<>(); |
| | | for (int i = 1; i < 9; i++) { |
| | |
| | | if (ToolUtil.isEmpty(userName) || ToolUtil.isEmpty(tStore.getPhone())) { |
| | | return ERROR; |
| | | } |
| | | LambdaQueryWrapper<User> managerAccountQuery = new LambdaQueryWrapper<User>() |
| | | .eq(User::getAccount, tStore.getPhone()); |
| | | if (byIdc.getStoreStaffId() != null) { |
| | | managerAccountQuery.ne(User::getId, byIdc.getStoreStaffId()); |
| | | } |
| | | if (!userMapper.selectList(managerAccountQuery).isEmpty()) { |
| | | return "5001"; |
| | | } |
| | | tStore.setManagerName(userName); |
| | | |
| | | if(yyId==null){ |
| | | yyId=0; |
| | |
| | | if (UserExt.getUser().getObjectType()==2){ |
| | | tStore.setOperatorId(null); |
| | | } |
| | | User storeManager = byIdc.getStoreStaffId() == null ? null : userMapper.selectById(byIdc.getStoreStaffId()); |
| | | if (storeManager == null) { |
| | | storeManager = createStoreManager(userName, tStore.getPhone(), tStore.getId()); |
| | | userMapper.insert(storeManager); |
| | | tStore.setStoreStaffId(storeManager.getId()); |
| | | } else { |
| | | storeManager.setName(userName); |
| | | storeManager.setPhone(tStore.getPhone()); |
| | | storeManager.setAccount(tStore.getPhone()); |
| | | userMapper.updateById(storeManager); |
| | | } |
| | | storeService.updateById(tStore); |
| | | |
| | | return new SuccessTip<>(); |
| | |
| | | } |
| | | } |
| | | |
| | | private User createStoreManager(String name, String phone, Integer storeId) { |
| | | User user = new User(); |
| | | user.setName(name); |
| | | user.setPhone(phone); |
| | | user.setAccount(phone); |
| | | user.setPassword(SecureUtil.md5("a123456")); |
| | | user.setRoleid("3"); |
| | | user.setObjectType(3); |
| | | user.setObjectId(storeId); |
| | | user.setStatus(1); |
| | | 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) { |
| | |
| | | @ResponseBody |
| | | public Object freeze(Integer id) { |
| | | try { |
| | | // 查询门店 获取门店店长id |
| | | TStore store = storeService.getById(id); |
| | | // 冻结 |
| | | store.setState(2); |
| | | storeService.updateById(store); |
| | | Integer storeStaffId = store.getStoreStaffId(); |
| | | User user = userService.getById(storeStaffId); |
| | | user.setStatus(2); |
| | | userService.updateById(user); |
| | | return SUCCESS_TIP; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | @ResponseBody |
| | | public Object unfreeze(Integer id) { |
| | | try { |
| | | // 查询门店 获取门店店长id |
| | | TStore store = storeService.getById(id); |
| | | // 解冻 |
| | | store.setState(1); |
| | | storeService.updateById(store); |
| | | Integer storeStaffId = store.getStoreStaffId(); |
| | | User user = userService.getById(storeStaffId); |
| | | user.setStatus(1); |
| | | userService.updateById(user); |
| | | return SUCCESS_TIP; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | public Object pwd(Integer id) { |
| | | try { |
| | | TStore byId = storeService.getById(id); |
| | | if (byId == null || byId.getStoreStaffId() == null) { |
| | | return ERROR; |
| | | } |
| | | User user = userMapper.selectById(byId.getStoreStaffId()); |
| | | if (user == null) { |
| | | return ERROR; |
| | | } |
| | | user.setPassword(SecureUtil.md5("a123456")); |
| | | userMapper.updateById(user); |
| | | return SUCCESS_TIP; |