| | |
| | | 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("type",1); |
| | | // 如果当前登陆人是运营商 |
| | | if (UserExt.getUser().getObjectType()==2){ |
| | |
| | | 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("type",0); |
| | | |
| | | return PREFIX + "TShop_edit.html"; |
| | |
| | | @ResponseBody |
| | | public Object listTwo1(Integer id) { |
| | | Page<TStoreOtherConfigTrue> page = new PageFactory<TStoreOtherConfigTrue>().defaultPage(); |
| | | List<TStoreOtherConfigTrue> list = tStoreOtherConfigTrueService.page(page,new LambdaQueryWrapper<TStoreOtherConfigTrue>().eq(TStoreOtherConfigTrue::getPid, id).eq(TStoreOtherConfigTrue::getState,1)).getRecords(); |
| | | List<TStoreOtherConfigTrue> list = tStoreOtherConfigTrueService.page(page,new LambdaQueryWrapper<TStoreOtherConfigTrue>().eq(TStoreOtherConfigTrue::getPid, id).eq(TStoreOtherConfigTrue::getState,1).orderByDesc(TStoreOtherConfigTrue::getId)).getRecords(); |
| | | page.setRecords(list); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object list(TStore tStore,String time,String userName,String userPhone,String ids,Integer type,Integer yyId,String lat,String lon,String pCode1,String cCode1) { |
| | | public Object list(TStore tStore, String time, String ids, Integer type, Integer yyId, String lat, String lon, |
| | | String pCode1, String cCode1, String userName) { |
| | | try { |
| | | if (ToolUtil.isEmpty(userName) || ToolUtil.isEmpty(tStore.getPhone())) { |
| | | return ERROR; |
| | | } |
| | | if (!userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getAccount, tStore.getPhone())).isEmpty()) { |
| | | return "5001"; |
| | | } |
| | | if(yyId==null || type==1){ |
| | | yyId=0; |
| | | } |
| | |
| | | tStore.setOperatorId(yyId); |
| | | tStore.setState(1); |
| | | tStore.setCreateTime(new Date()); |
| | | User user = new User(); |
| | | List<User> users = userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getAccount, userPhone)); |
| | | if(users.size()>0){ |
| | | return "5001"; |
| | | } |
| | | user.setAccount(userPhone); |
| | | user.setName(userName); |
| | | user.setRoleid("3"); |
| | | user.setPhone(userPhone); |
| | | user.setPassword(SecureUtil.md5("a123456")); |
| | | user.setObjectType(3); |
| | | user.setStatus(1); |
| | | userMapper.insert(user); |
| | | tStore.setStoreStaffId(user.getId()); |
| | | tStore.setLon(lon); |
| | | tStore.setLat(lat); |
| | | if (yyId == null || yyId == 0){ |
| | |
| | | map1.put("location",tStore.getCity()); |
| | | map1.put("address",tStore.getAddress()); |
| | | map1.put("telephone",tStore.getPhone()); |
| | | map1.put("linkman",userName); |
| | | map1.put("linkman",tStore.getName()); |
| | | map1.put("business_time","[{\"start_time\":\""+tStore.getStartTime()+"\",\"close_time\":\""+tStore.getEndTime()+"\"}]"); |
| | | map1.put("logo",tStore.getCoverDrawing()); |
| | | map1.put("remark",tStore.getIntroduce()); |
| | |
| | | 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); |
| | | user.setObjectId(tStore.getId()); |
| | | userService.updateById(user); |
| | | ArrayList<StoreConfig> storeConfigs = new ArrayList<>(); |
| | | for (int i = 1; i < 9; i++) { |
| | | StoreConfig storeConfig = new StoreConfig(); |
| | |
| | | |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(TStore tStore,String time,String userName,String userPhone,String ids,Integer type,Integer yyId,String lat,String lon,String pCode1,String cCode1) { |
| | | public Object update(TStore tStore, String time, String ids, Integer type, Integer yyId, String lat, String lon, |
| | | String pCode1, String cCode1, String userName) { |
| | | try { |
| | | TStore byIdc = storeService.getById(tStore.getId()); |
| | | 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"; |
| | | } |
| | | |
| | | if(yyId==null){ |
| | | yyId=0; |
| | |
| | | if(ToolUtil.isEmpty(tStore.getCoverDrawing())){ |
| | | tStore.setCoverDrawing(byIdc.getCoverDrawing()); |
| | | } |
| | | User user = userMapper.selectById(byIdc.getStoreStaffId()); |
| | | List<User> users = userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getAccount, userPhone).ne(User::getId,tStore.getStoreStaffId())); |
| | | if(users.size()>0){ |
| | | return "5001"; |
| | | } |
| | | user.setAccount(userPhone); |
| | | user.setName(userName); |
| | | user.setPhone(userPhone); |
| | | userMapper.updateById(user); |
| | | tStore.setLon(lon); |
| | | tStore.setLat(lat); |
| | | // 运营商编辑 |
| | | 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 ERROR; |
| | | } |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | @RequestMapping(value = "/onChange") |
| | | @ResponseBody |
| | | public Object onChange(Integer oneId) { |